code stringlengths 2 1.05M |
|---|
/**
* Created by hbzhang on 4/2/15.
*/
angular.module('mean.front').controller('FrameSecondMainContentController', ['$scope','Global','Restangular','Program','$location',
function($scope,Global,Restangular,Program,$location) {
$scope.global = Global;
$scope.package = {
name: 'front'
};
$scope.rootprogram = $location.path().split('/')[3];
var getprogramname = function(value){
var programarray = Program.programarray(value, '-');
return programarray[programarray.length-1];
};
var items = Restangular.all('item');
$scope.getitems = function() {
$scope.founditems = [];
items.getList().then(function(items) {
//$scope.allItems = [];
_.each(items, function(value) {
if(value.itemprogam.name === $scope.rootprogram && value.itemcontrol.published ===true){
var el = {
rootprogram:$scope.rootprogram,
value:value,
name:getprogramname(value.itemprogam.name)
};
$scope.founditems.push(el);
}
});
console.log($scope.founditems);
});
}
$scope.getitems();
// $scope.pt = SlidePanelContentData.getMeds($route.current.params.id);
}]);
|
var dbclient = require('mongodb').MongoClient;
var url = 'mongodb://localhost:27017/quadavore';
module.exports = function(cb)
{
dbclient.connect(url, function(err, db)
{
console.log('Connected to MongoDB');
cb(db);
});
};
|
/** Net.JS 0.0.1 */
/*!
* Net.JS
* Copyright(c) 2011 Oleg Shparber <trollixx@gmail.com>
* MIT Licensed
*/
/**
* @namespace
*/
var net = this.net = {
/**
* Library version.
*/
version: '0.0.1',
/**
* Applet loading states.
*
* @type {Objects}
* @api private
*/
_appletState: {
loaded: false,
loading: false,
failed: false
},
/**
* HTMLAppletElement parameters.
*
* @type {Object}
* @api private
*/
_appletAttributes: {
'id': 'NetJSApplet',
'code': 'netjs.NetJSApplet',
'archive': 'NetJS.jar',
'mayscript': 'mayscript',
'style': 'visibility: hidden;',
},
/**
* HTMLAppletElement.
*
* @type {Object}
* @api private
*/
_applet: {},
/**
* Stores net.Socket instances while applet isn't loaded.
*
* @type {Array}
* @api private
*/
_pendingSockets: [],
/**
* Stores net.Socket instances. Object properties are connection
* IDs in the applet.
*
* @type {Object}
* @api private
*/
_sockets: {},
/**
* Creates net.Server instance
*
* @param {Object} options
* @param {Function} connectionListener
* @api public
*/
createServer: function(options, connectionListener) {
throw new Error('net.Server is not implemented yet!');
},
/**
* Creates net.Socket instance
*
* @param {Number} port
* @param {String} host
* @api public
*/
createConnection: function(port, host) {
var socket = new net.Socket();
setTimeout(function() {
if (!net._appletState.loaded) {
net.loadApplet();
net._pendingSockets.push([socket, port, host]);
} else {
socket.connect(port, host);
}
}, 0);
return socket;
},
/**
* Loads Java applet. Call it directly to preload applet or it will
* be autoloaded on the first net.Socket.connect call.
*
* @api public
*/
loadApplet: function() {
if (net._appletState.loaded || net._appletState.loading) {
console.log('Applet already loaded or loading');
return;
}
net._appletState.loading = true;
// In case loading previously failed
net._appletState.failed = false;
/// TODO: Is this correct for all browsers?
if (net._applet.tagName !== 'APPLET') {
net._applet = document.createElement('applet');
for (var attribute in net._appletAttributes) {
net._applet.setAttribute(attribute, net._appletAttributes[attribute]);
}
/// XXX: Do we need `separate_jvm` and `classloader_cache`?
var param = document.createElement('param');
param.setAttribute('name', 'separate_jvm');
param.setAttribute('value', 'true');
net._applet.appendChild(param);
param = document.createElement('param');
param.setAttribute('name', 'classloader_cache');
param.setAttribute('value', 'false');
net._applet.appendChild(param);
}
document.body.appendChild(net._applet);
// FIXME: Maybe there's better way to determine user's refuse of applet running
setTimeout(net._appletLoadFailed, 30000);
},
/**
* Called by timeout on applet load.
*
* @api private
*/
_appletLoadFailed: function() {
if (!net._appletState.loaded) {
console.log('Applet loading failed');
net._appletState.failed = true;
net._appletState.loading = false;
document.body.removeChild(net._applet);
for (var i in net._pendingSockets) {
setTimeout(function() {
net._pendingSockets[i][0].emit.apply(net._pendingSockets[i][0], ['error', new Error('Applet loading failed')]);
});
}
}
},
/**
* Called by Java applet when it is loaded and started.
*
* @api private
*/
_appletLoaded: function() {
net._appletState.loaded = true;
net._appletState.loading = false;
for (var i in net._pendingSockets) {
setTimeout(function() {
net._pendingSockets[i][0].connect.apply(net._pendingSockets[i][0], [net._pendingSockets[i][1], net._pendingSockets[i][2]]);
});
}
},
/**
* Allows Java applet to emit events in net.Socket instances.
* XXX: Maybe applet should operate with _sockets directly?
*
* @param {Number} id net.Socket instance ID
* @param {String} event Event name
* @api private
*/
_emit: function(id, event) {
console.log("net._emit");
console.log(arguments);
/// XXX: Maybe 'in' should be used instead of Object.hasOwnProperty?
if (net._sockets.hasOwnProperty(id)) {
var args = arguments;
var instance = net._sockets[id];
/// XXX: Don't like it. Want to remove `event` param.
// Create Exception from String
if (event === 'error' && args[2]) {
args[2] = new Error(args[2]);
}
setTimeout(function() {
instance.emit.apply(instance, Array.prototype.slice.call(args, 1));
}, 0);
}
}
};
/**
* Expose NetJS in jQuery
*/
if ('jQuery' in this) jQuery.net = this.net;
(function() {
var net = this.net;
/**
* Set when the `onload` event is executed on the page. This variable is used by
* `net.util.load` to detect if we need to execute the function immediately or add
* it to a onload listener.
*
* @type {Boolean}
* @api private
*/
pageLoaded = false;
/**
* @namespace
*/
net.util = {
/**
* Executes the given function when the page is loaded.
*
* Example:
*
* net.util.load(function(){ console.log('page loaded') });
*
* @param {Function} fn
* @api public
*/
load: function(fn) {
if (/loaded|complete/.test(document.readyState) || pageLoaded) return fn();
if ('attachEvent' in window){
window.attachEvent('onload', fn);
} else {
window.addEventListener('load', fn, false);
}
}
};
net.util.load(function() {
pageLoaded = true;
});
})();
/**
* Simple EventEmitter implementation
*/
(function() {
var util = this.net.util;
var EventEmitter = util.EventEmitter = function() {
this._listeners = {};
}
/**
* Adds a listener to the end of the listeners array for the specified event.
*
* @param {String} event
* @param {Function} listener
* @api public
*/
EventEmitter.prototype.addListener =
EventEmitter.prototype.on = function(event, listener) {
/// FIXME: Is this our problem?
if (typeof listener !== 'function') {
throw new Error('Listener is not a function');
}
if (!this._listeners.hasOwnProperty(event)) {
this._listeners[event] = [];
}
this._listeners[event].push(listener);
};
/**
* Execute each of the listeners in order with the supplied
* arguments.
*
* @param {String} event
* @api public
*/
EventEmitter.prototype.emit = function(event) {
console.log('>>> emit: event=' + event);
if (this._listeners.hasOwnProperty(event)) {
var self = this;
var args = arguments;
for (var i in this._listeners[event]) {
setTimeout(function() {
self._listeners[event][i].apply(self, Array.prototype.slice.call(args, 1));
}, 0);
}
}
};
})();
(function() {
var net = this.net;
/**
* Construct a new socket object.
* TODO: @param options
*
* @api public
*/
var Socket = net.Socket = function() {
this._id = 0;
this.port = '';
this.host = '';
};
// Inheriting EventEmitter
Socket.prototype = new net.util.EventEmitter();
/**
* Opens the connection for a given socket. If `port` and `host` are
* given, then the socket will be opened as a TCP socket, if `host`
* is omitted, server hostname or 'localhost' will be assumed.
*
* Normally this method is not needed, as net.createConnection
* opens the socket. Use this only if you are implementing a
* custom Socket or if a Socket is closed and you want to reuse
* it to connect to another server.
*
* This function is asynchronous. When the 'connect' event is
* emitted the socket is established. If there is a problem
* connecting, the 'connect' event will not be emitted, the 'error'
* event will be emitted with the exception.
*
* The callback parameter will be added as an listener for the
* 'connect' event.
*
* TODO: Local sockets: socket.connect(path, [callback])
*
* @param {Number} port
* @param {String} host
* @param {Function} callback
* @api public
*/
Socket.prototype.connect = function(port, host, callback) {
this.port = port || '80';
/// XXX: This was needed for IcedTea
/*if (typeof this.port === 'number') {
this.port = this.port.toString();
}*/
this.host = host || (window.location.hostname === '' ? 'localhost' : window.location.hostname);
if (callback) {
this.on('connect', callback);
}
this._id = net._applet.connect(this.host, this.port);
net._sockets[this._id] = this;
};
/// TODO: call callback when the data is finally written out
// (internal events?)
Socket.prototype.write = function(data, callback) {
console.log('>>> write ' + data);
/// XXX: IcedTea handles only JS's String as Java's int
console.log(typeof data);
switch (typeof data) {
case 'string':
console.log('string');
return net._applet.writeString(this._id, data);
case 'number':
console.log('number');
return net._applet.writeNumber(this._id, data);
default:
return net._applet.write(this._id, data);
}
};
})();
|
import Button from './markdown-button';
import layout from '../templates/components/markdown-code';
export default Button.extend({
layout,
precede: '`',
succeed: '`'
});
|
'use strict';
angular.module('flagMatchApp.version', [
'flagMatchApp.version.interpolate-filter',
'flagMatchApp.version.version-directive'
])
.value('version', '0.1');
|
"use strict";
var test = require("tape");
var ellipsize = require("../src/index");
var ELLIPSE = "…";
test("ellipsize simple cases", function (assert) {
var cases = [
{
label: "zero length string",
len: 100,
string: "",
expect: "",
},
{
label: "simple string",
len: 8,
string: "one two three four",
expect: "one two" + ELLIPSE,
},
{
label: "long string gets truncated",
len: 8,
string: "12345678910",
expect: "1234567" + ELLIPSE,
},
{
label: 'dashes are also a "word boundary"',
len: 8,
string: "one two-three four",
expect: "one two" + ELLIPSE,
},
{
label: "dont ellipsize short strings",
len: 100,
string: "one two three four",
expect: "one two three four",
},
{
label: "multibyte characters",
len: 5,
string: "审核未通过",
expect: "审核未通过",
},
{
label: "multibyte characters ellipsised",
len: 5,
string: "审核未通过过",
expect: "审核未通" + ELLIPSE,
},
{
label: "length has a default",
len: undefined,
string: "xia3blpfgw9skc40k8k8808cw0cwk4wg88c4cwcokw88ggss40wo080so044og00gc4o40s88sowk8k4k0sswg0k84gws4ksg8so44gwcg0gkcwgc0wwcog08cwc0ogogsgkgcccko48w",
expect:
"xia3blpfgw9skc40k8k8808cw0cwk4wg88c4cwcokw88ggss40wo080so044og00gc4o40s88sowk8k4k0sswg0k84gws4ksg8so44gwcg0gkcwgc0wwcog08cwc0ogogsgkgcccko48w".slice(
0,
139
) + ELLIPSE,
},
{
label: "zero length returns an empty string",
len: 0,
string: "gc4o40s88sowk8k4k0ssw",
expect: "",
},
{
label: "bogus input",
len: 0,
string: null,
expect: "",
},
{
label: "bogus input",
len: 0,
string: undefined,
expect: "",
},
];
cases.forEach(function (testCase) {
var result = ellipsize(testCase.string, testCase.len);
assert.equal(result, testCase.expect, testCase.label);
assert.ok(result.length <= testCase.len || 140);
});
assert.end();
});
test("ellipsize truncate settings", function (assert) {
var cases = [
{
label: "truncate settings off",
len: 8,
string: "123456789ABCDEF",
expect: "",
truncate: false,
},
{
label: "truncate settings on",
len: 8,
string: "123456789ABCDEF",
expect: "1234567" + ELLIPSE,
truncate: true,
},
{
label: "truncate settings default",
len: 8,
string: "123456789ABCDEF",
expect: "1234567" + ELLIPSE,
truncate: undefined,
},
{
label: "truncate settings default",
len: 8,
string: "123456789ABCDEF",
expect: "1234567" + ELLIPSE,
truncate: null,
},
{
label: "truncate settings middle",
len: 8,
string: "123456789ABCDEF",
expect: "123" + ELLIPSE + "DEF",
truncate: "middle",
},
];
cases.forEach(function (testCase) {
var result = ellipsize(testCase.string, testCase.len, {
truncate: testCase.truncate,
});
assert.equal(result, testCase.expect, testCase.label);
});
assert.end();
});
test("ellipsize truncate middle", function (assert) {
var cases = [
{
label: "truncate words settings middle short",
len: 16,
string: "the quick brown fox",
expect: "the" + ELLIPSE + " fox",
truncate: "middle",
},
{
label: "truncate words settings middle longer",
len: 37,
string: "These are a few of my favourite things",
expect: "These are a few" + ELLIPSE + " favourite things",
truncate: "middle",
},
];
cases.forEach(function (testCase) {
var result = ellipsize(testCase.string, testCase.len, {
truncate: testCase.truncate,
});
assert.equal(result, testCase.expect, testCase.label);
});
assert.end();
});
test("ellipsize custom ellipsize", function (assert) {
var cases = [
{
label: "zero length string",
len: 100,
string: "",
expect: "",
ellipse: "--",
},
{
label: "two character ellipse",
len: 9,
string: "one two three four",
expect: "one two--",
ellipse: "--",
},
{
label: "unicode character ellipse",
len: 8,
string: "one two three four",
expect: "one two☃",
ellipse: "☃",
},
{
label: "off by one string",
len: 8,
string: "one two three four",
expect: "one--",
ellipse: "--",
},
];
cases.forEach(function (testCase) {
const { len, string, expect, ellipse } = testCase;
const result = ellipsize(string, len, {
ellipse,
});
assert.equal(result, expect, "ellipsized as expected");
assert.ok(result.length <= len, "length does not exceed maxLen");
});
assert.end();
});
|
module.exports = function () {
return {};
};
|
// <details> polyfill
// http://caniuse.com/#feat=details
// FF Support for HTML5's <details> and <summary>
// https://bugzilla.mozilla.org/show_bug.cgi?id=591737
// http://www.sitepoint.com/fixing-the-details-element/
;(function() {
'use strict'
var NATIVE_DETAILS = typeof document.createElement('details').open === 'boolean'
// Add event construct for modern browsers or IE
// which fires the callback with a pre-converted target reference
function addEvent(node, type, callback) {
if (node.addEventListener) {
node.addEventListener(
type,
function(e) {
callback(e, e.target)
},
false
)
} else if (node.attachEvent) {
node.attachEvent('on' + type, function(e) {
callback(e, e.srcElement)
})
}
}
// Handle cross-modal click events
function addClickEvent(node, callback) {
// Prevent space(32) from scrolling the page
addEvent(node, 'keypress', function(e, target) {
if (target.nodeName === 'SUMMARY') {
if (e.keyCode === 32) {
if (e.preventDefault) {
e.preventDefault()
} else {
e.returnValue = false
}
}
}
})
// When the key comes up - check if it is enter(13) or space(32)
addEvent(node, 'keyup', function(e, target) {
if (e.keyCode === 13 || e.keyCode === 32) {
callback(e, target)
}
})
addEvent(node, 'mouseup', function(e, target) {
callback(e, target)
})
}
// Get the nearest ancestor element of a node that matches a given tag name
function getAncestor(node, match) {
do {
if (!node || node.nodeName.toLowerCase() === match) {
break
}
node = node.parentNode
} while (node)
return node
}
// Create a started flag so we can prevent the initialisation
// function firing from both DOMContentLoaded and window.onload
var started = false
// Initialisation function
function addDetailsPolyfill(list) {
// If this has already happened, just return
// else set the flag so it doesn't happen again
if (started) {
return
}
started = true
// Get the collection of details elements, but if that's empty
// then we don't need to bother with the rest of the scripting
if ((list = document.getElementsByTagName('details')).length === 0) {
return
}
// else iterate through them to apply their initial state
var n = list.length
var i = 0
for (i; i < n; i++) {
var details = list[i]
// Save shortcuts to the inner summary and content elements
details.__summary = details.getElementsByTagName('summary').item(0)
details.__content = details.getElementsByTagName('div').item(0)
// If the content doesn't have an ID, assign it one now
// which we'll need for the summary's aria-controls assignment
if (!details.__content.id) {
details.__content.id = 'details-content-' + i
}
// Add ARIA role="group" to details
details.setAttribute('role', 'group')
// Add role=button to summary
details.__summary.setAttribute('role', 'button')
// Add aria-controls
details.__summary.setAttribute('aria-controls', details.__content.id)
// Set tabIndex so the summary is keyboard accessible for non-native elements
// http://www.saliences.com/browserBugs/tabIndex.html
if (!NATIVE_DETAILS) {
details.__summary.tabIndex = 0
}
// Detect initial open state
var openAttr = details.getAttribute('open') !== null
if (openAttr === true) {
details.__summary.setAttribute('aria-expanded', 'true')
details.__content.setAttribute('aria-hidden', 'false')
} else {
details.__summary.setAttribute('aria-expanded', 'false')
details.__content.setAttribute('aria-hidden', 'true')
if (!NATIVE_DETAILS) {
details.__content.style.display = 'none'
}
}
// Create a circular reference from the summary back to its
// parent details element, for convenience in the click handler
details.__summary.__details = details
// If this is not a native implementation, create an arrow
// inside the summary
if (!NATIVE_DETAILS) {
var twisty = document.createElement('i')
if (openAttr === true) {
twisty.className = 'arrow arrow-open'
twisty.appendChild(document.createTextNode('\u25bc'))
} else {
twisty.className = 'arrow arrow-closed'
twisty.appendChild(document.createTextNode('\u25ba'))
}
details.__summary.__twisty = details.__summary.insertBefore(twisty, details.__summary.firstChild)
details.__summary.__twisty.setAttribute('aria-hidden', 'true')
}
}
// Define a statechange function that updates aria-expanded and style.display
// Also update the arrow position
function statechange(summary) {
var expanded = summary.__details.__summary.getAttribute('aria-expanded') === 'true'
var hidden = summary.__details.__content.getAttribute('aria-hidden') === 'true'
summary.__details.__summary.setAttribute('aria-expanded', expanded ? 'false' : 'true')
summary.__details.__content.setAttribute('aria-hidden', hidden ? 'false' : 'true')
if (!NATIVE_DETAILS) {
summary.__details.__content.style.display = expanded ? 'none' : ''
var hasOpenAttr = summary.__details.getAttribute('open') !== null
if (!hasOpenAttr) {
summary.__details.setAttribute('open', 'open')
} else {
summary.__details.removeAttribute('open')
}
}
if (summary.__twisty) {
summary.__twisty.firstChild.nodeValue = expanded ? '\u25ba' : '\u25bc'
summary.__twisty.setAttribute('class', expanded ? 'arrow arrow-closed' : 'arrow arrow-open')
}
return true
}
// Bind a click event to handle summary elements
addClickEvent(document, function(e, summary) {
if (!(summary = getAncestor(summary, 'summary'))) {
return true
}
return statechange(summary)
})
}
// Bind two load events for modern and older browsers
// If the first one fires it will set a flag to block the second one
// but if it's not supported then the second one will fire
addEvent(document, 'DOMContentLoaded', addDetailsPolyfill)
addEvent(window, 'load', addDetailsPolyfill)
})()
|
// flow-typed signature: e7c03a4ac695e4a014530cf5ab6c79da
// flow-typed version: <<STUB>>/randexp_v^0.4.3/flow_v0.37.0
/**
* This is an autogenerated libdef stub for:
*
* 'randexp'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'randexp' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'randexp/build/randexp.min' {
declare module.exports: any;
}
declare module 'randexp/gulpfile' {
declare module.exports: any;
}
declare module 'randexp/lib/randexp' {
declare module.exports: any;
}
declare module 'randexp/test/custom-prng-test' {
declare module.exports: any;
}
declare module 'randexp/test/custom-range-test' {
declare module.exports: any;
}
declare module 'randexp/test/main-test' {
declare module.exports: any;
}
declare module 'randexp/test/sugar-test' {
declare module.exports: any;
}
declare module 'randexp/test/tests' {
declare module.exports: any;
}
// Filename aliases
declare module 'randexp/build/randexp.min.js' {
declare module.exports: $Exports<'randexp/build/randexp.min'>;
}
declare module 'randexp/gulpfile.js' {
declare module.exports: $Exports<'randexp/gulpfile'>;
}
declare module 'randexp/lib/randexp.js' {
declare module.exports: $Exports<'randexp/lib/randexp'>;
}
declare module 'randexp/test/custom-prng-test.js' {
declare module.exports: $Exports<'randexp/test/custom-prng-test'>;
}
declare module 'randexp/test/custom-range-test.js' {
declare module.exports: $Exports<'randexp/test/custom-range-test'>;
}
declare module 'randexp/test/main-test.js' {
declare module.exports: $Exports<'randexp/test/main-test'>;
}
declare module 'randexp/test/sugar-test.js' {
declare module.exports: $Exports<'randexp/test/sugar-test'>;
}
declare module 'randexp/test/tests.js' {
declare module.exports: $Exports<'randexp/test/tests'>;
}
|
import { callbackURLPrefix } from '../server';
const callbackURL =
process.env.NODE_ENV === 'production'
? `${callbackURLPrefix}/api/oauth2/github/callback`
: 'http://localhost:8000/api/oauth2/github/callback';
const githubApp = {
clientID: '',
clientSecret: '',
callbackURL,
};
export default githubApp;
|
!function ($) {
$('#tooltip1').tooltip();
$('#tooltip2').tooltip();
}(window.jQuery)
|
var mongoose = require('mongoose');
var bcrypt = require('bcrypt-nodejs');
var userSchema = mongoose.Schema({
local: {
email: String,
password: String,
isAdmin: Boolean
}
});
userSchema.methods.generateHash = function(password) {
return bcrypt.hashSync(password, bcrypt.genSaltSync(8), null);
};
userSchema.methods.validPassword = function(password) {
return bcrypt.compareSync(password, this.local.password);
};
module.exports = mongoose.model('User', userSchema); |
import format from 'date-fns/format';
import { createSelector } from 'reselect';
import {
getAccountsCurrencyMap,
getAccountsAsOptions
} from '../../entities/accounts';
import { getBaseCurrency } from '../../settings';
import { defaultKind, TransationKindT } from '../../../entities/Transaction';
const { Expense, Income } = TransationKindT;
export const getForm = state => state.ui.form.transaction;
const getDefaultAccountId = createSelector(
getAccountsAsOptions,
options => options.length > 0 && options[0].key
);
const getDefaultCurrency = createSelector(
getDefaultAccountId,
getAccountsCurrencyMap,
getBaseCurrency,
(accountId, currencies, base) =>
accountId &&
(currencies[accountId].includes(base) ? base : currencies[accountId][0])
);
const getDefaultLinkedAccountId = createSelector(
getAccountsAsOptions,
getDefaultAccountId,
getAccountsCurrencyMap,
(options, defaultAccountId, currencies) =>
options.length > 1
? options[1].key
: defaultAccountId &&
currencies[defaultAccountId].length > 1 &&
defaultAccountId
);
const getDefaultLinkedCurrency = createSelector(
getDefaultAccountId,
getDefaultLinkedAccountId,
getAccountsCurrencyMap,
getBaseCurrency,
(accountId, linkedAccountId, currencies, base) =>
accountId && accountId === linkedAccountId
? currencies[accountId][1]
: linkedAccountId &&
(currencies[linkedAccountId].includes(base)
? base
: currencies[linkedAccountId][0])
);
export const getDefaultState = createSelector(
getDefaultAccountId,
getDefaultCurrency,
getDefaultLinkedAccountId,
getDefaultLinkedCurrency,
(accountId, currency, linkedAccountId, linkedCurrency) => {
return {
kind: defaultKind,
isModalOpen: false,
accountId: accountId || null,
currency: currency || null,
amount: '',
linkedAccountId: linkedAccountId || null,
linkedCurrency: linkedCurrency || null,
linkedAmount: '',
tags: {
[Expense]: [],
[Income]: []
},
date: format(new Date(), 'YYYY-MM-DD'),
note: ''
};
}
);
|
function Project(id, type, name, lastActivity) {
this.id = id;
this.type = type;
this.name = name;
this.lastActivity = lastActivity;
}
// The list of all projects currently in the system.
// (Feel free to imagine this came from a database somewhere on page load.)
var CURRENT_PROJECTS = [
new Project(0, "Training", "Patrick's experimental branch", new Date(2014, 6, 17, 13, 5, 842)),
new Project(1, "Testing", "Blind test of autosuggest model", new Date(2014, 6, 21, 18, 44, 229))
];
// The current maximum ID, so we know how to allocate an ID for a new project.
// (Yes, the database should be taking care of this, too.)
var MAX_ID = Math.max.apply(null, $.map(CURRENT_PROJECTS, function(pj) { return pj.id; }));
$(function(){
var loadProjects = function($container, projects) {
$.fn.append.apply($container, $.map(projects, function(pj) {
return $("<tr>").append(
$("<td>").text(pj.id),
$("<td>").text(pj.type),
$("<td>").text(pj.name),
$("<td>").text(pj.lastActivity.toString())
);
}));
};
// Creates a new project based on the user input in the form.
var createProject = function($form) {
return new Project(
MAX_ID + 1,
$form.find("#project-type").val(),
$form.find("#project-name").val(),
new Date()
);
};
// Clears the data in the form so that it's easy to enter a new project.
var resetForm = function($form) {
$form.find("#project-type").val("");
$form.find("#project-name").val("");
$form.find("input:first").focus();
};
var $projectTable = $("#project-list>tbody");
loadProjects($projectTable, CURRENT_PROJECTS);
$("#add-project-form").submit(function(e) {
var $form = $(this);
pj = createProject($form);
MAX_ID = pj.id;
CURRENT_PROJECTS.push(pj);
loadProjects($projectTable, [pj]);
resetForm($form);
e.preventDefault();
});
/*******************************************************
* Adding in Branch Logic in response to webdev-exercise
* Anup Vasudevan : 08/06/2014
******************************************************/
var user = new Gh3.User("mquander")
, repoTitle = $(".repoTitle")
, branchTitle = $(".branchTitle")
, branchProperties = $("ul");
//get some repositories of the user
var userRepositories = new Gh3.Repositories(user);
//get one repository
var userRepo = new Gh3.Repository("webdev-exercise", user);
//fetch information on branches via github api
userRepo.fetch(function (err, res) {
if(err) {
console.log("Error", err.message, res.status)
throw err
}
userRepo.fetchBranches(function (err, res) {
if(err) {
console.log("Error", err.message, res.status)
throw err
}
//fetch master branch
var master = userRepo.getBranchByName("master");
var master_sha = master.sha;
//compare sha against master believed to be up-to-date
function uptodate(master_sha, branch_sha){
if(master_sha !== branch_sha){
return 'Out-of-date';
}
else {
return 'Latest';
}
};
//output branches
userRepo.eachBranch(function (branch) {
$('.name').append(branch.name + '<br>');
$('.sha').append(branch.sha + '<br>');
$('.status').append(uptodate(master_sha, branch.sha) + '<br>');
});
});
});
});
|
import { assert, expect } from 'chai';
import Kasmir from '../../src/kasmir';
import config from '../fixtures/config/test.config';
describe('Kasmir - successful test', () => {
let k;
let r;
// Initialize kasmir with some test actions and the
// default config
beforeEach('initialize kasmir instance', (done) => {
k = new Kasmir(config);
k.initReady().then(done);
});
it('should report no error', (done) => {
k.run(["Open success", "End"]).then(() => {
r = k.getReport();
expect(typeof r).to.equal('object');
expect(typeof r.taskSummary).to.equal('object');
expect(r.taskSummary.length).to.equal(0);
done();
})
.catch(done);
});
afterEach('kill kasmir instances', () => {
k.killRunners();
});
});
|
var $ = require('../$'),
Utils = require('../utils/utils'),
Droppable = require('./droppable-class');
$.fn.hqyDroppable = function (options) {
var args = arguments;
return this.each(function () {
var $ele = $(this);
var instance = $ele.data('hqyDroppable');
if (Utils.isString(options)){
instance && instance[options].apply(instance, Array.prototype.slice.call(args, 1));
return;
}
options = $.extend({}, $.fn.hqyDroppable.defaults, options || {});
if (instance){
instance.destroy();
}
instance = new $.fn.hqyDroppable.clz();
instance.init(this, options);
$ele.data('hqyDroppable', instance);
});
};
$.fn.hqyDroppable.clz = Droppable;
$.fn.hqyDroppable.instances = Droppable.instances;
$.fn.hqyDroppable.defaults = {
accept: null,
disabled: false,
cursor: 'copy',
onDragEnter: function(event, source){},
onDragOver: function(event, source){},
onDragLeave: function(event, source){},
onDrop: function(event, source){}
};
|
var user = require(__dirname + '/models/user.js');
var bot;
var dummy = {};
function addToClientList(clientList) {
user.findOne({where: {
username: 'bot'
}}).then(function(entity) {
if (entity) {
var zone = entity.sectionX + '_' + entity.sectionY;
clientList[zone][entity.username] = {};
clientList[zone][entity.username].record = entity;
clientList[zone][entity.username].direction = null;
clientList[zone][entity.username].player = false;
clientList[zone][entity.username].trapped = false;
bot = entity;
setInterval(directionUpdate, 1000, clientList);
}
else {
user.create({
username: 'bot',
color: 'blue',
shape: 'triangle',
stroke: 'red',
sectionX: 0,
sectionY: 0,
posX: 0,
posY: 0
}).then(function(entity) {
var zone = entity.sectionX + '_' + entity.sectionY;
clientList[zone][entity.username] = {};
clientList[zone][entity.username].record = entity;
clientList[zone][entity.username].direction = null;
clientList[zone][entity.username].player = false;
clientList[zone][entity.username].trapped = false;
bot = entity;
setInterval(directionUpdate, 1000, clientList);
});
}
});
};
function addBoringBots(clientList) {
for (i = 0; i < 30; ++i) {
addBoringBot(clientList, i);
}
}
function addBoringBot(clientList, i) {
user.findOne({where: {
username: 'bot' + i
}}).then(function(entity) {
if (entity) {
var zone = entity.sectionX + '_' + entity.sectionY;
clientList[zone][entity.username] = {};
clientList[zone][entity.username].record = entity;
clientList[zone][entity.username].direction = null;
clientList[zone][entity.username].player = false;
clientList[zone][entity.username].trapped = true;
dummy[i] = entity;
setInterval(dummyUpdate, 1000 + i, clientList, i);
}
else {
var stuff = {};
if (i === 0) {
stuff.color = 'blue';
stuff.shape = 'star';
stuff.stroke = 'green';
}
else if (i === 1) {
stuff.color = 'green';
stuff.shape = 'square';
stuff.stroke = 'blue';
}
else if (i === 2) {
stuff.color = 'orange';
stuff.shape = 'triangle';
stuff.stroke = 'white';
}
else if (i === 3) {
stuff.color = 'white';
stuff.shape = 'star';
stuff.stroke = 'yellow';
}
else {
stuff.color = 'red';
stuff.shape = 'pentagram';
stuff.stroke = 'black';
}
user.create({
username: 'bot' + i,
color: stuff.color,
shape: stuff.shape,
stroke: stuff.stroke,
sectionX: 0,
sectionY: 2,
posX: 0,
posY: 0
}).then(function(entity) {
entity.save();
var trapped = false;
if (i > 3) {
trapped = true;
}
var zone = entity.sectionX + '_' + entity.sectionY;
clientList[zone][entity.username] = {};
clientList[zone][entity.username].record = entity;
clientList[zone][entity.username].direction = null;
clientList[zone][entity.username].player = false;
clientList[zone][entity.username].trapped = trapped;
dummy[i] = entity;
setInterval(dummyUpdate, 1000 + i, clientList, i);
});
}
});
}
function directionUpdate(clientList) {
var zone = bot.sectionX + '_' + bot.sectionY;
var direction = null;
switch (Math.floor(Math.random() * 9)) {
case 0: direction = 'up'; break;
case 1: direction = 'up-right'; break;
case 2: direction = 'right'; break;
case 3: direction = 'down-right'; break;
case 4: direction = 'down'; break;
case 5: direction = 'down-left'; break;
case 6: direction = 'left'; break;
case 7: direction = 'up-left'; break;
case 8: direction = null;
}
clientList[zone][bot.username].direction = direction;
}
function dummyUpdate(clientList, botNum) {
var zone = dummy[botNum].sectionX + '_' + dummy[botNum].sectionY;
var direction = null;
switch (Math.floor(Math.random() * 9)) {
case 0: direction = 'up'; break;
case 1: direction = 'up-right'; break;
case 2: direction = 'right'; break;
case 3: direction = 'down-right'; break;
case 4: direction = 'down'; break;
case 5: direction = 'down-left'; break;
case 6: direction = 'left'; break;
case 7: direction = 'up-left'; break;
case 8: direction = null;
}
clientList[zone][dummy[botNum].username].direction = direction;
}
module.exports = {
add: addToClientList,
addBoringBots: addBoringBots
};
|
'use strict';
var resourceManager = require('./resource-manager');
var debog = require('./debog');
var relLog = debog('relationships');
var queryLog = debog('query');
/**
* @name query-builder
* @module query-builder
* @description
* build and return query object
*
* @param {object} struct - structure
* @param {array} ids - array of ids for calling specific peices fo data
* @param {functon} callback - callback
*/
module.exports = function (struct, ids) {
ids = [].concat(ids || []);
var queryObj = buildQueries(struct);
var query = 'SELECT '+getAttrQuery(queryObj)+' FROM '+queryObj.root.$$resource.table+'\n'+queryObj.joins.join('\n');
if (ids && ids.length) {
query += '\nWHERE '+queryObj.root.$$resource.table+'.'+queryObj.root.$$resource.idField+' IN ('+ids.join(',')+')'
}
if (queryLog.active) { queryLog.sql(query); }
queryObj.query = query;
return queryObj;
};
function buildQueries(struct, obj) {
obj = obj || {
attrs: {},
root: struct,
joins: [],
joinedResources: [struct.$$resource.table]
};
addAttributes(struct, obj);
// add struct join
if (obj.root !== struct) { // is not root resource
var relations = findRelations(struct.$$resource, struct.$$parent.$$resource);
relations.forEach(function (rel) {
// block from adding the same resource because of multiple fields with the same resource
if (obj.joinedResources.indexOf(rel.resource.table) !== -1) { return; }
obj.joins.push(buildRelationJoin(rel));
obj.joinedResources.push(rel.resource.table);
});
}
// add field level joins
// there may be none if the fields contain no additional resources
Object.keys(struct).forEach(function (key) {
var item = struct[key];
if (item.$$struct) { return; }
if (obj.joinedResources.indexOf(item.resource.table) === -1) {
var relations = findRelations(item.resource, struct.$$resource);
relations.forEach(function (rel) {
// block from adding the same resource because of multiple fields with the same resource
if (obj.joinedResources.indexOf(rel.resource.table) !== -1) { return; }
obj.joins.push(buildRelationJoin(rel));
obj.joinedResources.push(rel.resource.table);
});
}
});
// recusively handle sub structures
Object.keys(struct).forEach(function (key) {
if (!struct[key].$$struct) { return; }
buildQueries(struct[key], obj);
});
return obj;
}
function buildRelationJoin(rel) {
return 'LEFT JOIN '+
rel.resource.table+
' ON '+
rel.resource.table+'.'+rel.resourceField+
' = '+
rel.root.table+'.'+rel.rootField;
}
// walk resources to find relationship path
function findRelations(resource, parentResource) {
var arr = [];
if (relLog.active) { debugRelations(resource, parentResource); }
// top down
var found = pathFinder(parentResource, resource, {
added: [],
parent: parentResource,
children: {}
}, arr);
if (found) {
arr = arr.reverse();
return arr;
}
// bottom up
pathFinder(resource, parentResource, {
added: [],
parent: resource,
children: {}
}, arr);
return arr;
}
function debugRelations(resource, parentResource) {
var arr = [];
relLog.stash('lookup', relLog.chalk.magenta(parentResource.name), relLog.symbols.arrowRight, relLog.chalk.magenta(resource.name));
// top down
var found = pathFinder(parentResource, resource, {
added: [],
parent: parentResource,
children: {}
}, arr);
if (found) {
arr = arr.reverse();
logJoins(arr);
relLog.unstash(relLog.chalk.green('path resolved'));
return;
}
relLog.unstash(relLog.chalk.red('could not resolve path, will attemp'), relLog.chalk.yellow('reverse lookup'));
// bottom up
relLog.stash(relLog.chalk.yellow('reverse lookup'), relLog.chalk.magenta(parentResource.name), relLog.symbols.arrowLeft, relLog.chalk.magenta(resource.name));
found = pathFinder(resource, parentResource, {
added: [],
parent: resource,
children: {}
}, arr);
logJoins(arr);
relLog.unstash(found ? relLog.chalk.green('path resolved') : relLog.chalk.red('could not resolve path'));
if (found) { return; }
// run path again and logout bad pathways
// this code is meant for debugging purposes only
relLog.stash(relLog.chalk.bgYellow(relLog.chalk.black('debug Code')), relLog.chalk.magenta(parentResource.name), relLog.symbols.arrowRight, relLog.chalk.magenta(resource.name));
pathFinder(parentResource, resource, {
added: [],
parent: parentResource,
children: {}
}, arr, true);
relLog.unstash(relLog.chalk.bgYellow(relLog.chalk.black('debug Code')));
}
// TODO fix path finding. currently is not working with legs example
// walk resources for path
function pathFinder(a, b, path, arr, debug) {
return (a.relationships || []).some(function (item) {
path.children[item.resource.name] = {
added: path.added,
parent: path,
item: item,
children: {}
};
// NOTE debug code
var subDebug = debug;
if (subDebug && relLog.active) {
if (subDebug === true) { // root
relLog.stash('Pathway that was used in attempt to find '+relLog.chalk.magenta(b.name)+' resource')
subDebug = relLog.nest(item.root.name);
} else { // create new groups for each layer
subDebug = subDebug.nest(item.root.name);
}
subDebug.stash(item.resource.name);
}
// END Debug Code
// path completed
// convert to flat array and return true for sucessfull
if (item.resource.name === b.name) {
reducePath(path.children[item.resource.name], arr);
return true;
}
// continue finding on paths that have not been explored yet
if (path.added.indexOf(item.resource.name) === -1) {
path.added.push(item.resource.name);
return pathFinder(item.resource, b, path.children[item.resource.name], arr, subDebug);
}
});
}
// turn nested path into flat array
function reducePath(path, arr) {
while (path.item) {
arr.push(path.item);
path = path.parent;
}
}
// flatten attribute object into comma deliminated string
function getAttrQuery(queryObj) {
return Object.keys(queryObj.attrs).map(function (key) {
return queryObj.attrs[key].table+'.'+queryObj.attrs[key].field+' AS '+queryObj.attrs[key].alias
}).join(',');
}
function addAttributes(struct, obj) {
Object.keys(struct).forEach(function (key) {
if (struct[key].$$struct) { return; }
var item = struct[key];
var id = getUID();
var name = item.resource.table+'_'+item.field;
// NOTE may want to make multipel hashes so we can lookup by mulple peices of info
obj.attrs[name] = {
id: id,
table: item.resource.table,
field: item.field,
alias: id+'_'+name,
config: item.resource[item.field]
};
});
}
// uuids for attribute aliases
var uid = 0;
function getUID() {
return ''+(uid++);
}
function logJoins(arr) {
arr.forEach(function (item) {
relLog.stash('join %s %s %s on %s.%s = %s.%s',
relLog.chalk.magenta(item.resource.name),
relLog.symbols.arrowRight,
relLog.chalk.magenta(item.root.name),
relLog.chalk.magenta(item.resource.table),
relLog.chalk.magenta(item.resourceField),
relLog.chalk.magenta(item.root.table),
relLog.chalk.magenta(item.rootField)
);
});
}
|
var container;
var canvas;
var ctx;
var canvas_height = 300; // px
var canvas_width = 1000; // px
var bar_width = 20;
var bar_count = 2;
var bar_spacing = 10; // px
var bars = []; // array
function start_visualizer() {
canvas = document.getElementById("bars");
ctx = canvas.getContext("2d");
set_canvas_size();
generate_bars();
place_bars();
window.requestAnimationFrame(run_loop);
}
function run_loop() {
clear_canvas();
draw_box();
window.requestAnimationFrame(run_loop);
}
function set_canvas_size() {
canvas.width = canvas_width;
canvas.height = canvas_height;
ctx.canvas.width = canvas_width;
ctx.canvas.height = canvas_height;
}
function generate_bars() {
for (i = 1; i <= bar_count; i++) {
bars.push(new Bar(0, canvas_height, bar_width));
}
}
function place_bars() {
for (i = 0; i <= bars.length - 1; i++) {
bars[i].x = i * (bar_width + bar_spacing);
}
}
function clear_canvas() {
ctx.clearRect(0,0, canvas.width, canvas.height);
}
function draw_box() {
for (i = 0; i <= bars.length - 1; i++) {
bars[i].draw();
}
}
|
'use strict';
var mocha = require('gulp-mocha');
var istanbul = require('gulp-istanbul');
var config = require('../config');
module.exports = function (gulp) {
gulp.task('test', ['lint'], function (cb) {
gulp.src(['!' + config.paths.cliFile].concat(config.paths.lib))
.pipe(istanbul({
includeUntested: true
}))
.pipe(istanbul.hookRequire())
.on('finish', function () {
gulp.src(config.paths.test)
.pipe(mocha({reporter: 'spec'}))
.pipe(istanbul.writeReports())
.pipe(istanbul.enforceThresholds({thresholds: {global: 100}}))
.on('end', function () {
cb();
process.exit(0);
});
});
});
};
|
/* eslint-disable ember/no-classic-components */
/**
* @module ember-paper
*/
import Component from '@ember/component';
import { tagName, layout } from '@ember-decorators/component';
import template from './template';
/**
* @class PaperContent
* @extends Component
*/
@tagName('')
@layout(template)
class PaperContent extends Component {}
export default PaperContent;
|
/* eslint-env node,mocha */
/* global window */
(function(root) {
"use strict";
//
// Run in either Mocha, Karma or Browser environments
//
if (typeof root === "undefined") {
root = {};
}
var saltthepass = root.SaltThePass ? root.SaltThePass : require("../src/saltthepass");
var expect = root.expect ? root.expect : require("expect.js");
var DomainNameRule = saltthepass.DomainNameRule;
describe("DomainNameRule", function() {
//
// .matches()
//
describe(".matches()", function() {
var dnr = new DomainNameRule({
domain: "foo.com",
aliases: ["moo.com", "a.foo.com"]
});
//
// Matches
//
it("should match the primary domain", function() {
expect(dnr.matches("foo.com")).to.be.ok();
expect(dnr.matches("http://foo.com")).to.be.ok();
expect(dnr.matches("HTTP://foo.com")).to.be.ok();
expect(dnr.matches("FOO.com")).to.be.ok();
expect(dnr.matches("FOO.cOm")).to.be.ok();
});
it("should match aliases", function() {
expect(dnr.matches("moo.com")).to.be.ok();
expect(dnr.matches("HTTP://moo.com")).to.be.ok();
expect(dnr.matches("moo.cOm")).to.be.ok();
});
it("should match subdomains", function() {
expect(dnr.matches("a.foo.com")).to.be.ok();
expect(dnr.matches("a.foo.com")).to.be.ok();
expect(dnr.matches("a.foo.cOm")).to.be.ok();
});
it("should match paths", function() {
expect(dnr.matches("foo.com/")).to.be.ok();
expect(dnr.matches("foo.com/path")).to.be.ok();
});
//
// Non-matches
//
it("should not match other similar domains", function() {
expect(dnr.matches("oo.com")).to.not.be.ok();
expect(dnr.matches("afoo.com")).to.not.be.ok();
});
// similar to other domains
it("should not match other similar domains #2", function() {
expect(dnr.matches("a.moo.com")).to.not.be.ok();
expect(dnr.matches("http://afoo.com")).to.not.be.ok();
expect(dnr.matches("b.foo.com")).to.not.be.ok();
});
});
//
// Constructor
//
describe("new DomainNameRule()", function() {
it("should construct with the specified arguments", function() {
// only requirement is domain
var dnr = new DomainNameRule({
domain: "foo.com"
});
expect(dnr.domain).to.eql("foo.com");
// test passing all
dnr = new DomainNameRule({
domain: "foo.com",
min: 3,
max: 10,
required: ["a", "-"],
invalid: ["!"]
});
// validate
expect(dnr.domain).to.eql("foo.com");
expect(dnr.min).to.eql(3);
expect(dnr.max).to.eql(10);
expect(dnr.required).to.eql(["a", "-"]);
expect(dnr.invalid).to.eql(["!"]);
});
});
//
// .isValid()
//
describe(".isValid()", function() {
var dnr = new DomainNameRule({
domain: "foo.com",
min: 3,
max: 10,
required: ["a", "-"],
invalid: ["!"]
});
// minimum / maximum - true
it("should return true on valid passwords", function() {
expect(dnr.isValid("aaa")).to.be.ok();
expect(dnr.isValid("aaaa")).to.be.ok();
expect(dnr.isValid("aaaaa")).to.be.ok();
expect(dnr.isValid("aaaaaa")).to.be.ok();
expect(dnr.isValid("aaaaaaa")).to.be.ok();
expect(dnr.isValid("aaaaaaaa")).to.be.ok();
expect(dnr.isValid("aaaaaaaaa")).to.be.ok();
expect(dnr.isValid("aaaaaaaaaa")).to.be.ok();
});
it("should return false for passwords under the minimum length", function() {
// under minimum - false
expect(dnr.isValid("aa")).to.not.be.ok();
expect(dnr.isValid("a")).to.not.be.ok();
expect(dnr.isValid("")).to.not.be.ok();
});
// over maximum - false
it("should return false for passwords over the maximum length", function() {
expect(dnr.isValid("aaaaaaaaaaa")).to.not.be.ok();
expect(dnr.isValid("aaaaaaaaaaaa")).to.not.be.ok();
});
// required characters
it("should return true when required characters are specified", function() {
expect(dnr.isValid("aaa")).to.be.ok();
});
// invalid characters
it("should return false when an invalid character is specified", function() {
expect(dnr.isValid("aaa!")).to.not.be.ok();
});
});
describe(".isValid() using validregex", function() {
var dnr = new DomainNameRule({
domain: "foo.com",
validregex: "A-Za-z0-9"
});
it("should return true for strings that match the regex", function() {
expect(dnr.isValid("a")).to.be.ok();
expect(dnr.isValid("A")).to.be.ok();
expect(dnr.isValid("aa")).to.be.ok();
expect(dnr.isValid("AA")).to.be.ok();
expect(dnr.isValid("a9")).to.be.ok();
expect(dnr.isValid("aA9")).to.be.ok();
expect(dnr.isValid("aa01asd12e12d")).to.be.ok();
expect(dnr.isValid("aA1z091AZfa")).to.be.ok();
});
it("should return false for strings that do not match the regex", function() {
expect(dnr.isValid("a-")).to.not.be.ok();
expect(dnr.isValid("a.")).to.not.be.ok();
expect(dnr.isValid("a?")).to.not.be.ok();
expect(dnr.isValid("-")).to.not.be.ok();
expect(dnr.isValid("a-a")).to.not.be.ok();
});
});
describe(".isValid() using a case-sensitive validregex", function() {
var dnr = new DomainNameRule({
domain: "foo.com",
validregex: "A-Z0-9"
});
it("should return true for strings that match the regex", function() {
expect(dnr.isValid("A")).to.be.ok();
expect(dnr.isValid("AA")).to.be.ok();
});
it("should return false for strings that do not match the regex because of case issues", function() {
expect(dnr.isValid("aA9")).to.not.be.ok();
expect(dnr.isValid("aA1z091AZfa")).to.not.be.ok();
expect(dnr.isValid("a")).to.not.be.ok();
expect(dnr.isValid("aa")).to.not.be.ok();
expect(dnr.isValid("a9")).to.not.be.ok();
expect(dnr.isValid("aa01asd12e12d")).to.not.be.ok();
});
it("should return false for strings that do not match the regex", function() {
expect(dnr.isValid("a-")).to.not.be.ok();
expect(dnr.isValid("a.")).to.not.be.ok();
expect(dnr.isValid("a?")).to.not.be.ok();
expect(dnr.isValid("-")).to.not.be.ok();
expect(dnr.isValid("a-a")).to.not.be.ok();
});
});
describe(".isValid() - regex", function() {
// this regex enforces at least one letter and one number
var dnr = new DomainNameRule({
domain: "foo.com",
regex: "([A-Za-z])+([0-9])+|([0-9])+([A-Za-z])+"
});
it("should return true for strings that match the regex", function() {
expect(dnr.isValid("1a")).to.be.ok();
expect(dnr.isValid("a1")).to.be.ok();
expect(dnr.isValid("1A")).to.be.ok();
expect(dnr.isValid("A1")).to.be.ok();
expect(dnr.isValid("1a1")).to.be.ok();
expect(dnr.isValid("a1a")).to.be.ok();
expect(dnr.isValid("aa01asd12e12d")).to.be.ok();
expect(dnr.isValid("aA1z091AZfa-123123-21=312x-=321=3213-=s21=-3")).to.be.ok();
});
it("should return false for strings that do not match the regex", function() {
expect(dnr.isValid("aa")).to.not.be.ok();
expect(dnr.isValid("aA")).to.not.be.ok();
expect(dnr.isValid("AAA")).to.not.be.ok();
expect(dnr.isValid("1")).to.not.be.ok();
expect(dnr.isValid("11122")).to.not.be.ok();
});
});
//
// .rewrite()
//
describe(".rewrite()", function() {
var dnr = new DomainNameRule({
domain: "foo.com",
min: 3,
max: 10,
required: ["a", "-"],
invalid: ["!"]
});
it("should not change the input if it doesn't need to be changed", function() {
expect(dnr.rewrite("pass")).to.eql("pass");
});
it("should not change the input for 9 or 10 character strings", function() {
expect(dnr.rewrite("aaaaaaaaa")).to.eql("aaaaaaaaa");
expect(dnr.rewrite("aaaaaaaaaa")).to.eql("aaaaaaaaaa");
});
it("should trim to the max if over it", function() {
expect(dnr.rewrite("aaaaaaaaaaaaaaaaaaaa")).to.eql("aaaaaaaaaa");
expect(dnr.rewrite("aaaaaaaaaaa")).to.eql("aaaaaaaaaa");
});
it("should remove invalid characters", function() {
expect(dnr.rewrite("pass!")).to.eql("pass");
expect(dnr.rewrite("pass!!!!!!")).to.eql("pass");
expect(dnr.rewrite("!!!!!pass!!!!!!")).to.eql("pass");
});
it("should remove all invalid characters even to the point that there are no characters left", function() {
// invalid characters but won"t pass afterwards because not long enough
expect(dnr.rewrite("!!!!!!!!!!!")).to.be(undefined);
});
it("should add required characters", function() {
expect(dnr.rewrite("bb")).to.eql("abb");
expect(dnr.rewrite("bbb")).to.eql("abbb");
expect(dnr.rewrite("bbbb")).to.eql("abbbb");
});
it("should add required characters and trim the string if needed", function() {
expect(dnr.rewrite("bbbbbbbbbbbbbbbbbb")).to.eql("abbbbbbbbb");
});
it("should not change it if at least one required character is present", function() {
expect(dnr.rewrite("bbb-")).to.eql("bbb-");
});
it("should add a required character and trim if necessary", function() {
expect(dnr.rewrite("bbbbbbbbbbbbbbbbbb-")).to.eql("abbbbbbbbb");
expect(dnr.rewrite("bbbbbbbbbbbbbbbbbba")).to.eql("abbbbbbbbb");
expect(dnr.rewrite("abbbbbbbbbbbbbbbbba")).to.eql("abbbbbbbbb");
expect(dnr.rewrite("-bbbbbbbbbbbbbbbbbb")).to.eql("-bbbbbbbbb");
});
});
describe(".rewrite() using validregex", function() {
var dnr = new DomainNameRule({
domain: "foo.com",
validregex: "A-Za-z0-9"
});
it("should not change the input if it doesn't need to be changed", function() {
expect(dnr.rewrite("pass")).to.eql("pass");
expect(dnr.rewrite("PASS")).to.eql("PASS");
expect(dnr.rewrite("PASS01")).to.eql("PASS01");
});
it("should remove invalid characters", function() {
expect(dnr.rewrite("pass-pass")).to.eql("passpass");
expect(dnr.rewrite("pass?-pass")).to.eql("passpass");
expect(dnr.rewrite("pass?-PASS")).to.eql("passPASS");
});
});
describe(".rewrite() using validregex with case sensitivity", function() {
var dnr = new DomainNameRule({
domain: "foo.com",
validregex: "A-Z0-9"
});
it("should not change the input if it doesn't need to be changed", function() {
expect(dnr.rewrite("PASS")).to.eql("PASS");
expect(dnr.rewrite("PASS01")).to.eql("PASS01");
});
it("should remove invalid characters", function() {
expect(dnr.rewrite("PaSS")).to.eql("PSS");
expect(dnr.rewrite("PASS-PASS")).to.eql("PASSPASS");
expect(dnr.rewrite("PASS?-PASS")).to.eql("PASSPASS");
expect(dnr.rewrite("pass?-PASS")).to.eql("PASS");
});
});
});
}(typeof window !== "undefined" ? window : undefined));
|
import Vue from 'vue'
import * as types from './mutation-types'
export const getUserInfo = ({ state, commit }) => {
Vue.resource(state.userInfoUrl).get()
.then(response => {
commit(types.GET_USER_INFO_SUCCESS, response.data)
})
}
|
goog.provide('dc.Application');
goog.require('dc.BaseApplication');
goog.require('dc.services.Settings');
goog.require('zb.console');
goog.require('zb.device.Resolution');
/**
* @extends {dc.BaseApplication}
* @constructor
*/
dc.Application = function() {
zb.console.setLevel(zb.console.Level.LOG);
goog.base(this);
this.services = {
settings: new dc.services.Settings
};
};
goog.inherits(dc.Application, dc.BaseApplication);
/**
* @override
*/
dc.Application.prototype.onReady = function() {
this.services.settings.setStorage(this.device.storage);
this.setHomeScene('home');
};
/**
* @override
*/
dc.Application.prototype.onStart = function() {
if (this.isDeviceSamsung()) {
this.device.screenSaverOff();
}
this.home();
};
/**
* @override
*/
dc.Application.prototype._appendScreenSizeClass = function() {
var resulutionType = this.device.info.osdResolutionType();
if (resulutionType !== zb.device.Resolution.HD && resulutionType !== zb.device.Resolution.FULL_HD) {
resulutionType = zb.device.Resolution.HD;
}
var resolution = zb.device.ResolutionInfo[resulutionType];
this._body.classList.add('zb-' + resolution.name);
this._appendViewportSize(resolution);
};
/**
* @type {{
* settings: dc.services.Settings
* }}
*/
dc.Application.prototype.services;
|
define(['jquery'], function ($) {define('select2/utils',[], function () {
var Utils = {};
Utils.Extend = function (ChildClass, SuperClass) {
var __hasProp = {}.hasOwnProperty;
function BaseConstructor () {
this.constructor = ChildClass;
}
for (var key in SuperClass) {
if (__hasProp.call(SuperClass, key)) {
ChildClass[key] = SuperClass[key];
}
}
BaseConstructor.prototype = SuperClass.prototype;
ChildClass.prototype = new BaseConstructor();
ChildClass.__super__ = SuperClass.prototype;
return ChildClass;
};
function getMethods (theClass) {
var proto = theClass.prototype;
var methods = [];
for (var methodName in proto) {
var m = proto[methodName];
if (typeof m !== 'function') {
continue;
}
if (methodName === 'constructor') {
continue;
}
methods.push(methodName);
}
return methods;
}
Utils.Decorate = function (SuperClass, DecoratorClass) {
var decoratedMethods = getMethods(DecoratorClass);
var superMethods = getMethods(SuperClass);
function DecoratedClass () {
var unshift = Array.prototype.unshift;
var argCount = DecoratorClass.prototype.constructor.length;
var calledConstructor = SuperClass.prototype.constructor;
if (argCount > 0) {
unshift.call(arguments, SuperClass.prototype.constructor);
calledConstructor = DecoratorClass.prototype.constructor;
}
calledConstructor.apply(this, arguments);
}
DecoratorClass.displayName = SuperClass.displayName;
function ctr () {
this.constructor = DecoratedClass;
}
DecoratedClass.prototype = new ctr();
for (var m = 0; m < superMethods.length; m++) {
var superMethod = superMethods[m];
DecoratedClass.prototype[superMethod] =
SuperClass.prototype[superMethod];
}
var calledMethod = function (methodName) {
// Stub out the original method if it's not decorating an actual method
var originalMethod = function () {};
if (methodName in DecoratedClass.prototype) {
originalMethod = DecoratedClass.prototype[methodName];
}
var decoratedMethod = DecoratorClass.prototype[methodName];
return function () {
var unshift = Array.prototype.unshift;
unshift.call(arguments, originalMethod);
return decoratedMethod.apply(this, arguments);
};
};
for (var d = 0; d < decoratedMethods.length; d++) {
var decoratedMethod = decoratedMethods[d];
DecoratedClass.prototype[decoratedMethod] = calledMethod(decoratedMethod);
}
return DecoratedClass;
};
var Observable = function () {
this.listeners = {};
};
Observable.prototype.on = function (event, callback) {
this.listeners = this.listeners || {};
if (event in this.listeners) {
this.listeners[event].push(callback);
} else {
this.listeners[event] = [callback];
}
};
Observable.prototype.trigger = function (event) {
var slice = Array.prototype.slice;
this.listeners = this.listeners || {};
if (event in this.listeners) {
this.invoke(this.listeners[event], slice.call(arguments, 1));
}
if ('*' in this.listeners) {
this.invoke(this.listeners['*'], arguments);
}
};
Observable.prototype.invoke = function (listeners, params) {
for (var i = 0, len = listeners.length; i < len; i++) {
listeners[i].apply(this, params);
}
};
Utils.Observable = Observable;
Utils.generateChars = function (length) {
var chars = '';
for (var i = 0; i < length; i++) {
var randomChar = Math.floor(Math.random() * 36);
chars += randomChar.toString(36);
}
return chars;
};
Utils.bind = function (func, context) {
return function () {
func.apply(context, arguments);
};
};
Utils._convertData = function (data) {
for (var originalKey in data) {
var keys = originalKey.split('-');
var dataLevel = data;
if (keys.length === 1) {
continue;
}
for (var k = 0; k < keys.length; k++) {
var key = keys[k];
// Lowercase the first letter
// By default, dash-separated becomes camelCase
key = key.substring(0, 1).toLowerCase() + key.substring(1);
if (!(key in dataLevel)) {
dataLevel[key] = {};
}
if (k == keys.length - 1) {
dataLevel[key] = data[originalKey];
}
dataLevel = dataLevel[key];
}
delete data[originalKey];
}
return data;
};
Utils.hasScroll = function (index, el) {
// Adapted from the function created by @ShadowScripter
// and adapted by @BillBarry on the Stack Exchange Code Review website.
// The original code can be found at
// http://codereview.stackexchange.com/q/13338
// and was designed to be used with the Sizzle selector engine.
var $el = $(el);
var overflowX = el.style.overflowX;
var overflowY = el.style.overflowY;
//Check both x and y declarations
if (overflowX === overflowY &&
(overflowY === 'hidden' || overflowY === 'visible')) {
return false;
}
if (overflowX === 'scroll' || overflowY === 'scroll') {
return true;
}
return ($el.innerHeight() < el.scrollHeight ||
$el.innerWidth() < el.scrollWidth);
};
return Utils;
});
define('select2/results',[
'jquery',
'./utils'
], function ($, Utils) {
function Results ($element, options, dataAdapter) {
this.$element = $element;
this.data = dataAdapter;
this.options = options;
Results.__super__.constructor.call(this);
}
Utils.Extend(Results, Utils.Observable);
Results.prototype.render = function () {
var $results = $(
'<ul class="select2-results__options" role="tree"></ul>'
);
if (this.options.get('multiple')) {
$results.attr('aria-multiselectable', 'true');
}
this.$results = $results;
return $results;
};
Results.prototype.clear = function () {
this.$results.empty();
};
Results.prototype.displayMessage = function (params) {
this.clear();
this.hideLoading();
var $message = $(
'<li role="treeitem" class="select2-results__option"></li>'
);
var message = this.options.get('translations').get(params.message);
$message.text(message(params.args));
this.$results.append($message);
};
Results.prototype.append = function (data) {
this.hideLoading();
var $options = [];
if (data.results == null || data.results.length === 0) {
if (this.$results.children().length === 0) {
this.trigger('results:message', {
message: 'noResults'
});
}
return;
}
data.results = this.sort(data.results);
for (var d = 0; d < data.results.length; d++) {
var item = data.results[d];
var $option = this.option(item);
$options.push($option);
}
this.$results.append($options);
};
Results.prototype.position = function ($results, $dropdown) {
var $resultsContainer = $dropdown.find('.select2-results');
$resultsContainer.append($results);
};
Results.prototype.sort = function (data) {
var sorter = this.options.get('sorter');
return sorter(data);
};
Results.prototype.setClasses = function () {
var self = this;
this.data.current(function (selected) {
var selectedIds = $.map(selected, function (s) {
return s.id.toString();
});
var $options = self.$results
.find('.select2-results__option[aria-selected]');
$options.each(function () {
var $option = $(this);
var item = $.data(this, 'data');
if (item.id != null && selectedIds.indexOf(item.id.toString()) > -1) {
$option.attr('aria-selected', 'true');
} else {
$option.attr('aria-selected', 'false');
}
});
var $selected = $options.filter('[aria-selected=true]');
// Check if there are any selected options
if ($selected.length > 0) {
// If there are selected options, highlight the first
$selected.first().trigger('mouseenter');
} else {
// If there are no selected options, highlight the first option
// in the dropdown
$options.first().trigger('mouseenter');
}
});
};
Results.prototype.showLoading = function (params) {
this.hideLoading();
var loadingMore = this.options.get('translations').get('searching');
var loading = {
disabled: true,
loading: true,
text: loadingMore(params)
};
var $loading = this.option(loading);
$loading.className += ' loading-results';
this.$results.prepend($loading);
};
Results.prototype.hideLoading = function () {
this.$results.find('.loading-results').remove();
};
Results.prototype.option = function (data) {
var option = document.createElement('li');
option.className = 'select2-results__option';
var attrs = {
'role': 'treeitem',
'aria-selected': 'false'
};
if (data.disabled) {
delete attrs['aria-selected'];
attrs['aria-disabled'] = 'true';
}
if (data.id == null) {
delete attrs['aria-selected'];
}
if (data._resultId != null) {
option.id = data._resultId;
}
if (data.children) {
attrs.role = 'group';
attrs['aria-label'] = data.text;
delete attrs['aria-selected'];
}
for (var attr in attrs) {
var val = attrs[attr];
option.setAttribute(attr, val);
}
if (data.children) {
var $option = $(option);
var label = document.createElement('strong');
label.className = 'select2-results__group';
var $label = $(label);
this.template(data, label);
var $children = [];
for (var c = 0; c < data.children.length; c++) {
var child = data.children[c];
var $child = this.option(child);
$children.push($child);
}
var $childrenContainer = $('<ul></ul>', {
'class': 'select2-results__options select2-results__options--nested'
});
$childrenContainer.append($children);
$option.append(label);
$option.append($childrenContainer);
} else {
this.template(data, option);
}
$.data(option, 'data', data);
return option;
};
Results.prototype.bind = function (container, $container) {
var self = this;
var id = container.id + '-results';
this.$results.attr('id', id);
container.on('results:all', function (params) {
self.clear();
self.append(params.data);
if (container.isOpen()) {
self.setClasses();
}
});
container.on('results:append', function (params) {
self.append(params.data);
if (container.isOpen()) {
self.setClasses();
}
});
container.on('query', function (params) {
self.showLoading(params);
});
container.on('select', function () {
if (!container.isOpen()) {
return;
}
self.setClasses();
});
container.on('unselect', function () {
if (!container.isOpen()) {
return;
}
self.setClasses();
});
container.on('open', function () {
// When the dropdown is open, aria-expended="true"
self.$results.attr('aria-expanded', 'true');
self.$results.attr('aria-hidden', 'false');
self.setClasses();
self.ensureHighlightVisible();
});
container.on('close', function () {
// When the dropdown is closed, aria-expended="false"
self.$results.attr('aria-expanded', 'false');
self.$results.attr('aria-hidden', 'true');
self.$results.removeAttr('aria-activedescendant');
});
container.on('results:select', function () {
var $highlighted = self.getHighlightedResults();
if ($highlighted.length === 0) {
return;
}
var data = $highlighted.data('data');
if ($highlighted.attr('aria-selected') == 'true') {
if (self.options.get('multiple')) {
self.trigger('unselect', {
data: data
});
} else {
self.trigger('close');
}
} else {
self.trigger('select', {
data: data
});
}
});
container.on('results:previous', function () {
var $highlighted = self.getHighlightedResults();
var $options = self.$results.find('[aria-selected]');
var currentIndex = $options.index($highlighted);
// If we are already at te top, don't move further
if (currentIndex === 0) {
return;
}
var nextIndex = currentIndex - 1;
// If none are highlighted, highlight the first
if ($highlighted.length === 0) {
nextIndex = 0;
}
var $next = $options.eq(nextIndex);
$next.trigger('mouseenter');
var currentOffset = self.$results.offset().top;
var nextTop = $next.offset().top;
var nextOffset = self.$results.scrollTop() + (nextTop - currentOffset);
if (nextIndex === 0) {
self.$results.scrollTop(0);
} else if (nextTop - currentOffset < 0) {
self.$results.scrollTop(nextOffset);
}
});
container.on('results:next', function () {
var $highlighted = self.getHighlightedResults();
var $options = self.$results.find('[aria-selected]');
var currentIndex = $options.index($highlighted);
var nextIndex = currentIndex + 1;
// If we are at the last option, stay there
if (nextIndex >= $options.length) {
return;
}
var $next = $options.eq(nextIndex);
$next.trigger('mouseenter');
var currentOffset = self.$results.offset().top +
self.$results.outerHeight(false);
var nextBottom = $next.offset().top + $next.outerHeight(false);
var nextOffset = self.$results.scrollTop() + nextBottom - currentOffset;
if (nextIndex === 0) {
self.$results.scrollTop(0);
} else if (nextBottom > currentOffset) {
self.$results.scrollTop(nextOffset);
}
});
container.on('results:focus', function (params) {
params.element.addClass('select2-results__option--highlighted');
});
container.on('results:message', function (params) {
self.displayMessage(params);
});
if ($.fn.mousewheel) {
this.$results.on('mousewheel', function (e) {
var top = self.$results.scrollTop();
var bottom = (
self.$results.get(0).scrollHeight -
self.$results.scrollTop() +
e.deltaY
);
var isAtTop = e.deltaY > 0 && top - e.deltaY <= 0;
var isAtBottom = e.deltaY < 0 && bottom <= self.$results.height();
if (isAtTop) {
self.$results.scrollTop(0);
e.preventDefault();
e.stopPropagation();
} else if (isAtBottom) {
self.$results.scrollTop(
self.$results.get(0).scrollHeight - self.$results.height()
);
e.preventDefault();
e.stopPropagation();
}
});
}
this.$results.on('mouseup', '.select2-results__option[aria-selected]',
function (evt) {
var $this = $(this);
var data = $this.data('data');
if ($this.attr('aria-selected') === 'true') {
if (self.options.get('multiple')) {
self.trigger('unselect', {
originalEvent: evt,
data: data
});
} else {
self.trigger('close');
}
return;
}
self.trigger('select', {
originalEvent: evt,
data: data
});
});
this.$results.on('mouseenter', '.select2-results__option[aria-selected]',
function (evt) {
var data = $(this).data('data');
self.getHighlightedResults()
.removeClass('select2-results__option--highlighted');
self.trigger('results:focus', {
data: data,
element: $(this)
});
});
};
Results.prototype.getHighlightedResults = function () {
var $highlighted = this.$results
.find('.select2-results__option--highlighted');
return $highlighted;
};
Results.prototype.destroy = function () {
this.$results.remove();
};
Results.prototype.ensureHighlightVisible = function () {
var $highlighted = this.getHighlightedResults();
if ($highlighted.length === 0) {
return;
}
var $options = this.$results.find('[aria-selected]');
var currentIndex = $options.index($highlighted);
var currentOffset = this.$results.offset().top;
var nextTop = $highlighted.offset().top;
var nextOffset = this.$results.scrollTop() + (nextTop - currentOffset);
var offsetDelta = nextTop - currentOffset;
nextOffset -= $highlighted.outerHeight(false) * 2;
if (currentIndex <= 2) {
this.$results.scrollTop(0);
} else if (offsetDelta > this.$results.outerHeight() || offsetDelta < 0) {
this.$results.scrollTop(nextOffset);
}
};
Results.prototype.template = function (result, container) {
var template = this.options.get('templateResult');
var content = template(result);
if (content == null) {
container.style.display = 'none';
} else {
container.innerHTML = content;
}
};
return Results;
});
define('select2/keys',[
], function () {
var KEYS = {
BACKSPACE: 8,
TAB: 9,
ENTER: 13,
SHIFT: 16,
CTRL: 17,
ALT: 18,
ESC: 27,
SPACE: 32,
PAGE_UP: 33,
PAGE_DOWN: 34,
END: 35,
HOME: 36,
LEFT: 37,
UP: 38,
RIGHT: 39,
DOWN: 40,
DELETE: 46,
isArrow: function (k) {
k = k.which ? k.which : k;
switch (k) {
case KEY.LEFT:
case KEY.RIGHT:
case KEY.UP:
case KEY.DOWN:
return true;
}
return false;
}
};
return KEYS;
});
define('select2/selection/base',[
'jquery',
'../utils',
'../keys'
], function ($, Utils, KEYS) {
function BaseSelection ($element, options) {
this.$element = $element;
this.options = options;
BaseSelection.__super__.constructor.call(this);
}
Utils.Extend(BaseSelection, Utils.Observable);
BaseSelection.prototype.render = function () {
var $selection = $(
'<span class="select2-selection" tabindex="0" role="combobox" ' +
'aria-autocomplete="list" aria-haspopup="true" aria-expanded="false">' +
'</span>'
);
$selection.attr('title', this.$element.attr('title'));
this.$selection = $selection;
return $selection;
};
BaseSelection.prototype.bind = function (container, $container) {
var self = this;
var id = container.id + '-container';
var resultsId = container.id + '-results';
this.container = container;
this.$selection.attr('aria-owns', resultsId);
this.$selection.on('keydown', function (evt) {
self.trigger('keypress', evt);
if (evt.which === KEYS.SPACE) {
evt.preventDefault();
}
});
container.on('results:focus', function (params) {
self.$selection.attr('aria-activedescendant', params.data._resultId);
});
container.on('selection:update', function (params) {
self.update(params.data);
});
container.on('open', function () {
// When the dropdown is open, aria-expanded="true"
self.$selection.attr('aria-expanded', 'true');
self._attachCloseHandler(container);
});
container.on('close', function () {
// When the dropdown is closed, aria-expanded="false"
self.$selection.attr('aria-expanded', 'false');
self.$selection.removeAttr('aria-activedescendant');
self.$selection.focus();
self._detachCloseHandler(container);
});
container.on('enable', function () {
self.$selection.attr('tabindex', '0');
});
container.on('disable', function () {
self.$selection.attr('tabindex', '-1');
});
};
BaseSelection.prototype._attachCloseHandler = function (container) {
var self = this;
$(document.body).on('mousedown.select2.' + container.id, function (e) {
var $target = $(e.target);
var $select = $target.closest('.select2');
var $all = $('.select2.select2-container--open');
$all.each(function () {
var $this = $(this);
if (this == $select[0]) {
return;
}
var $element = $this.data('element');
$element.select2('close');
});
});
};
BaseSelection.prototype._detachCloseHandler = function (container) {
$(document.body).off('mousedown.select2.' + container.id);
};
BaseSelection.prototype.position = function ($selection, $container) {
var $selectionContainer = $container.find('.selection');
$selectionContainer.append($selection);
};
BaseSelection.prototype.destroy = function () {
this._detachCloseHandler(this.container);
};
BaseSelection.prototype.update = function (data) {
throw new Error('The `update` method must be defined in child classes.');
};
return BaseSelection;
});
define('select2/selection/single',[
'jquery',
'./base',
'../utils',
'../keys'
], function ($, BaseSelection, Utils, KEYS) {
function SingleSelection () {
SingleSelection.__super__.constructor.apply(this, arguments);
}
Utils.Extend(SingleSelection, BaseSelection);
SingleSelection.prototype.render = function () {
var $selection = SingleSelection.__super__.render.call(this);
$selection.addClass('select2-selection--single');
$selection.html(
'<span class="select2-selection__rendered"></span>' +
'<span class="select2-selection__arrow" role="presentation">' +
'<b role="presentation"></b>' +
'</span>'
);
return $selection;
};
SingleSelection.prototype.bind = function (container, $container) {
var self = this;
SingleSelection.__super__.bind.apply(this, arguments);
var id = container.id + '-container';
this.$selection.find('.select2-selection__rendered').attr('id', id);
this.$selection.attr('aria-labelledby', id);
this.$selection.on('mousedown', function (evt) {
// Only respond to left clicks
if (evt.which !== 1) {
return;
}
self.trigger('toggle', {
originalEvent: evt
});
});
this.$selection.on('focus', function (evt) {
// User focuses on the container
});
this.$selection.on('blur', function (evt) {
// User exits the container
});
container.on('selection:update', function (params) {
self.update(params.data);
});
};
SingleSelection.prototype.clear = function () {
this.$selection.find('.select2-selection__rendered').empty();
};
SingleSelection.prototype.display = function (data) {
var template = this.options.get('templateSelection');
return template(data);
};
SingleSelection.prototype.selectionContainer = function () {
return $('<span></span>');
};
SingleSelection.prototype.update = function (data) {
if (data.length === 0) {
this.clear();
return;
}
var selection = data[0];
var formatted = this.display(selection);
this.$selection.find('.select2-selection__rendered').html(formatted);
};
return SingleSelection;
});
define('select2/selection/multiple',[
'jquery',
'./base',
'../utils'
], function ($, BaseSelection, Utils) {
function MultipleSelection ($element, options) {
MultipleSelection.__super__.constructor.apply(this, arguments);
}
Utils.Extend(MultipleSelection, BaseSelection);
MultipleSelection.prototype.render = function () {
var $selection = MultipleSelection.__super__.render.call(this);
$selection.addClass('select2-selection--multiple');
$selection.html(
'<ul class="select2-selection__rendered"></ul>'
);
return $selection;
};
MultipleSelection.prototype.bind = function (container, $container) {
var self = this;
MultipleSelection.__super__.bind.apply(this, arguments);
this.$selection.on('click', function (evt) {
self.trigger('toggle', {
originalEvent: evt
});
});
this.$selection.on('click', '.select2-selection__choice__remove',
function (evt) {
var $remove = $(this);
var $selection = $remove.parent();
var data = $selection.data('data');
self.trigger('unselect', {
originalEvent: evt,
data: data
});
});
};
MultipleSelection.prototype.clear = function () {
this.$selection.find('.select2-selection__rendered').empty();
};
MultipleSelection.prototype.display = function (data) {
var template = this.options.get('templateSelection');
return template(data);
};
MultipleSelection.prototype.selectionContainer = function () {
var $container = $(
'<li class="select2-selection__choice">' +
'<span class="select2-selection__choice__remove" role="presentation">' +
'×' +
'</span>' +
'</li>'
);
return $container;
};
MultipleSelection.prototype.update = function (data) {
this.clear();
if (data.length === 0) {
return;
}
var $selections = [];
for (var d = 0; d < data.length; d++) {
var selection = data[d];
var formatted = this.display(selection);
var $selection = this.selectionContainer();
$selection.append(formatted);
$selection.data('data', selection);
$selections.push($selection);
}
this.$selection.find('.select2-selection__rendered').append($selections);
};
return MultipleSelection;
});
define('select2/selection/placeholder',[
'../utils'
], function (Utils) {
function Placeholder (decorated, $element, options) {
this.placeholder = this.normalizePlaceholder(options.get('placeholder'));
decorated.call(this, $element, options);
}
Placeholder.prototype.normalizePlaceholder = function (_, placeholder) {
if (typeof placeholder === 'string') {
placeholder = {
id: '',
text: placeholder
};
}
return placeholder;
};
Placeholder.prototype.createPlaceholder = function (decorated, placeholder) {
var $placeholder = this.selectionContainer();
$placeholder.html(this.display(placeholder));
$placeholder.addClass('select2-selection__placeholder')
.removeClass('select2-selection__choice');
return $placeholder;
};
Placeholder.prototype.update = function (decorated, data) {
var singlePlaceholder = (
data.length == 1 && data[0].id != this.placeholder.id
);
var multipleSelections = data.length > 1;
if (multipleSelections || singlePlaceholder) {
return decorated.call(this, data);
}
this.clear();
var $placeholder = this.createPlaceholder(this.placeholder);
this.$selection.find('.select2-selection__rendered').append($placeholder);
};
return Placeholder;
});
define('select2/selection/allowClear',[
'jquery'
], function ($) {
function AllowClear () { }
AllowClear.prototype.bind = function (decorated, container, $container) {
var self = this;
decorated.call(this, container, $container);
this.$selection.on('mousedown', '.select2-selection__clear',
function (evt) {
// Ignore the event if it is disabled
if (self.options.get('disabled')) {
return;
}
evt.stopPropagation();
var data = $(this).data('data');
for (var d = 0; d < data.length; d++) {
var unselectData = {
data: data[d]
};
// Trigger the `unselect` event, so people can prevent it from being
// cleared.
self.trigger('unselect', unselectData);
// If the event was prevented, don't clear it out.
if (unselectData.prevented) {
return;
}
}
self.$element.val(self.placeholder.id).trigger('change');
self.trigger('toggle');
});
};
AllowClear.prototype.update = function (decorated, data) {
decorated.call(this, data);
if (this.$selection.find('.select2-selection__placeholder').length > 0 ||
data.length === 0) {
return;
}
var $remove = $(
'<span class="select2-selection__clear">' +
'×' +
'</span>'
);
$remove.data('data', data);
this.$selection.find('.select2-selection__rendered').append($remove);
};
return AllowClear;
});
define('select2/selection/search',[
'jquery',
'../utils',
'../keys'
], function ($, Utils, KEYS) {
function Search (decorated, $element, options) {
decorated.call(this, $element, options);
}
Search.prototype.render = function (decorated) {
var $search = $(
'<li class="select2-search select2-search--inline">' +
'<input class="select2-search__field" type="search" tabindex="-1"' +
' role="textbox" />' +
'</li>'
);
this.$searchContainer = $search;
this.$search = $search.find('input');
var $rendered = decorated.call(this);
return $rendered;
};
Search.prototype.bind = function (decorated, container, $container) {
var self = this;
decorated.call(this, container, $container);
container.on('open', function () {
self.$search.attr('tabindex', 0);
self.$search.focus();
});
container.on('close', function () {
self.$search.attr('tabindex', -1);
self.$search.val('');
});
container.on('enable', function () {
self.$search.prop('disabled', false);
});
container.on('disable', function () {
self.$search.prop('disabled', true);
});
this.$selection.on('keydown', '.select2-search--inline', function (evt) {
evt.stopPropagation();
self.trigger('keypress', evt);
self._keyUpPrevented = evt.isDefaultPrevented();
var key = evt.which;
if (key === KEYS.BACKSPACE && self.$search.val() === '') {
var $previousChoice = self.$searchContainer
.prev('.select2-selection__choice');
if ($previousChoice.length > 0) {
var item = $previousChoice.data('data');
self.searchRemoveChoice(item);
}
}
});
this.$selection.on('keyup', '.select2-search--inline', function (evt) {
self.handleSearch(evt);
});
};
Search.prototype.createPlaceholder = function (decorated, placeholder) {
this.$search.attr('placeholder', placeholder.text);
};
Search.prototype.update = function (decorated, data) {
this.$search.attr('placeholder', '');
decorated.call(this, data);
this.$selection.find('.select2-selection__rendered')
.append(this.$searchContainer);
this.resizeSearch();
};
Search.prototype.handleSearch = function () {
this.resizeSearch();
if (!this._keyUpPrevented) {
var input = this.$search.val();
this.trigger('query', {
term: input
});
}
this._keyUpPrevented = false;
};
Search.prototype.searchRemoveChoice = function (decorated, item) {
this.trigger('unselect', {
data: item
});
this.trigger('open');
this.$search.val(item.text + ' ');
};
Search.prototype.resizeSearch = function () {
this.$search.css('width', '25px');
var width = '';
if (this.$search.attr('placeholder') !== '') {
width = this.$selection.find('.select2-selection__rendered').innerWidth();
} else {
var minimumWidth = this.$search.val().length + 1;
width = (minimumWidth * 0.75) + 'em';
}
this.$search.css('width', width);
};
return Search;
});
define('select2/selection/eventRelay',[
'jquery'
], function ($) {
function EventRelay () { }
EventRelay.prototype.bind = function (decorated, container, $container) {
var self = this;
var relayEvents = [
'open', 'opening',
'close', 'closing',
'select', 'selecting',
'unselect', 'unselecting'
];
var preventableEvents = ['opening', 'closing', 'selecting', 'unselecting'];
decorated.call(this, container, $container);
container.on('*', function (name, params) {
// Ignore events that should not be relayed
if (relayEvents.indexOf(name) === -1) {
return;
}
// The parameters should always be an object
params = params || {};
// Generate the jQuery event for the Select2 event
var evt = $.Event('select2:' + name, {
params: params
});
self.$element.trigger(evt);
// Only handle preventable events if it was one
if (preventableEvents.indexOf(name) === -1) {
return;
}
params.prevented = evt.isDefaultPrevented();
});
};
return EventRelay;
});
define('select2/translation',[
'jquery'
], function ($) {
function Translation (dict) {
this.dict = dict || {};
}
Translation.prototype.all = function () {
return this.dict;
};
Translation.prototype.get = function (key) {
return this.dict[key];
};
Translation.prototype.extend = function (translation) {
this.dict = $.extend({}, translation.all(), this.dict);
};
// Static functions
Translation._cache = {};
Translation.loadPath = function (path) {
if (!(path in Translation._cache)) {
var translations = require(path);
Translation._cache[path] = translations;
}
return new Translation(Translation._cache[path]);
};
return Translation;
});
define('select2/diacritics',[
], function () {
var diacritics = {
'\u24B6': 'A',
'\uFF21': 'A',
'\u00C0': 'A',
'\u00C1': 'A',
'\u00C2': 'A',
'\u1EA6': 'A',
'\u1EA4': 'A',
'\u1EAA': 'A',
'\u1EA8': 'A',
'\u00C3': 'A',
'\u0100': 'A',
'\u0102': 'A',
'\u1EB0': 'A',
'\u1EAE': 'A',
'\u1EB4': 'A',
'\u1EB2': 'A',
'\u0226': 'A',
'\u01E0': 'A',
'\u00C4': 'A',
'\u01DE': 'A',
'\u1EA2': 'A',
'\u00C5': 'A',
'\u01FA': 'A',
'\u01CD': 'A',
'\u0200': 'A',
'\u0202': 'A',
'\u1EA0': 'A',
'\u1EAC': 'A',
'\u1EB6': 'A',
'\u1E00': 'A',
'\u0104': 'A',
'\u023A': 'A',
'\u2C6F': 'A',
'\uA732': 'AA',
'\u00C6': 'AE',
'\u01FC': 'AE',
'\u01E2': 'AE',
'\uA734': 'AO',
'\uA736': 'AU',
'\uA738': 'AV',
'\uA73A': 'AV',
'\uA73C': 'AY',
'\u24B7': 'B',
'\uFF22': 'B',
'\u1E02': 'B',
'\u1E04': 'B',
'\u1E06': 'B',
'\u0243': 'B',
'\u0182': 'B',
'\u0181': 'B',
'\u24B8': 'C',
'\uFF23': 'C',
'\u0106': 'C',
'\u0108': 'C',
'\u010A': 'C',
'\u010C': 'C',
'\u00C7': 'C',
'\u1E08': 'C',
'\u0187': 'C',
'\u023B': 'C',
'\uA73E': 'C',
'\u24B9': 'D',
'\uFF24': 'D',
'\u1E0A': 'D',
'\u010E': 'D',
'\u1E0C': 'D',
'\u1E10': 'D',
'\u1E12': 'D',
'\u1E0E': 'D',
'\u0110': 'D',
'\u018B': 'D',
'\u018A': 'D',
'\u0189': 'D',
'\uA779': 'D',
'\u01F1': 'DZ',
'\u01C4': 'DZ',
'\u01F2': 'Dz',
'\u01C5': 'Dz',
'\u24BA': 'E',
'\uFF25': 'E',
'\u00C8': 'E',
'\u00C9': 'E',
'\u00CA': 'E',
'\u1EC0': 'E',
'\u1EBE': 'E',
'\u1EC4': 'E',
'\u1EC2': 'E',
'\u1EBC': 'E',
'\u0112': 'E',
'\u1E14': 'E',
'\u1E16': 'E',
'\u0114': 'E',
'\u0116': 'E',
'\u00CB': 'E',
'\u1EBA': 'E',
'\u011A': 'E',
'\u0204': 'E',
'\u0206': 'E',
'\u1EB8': 'E',
'\u1EC6': 'E',
'\u0228': 'E',
'\u1E1C': 'E',
'\u0118': 'E',
'\u1E18': 'E',
'\u1E1A': 'E',
'\u0190': 'E',
'\u018E': 'E',
'\u24BB': 'F',
'\uFF26': 'F',
'\u1E1E': 'F',
'\u0191': 'F',
'\uA77B': 'F',
'\u24BC': 'G',
'\uFF27': 'G',
'\u01F4': 'G',
'\u011C': 'G',
'\u1E20': 'G',
'\u011E': 'G',
'\u0120': 'G',
'\u01E6': 'G',
'\u0122': 'G',
'\u01E4': 'G',
'\u0193': 'G',
'\uA7A0': 'G',
'\uA77D': 'G',
'\uA77E': 'G',
'\u24BD': 'H',
'\uFF28': 'H',
'\u0124': 'H',
'\u1E22': 'H',
'\u1E26': 'H',
'\u021E': 'H',
'\u1E24': 'H',
'\u1E28': 'H',
'\u1E2A': 'H',
'\u0126': 'H',
'\u2C67': 'H',
'\u2C75': 'H',
'\uA78D': 'H',
'\u24BE': 'I',
'\uFF29': 'I',
'\u00CC': 'I',
'\u00CD': 'I',
'\u00CE': 'I',
'\u0128': 'I',
'\u012A': 'I',
'\u012C': 'I',
'\u0130': 'I',
'\u00CF': 'I',
'\u1E2E': 'I',
'\u1EC8': 'I',
'\u01CF': 'I',
'\u0208': 'I',
'\u020A': 'I',
'\u1ECA': 'I',
'\u012E': 'I',
'\u1E2C': 'I',
'\u0197': 'I',
'\u24BF': 'J',
'\uFF2A': 'J',
'\u0134': 'J',
'\u0248': 'J',
'\u24C0': 'K',
'\uFF2B': 'K',
'\u1E30': 'K',
'\u01E8': 'K',
'\u1E32': 'K',
'\u0136': 'K',
'\u1E34': 'K',
'\u0198': 'K',
'\u2C69': 'K',
'\uA740': 'K',
'\uA742': 'K',
'\uA744': 'K',
'\uA7A2': 'K',
'\u24C1': 'L',
'\uFF2C': 'L',
'\u013F': 'L',
'\u0139': 'L',
'\u013D': 'L',
'\u1E36': 'L',
'\u1E38': 'L',
'\u013B': 'L',
'\u1E3C': 'L',
'\u1E3A': 'L',
'\u0141': 'L',
'\u023D': 'L',
'\u2C62': 'L',
'\u2C60': 'L',
'\uA748': 'L',
'\uA746': 'L',
'\uA780': 'L',
'\u01C7': 'LJ',
'\u01C8': 'Lj',
'\u24C2': 'M',
'\uFF2D': 'M',
'\u1E3E': 'M',
'\u1E40': 'M',
'\u1E42': 'M',
'\u2C6E': 'M',
'\u019C': 'M',
'\u24C3': 'N',
'\uFF2E': 'N',
'\u01F8': 'N',
'\u0143': 'N',
'\u00D1': 'N',
'\u1E44': 'N',
'\u0147': 'N',
'\u1E46': 'N',
'\u0145': 'N',
'\u1E4A': 'N',
'\u1E48': 'N',
'\u0220': 'N',
'\u019D': 'N',
'\uA790': 'N',
'\uA7A4': 'N',
'\u01CA': 'NJ',
'\u01CB': 'Nj',
'\u24C4': 'O',
'\uFF2F': 'O',
'\u00D2': 'O',
'\u00D3': 'O',
'\u00D4': 'O',
'\u1ED2': 'O',
'\u1ED0': 'O',
'\u1ED6': 'O',
'\u1ED4': 'O',
'\u00D5': 'O',
'\u1E4C': 'O',
'\u022C': 'O',
'\u1E4E': 'O',
'\u014C': 'O',
'\u1E50': 'O',
'\u1E52': 'O',
'\u014E': 'O',
'\u022E': 'O',
'\u0230': 'O',
'\u00D6': 'O',
'\u022A': 'O',
'\u1ECE': 'O',
'\u0150': 'O',
'\u01D1': 'O',
'\u020C': 'O',
'\u020E': 'O',
'\u01A0': 'O',
'\u1EDC': 'O',
'\u1EDA': 'O',
'\u1EE0': 'O',
'\u1EDE': 'O',
'\u1EE2': 'O',
'\u1ECC': 'O',
'\u1ED8': 'O',
'\u01EA': 'O',
'\u01EC': 'O',
'\u00D8': 'O',
'\u01FE': 'O',
'\u0186': 'O',
'\u019F': 'O',
'\uA74A': 'O',
'\uA74C': 'O',
'\u01A2': 'OI',
'\uA74E': 'OO',
'\u0222': 'OU',
'\u24C5': 'P',
'\uFF30': 'P',
'\u1E54': 'P',
'\u1E56': 'P',
'\u01A4': 'P',
'\u2C63': 'P',
'\uA750': 'P',
'\uA752': 'P',
'\uA754': 'P',
'\u24C6': 'Q',
'\uFF31': 'Q',
'\uA756': 'Q',
'\uA758': 'Q',
'\u024A': 'Q',
'\u24C7': 'R',
'\uFF32': 'R',
'\u0154': 'R',
'\u1E58': 'R',
'\u0158': 'R',
'\u0210': 'R',
'\u0212': 'R',
'\u1E5A': 'R',
'\u1E5C': 'R',
'\u0156': 'R',
'\u1E5E': 'R',
'\u024C': 'R',
'\u2C64': 'R',
'\uA75A': 'R',
'\uA7A6': 'R',
'\uA782': 'R',
'\u24C8': 'S',
'\uFF33': 'S',
'\u1E9E': 'S',
'\u015A': 'S',
'\u1E64': 'S',
'\u015C': 'S',
'\u1E60': 'S',
'\u0160': 'S',
'\u1E66': 'S',
'\u1E62': 'S',
'\u1E68': 'S',
'\u0218': 'S',
'\u015E': 'S',
'\u2C7E': 'S',
'\uA7A8': 'S',
'\uA784': 'S',
'\u24C9': 'T',
'\uFF34': 'T',
'\u1E6A': 'T',
'\u0164': 'T',
'\u1E6C': 'T',
'\u021A': 'T',
'\u0162': 'T',
'\u1E70': 'T',
'\u1E6E': 'T',
'\u0166': 'T',
'\u01AC': 'T',
'\u01AE': 'T',
'\u023E': 'T',
'\uA786': 'T',
'\uA728': 'TZ',
'\u24CA': 'U',
'\uFF35': 'U',
'\u00D9': 'U',
'\u00DA': 'U',
'\u00DB': 'U',
'\u0168': 'U',
'\u1E78': 'U',
'\u016A': 'U',
'\u1E7A': 'U',
'\u016C': 'U',
'\u00DC': 'U',
'\u01DB': 'U',
'\u01D7': 'U',
'\u01D5': 'U',
'\u01D9': 'U',
'\u1EE6': 'U',
'\u016E': 'U',
'\u0170': 'U',
'\u01D3': 'U',
'\u0214': 'U',
'\u0216': 'U',
'\u01AF': 'U',
'\u1EEA': 'U',
'\u1EE8': 'U',
'\u1EEE': 'U',
'\u1EEC': 'U',
'\u1EF0': 'U',
'\u1EE4': 'U',
'\u1E72': 'U',
'\u0172': 'U',
'\u1E76': 'U',
'\u1E74': 'U',
'\u0244': 'U',
'\u24CB': 'V',
'\uFF36': 'V',
'\u1E7C': 'V',
'\u1E7E': 'V',
'\u01B2': 'V',
'\uA75E': 'V',
'\u0245': 'V',
'\uA760': 'VY',
'\u24CC': 'W',
'\uFF37': 'W',
'\u1E80': 'W',
'\u1E82': 'W',
'\u0174': 'W',
'\u1E86': 'W',
'\u1E84': 'W',
'\u1E88': 'W',
'\u2C72': 'W',
'\u24CD': 'X',
'\uFF38': 'X',
'\u1E8A': 'X',
'\u1E8C': 'X',
'\u24CE': 'Y',
'\uFF39': 'Y',
'\u1EF2': 'Y',
'\u00DD': 'Y',
'\u0176': 'Y',
'\u1EF8': 'Y',
'\u0232': 'Y',
'\u1E8E': 'Y',
'\u0178': 'Y',
'\u1EF6': 'Y',
'\u1EF4': 'Y',
'\u01B3': 'Y',
'\u024E': 'Y',
'\u1EFE': 'Y',
'\u24CF': 'Z',
'\uFF3A': 'Z',
'\u0179': 'Z',
'\u1E90': 'Z',
'\u017B': 'Z',
'\u017D': 'Z',
'\u1E92': 'Z',
'\u1E94': 'Z',
'\u01B5': 'Z',
'\u0224': 'Z',
'\u2C7F': 'Z',
'\u2C6B': 'Z',
'\uA762': 'Z',
'\u24D0': 'a',
'\uFF41': 'a',
'\u1E9A': 'a',
'\u00E0': 'a',
'\u00E1': 'a',
'\u00E2': 'a',
'\u1EA7': 'a',
'\u1EA5': 'a',
'\u1EAB': 'a',
'\u1EA9': 'a',
'\u00E3': 'a',
'\u0101': 'a',
'\u0103': 'a',
'\u1EB1': 'a',
'\u1EAF': 'a',
'\u1EB5': 'a',
'\u1EB3': 'a',
'\u0227': 'a',
'\u01E1': 'a',
'\u00E4': 'a',
'\u01DF': 'a',
'\u1EA3': 'a',
'\u00E5': 'a',
'\u01FB': 'a',
'\u01CE': 'a',
'\u0201': 'a',
'\u0203': 'a',
'\u1EA1': 'a',
'\u1EAD': 'a',
'\u1EB7': 'a',
'\u1E01': 'a',
'\u0105': 'a',
'\u2C65': 'a',
'\u0250': 'a',
'\uA733': 'aa',
'\u00E6': 'ae',
'\u01FD': 'ae',
'\u01E3': 'ae',
'\uA735': 'ao',
'\uA737': 'au',
'\uA739': 'av',
'\uA73B': 'av',
'\uA73D': 'ay',
'\u24D1': 'b',
'\uFF42': 'b',
'\u1E03': 'b',
'\u1E05': 'b',
'\u1E07': 'b',
'\u0180': 'b',
'\u0183': 'b',
'\u0253': 'b',
'\u24D2': 'c',
'\uFF43': 'c',
'\u0107': 'c',
'\u0109': 'c',
'\u010B': 'c',
'\u010D': 'c',
'\u00E7': 'c',
'\u1E09': 'c',
'\u0188': 'c',
'\u023C': 'c',
'\uA73F': 'c',
'\u2184': 'c',
'\u24D3': 'd',
'\uFF44': 'd',
'\u1E0B': 'd',
'\u010F': 'd',
'\u1E0D': 'd',
'\u1E11': 'd',
'\u1E13': 'd',
'\u1E0F': 'd',
'\u0111': 'd',
'\u018C': 'd',
'\u0256': 'd',
'\u0257': 'd',
'\uA77A': 'd',
'\u01F3': 'dz',
'\u01C6': 'dz',
'\u24D4': 'e',
'\uFF45': 'e',
'\u00E8': 'e',
'\u00E9': 'e',
'\u00EA': 'e',
'\u1EC1': 'e',
'\u1EBF': 'e',
'\u1EC5': 'e',
'\u1EC3': 'e',
'\u1EBD': 'e',
'\u0113': 'e',
'\u1E15': 'e',
'\u1E17': 'e',
'\u0115': 'e',
'\u0117': 'e',
'\u00EB': 'e',
'\u1EBB': 'e',
'\u011B': 'e',
'\u0205': 'e',
'\u0207': 'e',
'\u1EB9': 'e',
'\u1EC7': 'e',
'\u0229': 'e',
'\u1E1D': 'e',
'\u0119': 'e',
'\u1E19': 'e',
'\u1E1B': 'e',
'\u0247': 'e',
'\u025B': 'e',
'\u01DD': 'e',
'\u24D5': 'f',
'\uFF46': 'f',
'\u1E1F': 'f',
'\u0192': 'f',
'\uA77C': 'f',
'\u24D6': 'g',
'\uFF47': 'g',
'\u01F5': 'g',
'\u011D': 'g',
'\u1E21': 'g',
'\u011F': 'g',
'\u0121': 'g',
'\u01E7': 'g',
'\u0123': 'g',
'\u01E5': 'g',
'\u0260': 'g',
'\uA7A1': 'g',
'\u1D79': 'g',
'\uA77F': 'g',
'\u24D7': 'h',
'\uFF48': 'h',
'\u0125': 'h',
'\u1E23': 'h',
'\u1E27': 'h',
'\u021F': 'h',
'\u1E25': 'h',
'\u1E29': 'h',
'\u1E2B': 'h',
'\u1E96': 'h',
'\u0127': 'h',
'\u2C68': 'h',
'\u2C76': 'h',
'\u0265': 'h',
'\u0195': 'hv',
'\u24D8': 'i',
'\uFF49': 'i',
'\u00EC': 'i',
'\u00ED': 'i',
'\u00EE': 'i',
'\u0129': 'i',
'\u012B': 'i',
'\u012D': 'i',
'\u00EF': 'i',
'\u1E2F': 'i',
'\u1EC9': 'i',
'\u01D0': 'i',
'\u0209': 'i',
'\u020B': 'i',
'\u1ECB': 'i',
'\u012F': 'i',
'\u1E2D': 'i',
'\u0268': 'i',
'\u0131': 'i',
'\u24D9': 'j',
'\uFF4A': 'j',
'\u0135': 'j',
'\u01F0': 'j',
'\u0249': 'j',
'\u24DA': 'k',
'\uFF4B': 'k',
'\u1E31': 'k',
'\u01E9': 'k',
'\u1E33': 'k',
'\u0137': 'k',
'\u1E35': 'k',
'\u0199': 'k',
'\u2C6A': 'k',
'\uA741': 'k',
'\uA743': 'k',
'\uA745': 'k',
'\uA7A3': 'k',
'\u24DB': 'l',
'\uFF4C': 'l',
'\u0140': 'l',
'\u013A': 'l',
'\u013E': 'l',
'\u1E37': 'l',
'\u1E39': 'l',
'\u013C': 'l',
'\u1E3D': 'l',
'\u1E3B': 'l',
'\u017F': 'l',
'\u0142': 'l',
'\u019A': 'l',
'\u026B': 'l',
'\u2C61': 'l',
'\uA749': 'l',
'\uA781': 'l',
'\uA747': 'l',
'\u01C9': 'lj',
'\u24DC': 'm',
'\uFF4D': 'm',
'\u1E3F': 'm',
'\u1E41': 'm',
'\u1E43': 'm',
'\u0271': 'm',
'\u026F': 'm',
'\u24DD': 'n',
'\uFF4E': 'n',
'\u01F9': 'n',
'\u0144': 'n',
'\u00F1': 'n',
'\u1E45': 'n',
'\u0148': 'n',
'\u1E47': 'n',
'\u0146': 'n',
'\u1E4B': 'n',
'\u1E49': 'n',
'\u019E': 'n',
'\u0272': 'n',
'\u0149': 'n',
'\uA791': 'n',
'\uA7A5': 'n',
'\u01CC': 'nj',
'\u24DE': 'o',
'\uFF4F': 'o',
'\u00F2': 'o',
'\u00F3': 'o',
'\u00F4': 'o',
'\u1ED3': 'o',
'\u1ED1': 'o',
'\u1ED7': 'o',
'\u1ED5': 'o',
'\u00F5': 'o',
'\u1E4D': 'o',
'\u022D': 'o',
'\u1E4F': 'o',
'\u014D': 'o',
'\u1E51': 'o',
'\u1E53': 'o',
'\u014F': 'o',
'\u022F': 'o',
'\u0231': 'o',
'\u00F6': 'o',
'\u022B': 'o',
'\u1ECF': 'o',
'\u0151': 'o',
'\u01D2': 'o',
'\u020D': 'o',
'\u020F': 'o',
'\u01A1': 'o',
'\u1EDD': 'o',
'\u1EDB': 'o',
'\u1EE1': 'o',
'\u1EDF': 'o',
'\u1EE3': 'o',
'\u1ECD': 'o',
'\u1ED9': 'o',
'\u01EB': 'o',
'\u01ED': 'o',
'\u00F8': 'o',
'\u01FF': 'o',
'\u0254': 'o',
'\uA74B': 'o',
'\uA74D': 'o',
'\u0275': 'o',
'\u01A3': 'oi',
'\u0223': 'ou',
'\uA74F': 'oo',
'\u24DF': 'p',
'\uFF50': 'p',
'\u1E55': 'p',
'\u1E57': 'p',
'\u01A5': 'p',
'\u1D7D': 'p',
'\uA751': 'p',
'\uA753': 'p',
'\uA755': 'p',
'\u24E0': 'q',
'\uFF51': 'q',
'\u024B': 'q',
'\uA757': 'q',
'\uA759': 'q',
'\u24E1': 'r',
'\uFF52': 'r',
'\u0155': 'r',
'\u1E59': 'r',
'\u0159': 'r',
'\u0211': 'r',
'\u0213': 'r',
'\u1E5B': 'r',
'\u1E5D': 'r',
'\u0157': 'r',
'\u1E5F': 'r',
'\u024D': 'r',
'\u027D': 'r',
'\uA75B': 'r',
'\uA7A7': 'r',
'\uA783': 'r',
'\u24E2': 's',
'\uFF53': 's',
'\u00DF': 's',
'\u015B': 's',
'\u1E65': 's',
'\u015D': 's',
'\u1E61': 's',
'\u0161': 's',
'\u1E67': 's',
'\u1E63': 's',
'\u1E69': 's',
'\u0219': 's',
'\u015F': 's',
'\u023F': 's',
'\uA7A9': 's',
'\uA785': 's',
'\u1E9B': 's',
'\u24E3': 't',
'\uFF54': 't',
'\u1E6B': 't',
'\u1E97': 't',
'\u0165': 't',
'\u1E6D': 't',
'\u021B': 't',
'\u0163': 't',
'\u1E71': 't',
'\u1E6F': 't',
'\u0167': 't',
'\u01AD': 't',
'\u0288': 't',
'\u2C66': 't',
'\uA787': 't',
'\uA729': 'tz',
'\u24E4': 'u',
'\uFF55': 'u',
'\u00F9': 'u',
'\u00FA': 'u',
'\u00FB': 'u',
'\u0169': 'u',
'\u1E79': 'u',
'\u016B': 'u',
'\u1E7B': 'u',
'\u016D': 'u',
'\u00FC': 'u',
'\u01DC': 'u',
'\u01D8': 'u',
'\u01D6': 'u',
'\u01DA': 'u',
'\u1EE7': 'u',
'\u016F': 'u',
'\u0171': 'u',
'\u01D4': 'u',
'\u0215': 'u',
'\u0217': 'u',
'\u01B0': 'u',
'\u1EEB': 'u',
'\u1EE9': 'u',
'\u1EEF': 'u',
'\u1EED': 'u',
'\u1EF1': 'u',
'\u1EE5': 'u',
'\u1E73': 'u',
'\u0173': 'u',
'\u1E77': 'u',
'\u1E75': 'u',
'\u0289': 'u',
'\u24E5': 'v',
'\uFF56': 'v',
'\u1E7D': 'v',
'\u1E7F': 'v',
'\u028B': 'v',
'\uA75F': 'v',
'\u028C': 'v',
'\uA761': 'vy',
'\u24E6': 'w',
'\uFF57': 'w',
'\u1E81': 'w',
'\u1E83': 'w',
'\u0175': 'w',
'\u1E87': 'w',
'\u1E85': 'w',
'\u1E98': 'w',
'\u1E89': 'w',
'\u2C73': 'w',
'\u24E7': 'x',
'\uFF58': 'x',
'\u1E8B': 'x',
'\u1E8D': 'x',
'\u24E8': 'y',
'\uFF59': 'y',
'\u1EF3': 'y',
'\u00FD': 'y',
'\u0177': 'y',
'\u1EF9': 'y',
'\u0233': 'y',
'\u1E8F': 'y',
'\u00FF': 'y',
'\u1EF7': 'y',
'\u1E99': 'y',
'\u1EF5': 'y',
'\u01B4': 'y',
'\u024F': 'y',
'\u1EFF': 'y',
'\u24E9': 'z',
'\uFF5A': 'z',
'\u017A': 'z',
'\u1E91': 'z',
'\u017C': 'z',
'\u017E': 'z',
'\u1E93': 'z',
'\u1E95': 'z',
'\u01B6': 'z',
'\u0225': 'z',
'\u0240': 'z',
'\u2C6C': 'z',
'\uA763': 'z',
'\u0386': '\u0391',
'\u0388': '\u0395',
'\u0389': '\u0397',
'\u038A': '\u0399',
'\u03AA': '\u0399',
'\u038C': '\u039F',
'\u038E': '\u03A5',
'\u03AB': '\u03A5',
'\u038F': '\u03A9',
'\u03AC': '\u03B1',
'\u03AD': '\u03B5',
'\u03AE': '\u03B7',
'\u03AF': '\u03B9',
'\u03CA': '\u03B9',
'\u0390': '\u03B9',
'\u03CC': '\u03BF',
'\u03CD': '\u03C5',
'\u03CB': '\u03C5',
'\u03B0': '\u03C5',
'\u03C9': '\u03C9',
'\u03C2': '\u03C3'
};
return diacritics;
});
define('select2/data/base',[
'../utils'
], function (Utils) {
function BaseAdapter ($element, options) {
BaseAdapter.__super__.constructor.call(this);
}
Utils.Extend(BaseAdapter, Utils.Observable);
BaseAdapter.prototype.current = function (callback) {
throw new Error('The `current` method must be defined in child classes.');
};
BaseAdapter.prototype.query = function (params, callback) {
throw new Error('The `query` method must be defined in child classes.');
};
BaseAdapter.prototype.bind = function (container, $container) {
// Can be implemented in subclasses
};
BaseAdapter.prototype.destroy = function () {
// Can be implemented in subclasses
};
BaseAdapter.prototype.generateResultId = function (container, data) {
var id = container.id + '-result-';
id += Utils.generateChars(4);
if (data.id != null) {
id += '-' + data.id.toString();
} else {
id += '-' + Utils.generateChars(4);
}
return id;
};
return BaseAdapter;
});
define('select2/data/select',[
'./base',
'../utils',
'jquery'
], function (BaseAdapter, Utils, $) {
function SelectAdapter ($element, options) {
this.$element = $element;
this.options = options;
SelectAdapter.__super__.constructor.call(this);
}
Utils.Extend(SelectAdapter, BaseAdapter);
SelectAdapter.prototype.current = function (callback) {
var data = [];
var self = this;
this.$element.find(':selected').each(function () {
var $option = $(this);
var option = self.item($option);
data.push(option);
});
callback(data);
};
SelectAdapter.prototype.select = function (data) {
var self = this;
// If data.element is a DOM nose, use it instead
if ($(data.element).is('option')) {
data.element.selected = true;
this.$element.trigger('change');
return;
}
if (this.$element.prop('multiple')) {
this.current(function (currentData) {
var val = [];
data = [data];
data.push.apply(data, currentData);
for (var d = 0; d < data.length; d++) {
id = data[d].id;
if (val.indexOf(id) === -1) {
val.push(id);
}
}
self.$element.val(val);
self.$element.trigger('change');
});
} else {
var val = data.id;
this.$element.val(val);
this.$element.trigger('change');
}
};
SelectAdapter.prototype.unselect = function (data) {
var self = this;
if (!this.$element.prop('multiple')) {
return;
}
if ($(data.element).is('option')) {
data.element.selected = false;
this.$element.trigger('change');
return;
}
this.current(function (currentData) {
var val = [];
for (var d = 0; d < currentData.length; d++) {
id = currentData[d].id;
if (id !== data.id && val.indexOf(id) === -1) {
val.push(id);
}
}
self.$element.val(val);
self.$element.trigger('change');
});
};
SelectAdapter.prototype.bind = function (container, $container) {
var self = this;
this.container = container;
container.on('select', function (params) {
self.select(params.data);
});
container.on('unselect', function (params) {
self.unselect(params.data);
});
};
SelectAdapter.prototype.destroy = function () {
// Remove anything added to child elements
this.$element.find('*').each(function () {
// Remove any custom data set by Select2
$.removeData(this, 'data');
});
};
SelectAdapter.prototype.query = function (params, callback) {
var data = [];
var self = this;
var $options = this.$element.children();
$options.each(function () {
var $option = $(this);
if (!$option.is('option') && !$option.is('optgroup')) {
return;
}
var option = self.item($option);
var matches = self.matches(params, option);
if (matches !== null) {
data.push(matches);
}
});
callback({
results: data
});
};
SelectAdapter.prototype.option = function (data) {
var option;
if (data.children) {
option = document.createElement('optgroup');
option.label = data.text;
} else {
option = document.createElement('option');
option.innerText = data.text;
}
if (data.id) {
option.value = data.id;
}
if (data.disabled) {
option.disabled = true;
}
if (data.selected) {
option.selected = true;
}
var $option = $(option);
var normalizedData = this._normalizeItem(data);
normalizedData.element = option;
// Override the option's data with the combined data
$.data(option, 'data', normalizedData);
return $option;
};
SelectAdapter.prototype.item = function ($option) {
var data = {};
data = $.data($option[0], 'data');
if (data != null) {
return data;
}
if ($option.is('option')) {
data = {
id: $option.val(),
text: $option.html(),
disabled: $option.prop('disabled'),
selected: $option.prop('selected')
};
} else if ($option.is('optgroup')) {
data = {
text: $option.prop('label'),
children: []
};
var $children = $option.children('option');
var children = [];
for (var c = 0; c < $children.length; c++) {
var $child = $($children[c]);
var child = this.item($child);
children.push(child);
}
data.children = children;
}
data = this._normalizeItem(data);
data.element = $option[0];
$.data($option[0], 'data', data);
return data;
};
SelectAdapter.prototype._normalizeItem = function (item) {
if (!$.isPlainObject(item)) {
item = {
id: item,
text: item
};
}
item = $.extend({}, {
text: ''
}, item);
var defaults = {
selected: false,
disabled: false
};
if (item.id != null) {
item.id = item.id.toString();
}
if (item.text != null) {
item.text = item.text.toString();
}
if (item._resultId == null && item.id && this.container != null) {
item._resultId = this.generateResultId(this.container, item);
}
return $.extend({}, defaults, item);
};
SelectAdapter.prototype.matches = function (params, data) {
var matcher = this.options.get('matcher');
return matcher(params, data);
};
return SelectAdapter;
});
define('select2/data/array',[
'./select',
'../utils',
'jquery'
], function (SelectAdapter, Utils, $) {
function ArrayAdapter ($element, options) {
var data = options.get('data') || [];
ArrayAdapter.__super__.constructor.call(this, $element, options);
$element.append(this.convertToOptions(data));
}
Utils.Extend(ArrayAdapter, SelectAdapter);
ArrayAdapter.prototype.select = function (data) {
var $option = this.$element.find('option[value="' + data.id + '"]');
if ($option.length === 0) {
$option = this.option(data);
this.$element.append($option);
}
ArrayAdapter.__super__.select.call(this, data);
};
ArrayAdapter.prototype.convertToOptions = function (data) {
var self = this;
var $existing = this.$element.find('option');
var existingIds = $existing.map(function () {
return self.item($(this)).id;
}).get();
var $options = [];
// Filter out all items except for the one passed in the argument
function onlyItem (item) {
return function () {
return $(this).val() == item.id;
};
}
for (var d = 0; d < data.length; d++) {
var item = this._normalizeItem(data[d]);
// Skip items which were pre-loaded, only merge the data
if (existingIds.indexOf(item.id) >= 0) {
var $existingOption = $existing.filter(onlyItem(item));
var existingData = this.item($existingOption);
var newData = $.extend(true, {}, existingData, item);
var $newOption = this.option(existingData);
$existingOption.replaceWith($newOption);
continue;
}
var $option = this.option(item);
if (item.children) {
var $children = this.convertToOptions(item.children);
$option.append($children);
}
$options.push($option);
}
return $options;
};
return ArrayAdapter;
});
define('select2/data/ajax',[
'./array',
'../utils',
'jquery'
], function (ArrayAdapter, Utils, $) {
function AjaxAdapter ($element, options) {
this.ajaxOptions = options.get('ajax');
if (this.ajaxOptions.processResults != null) {
this.processResults = this.ajaxOptions.processResults;
}
ArrayAdapter.__super__.constructor.call(this, $element, options);
}
Utils.Extend(AjaxAdapter, ArrayAdapter);
AjaxAdapter.prototype.processResults = function (results) {
return results;
};
AjaxAdapter.prototype.query = function (params, callback) {
var matches = [];
var self = this;
if (this._request) {
this._request.abort();
this._request = null;
}
var options = $.extend({
type: 'GET'
}, this.ajaxOptions);
if (typeof options.url === 'function') {
options.url = options.url(params);
}
if (typeof options.data === 'function') {
options.data = options.data(params);
}
function request () {
var $request = $.ajax(options);
$request.success(function (data) {
var results = self.processResults(data, params);
if (console && console.error) {
// Check to make sure that the response included a `results` key.
if (!results || !results.results || !$.isArray(results.results)) {
console.error(
'Select2: The AJAX results did not return an array in the ' +
'`results` key of the response.'
);
}
}
callback(results);
});
self._request = $request;
}
if (this.ajaxOptions.delay && params.term !== '') {
if (this._queryTimeout) {
window.clearTimeout(this._queryTimeout);
}
this._queryTimeout = window.setTimeout(request, this.ajaxOptions.delay);
} else {
request();
}
};
return AjaxAdapter;
});
define('select2/data/tags',[
'jquery'
], function ($) {
function Tags (decorated, $element, options) {
var tags = options.get('tags');
var createTag = options.get('createTag');
if (createTag !== undefined) {
this.createTag = createTag;
}
decorated.call(this, $element, options);
if ($.isArray(tags)) {
for (var t = 0; t < tags.length; t++) {
var tag = tags[t];
var item = this._normalizeItem(tag);
var $option = this.option(item);
this.$element.append($option);
}
}
}
Tags.prototype.query = function (decorated, params, callback) {
var self = this;
this._removeOldTags();
if (params.term == null || params.term === '' || params.page != null) {
decorated.call(this, params, callback);
return;
}
function wrapper (obj, child) {
var data = obj.results;
for (var i = 0; i < data.length; i++) {
var option = data[i];
var checkChildren = (
option.children != null &&
!wrapper({
results: option.children
}, true)
);
var checkText = option.text === params.term;
if (checkText || checkChildren) {
if (child) {
return false;
}
obj.data = data;
callback(obj);
return;
}
}
if (child) {
return true;
}
var tag = self.createTag(params);
if (tag != null) {
var $option = self.option(tag);
$option.attr('data-select2-tag', true);
self.$element.append($option);
self.insertTag(data, tag);
}
obj.results = data;
callback(obj);
}
decorated.call(this, params, wrapper);
};
Tags.prototype.createTag = function (decorated, params) {
return {
id: params.term,
text: params.term
};
};
Tags.prototype.insertTag = function (_, data, tag) {
data.unshift(tag);
};
Tags.prototype._removeOldTags = function (_) {
var tag = this._lastTag;
var $options = this.$element.find('option[data-select2-tag]');
$options.each(function () {
if (this.selected) {
return;
}
$(this).remove();
});
};
return Tags;
});
define('select2/data/tokenizer',[
'jquery'
], function ($) {
function Tokenizer (decorated, $element, options) {
var tokenizer = options.get('tokenizer');
if (tokenizer !== undefined) {
this.tokenizer = tokenizer;
}
decorated.call(this, $element, options);
}
Tokenizer.prototype.bind = function (decorated, container, $container) {
decorated.call(this, container, $container);
this.$search = container.dropdown.$search || container.selection.$search ||
$container.find('.select2-search__field');
};
Tokenizer.prototype.query = function (decorated, params, callback) {
var self = this;
function select (data) {
self.select(data);
}
params.term = params.term || '';
var tokenData = this.tokenizer(params, this.options, select);
if (tokenData.term !== params.term) {
// Replace the search term if we have the search box
if (this.$search.length) {
this.$search.val(tokenData.term);
this.$search.focus();
}
params.term = tokenData.term;
}
decorated.call(this, params, callback);
};
Tokenizer.prototype.tokenizer = function (_, params, options, callback) {
var separators = options.get('tokenSeparators') || [];
var term = params.term;
var i = 0;
var createTag = this.createTag || function (params) {
return {
id: params.term,
text: params.term
};
};
while (i < term.length) {
var termChar = term[i];
if (separators.indexOf(termChar) === -1) {
i++;
continue;
}
var part = term.substr(0, i);
var partParams = $.extend({}, params, {
term: part
});
var data = createTag(partParams);
callback(data);
// Reset the term to not include the tokenized portion
term = term.substr(i + 1) || '';
i = 0;
}
return {
term: term
};
};
return Tokenizer;
});
define('select2/data/minimumInputLength',[
], function () {
function MinimumInputLength (decorated, $e, options) {
this.minimumInputLength = options.get('minimumInputLength');
decorated.call(this, $e, options);
}
MinimumInputLength.prototype.query = function (decorated, params, callback) {
params.term = params.term || '';
if (params.term.length < this.minimumInputLength) {
this.trigger('results:message', {
message: 'inputTooShort',
args: {
minimum: this.minimumInputLength,
input: params.term,
params: params
}
});
return;
}
decorated.call(this, params, callback);
};
return MinimumInputLength;
});
define('select2/data/maximumInputLength',[
], function () {
function MaximumInputLength (decorated, $e, options) {
this.maximumInputLength = options.get('maximumInputLength');
decorated.call(this, $e, options);
}
MaximumInputLength.prototype.query = function (decorated, params, callback) {
params.term = params.term || '';
if (this.maximumInputLength > 0 &&
params.term.length > this.maximumInputLength) {
this.trigger('results:message', {
message: 'inputTooLong',
args: {
minimum: this.maximumInputLength,
input: params.term,
params: params
}
});
return;
}
decorated.call(this, params, callback);
};
return MaximumInputLength;
});
define('select2/data/maximumSelectionLength',[
], function (){
function MaximumSelectionLength (decorated, $e, options) {
this.maximumSelectionLength = options.get('maximumSelectionLength');
decorated.call(this, $e, options);
}
MaximumSelectionLength.prototype.query =
function (decorated, params, callback) {
var self = this;
this.current(function (currentData) {
var count = currentData != null ? currentData.length : 0;
if (self.maximumSelectionLength > 0 &&
count >= self.maximumSelectionLength) {
self.trigger('results:message', {
message: 'maximumSelected',
args: {
maximum: self.maximumSelectionLength
}
});
return;
}
decorated.call(self, params, callback);
});
};
return MaximumSelectionLength;
});
define('select2/dropdown',[
'jquery',
'./utils'
], function ($, Utils) {
function Dropdown ($element, options) {
this.$element = $element;
this.options = options;
Dropdown.__super__.constructor.call(this);
}
Utils.Extend(Dropdown, Utils.Observable);
Dropdown.prototype.render = function () {
var $dropdown = $(
'<span class="select2-dropdown">' +
'<span class="select2-results"></span>' +
'</span>'
);
$dropdown.attr('dir', this.options.get('dir'));
this.$dropdown = $dropdown;
return $dropdown;
};
Dropdown.prototype.position = function ($dropdown, $container) {
// Should be implmented in subclasses
};
Dropdown.prototype.destroy = function () {
// Remove the dropdown from the DOM
this.$dropdown.remove();
};
Dropdown.prototype.bind = function (container, $container) {
var self = this;
container.on('select', function (params) {
self._onSelect(params);
});
container.on('unselect', function (params) {
self._onUnSelect(params);
});
};
Dropdown.prototype._onSelect = function () {
this.trigger('close');
};
Dropdown.prototype._onUnSelect = function () {
this.trigger('close');
};
return Dropdown;
});
define('select2/dropdown/search',[
'jquery',
'../utils'
], function ($, Utils) {
function Search () { }
Search.prototype.render = function (decorated) {
var $rendered = decorated.call(this);
var $search = $(
'<span class="select2-search select2-search--dropdown">' +
'<input class="select2-search__field" type="search" tabindex="-1"' +
' role="textbox" />' +
'</span>'
);
this.$searchContainer = $search;
this.$search = $search.find('input');
$rendered.prepend($search);
return $rendered;
};
Search.prototype.bind = function (decorated, container, $container) {
var self = this;
decorated.call(this, container, $container);
this.$search.on('keydown', function (evt) {
self.trigger('keypress', evt);
self._keyUpPrevented = evt.isDefaultPrevented();
});
this.$search.on('keyup', function (evt) {
self.handleSearch(evt);
});
container.on('open', function () {
self.$search.attr('tabindex', 0);
self.$search.focus();
window.setTimeout(function () {
self.$search.focus();
}, 0);
});
container.on('close', function () {
self.$search.attr('tabindex', -1);
self.$search.val('');
});
container.on('results:all', function (params) {
if (params.query.term == null || params.query.term === '') {
var showSearch = self.showSearch(params);
if (showSearch) {
self.$searchContainer.removeClass('select2-search--hide');
} else {
self.$searchContainer.addClass('select2-search--hide');
}
}
});
};
Search.prototype.handleSearch = function (evt) {
if (!this._keyUpPrevented) {
var input = this.$search.val();
this.trigger('query', {
term: input
});
}
this._keyUpPrevented = false;
};
Search.prototype.showSearch = function (_, params) {
return true;
};
return Search;
});
define('select2/dropdown/hidePlaceholder',[
], function () {
function HidePlaceholder (decorated, $element, options, dataAdapter) {
this.placeholder = this.normalizePlaceholder(options.get('placeholder'));
decorated.call(this, $element, options, dataAdapter);
}
HidePlaceholder.prototype.append = function (decorated, data) {
data.results = this.removePlaceholder(data.results);
decorated.call(this, data);
};
HidePlaceholder.prototype.normalizePlaceholder = function (_, placeholder) {
if (typeof placeholder === 'string') {
placeholder = {
id: '',
text: placeholder
};
}
return placeholder;
};
HidePlaceholder.prototype.removePlaceholder = function (_, data) {
var modifiedData = data.slice(0);
for (var d = data.length - 1; d >= 0; d--) {
var item = data[d];
if (this.placeholder.id === item.id) {
modifiedData.splice(d, 1);
}
}
return modifiedData;
};
return HidePlaceholder;
});
define('select2/dropdown/infiniteScroll',[
'jquery'
], function ($) {
function InfiniteScroll (decorated, $element, options, dataAdapter) {
this.lastParams = {};
decorated.call(this, $element, options, dataAdapter);
this.$loadingMore = this.createLoadingMore();
this.loading = false;
}
InfiniteScroll.prototype.append = function (decorated, data) {
this.$loadingMore.remove();
this.loading = false;
decorated.call(this, data);
if (this.showLoadingMore(data)) {
this.$results.append(this.$loadingMore);
}
};
InfiniteScroll.prototype.bind = function (decorated, container, $container) {
var self = this;
decorated.call(this, container, $container);
container.on('query', function (params) {
self.lastParams = params;
self.loading = true;
});
container.on('query:append', function (params) {
self.lastParams = params;
self.loading = true;
});
this.$results.on('scroll', function () {
var isLoadMoreVisible = $.contains(
document.documentElement,
self.$loadingMore[0]
);
if (self.loading || !isLoadMoreVisible) {
return;
}
var currentOffset = self.$results.offset().top +
self.$results.outerHeight(false);
var loadingMoreOffset = self.$loadingMore.offset().top +
self.$loadingMore.outerHeight(false);
if (currentOffset + 50 >= loadingMoreOffset) {
self.loadMore();
}
});
};
InfiniteScroll.prototype.loadMore = function () {
this.loading = true;
var params = $.extend({}, {page: 1}, this.lastParams);
params.page++;
this.trigger('query:append', params);
};
InfiniteScroll.prototype.showLoadingMore = function (_, data) {
return data.pagination && data.pagination.more;
};
InfiniteScroll.prototype.createLoadingMore = function () {
var $option = $(
'<li class="option load-more" role="treeitem"></li>'
);
var message = this.options.get('translations').get('loadingMore');
$option.html(message(this.lastParams));
return $option;
};
return InfiniteScroll;
});
define('select2/dropdown/attachBody',[
'jquery',
'../utils'
], function ($, Utils) {
function AttachBody (decorated, $element, options) {
this.$dropdownParent = options.get('dropdownParent') || document.body;
decorated.call(this, $element, options);
}
AttachBody.prototype.bind = function (decorated, container, $container) {
var self = this;
var setupResultsEvents = false;
decorated.call(this, container, $container);
container.on('open', function () {
self._showDropdown();
self._attachPositioningHandler(container);
if (!setupResultsEvents) {
setupResultsEvents = true;
container.on('results:all', function () {
self._positionDropdown();
self._resizeDropdown();
});
container.on('results:append', function () {
self._positionDropdown();
self._resizeDropdown();
});
}
});
container.on('close', function () {
self._hideDropdown();
self._detachPositioningHandler(container);
});
this.$dropdownContainer.on('mousedown', function (evt) {
evt.stopPropagation();
});
};
AttachBody.prototype.position = function (decorated, $dropdown, $container) {
// Clone all of the container classes
$dropdown.attr('class', $container.attr('class'));
$dropdown.removeClass('select2');
$dropdown.addClass('select2-container--open');
$dropdown.css({
position: 'absolute',
top: -999999
});
this.$container = $container;
};
AttachBody.prototype.render = function (decorated) {
var $container = $('<span></span>');
var $dropdown = decorated.call(this);
$container.append($dropdown);
this.$dropdownContainer = $container;
return $container;
};
AttachBody.prototype._hideDropdown = function (decorated) {
this.$dropdownContainer.detach();
};
AttachBody.prototype._attachPositioningHandler = function (container) {
var self = this;
var scrollEvent = 'scroll.select2.' + container.id;
var resizeEvent = 'resize.select2.' + container.id;
var orientationEvent = 'orientationchange.select2.' + container.id;
$watchers = this.$container.parents().filter(Utils.hasScroll);
$watchers.each(function () {
$(this).data('select2-scroll-position', {
x: $(this).scrollLeft(),
y: $(this).scrollTop()
});
});
$watchers.on(scrollEvent, function (ev) {
var position = $(this).data('select2-scroll-position');
$(this).scrollTop(position.y);
});
$(window).on(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent,
function (e) {
self._positionDropdown();
self._resizeDropdown();
});
};
AttachBody.prototype._detachPositioningHandler = function (container) {
var scrollEvent = 'scroll.select2.' + container.id;
var resizeEvent = 'resize.select2.' + container.id;
var orientationEvent = 'orientationchange.select2.' + container.id;
$watchers = this.$container.parents().filter(Utils.hasScroll);
$watchers.off(scrollEvent);
$(window).off(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent);
};
AttachBody.prototype._positionDropdown = function () {
var $window = $(window);
var isCurrentlyAbove = this.$dropdown.hasClass('select2-dropdown--above');
var isCurrentlyBelow = this.$dropdown.hasClass('select2-dropdown--below');
var newDirection = null;
var position = this.$container.position();
var offset = this.$container.offset();
offset.bottom = offset.top + this.$container.outerHeight(false);
var container = {
height: this.$container.outerHeight(false)
};
container.top = offset.top;
container.bottom = offset.top + container.height;
var dropdown = {
height: this.$dropdown.outerHeight(false)
};
var viewport = {
top: $window.scrollTop(),
bottom: $window.scrollTop() + $window.height()
};
var enoughRoomAbove = viewport.top < (offset.top - dropdown.height);
var enoughRoomBelow = viewport.bottom > (offset.bottom + dropdown.height);
var css = {
left: offset.left,
top: container.bottom
};
if (!isCurrentlyAbove && !isCurrentlyBelow) {
newDirection = 'below';
}
if (!enoughRoomBelow && enoughRoomAbove && !isCurrentlyAbove) {
newDirection = 'above';
} else if (!enoughRoomAbove && enoughRoomBelow && isCurrentlyAbove) {
newDirection = 'below';
}
if (newDirection == 'above' ||
(isCurrentlyAbove && newDirection !== 'below')) {
css.top = container.top - dropdown.height;
}
if (newDirection != null) {
this.$dropdown
.removeClass('select2-dropdown--below select2-dropdown--above')
.addClass('select2-dropdown--' + newDirection);
this.$container
.removeClass('select2-container--below select2-container--above')
.addClass('select2-container--' + newDirection);
}
this.$dropdownContainer.css(css);
};
AttachBody.prototype._resizeDropdown = function () {
this.$dropdownContainer.width();
this.$dropdown.css({
width: this.$container.outerWidth(false) + 'px'
});
};
AttachBody.prototype._showDropdown = function (decorated) {
this.$dropdownContainer.appendTo(this.$dropdownParent);
this._positionDropdown();
this._resizeDropdown();
};
return AttachBody;
});
define('select2/dropdown/minimumResultsForSearch',[
], function () {
function countResults (data) {
count = 0;
for (var d = 0; d < data.length; d++) {
var item = data[d];
if (item.children) {
count += countResults(item.children);
} else {
count++;
}
}
return count;
}
function MinimumResultsForSearch (decorated, $element, options, dataAdapter) {
this.minimumResultsForSearch = options.get('minimumResultsForSearch');
decorated.call(this, $element, options, dataAdapter);
}
MinimumResultsForSearch.prototype.showSearch = function (decorated, params) {
if (countResults(params.data.results) < this.minimumResultsForSearch) {
return false;
}
return decorated.call(this, params);
};
return MinimumResultsForSearch;
});
define('select2/dropdown/selectOnClose',[
], function () {
function SelectOnClose () { }
SelectOnClose.prototype.bind = function (decorated, container, $container) {
var self = this;
decorated.call(this, container, $container);
container.on('close', function () {
self._handleSelectOnClose();
});
};
SelectOnClose.prototype._handleSelectOnClose = function () {
var $highlightedResults = this.getHighlightedResults();
if ($highlightedResults.length < 1) {
return;
}
$highlightedResults.trigger('mouseup');
};
return SelectOnClose;
});
define('select2/i18n/en',[],function () {
// English
return {
errorLoading: function () {
return 'The results could not be loaded.';
},
inputTooLong: function (args) {
var overChars = args.input.length - args.maximum;
var message = 'Please delete ' + overChars + ' character';
if (overChars != 1) {
message += 's';
}
return message;
},
inputTooShort: function (args) {
var remainingChars = args.minimum - args.input.length;
var message = 'Please enter ' + remainingChars + ' or more characters';
return message;
},
loadingMore: function () {
return 'Loading more results…';
},
maximumSelected: function (args) {
var message = 'You can only select ' + args.maximum + ' item';
if (args.maximum != 1) {
message += 's';
}
return message;
},
noResults: function () {
return 'No results found';
},
searching: function () {
return 'Searching…';
}
};
});
define('select2/defaults',[
'jquery',
'./results',
'./selection/single',
'./selection/multiple',
'./selection/placeholder',
'./selection/allowClear',
'./selection/search',
'./selection/eventRelay',
'./utils',
'./translation',
'./diacritics',
'./data/select',
'./data/array',
'./data/ajax',
'./data/tags',
'./data/tokenizer',
'./data/minimumInputLength',
'./data/maximumInputLength',
'./data/maximumSelectionLength',
'./dropdown',
'./dropdown/search',
'./dropdown/hidePlaceholder',
'./dropdown/infiniteScroll',
'./dropdown/attachBody',
'./dropdown/minimumResultsForSearch',
'./dropdown/selectOnClose',
'./i18n/en'
], function ($, ResultsList,
SingleSelection, MultipleSelection, Placeholder, AllowClear,
SelectionSearch, EventRelay,
Utils, Translation, DIACRITICS,
SelectData, ArrayData, AjaxData, Tags, Tokenizer,
MinimumInputLength, MaximumInputLength, MaximumSelectionLength,
Dropdown, DropdownSearch, HidePlaceholder, InfiniteScroll,
AttachBody, MinimumResultsForSearch, SelectOnClose,
EnglishTranslation) {
function Defaults () {
this.reset();
}
Defaults.prototype.apply = function (options) {
options = $.extend({}, this.defaults, options);
if (options.dataAdapter == null) {
if (options.ajax != null) {
options.dataAdapter = AjaxData;
} else if (options.data != null) {
options.dataAdapter = ArrayData;
} else {
options.dataAdapter = SelectData;
}
if (options.minimumInputLength > 0) {
options.dataAdapter = Utils.Decorate(
options.dataAdapter,
MinimumInputLength
);
}
if (options.maximumInputLength > 0) {
options.dataAdapter = Utils.Decorate(
options.dataAdapter,
MaximumInputLength
);
}
if (options.maximumSelectionLength > 0) {
options.dataAdapter = Utils.Decorate(
options.dataAdapter,
MaximumSelectionLength
);
}
if (options.tags != null) {
options.dataAdapter = Utils.Decorate(options.dataAdapter, Tags);
}
if (options.tokenSeparators != null || options.tokenizer != null) {
options.dataAdapter = Utils.Decorate(
options.dataAdapter,
Tokenizer
);
}
if (options.query != null) {
var Query = require(options.amdBase + 'compat/query');
options.dataAdapter = Utils.Decorate(
options.dataAdapter,
Query
);
}
if (options.initSelection != null) {
var InitSelection = require(options.amdBase + 'compat/initSelection');
options.dataAdapter = Utils.Decorate(
options.dataAdapter,
InitSelection
);
}
}
if (options.resultsAdapter == null) {
options.resultsAdapter = ResultsList;
if (options.ajax != null) {
options.resultsAdapter = Utils.Decorate(
options.resultsAdapter,
InfiniteScroll
);
}
if (options.placeholder != null) {
options.resultsAdapter = Utils.Decorate(
options.resultsAdapter,
HidePlaceholder
);
}
if (options.selectOnClose) {
options.resultsAdapter = Utils.Decorate(
options.resultsAdapter,
SelectOnClose
);
}
}
if (options.dropdownAdapter == null) {
if (options.multiple) {
options.dropdownAdapter = Dropdown;
} else {
var SearchableDropdown = Utils.Decorate(Dropdown, DropdownSearch);
options.dropdownAdapter = SearchableDropdown;
}
if (options.minimumResultsForSearch > 0) {
options.dropdownAdapter = Utils.Decorate(
options.dropdownAdapter,
MinimumResultsForSearch
);
}
options.dropdownAdapter = Utils.Decorate(
options.dropdownAdapter,
AttachBody
);
}
if (options.selectionAdapter == null) {
if (options.multiple) {
options.selectionAdapter = MultipleSelection;
} else {
options.selectionAdapter = SingleSelection;
}
// Add the placeholder mixin if a placeholder was specified
if (options.placeholder != null) {
options.selectionAdapter = Utils.Decorate(
options.selectionAdapter,
Placeholder
);
if (options.allowClear) {
options.selectionAdapter = Utils.Decorate(
options.selectionAdapter,
AllowClear
);
}
}
if (options.multiple) {
options.selectionAdapter = Utils.Decorate(
options.selectionAdapter,
SelectionSearch
);
}
options.selectionAdapter = Utils.Decorate(
options.selectionAdapter,
EventRelay
);
}
if (typeof options.language === 'string') {
// Check if the lanugage is specified with a region
if (options.language.indexOf('-') > 0) {
// Extract the region information if it is included
var languageParts = options.language.split('-');
var baseLanguage = languageParts[0];
options.language = [options.language, baseLanguage];
} else {
options.language = [options.language];
}
}
if ($.isArray(options.language)) {
var languages = new Translation();
options.language.push('en');
var languageNames = options.language;
for (var l = 0; l < languageNames.length; l++) {
var name = languageNames[l];
var language = {};
try {
// Try to load it with the original name
language = Translation.loadPath(name);
} catch (e) {
try {
// If we couldn't load it, check if it wasn't the full path
name = this.defaults.amdLanguageBase + name;
language = Translation.loadPath(name);
} catch (ex) {
// The translation could not be loaded at all. Sometimes this is
// because of a configuration problem, other times this can be
// because of how Select2 helps load all possible translation files.
if (console && console.warn) {
console.warn(
'Select2: The lanugage file for "' + name + '" could not be ' +
'automatically loaded. A fallback will be used instead.'
);
}
continue;
}
}
languages.extend(language);
}
options.translations = languages;
} else {
options.translations = new Translation(options.language);
}
return options;
};
Defaults.prototype.reset = function () {
function stripDiacritics (text) {
// Used 'uni range + named function' from http://jsperf.com/diacritics/18
function match(a) {
return DIACRITICS[a] || a;
}
return text.replace(/[^\u0000-\u007E]/g, match);
}
function matcher (params, data) {
// Always return the object if there is nothing to compare
if ($.trim(params.term) === '') {
return data;
}
// Do a recursive check for options with children
if (data.children && data.children.length > 0) {
// Clone the data object if there are children
// This is required as we modify the object to remove any non-matches
var match = $.extend(true, {}, data);
// Check each child of the option
for (var c = data.children.length - 1; c >= 0; c--) {
var child = data.children[c];
var matches = matcher(params, child);
// If there wasn't a match, remove the object in the array
if (matches == null) {
match.children.splice(c, 1);
}
}
// If any children matched, return the new object
if (match.children.length > 0) {
return match;
}
// If there were no matching children, check just the plain object
return matcher(params, match);
}
var original = stripDiacritics(data.text).toUpperCase();
var term = stripDiacritics(params.term).toUpperCase();
// Check if the text contains the term
if (original.indexOf(term) > -1) {
return data;
}
// If it doesn't contain the term, don't return anything
return null;
}
this.defaults = {
amdBase: 'select2/',
amdLanguageBase: 'select2/i18n/',
language: EnglishTranslation,
matcher: matcher,
minimumInputLength: 0,
maximumInputLength: 0,
maximumSelectionLength: 0,
minimumResultsForSearch: 0,
selectOnClose: false,
sorter: function (data) {
return data;
},
templateResult: function (result) {
return result.text;
},
templateSelection: function (selection) {
return selection.text;
},
theme: 'default',
width: 'resolve'
};
};
Defaults.prototype.set = function (key, value) {
var camelKey = $.camelCase(key);
var data = {};
data[camelKey] = value;
var convertedData = Utils._convertData(data);
$.extend(this.defaults, convertedData);
};
var defaults = new Defaults();
return defaults;
});
define('select2/options',[
'jquery',
'./defaults',
'./utils'
], function ($, Defaults, Utils) {
function Options (options, $element) {
this.options = options;
if ($element != null) {
this.fromElement($element);
}
this.options = Defaults.apply(this.options);
}
Options.prototype.fromElement = function ($e) {
var excludedData = ['select2'];
if (this.options.multiple == null) {
this.options.multiple = $e.prop('multiple');
}
if (this.options.disabled == null) {
this.options.disabled = $e.prop('disabled');
}
if (this.options.language == null) {
if ($e.prop('lang')) {
this.options.language = $e.prop('lang').toLowerCase();
} else if ($e.closest('[lang]').prop('lang')) {
this.options.language = $e.closest('[lang]').prop('lang');
}
}
if (this.options.dir == null) {
if ($e.prop('dir')) {
this.options.dir = $e.prop('dir');
} else if ($e.closest('[dir]').prop('dir')) {
this.options.dir = $e.closest('[dir]').prop('dir');
} else {
this.options.dir = 'ltr';
}
}
$e.prop('disabled', this.options.disabled);
$e.prop('multiple', this.options.multiple);
if ($e.data('select2-tags')) {
if (console && console.warn) {
console.warn(
'Select2: The `data-select2-tags` attribute has been changed to ' +
'use the `data-data` and `data-tags="true"` attributes and will be ' +
'removed in future versions of Select2.'
);
}
$e.data('data', $e.data('select2-tags'));
$e.data('tags', true);
}
if ($e.data('ajax-url')) {
if (console && console.warn) {
console.warn(
'Select2: The `data-ajax-url` attribute has been changed to ' +
'`data-ajax--url` and support for the old attribute will be removed' +
' in future versions of Select2.'
);
}
$e.data('ajax--url', $e.data('ajax-url'));
}
var data = $e.data();
data = Utils._convertData(data);
for (var key in data) {
if (excludedData.indexOf(key) > -1) {
continue;
}
if ($.isPlainObject(this.options[key])) {
$.extend(this.options[key], data[key]);
} else {
this.options[key] = data[key];
}
}
return this;
};
Options.prototype.get = function (key) {
return this.options[key];
};
Options.prototype.set = function (key, val) {
this.options[key] = val;
};
return Options;
});
define('select2/core',[
'jquery',
'./options',
'./utils',
'./keys'
], function ($, Options, Utils, KEYS) {
var Select2 = function ($element, options) {
if ($element.data('select2') != null) {
$element.data('select2').destroy();
}
this.$element = $element;
this.id = this._generateId($element);
options = options || {};
this.options = new Options(options, $element);
Select2.__super__.constructor.call(this);
// Set up containers and adapters
var DataAdapter = this.options.get('dataAdapter');
this.data = new DataAdapter($element, this.options);
var $container = this.render();
this._placeContainer($container);
var SelectionAdapter = this.options.get('selectionAdapter');
this.selection = new SelectionAdapter($element, this.options);
this.$selection = this.selection.render();
this.selection.position(this.$selection, $container);
var DropdownAdapter = this.options.get('dropdownAdapter');
this.dropdown = new DropdownAdapter($element, this.options);
this.$dropdown = this.dropdown.render();
this.dropdown.position(this.$dropdown, $container);
var ResultsAdapter = this.options.get('resultsAdapter');
this.results = new ResultsAdapter($element, this.options, this.data);
this.$results = this.results.render();
this.results.position(this.$results, this.$dropdown);
// Bind events
var self = this;
// Bind the container to all of the adapters
this._bindAdapters();
// Register any DOM event handlers
this._registerDomEvents();
// Register any internal event handlers
this._registerDataEvents();
this._registerSelectionEvents();
this._registerDropdownEvents();
this._registerResultsEvents();
this._registerEvents();
// Set the initial state
this.data.current(function (initialData) {
self.trigger('selection:update', {
data: initialData
});
});
// Hide the original select
$element.hide();
// Synchronize any monitored attributes
this._syncAttributes();
this._tabindex = $element.attr('tabindex') || 0;
$element.attr('tabindex', '-1');
$element.data('select2', this);
};
Utils.Extend(Select2, Utils.Observable);
Select2.prototype._generateId = function ($element) {
var id = '';
if ($element.attr('id') != null) {
id = $element.attr('id');
} else if ($element.attr('name') != null) {
id = $element.attr('name') + '-' + Utils.generateChars(2);
} else {
id = Utils.generateChars(4);
}
id = 'select2-' + id;
return id;
};
Select2.prototype._placeContainer = function ($container) {
$container.insertAfter(this.$element);
var width = this._resolveWidth(this.$element, this.options.get('width'));
if (width != null) {
$container.css('width', width);
}
};
Select2.prototype._resolveWidth = function ($element, method) {
var WIDTH = /^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;
if (method == 'resolve') {
var styleWidth = this._resolveWidth($element, 'style');
if (styleWidth != null) {
return styleWidth;
}
return this._resolveWidth($element, 'element');
}
if (method == 'element') {
var elementWidth = $element.outerWidth(false);
if (elementWidth <= 0) {
return 'auto';
}
return elementWidth + 'px';
}
if (method == 'style') {
var style = $element.attr('style');
if (typeof(style) !== 'string') {
return null;
}
var attrs = style.split(';');
for (i = 0, l = attrs.length; i < l; i = i + 1) {
attr = attrs[i].replace(/\s/g, '');
var matches = attr.match(WIDTH);
if (matches !== null && matches.length >= 1) {
return matches[1];
}
}
return null;
}
return method;
};
Select2.prototype._bindAdapters = function () {
this.data.bind(this, this.$container);
this.selection.bind(this, this.$container);
this.dropdown.bind(this, this.$container);
this.results.bind(this, this.$container);
};
Select2.prototype._registerDomEvents = function () {
var self = this;
this.$element.on('change.select2', function () {
self.data.current(function (data) {
self.trigger('selection:update', {
data: data
});
});
});
this._sync = Utils.bind(this._syncAttributes, this);
if (this.$element[0].attachEvent) {
this.$element[0].attachEvent('onpropertychange', this._sync);
}
var observer = window.MutationObserver ||
window.WebKitMutationObserver ||
window.MozMutationObserver
;
if (observer != null) {
this._observer = new observer(function (mutations) {
$.each(mutations, self._sync);
});
this._observer.observe(this.$element[0], {
attributes: true,
subtree: false
});
}
};
Select2.prototype._registerDataEvents = function () {
var self = this;
this.data.on('*', function (name, params) {
self.trigger(name, params);
});
};
Select2.prototype._registerSelectionEvents = function () {
var self = this;
var nonRelayEvents = ['toggle'];
this.selection.on('toggle', function () {
self.toggleDropdown();
});
this.selection.on('*', function (name, params) {
if (nonRelayEvents.indexOf(name) !== -1) {
return;
}
self.trigger(name, params);
});
};
Select2.prototype._registerDropdownEvents = function () {
var self = this;
this.dropdown.on('*', function (name, params) {
self.trigger(name, params);
});
};
Select2.prototype._registerResultsEvents = function () {
var self = this;
this.results.on('*', function (name, params) {
self.trigger(name, params);
});
};
Select2.prototype._registerEvents = function () {
var self = this;
this.on('open', function () {
self.$container.addClass('select2-container--open');
});
this.on('close', function () {
self.$container.removeClass('select2-container--open');
});
this.on('enable', function () {
self.$container.removeClass('select2-container--disabled');
});
this.on('disable', function () {
self.$container.addClass('select2-container--disabled');
});
this.on('query', function (params) {
this.data.query(params, function (data) {
self.trigger('results:all', {
data: data,
query: params
});
});
});
this.on('query:append', function (params) {
this.data.query(params, function (data) {
self.trigger('results:append', {
data: data,
query: params
});
});
});
this.on('keypress', function (evt) {
var key = evt.which;
if (self.isOpen()) {
if (key === KEYS.ENTER) {
self.trigger('results:select');
evt.preventDefault();
} else if (key === KEYS.UP) {
self.trigger('results:previous');
evt.preventDefault();
} else if (key === KEYS.DOWN) {
self.trigger('results:next');
evt.preventDefault();
} else if (key === KEYS.ESC || key === KEYS.TAB) {
self.close();
evt.preventDefault();
}
} else {
if (key === KEYS.ENTER || key === KEYS.SPACE ||
((key === KEYS.DOWN || key === KEYS.UP) && evt.altKey)) {
self.open();
evt.preventDefault();
}
}
});
};
Select2.prototype._syncAttributes = function () {
this.options.set('disabled', this.$element.prop('disabled'));
if (this.options.get('disabled')) {
if (this.isOpen()) {
this.close();
}
this.trigger('disable');
} else {
this.trigger('enable');
}
};
/**
* Override the trigger method to automatically trigger pre-events when
* there are events that can be prevented.
*/
Select2.prototype.trigger = function (name, args) {
var actualTrigger = Select2.__super__.trigger;
var preTriggerMap = {
'open': 'opening',
'close': 'closing',
'select': 'selecting',
'unselect': 'unselecting'
};
if (name in preTriggerMap) {
var preTriggerName = preTriggerMap[name];
var preTriggerArgs = {
prevented: false,
name: name,
args: args
};
actualTrigger.call(this, preTriggerName, preTriggerArgs);
if (preTriggerArgs.prevented) {
args.prevented = true;
return;
}
}
actualTrigger.call(this, name, args);
};
Select2.prototype.toggleDropdown = function () {
if (this.options.get('disabled')) {
return;
}
if (this.isOpen()) {
this.close();
} else {
this.open();
}
};
Select2.prototype.open = function () {
if (this.isOpen()) {
return;
}
this.trigger('query', {});
this.trigger('open');
};
Select2.prototype.close = function () {
if (!this.isOpen()) {
return;
}
this.trigger('close');
};
Select2.prototype.isOpen = function () {
return this.$container.hasClass('select2-container--open');
};
Select2.prototype.enable = function (args) {
if (console && console.warn) {
console.warn(
'Select2: The `select2("enable")` method has been deprecated and will' +
' be removed in later Select2 versions. Use $element.prop("disabled")' +
' instead.'
);
}
if (args.length === 0) {
args = [true];
}
var disabled = !args[0];
this.$element.prop('disabled', disabled);
};
Select2.prototype.val = function (args) {
if (console && console.warn) {
console.warn(
'Select2: The `select2("val")` method has been deprecated and will be' +
' removed in later Select2 versions. Use $element.val() instead.'
);
}
if (args.length === 0) {
return this.$element.val();
}
var newVal = args[0];
if ($.isArray(newVal)) {
newVal = $.map(newVal, function (obj) {
return obj.toString();
});
}
this.$element.val(newVal).trigger('change');
};
Select2.prototype.destroy = function () {
this.$container.remove();
if (this.$element[0].detachEvent) {
this.$element[0].detachEvent('onpropertychange', this._sync);
}
if (this._observer != null) {
this._observer.disconnect();
this._observer = null;
}
this._sync = null;
this.$element.off('.select2');
this.$element.attr('tabindex', this._tabindex);
this.$element.show();
this.$element.removeData('select2');
this.data.destroy();
this.selection.destroy();
this.dropdown.destroy();
this.results.destroy();
this.data = null;
this.selection = null;
this.dropdown = null;
this.results = null;
};
Select2.prototype.render = function () {
var $container = $(
'<span class="select2 select2-container">' +
'<span class="selection"></span>' +
'<span class="dropdown-wrapper" aria-hidden="true"></span>' +
'</span>'
);
$container.attr('dir', this.options.get('dir'));
this.$container = $container;
this.$container.addClass('select2-container--' + this.options.get('theme'));
$container.data('element', this.$element);
return $container;
};
return Select2;
});
define('jquery.select2',[
'jquery',
'./select2/core',
'./select2/defaults'
], function ($, Select2, Defaults) {
// Force jQuery.mousewheel to be loaded if it hasn't already
try {
require('jquery.mousewheel');
} catch (Exception) { }
if ($.fn.select2 == null) {
$.fn.select2 = function (options) {
options = options || {};
if (typeof options === 'object') {
this.each(function () {
var instanceOptions = $.extend({}, options, true);
var instance = new Select2($(this), instanceOptions);
});
return this;
} else if (typeof options === 'string') {
var instance = this.data('select2');
var args = Array.prototype.slice.call(arguments, 1);
return instance[options](args);
} else {
throw new Error('Invalid arguments for Select2: ' + options);
}
};
}
if ($.fn.select2.defaults == null) {
$.fn.select2.defaults = Defaults;
}
return Select2;
});
return require('jquery.select2'); }); |
/*!
* Copyright(c) 2014 Jan Blaha
*/
/*globals $data */
var async = require("async"),
express = require('express'),
_ = require("underscore"),
path = require("path"),
odata_server = require('odata-server'),
q = require("q"),
bodyParser = require("body-parser"),
cookieParser = require('cookie-parser'),
fs = require("fs"),
http = require("http"),
https = require("https"),
cluster = require("cluster"),
cors = require('cors'),
routes = require("./routes.js"),
multer = require('multer');
var useDomainMiddleware = function(reporter, req, res) {
var clusterInstance = (reporter.options.cluster && reporter.options.cluster.enabled) ? reporter.options.cluster.instance : null;
return require("./clusterDomainMiddleware.js")(clusterInstance, reporter.express.server, reporter.logger, req, res, reporter.express.app);
};
var startAsync = function(reporter, server, port) {
var defer = q.defer();
server.on('error', function (e) {
reporter.logger.error("Error when starting http server on port " + port + " " + e.stack);
defer.reject(e);
}).on("listen", function() {
defer.resolve();
});
server.listen(port, function () {
defer.resolve();
});
return defer.promise;
};
var startExpressApp = function(reporter, app, config) {
//no port, use process.env.PORT, this is used when hosted in iisnode
if (!config.httpPort && !config.httpsPort) {
reporter.express.server = http.createServer(app);
return q.ninvoke(reporter.express.server, "listen", process.env.PORT);
}
//just http port is specified, lets start server on http
if (!config.httpsPort) {
reporter.express.server = http.createServer(function(req, res) { useDomainMiddleware(reporter, req, res); });
return startAsync(reporter, reporter.express.server, config.httpPort);
}
//http and https port specified
//fist start http => https redirector
if (config.httpPort) {
http.createServer(function (req, res) {
res.writeHead(302, {
'Location': "https://" + req.headers.host.split(':')[0] + ':' + config.httpsPort + req.url
});
res.end();
}).listen(config.httpPort).on('error', function (e) {
console.error("Error when starting http server on port " + config.httpPort + " " + e.stack);
});
}
//second start https server
if (!fs.existsSync(config.certificate.key)) {
config.certificate.key = path.join(__dirname, "../../../", "certificates", "jsreport.net.key");
config.certificate.cert = path.join(__dirname, "../../../", "certificates", "jsreport.net.cert");
}
var credentials = {
key: fs.readFileSync(config.certificate.key, 'utf8'),
cert: fs.readFileSync(config.certificate.cert, 'utf8'),
rejectUnauthorized: false //support invalid certificates
};
reporter.express.server = https.createServer(credentials, function(req, res) { useDomainMiddleware(reporter, req, res); });
return startAsync(reporter, reporter.express.server, config.httpsPort);
};
var configureExpressApp = function(app, reporter, definition){
reporter.express.app = app;
app.options('*', function(req, res) {
require("cors")({
methods : ["GET", "POST", "PUT", "DELETE", "PATCH", "MERGE"],
origin: true
})(req, res);
});
app.use(cookieParser());
app.use(bodyParser.urlencoded({ extended: true, limit: definition.options.inputRequestLimit || "20mb"}));
app.use(bodyParser.json({
limit: definition.options.inputRequestLimit || "20mb"
}));
app.set('views', path.join(__dirname, '../public/views'));
app.engine('html', require('ejs').renderFile);
app.use(multer({ dest: reporter.options.tempDirectory}));
app.use(cors());
reporter.emit("before-express-configure", app);
routes(app, reporter);
reporter.emit("express-configure", app);
};
module.exports = function(reporter, definition) {
reporter.express = {};
var app = definition.options.app;
if (!app) {
app = express();
}
reporter.initializeListener.add(definition.name, this, function() {
function logStart() {
if (reporter.options.httpsPort)
reporter.logger.info("jsreport server successfully started on https port: " + reporter.options.httpsPort);
if (reporter.options.httpPort)
reporter.logger.info("jsreport server successfully started on http port: " + reporter.options.httpPort);
if (!reporter.options.httpPort && !reporter.options.httpsPort && reporter.express.server)
reporter.logger.info("jsreport server successfully started on http port: " + reporter.express.server.address().port);
}
if (definition.options.app) {
reporter.logger.info("Configuring routes for existing express app.");
configureExpressApp(app, reporter, definition);
logStart();
return;
}
reporter.logger.info("Creating default express app.");
configureExpressApp(app, reporter, definition);
return startExpressApp(reporter, app, reporter.options).then(function() {
logStart();
});
});
}; |
import {TiInfinity as icon} from 'react-icons/ti'
export default {
name: 'recursivePopoverTest',
type: 'document',
title: 'Recursive Popover Test',
icon,
fields: [
{
name: 'title',
title: 'Title',
type: 'string',
},
{
name: 'arrayWithAnonymousObject',
title: 'Array with anonymous objects',
description: 'This array contains objects of type as defined inline',
type: 'array',
options: {
editModal: 'popover',
},
of: [
{type: 'recursivePopoverTest'},
{
type: 'object',
title: 'Something',
fields: [
{name: 'first', type: 'string', title: 'First string'},
{name: 'second', type: 'string', title: 'Second string'},
{name: 'image', type: 'image', title: 'An image', options: {hotspot: true}},
{
name: 'gallery',
title: 'Image array',
type: 'array',
options: {
layout: 'grid',
},
of: [
{
title: 'Book',
type: 'book',
},
{
title: 'Image',
type: 'image',
fields: [
{
name: 'caption',
type: 'string',
title: 'Caption',
options: {
isHighlighted: true,
},
},
],
},
],
},
{
name: 'arrayOfNamedReferences',
type: 'array',
title: 'Array of named references',
description:
'The values here should get _type == authorReference or _type == bookReference',
options: {
editModal: 'fold',
},
of: [
{
type: 'reference',
name: 'authorReference',
to: [{type: 'author', title: 'Reference to author'}],
},
{
type: 'reference',
name: 'bookReference',
to: [{type: 'book', title: 'Reference to book'}],
},
],
},
{
name: 'aReferenceAtTheEnd',
type: 'reference',
to: [{type: 'book', title: 'Reference to book'}],
},
{
name: 'aDateTimeAtTheEnd',
type: 'datetime',
},
],
},
],
},
],
}
|
const path = require('path');
const webpack = require('webpack');
const autoprefixer = require('autoprefixer');
// App files location
const PATHS = {
app: path.resolve(__dirname, '../src/js'),
styles: path.resolve(__dirname, '../src/styles'),
build: path.resolve(__dirname, '../build')
};
const plugins = [
// Shared code
new webpack.optimize.CommonsChunkPlugin('vendor', 'js/vendor.bundle.js'),
// Avoid publishing files when compilation fails
new webpack.NoErrorsPlugin(),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('development'),
__DEV__: JSON.stringify(JSON.parse(process.env.DEBUG || 'false'))
}),
new webpack.optimize.OccurenceOrderPlugin()
];
const sassLoaders = [
'style-loader',
'css-loader?sourceMap',
'postcss-loader',
'sass-loader?outputStyle=expanded'
];
module.exports = {
env : process.env.NODE_ENV,
entry: {
app: path.resolve(PATHS.app, 'main.js'),
vendor: ['react']
},
output: {
path: PATHS.build,
filename: 'js/[name].js',
publicPath: '/'
},
stats: {
colors: true,
reasons: true
},
resolve: {
// We can now require('file') instead of require('file.jsx')
extensions: ['', '.js', '.jsx', '.scss']
},
module: {
loaders: [
{
test: /\.jsx?$/,
loaders: ['react-hot', 'babel'],
include: PATHS.app
},
{
test: /\.scss$/,
loader: sassLoaders.join('!')
},
{
test: /\.css$/,
loader: 'style-loader!css-loader!postcss-loader'
},
// Inline base64 URLs for <=8k images, direct URLs for the rest
{
test: /\.(png|jpg|jpeg|gif|svg|woff|woff2)$/,
loader: 'url-loader?limit=8192'
}
]
},
plugins: plugins,
postcss: function () {
return [autoprefixer({
browsers: ['last 2 versions']
})];
},
devServer: {
contentBase: path.resolve(__dirname, '../src'),
port: 3001,
historyApiFallback: true,
proxy: {
'/login': {
target: 'http://localhost:3000'
},
'/messages': {
target: 'http://localhost:3000'
}
}
},
devtool: 'eval'
};
|
/**
* shortsort
* @param {integer} start - pixel to start at
* @param {integer} end - pixel to end at
*/
Jimp.prototype.shortsort = function shortsort(dir, start, end, cb) {
var width = this.bitmap.width,
height = this.bitmap.height,
data = new Uint32Array(this.bitmap.data),
cut, mm;
if (nullOrUndefined(start) && nullOrUndefined(end)) {
mm = randMinMax(0, width * height);
mm = randMinMax2(mm[0], mm[1]);
} else if(!nullOrUndefined(start) && nullOrUndefined(end)) {
mm = randMinMax(start, randMinMax2(width * height)[1]);
} else if(nullOrUndefined(start) && !nullOrUndefined(end)) {
mm = randMinMax(randMinMax2((width * height) - end)[0], end);
} else {
mm = [start, end];
}
cut = data.subarray(mm[0], mm[1]);
dir = nullOrUndefined(dir)? coinToss() : dir;
if (dir) {
Array.prototype.sort.call(cut, leftSort);
} else {
Array.prototype.sort.call(cut, rightSort);
}
this.bitmap.data = new Buffer(data.buffer);
if (isNodePattern(cb)) return cb.call(this, null, this);
else return this;
};
|
import _ from 'underscore'
import moment from 'moment'
import rewire from 'rewire'
import sinon from 'sinon'
const app = require('api/index.coffee')
const { fixtures, fabricate, empty } = require('api/test/helpers/db.coffee')
const resolvers = rewire('../resolvers.js')
describe('resolvers', () => {
let article, articles, server, promisedMongoFetch
const req = { user: { channel_ids: ['456'] } }
before((done) => {
empty(() => {
fabricate('users', { channel_ids: ['456'] }, (err, user) => {
if (err) {
done(err)
}
server = app.listen(5000, () => done())
})
})
})
beforeEach(() => {
articles = {
total: 20,
count: 1,
results: [
_.extend(fixtures().articles, {
slugs: ['slug-1'],
tags: ['dog'],
vertical: { id: '54276766fd4f50996aeca2b3' }
})
]
}
article = _.extend({}, fixtures().articles, {
slugs: ['slug-2'],
channel_id: '456'
})
const authors = { total: 20, count: 1, results: [fixtures().authors] }
const channels = { total: 20, count: 1, results: [fixtures().channels] }
const curations = { total: 20, count: 1, results: [fixtures().curations] }
const tags = { total: 20, count: 1, results: [fixtures().tags] }
promisedMongoFetch = sinon.stub()
resolvers.__set__('mongoFetch', sinon.stub().yields(null, articles))
resolvers.__set__('promisedMongoFetch', promisedMongoFetch)
resolvers.__set__('Author', { mongoFetch: (sinon.stub().yields(null, authors)) })
resolvers.__set__('Channel', { mongoFetch: (sinon.stub().yields(null, channels)) })
resolvers.__set__('Curation', { mongoFetch: (sinon.stub().yields(null, curations)) })
resolvers.__set__('Tag', { mongoFetch: (sinon.stub().yields(null, tags)) })
})
afterEach(() => {
server.close()
})
describe('articles', () => {
it('returns throws error when trying to view a draft without channel_id', () => {
const args = { published: false }
resolvers.articles.bind({}, args, {}, {}).should.throw()
})
it('returns throws an error when trying to view an unauthorized draft', () => {
const args = { published: false, channel_id: '123' }
resolvers.articles.bind({}, args, {}, {}).should.throw()
})
it('can view drafts', async () => {
const args = { published: false, channel_id: '456' }
const results = await resolvers.articles({}, args, req, {})
results.length.should.equal(1)
results[0].slug.should.equal('slug-1')
})
it('can view published articles', async () => {
const args = { published: true }
const results = await resolvers.articles({}, args, req, {})
results.length.should.equal(1)
results[0].slug.should.equal('slug-1')
})
})
describe('article', () => {
it('rejects with an error when no article is found', async () => {
const args = { id: '123' }
resolvers.__set__('find', (sinon.stub().yields(null, null)))
try {
await resolvers.article({}, args, {}, {})
} catch (err) {
err.toString().should.containEql('Article not found.')
}
})
it('rejects with an error when trying to view an unauthorized draft', async () => {
const args = { id: '123' }
const newArticle = _.extend({}, article, { channel_id: '000', published: false })
resolvers.__set__('find', (sinon.stub().yields(null, newArticle)))
try {
await resolvers.article({}, args, {}, {})
} catch (err) {
err.toString().should.containEql('Must be a member of the channel')
}
})
it('can view drafts', async () => {
const args = { id: '123' }
const newArticle = _.extend({}, article, { published: false })
resolvers.__set__('find', (sinon.stub().yields(null, newArticle)))
const results = await resolvers.article({}, args, req, {})
results.slug.should.equal('slug-2')
})
it('can view published articles', async () => {
const args = { id: '123' }
resolvers.__set__('find', (sinon.stub().yields(null, article)))
const results = await resolvers.article({}, args, req, {})
results.slug.should.equal('slug-2')
})
})
describe('authors', () => {
it('can find authors', async () => {
const results = await resolvers.authors({}, {}, req, {})
results.length.should.equal(1)
results[0].name.should.equal('Halley Johnson')
results[0].bio.should.equal('Writer based in NYC')
results[0].twitter_handle.should.equal('kanaabe')
results[0].image_url.should.equal('https://artsy-media.net/halley.jpg')
})
})
describe('relatedAuthors', () => {
it('can find authors', async () => {
const root = { author_ids: [{ id: '123' }] }
const results = await resolvers.relatedAuthors(root)
results.length.should.equal(1)
results[0].name.should.equal('Halley Johnson')
results[0].bio.should.equal('Writer based in NYC')
results[0].twitter_handle.should.equal('kanaabe')
results[0].image_url.should.equal('https://artsy-media.net/halley.jpg')
})
it('returns null if there are no authors from fetch', async () => {
resolvers.__set__('Author', {
mongoFetch: sinon.stub().yields(null, { results: [] })
})
const root = { author_ids: [{ id: '123' }] }
const results = await resolvers.relatedAuthors(root)
_.isNull(results).should.be.true()
})
it('returns null if the article has no author_ids', async () => {
const root = { author_ids: null }
const results = await resolvers.relatedAuthors(root)
_.isNull(results).should.be.true()
})
})
describe('channels', () => {
it('can find channels', async () => {
const results = await resolvers.channels({}, {}, req, {})
results.length.should.equal(1)
results[0].name.should.equal('Editorial')
results[0].type.should.equal('editorial')
})
})
describe('curations', () => {
it('can find curations', async () => {
const results = await resolvers.curations({}, {}, req, {})
results.length.should.equal(1)
results[0].name.should.equal('Featured Articles')
})
})
describe('display', () => {
it('can fetch campaign data', async () => {
const display = {
total: 20,
count: 4,
results: [{
campaigns: [
fixtures().display,
fixtures().display,
fixtures().display,
fixtures().display
]
}]
}
resolvers.__set__('Curation', { mongoFetch: (sinon.stub().yields(null, display)) })
const result = await resolvers.display({}, {}, req, {})
result.name.should.equal('Sample Campaign')
result.canvas.headline.should.containEql('Sample copy')
result.panel.headline.should.containEql('Euismod Inceptos Quam')
})
it('rejects if SOV is over 100%', async () => {
const display = {
total: 20,
count: 2,
results: [{
campaigns: [
fixtures().display,
fixtures().display,
fixtures().display,
fixtures().display,
fixtures().display
]
}]
}
resolvers.__set__('Curation', { mongoFetch: (sinon.stub().yields(null, display)) })
await resolvers.display({}, {}, req, {}).catch((e) => {
e.message.should.containEql('Share of voice sum cannot be greater than 100')
})
})
it('resolves null if there are no results', async () => {
const display = {
total: 20,
count: 1,
results: []
}
resolvers.__set__('Curation', { mongoFetch: (sinon.stub().yields(null, display)) })
const result = await resolvers.display({}, {}, req, {})
_.isNull(result).should.be.true()
})
it('resolves null if there are no campaigns', async () => {
const display = {
total: 20,
count: 1,
results: [{ campaigns: [] }]
}
resolvers.__set__('Curation', { mongoFetch: (sinon.stub().yields(null, display)) })
const result = await resolvers.display({}, {}, req, {})
_.isNull(result).should.be.true()
})
describe('inactive campaigns', () => {
const now = () => moment(new Date())
const getDisplayData = async ({ startDate, endDate }) => {
const campaign = {
...fixtures().display,
start_date: startDate.toDate(),
end_date: endDate.toDate()
}
const display = {
total: 20,
count: 4,
results: [{
campaigns: [
campaign,
campaign,
campaign,
campaign
]
}]
}
resolvers.__set__('Curation', {
mongoFetch: sinon.stub().yields(null, display)
})
const result = await resolvers.display({}, {}, req, {})
return result
}
it('does not filter active campaigns', async () => {
const inValidRange = await getDisplayData({
startDate: now().subtract(1, 'day'),
endDate: now().add(1, 'day')
})
inValidRange.should.not.equal(null)
})
it('filters out if start date greater than now', async () => {
const result = await getDisplayData({
startDate: now().add(1, 'days'),
endDate: now().add(2, 'days')
})
_.isNull(result).should.be.true()
})
it('filters out if end date less than now', async () => {
const result = await getDisplayData({
startDate: now().subtract(3, 'days'),
endDate: now().subtract(2, 'days')
})
_.isNull(result).should.be.true()
})
})
})
describe('relatedArticlesCanvas', () => {
it('can find related articles for the canvas', async () => {
promisedMongoFetch.onFirstCall().resolves(articles)
const results = await resolvers.relatedArticlesCanvas({
id: '54276766fd4f50996aeca2b8',
vertical: { id: '54276766fd4f50996aeca2b3' }
})
results.length.should.equal(1)
results[0].vertical.id.should.equal('54276766fd4f50996aeca2b3')
})
it('resolves null if it does not have articles', async () => {
promisedMongoFetch.onFirstCall().resolves({ results: [] })
const results = await resolvers.relatedArticlesCanvas({
id: '54276766fd4f50996aeca2b8',
vertical: { id: '54276766fd4f50996aeca2b3' }
})
_.isNull(results).should.be.true()
})
})
describe('relatedArticlesPanel', () => {
it('can find related articles for the panel without related_article_ids', async () => {
promisedMongoFetch.onFirstCall().resolves(articles)
const results = await resolvers.relatedArticlesPanel({
id: '54276766fd4f50996aeca2b8',
tags: ['dog', 'cat']
})
results.length.should.equal(1)
results[0].tags[0].should.equal('dog')
})
it('can find related articles for the panel with related_article_ids', async () => {
const relatedArticles = {
results: [
_.extend({}, fixtures.article, {
title: 'Related Article'
})
]
}
promisedMongoFetch.onFirstCall().resolves(articles)
promisedMongoFetch.onSecondCall().resolves(relatedArticles)
const results = await resolvers.relatedArticlesPanel({
id: '54276766fd4f50996aeca2b8',
tags: ['dog', 'cat'],
related_article_ids: ['54276766fd4f50996aeca2b1']
})
results.length.should.equal(2)
results[0].title.should.equal('Related Article')
results[1].tags[0].should.equal('dog')
})
it('returns an error on the mongo fetch', async () => {
promisedMongoFetch.onFirstCall().rejects()
await resolvers.relatedArticlesPanel({
id: '54276766fd4f50996aeca2b8',
tags: ['dog', 'cat'],
related_article_ids: ['54276766fd4f50996aeca2b1']
}).catch((e) => {
e.message.should.containEql('Error')
})
})
it('resolves null if there are no articles', async () => {
promisedMongoFetch.onFirstCall().resolves({ results: [] })
const result = await resolvers.relatedArticlesPanel({
id: '54276766fd4f50996aeca2b8',
tags: ['dog', 'cat']
})
_.isNull(result).should.be.true()
})
it('strips tags from args when the article does not have tags', async () => {
promisedMongoFetch.onFirstCall().resolves(articles)
await resolvers.relatedArticlesPanel({
id: '54276766fd4f50996aeca2b8',
tags: []
})
Object.keys(promisedMongoFetch.args[0][0]).should.not.containEql('tags')
})
})
describe('tags', () => {
it('can find tags', async () => {
const results = await resolvers.tags({}, {}, req, {})
results.length.should.equal(1)
results[0].name.should.equal('Show Reviews')
})
})
})
|
import Mat23 from 'math/matrix/mat23/Build.js';
import Scale from 'math/transform/2d/components/Scale.js';
import Position from 'math/transform/2d/components/Position.js';
// A Minimal 2D Transform class
// Components: Position and Scale, baked to a Mat23
// Supports: Immediate or Deferred Updates, Interpolation.
export default class Transform {
constructor (x = 0, y = 0, scaleX = 1, scaleY = 1) {
this.position = new Position(this, x, y);
this.scale = new Scale(this, scaleX, scaleY);
this.local = Mat23(scaleX, 0, 0, scaleY, x, y);
this.interpolate = false;
this.immediate = false;
this.dirty = true;
}
// Inject the transform properties to the given target
addProperties (target) {
// Property getter/setter injection
this.position.addProperties(target);
// Component references
target.position = this.position;
target.scale = this.scale;
return target;
}
enableImmediateUpdates () {
this.immediate = true;
return this;
}
disableImmediateUpdates () {
this.immediate = false;
this.dirty = true;
return this;
}
enableInterpolation () {
this.interpolate = true;
this.position.reset(this.position.x, this.position.y);
this.scale.reset(this.scale.x, this.scale.y);
return this;
}
disableInterpolation () {
this.interpolate = false;
return this;
}
setDirty () {
if (this.immediate)
{
this.updateTransform();
}
else
{
this.dirty = true;
}
return this;
}
updateTransform (i = 1) {
this.local[0] = this.scale[0];
this.local[1] = 0;
this.local[2] = 0;
this.local[3] = this.scale[1];
if (this.interpolate)
{
this.local[4] = this.position.getDeltaX(i);
this.local[5] = this.position.getDeltaY(i);
}
else
{
this.local[4] = this.position[0];
this.local[5] = this.position[1];
}
this.dirty = false;
return this;
}
destroy () {
this.position.destroy();
this.scale.destroy();
this.local = undefined;
}
}
|
import Class from '../mixin/class';
import Media from '../mixin/media';
import {
$,
addClass,
after,
Animation,
clamp,
css,
dimensions,
fastdom,
height as getHeight,
offset as getOffset,
getScrollingElement,
hasClass,
isString,
isVisible,
noop,
offsetPosition,
parent,
query,
remove,
removeClass,
replaceClass,
scrollTop,
toFloat,
toggleClass,
toPx,
trigger,
within,
intersectRect,
} from 'uikit-util';
export default {
mixins: [Class, Media],
props: {
position: String,
top: null,
bottom: Boolean,
offset: String,
animation: String,
clsActive: String,
clsInactive: String,
clsFixed: String,
clsBelow: String,
selTarget: String,
widthElement: Boolean,
showOnUp: Boolean,
targetOffset: Number,
},
data: {
position: 'top',
top: 0,
bottom: false,
offset: 0,
animation: '',
clsActive: 'uk-active',
clsInactive: '',
clsFixed: 'uk-sticky-fixed',
clsBelow: 'uk-sticky-below',
selTarget: '',
widthElement: false,
showOnUp: false,
targetOffset: false,
},
computed: {
selTarget({ selTarget }, $el) {
return (selTarget && $(selTarget, $el)) || $el;
},
widthElement({ widthElement }, $el) {
return query(widthElement, $el) || this.placeholder;
},
isActive: {
get() {
return hasClass(this.selTarget, this.clsActive);
},
set(value) {
if (value && !this.isActive) {
replaceClass(this.selTarget, this.clsInactive, this.clsActive);
trigger(this.$el, 'active');
} else if (!value && !hasClass(this.selTarget, this.clsInactive)) {
replaceClass(this.selTarget, this.clsActive, this.clsInactive);
trigger(this.$el, 'inactive');
}
},
},
},
connected() {
this.placeholder =
$('+ .uk-sticky-placeholder', this.$el) ||
$('<div class="uk-sticky-placeholder"></div>');
this.isFixed = false;
this.isActive = false;
},
disconnected() {
if (this.isFixed) {
this.hide();
removeClass(this.selTarget, this.clsInactive);
}
remove(this.placeholder);
this.placeholder = null;
this.widthElement = null;
},
events: [
{
name: 'load hashchange popstate',
el() {
return window;
},
filter() {
return this.targetOffset !== false;
},
handler() {
if (!location.hash || scrollTop(window) === 0) {
return;
}
fastdom.read(() => {
const targetOffset = getOffset($(location.hash));
const elOffset = getOffset(this.$el);
if (this.isFixed && intersectRect(targetOffset, elOffset)) {
scrollTop(
window,
targetOffset.top -
elOffset.height -
toPx(this.targetOffset, 'height') -
toPx(this.offset, 'height')
);
}
});
},
},
],
update: [
{
read({ height, margin }, types) {
this.inactive = !this.matchMedia || !isVisible(this.$el);
if (this.inactive) {
return false;
}
const hide = this.isActive && types.has('resize');
if (hide) {
css(this.selTarget, 'transition', '0s');
this.hide();
}
if (!this.isActive) {
height = getOffset(this.$el).height;
margin = css(this.$el, 'margin');
}
if (hide) {
this.show();
fastdom.write(() => css(this.selTarget, 'transition', ''));
}
const referenceElement = this.isFixed ? this.placeholder : this.$el;
const windowHeight = getHeight(window);
let position = this.position;
if (position === 'auto' && height > windowHeight) {
position = 'bottom';
}
let offset = toPx(this.offset, 'height', referenceElement);
if (position === 'bottom') {
offset += windowHeight - height;
}
const overflow = Math.max(0, height + offset - windowHeight);
const topOffset = getOffset(referenceElement).top;
const offsetParentTop = getOffset(referenceElement.offsetParent).top;
const top = parseProp(this.top, this.$el, topOffset);
const bottom = parseProp(this.bottom, this.$el, topOffset + height, true);
const start = Math.max(top, topOffset) - offset;
const end = bottom
? bottom - getOffset(this.$el).height + overflow - offset
: getScrollingElement(this.$el).scrollHeight - windowHeight;
return {
start,
end,
offset,
overflow,
topOffset,
offsetParentTop,
height,
margin,
width: dimensions(isVisible(this.widthElement) ? this.widthElement : this.$el)
.width,
top: offsetPosition(referenceElement)[0],
};
},
write({ height, margin }) {
const { placeholder } = this;
css(placeholder, { height, margin });
if (!within(placeholder, document)) {
after(this.$el, placeholder);
placeholder.hidden = true;
}
this.isActive = !!this.isActive; // force self-assign
},
events: ['resize'],
},
{
read({
scroll: prevScroll = 0,
dir: prevDir = 'down',
overflow,
overflowScroll = 0,
start,
end,
}) {
const scroll = scrollTop(window);
const dir = prevScroll <= scroll ? 'down' : 'up';
return {
dir,
prevDir,
scroll,
prevScroll,
overflowScroll: clamp(
overflowScroll + clamp(scroll, start, end) - clamp(prevScroll, start, end),
0,
overflow
),
};
},
write(data, types) {
const isScrollUpdate = types.has('scroll');
const {
initTimestamp = 0,
dir,
prevDir,
scroll,
prevScroll = 0,
top,
start,
topOffset,
height,
} = data;
if (
scroll < 0 ||
(scroll === prevScroll && isScrollUpdate) ||
(this.showOnUp && !isScrollUpdate && !this.isFixed)
) {
return;
}
const now = Date.now();
if (now - initTimestamp > 300 || dir !== prevDir) {
data.initScroll = scroll;
data.initTimestamp = now;
}
if (
this.showOnUp &&
!this.isFixed &&
Math.abs(data.initScroll - scroll) <= 30 &&
Math.abs(prevScroll - scroll) <= 10
) {
return;
}
if (
this.inactive ||
scroll < start ||
(this.showOnUp &&
(scroll <= start ||
(dir === 'down' && isScrollUpdate) ||
(dir === 'up' && !this.isFixed && scroll <= topOffset + height)))
) {
if (!this.isFixed) {
if (Animation.inProgress(this.$el) && top > scroll) {
Animation.cancel(this.$el);
this.hide();
}
return;
}
this.isFixed = false;
if (this.animation && scroll > topOffset) {
Animation.cancel(this.$el);
Animation.out(this.$el, this.animation).then(() => this.hide(), noop);
} else {
this.hide();
}
} else if (this.isFixed) {
this.update();
} else if (this.animation && scroll > topOffset) {
Animation.cancel(this.$el);
this.show();
Animation.in(this.$el, this.animation).catch(noop);
} else {
this.show();
}
},
events: ['resize', 'scroll'],
},
],
methods: {
show() {
this.isFixed = true;
this.update();
this.placeholder.hidden = false;
},
hide() {
this.isActive = false;
removeClass(this.$el, this.clsFixed, this.clsBelow);
css(this.$el, { position: '', top: '', width: '' });
this.placeholder.hidden = true;
},
update() {
let {
width,
scroll = 0,
overflow,
overflowScroll = 0,
start,
end,
offset,
topOffset,
height,
offsetParentTop,
} = this._data;
const active = start !== 0 || scroll > start;
let position = 'fixed';
if (scroll > end) {
offset += end - offsetParentTop;
position = 'absolute';
}
if (overflow) {
offset -= overflowScroll;
}
css(this.$el, {
position,
top: `${offset}px`,
width,
});
this.isActive = active;
toggleClass(this.$el, this.clsBelow, scroll > topOffset + height);
addClass(this.$el, this.clsFixed);
},
},
};
function parseProp(value, el, propOffset, padding) {
if (!value) {
return 0;
}
if (isString(value) && value.match(/^-?\d/)) {
return propOffset + toPx(value);
} else {
const refElement = value === true ? parent(el) : query(value, el);
return (
getOffset(refElement).bottom -
(padding && refElement && within(el, refElement)
? toFloat(css(refElement, 'paddingBottom'))
: 0)
);
}
}
|
var ndarray = require('ndarray');
var show = require('ndarray-show');
var zeros = require('zeros');
var crout = require('../');
var A = ndarray([
2, 1, 1, 3, 2,
1, 2, 2, 1, 1,
1, 2, 9, 1, 5,
3, 1, 1, 7, 1,
2, 1, 5, 1, 8
], [ 5, 5 ]);
var L = zeros([ 5, 5 ]);
var U = zeros([ 5, 5 ]);
crout(A, L, U);
console.log('L=\n' + show(L));
console.log('U=\n' + show(U));
|
'use strict';
// Declare app level module which depends on views, and components
var app =angular.module('myApp', [
'ngRoute',
'myApp.milestones',
'myApp.stage',
'myApp.version'
]).
config(['$locationProvider', '$routeProvider', function($locationProvider, $routeProvider) {
$locationProvider.hashPrefix('!');
$routeProvider.otherwise({redirectTo: '/milestones'});
}]);
app.controller('main', function($http) {
var ctrl = this;
ctrl.stages = [
{
name: 'Creative Logo',
keyword: 'logo',
snippet: ''
},
{
name: 'How to deal with banks?',
keyword: 'banks',
snippet: ''
},
{
name: 'Financial institutions',
keyword: 'financial-institutions',
snippet: ''
}
];
ctrl.newStage = {
name: ''
};
ctrl.getStages = function () {
$http.get('/stages').then(function (response) {
ctrl.stages = response.data;
});
};
//
// ctrl.addStage = function (stage) {
// $http.post('/stage', stage).then(function () {
// ctrl.newStage = {name: ''};
// return ctrl.getStages();
// });
// };
ctrl.getStages();
});
|
import React, { Component } from "react";
export default class Home extends Component
render() {
return (
{this._renderHeader()}
{this._renderBody()}
);
}
_renderHeader() {
return (
<div className=""><div/>
);
}
_renderBody() {
return (
<div className=""><div/>
);
}
_renderFooter() {
return (
<div className=""><div/>
);
}
};
|
if (true) { };
function foo() { };
function foo() {
};
if (true) {
};
function foo() { }; function bar() { };
|
/**
* SignWriting 2010 JavaScript Library v1.9.1
* https://github.com/Slevinski/sw10js
* Copyright (c) 2007-2016, Stephen E Slevinski Jr
* sw10.js is released under the MIT License.
*/
var sw10 = {
key: function(text,style){
var key = text.match(/S[123][0-9a-f]{2}[0-5][0-9a-f]([0-9]{3}x[0-9]{3})?/g);
if (!key) {
return '';
} else {
return key[0] + (style?sw10.styling(text):'');
}
},
fsw: function(text,style){
var fsw = text.match(/(A(S[123][0-9a-f]{2}[0-5][0-9a-f])+)?[BLMR]([0-9]{3}x[0-9]{3})(S[123][0-9a-f]{2}[0-5][0-9a-f][0-9]{3}x[0-9]{3})*|S38[7-9ab][0-5][0-9a-f][0-9]{3}x[0-9]{3}/);
if (!fsw) {
return '';
} else {
return fsw[0] + (style?sw10.styling(text):'');
}
},
styling: function(text){
var sfsw = text.match(/-C?(P[0-9]{2})?(G_([0-9a-fA-F]{3}([0-9a-fA-F]{3})?|[a-zA-Z]+)_)?(D_([0-9a-fA-F]{3}([0-9a-fA-F]{3})?|[a-zA-Z]+)(,([0-9a-fA-F]{3}([0-9a-fA-F]{3})?|[a-zA-Z]+))?_)?(Z([0-9]+(\.[0-9]+)?|x))?(-(D[0-9]{2}_([0-9a-fA-F]{3}([0-9a-fA-F]{3})?|[a-zA-Z]+)(,([0-9a-fA-F]{3}([0-9a-fA-F]{3})?|[a-zA-Z]+))?_)*(Z[0-9]{2},[0-9]+(\.[0-9]+)?(,[0-9]{3}x[0-9]{3})?)*)?/);
if (!sfsw) {
return '';
} else {
return sfsw[0];
}
},
mirror: function(key){
key = sw10.key(key);
if (!sw10.size(key)) {return '';}
var base = key.slice(0,4);
var fill = key.slice(4,5);
var rot = parseInt(key.slice(5,6),16);
var key1 = base + "08";
var key2 = base + "18";
var rAdd;
if (sw10.size(key1) || sw10.size(key2)){
rAdd = 8;
} else {
if ((rot===0) || (rot==4)) {rAdd=0;}
if ((rot==1) || (rot==5)) {rAdd=6;}
if ((rot==2) || (rot==6)) {rAdd=4;}
if ((rot==3) || (rot==7)) {rAdd=2;}
}
key='';
while (!sw10.size(key)) {
rot += rAdd;
if ((rot>7) && (rAdd<8)) { rot = rot -8;}
if (rot>15) { rot = rot -16;}
key = base + fill + rot.toString(16);
}
return key;
},
fill: function(key,step){
key = sw10.key(key);
if (!sw10.size(key)) {return '';}
if (step!=-1) {step=1;}
var base = key.slice(0,4);
var fill = parseInt(key.slice(4,5));
var rot = key.slice(5,6);
key='';
while (!sw10.size(key)){
fill += step;
if (fill>5) {fill=0;}
if (fill<0) {fill=5;}
key = base + fill + rot;
}
return key;
},
rotate: function(key,step){
key = sw10.key(key);
if (!sw10.size(key)) {return '';}
if (step!=-1) {step=1;}
var base = key.slice(0,4);
var fill = key.slice(4,5);
var rot = parseInt(key.slice(5,6),16);
key='';
while (!sw10.size(key)){
if (rot>7){
rot += step;
if (rot>15) {rot=8;}
if (rot<8) {rot=15;}
key = base + fill + rot.toString(16);
} else {
rot -= step;
if (rot>7) {rot=0;}
if (rot<0) {rot=7;}
key = base + fill + rot;
}
}
return key;
},
scroll: function(key,step){
key = sw10.key(key);
if (!sw10.size(key)) {return '';}
if (step!=-1) {step=1;}
var base = parseInt(key.slice(1,4),16) + step;
var fill = key.slice(4,5);
var rot = key.slice(5,6);
var nkey= 'S' + base.toString(16) + fill + rot;
if(sw10.size(nkey)){
return nkey;
} else {
return key;
}
},
structure: function(division,key,opt){
var arrs = {kind:['S100','S37f','S387'],
category:['S100','S205','S2f7','S2ff','S36d','S37f','S387'],
group:['S100','S10e','S11e','S144','S14c','S186','S1a4','S1ba','S1cd','S1f5','S205','S216','S22a','S255','S265','S288','S2a6','S2b7','S2d5','S2e3','S2f7','S2ff','S30a','S32a','S33b','S359','S36d','S376','S37f','S387']
};
var arr = arrs[division];
if (!arr) {return !key?[]:opt=="is"?false:'';}
if (!key&&!opt) {return arr;}
if (!opt) {opt='';}
var adj;
switch(opt){
case 'is':
return (arr.indexOf(key.slice(0,4))==-1)?false:true;
case 'first':
return arr[0];
case 'last':
return arr.slice(-1)[0];
case 'prev':
adj = -2;
break;
case '':
adj = -1;
break;
case 'next':
adj = 0;
break;
default:
return '';
}
var i;
var index = arr.length;
for(i=0; i<arr.length; i+=1) {
if(parseInt(key.slice(1,4),16) < parseInt(arr[i].slice(1,4),16)) {
index = i;
break;
}
}
index += adj;
index = index<0?0:index>=arr.length?arr.length-1:index;
return arr[index];
},
type: function(type){
var start;
var end;
switch(type) {
case "writing":
start = '100';
end = '37e';
break;
case "hand":
start = '100';
end = '204';
break;
case "movement":
start = '205';
end = '2f6';
break;
case "dynamic":
start = '2f7';
end = '2fe';
break;
case "head":
case "hcenter":
start = '2ff';
end = '36c';
break;
case "vcenter":
start = '2ff';
end = '375';
break;
case "trunk":
start = '36d';
end = '375';
break;
case "limb":
start = '376';
end = '37e';
break;
case "location":
start = '37f';
end = '386';
break;
case "punctuation":
start = '387';
end = '38b';
break;
default:
start = '100';
end = '38b';
break;
}
return [start,end];
},
is: function(key,type){
if (key.length==6 && !sw10.size(key)) {return false;}
var range = sw10.type(type);
var start = range[0];
var end = range[1];
var char = key.slice(1,4);
return (parseInt(start,16)<=parseInt(char,16) && parseInt(end,16)>=parseInt(char,16));
},
filter: function (fsw,type) {
var range = sw10.type(type);
var start = range[0];
var end = range[1];
var re = 'S' + sw10.range(start,end,1) + '[0-5][0-9a-f][0-9]{3}x[0-9]{3}';
var matches = fsw.match(new RegExp(re,'g'));
if (matches){
return matches.join('');
} else {
return '';
}
},
random: function(type) {
var range = sw10.type(type);
var start = range[0];
var end = range[1];
var rBase = Math.floor(Math.random() * (parseInt(end,16)-parseInt(start,16)+1) + parseInt(start,16));
var rFill = Math.floor(Math.random() * 6);
var rRota = Math.floor(Math.random() * 16);
var key = "S" + rBase.toString(16) + rFill.toString(16) + rRota.toString(16);
if (sw10.size(key)){
return key;
} else {
return sw10.random(type);
}
},
colorize: function(key) {
var color = '000000';
if (sw10.is(key,'hand')) {color = '0000CC';}
if (sw10.is(key,'movement')) {color = 'CC0000';}
if (sw10.is(key,'dynamic')) {color = 'FF0099';}
if (sw10.is(key,'head')) {color = '006600';}
// if (sw10.is(key,'trunk')) {color = '000000';}
// if (sw10.is(key,'limb')) {color = '000000';}
if (sw10.is(key,'location')) {color = '884411';}
if (sw10.is(key,'punctuation')) {color = 'FF9900';}
return color;
},
view: function(key,fillone) {
if (!sw10.is(key)) {return '';}
var prefix = key.slice(0,4);
if (fillone){
return prefix + ((sw10.size(prefix + '00'))?'0':'1') +'0';
} else {
return prefix + ((sw10.is(prefix,'hand') && !sw10.structure('group',prefix,'is'))?'1':'0') +'0';
}
},
code: function(text,hexval){
var key;
var i;
var fsw = sw10.fsw(text);
if (fsw){
var pattern = 'S[123][0-9a-f]{2}[0-5][0-9a-f]';
var matches = fsw.match(new RegExp(pattern,'g'));
for(i=0; i<matches.length; i+=1) {
key = matches[i];
fsw = fsw.replace(key,sw10.code(key,hexval));
}
return fsw;
}
key = sw10.key(text);
if (!key) {return '';}
var code = 0x100000 + ((parseInt(key.slice(1,4),16) - 256) * 96) + ((parseInt(key.slice(4,5),16))*16) + parseInt(key.slice(5,6),16) + 1;
return hexval?code.toString(16).toUpperCase():String.fromCharCode(0xD800 + ((code - 0x10000) >> 10), 0xDC00 + ((code - 0x10000) & 0x3FF));
},
uni10: function(text,hexval){
var key;
var i;
var fsw = sw10.fsw(text);
if (fsw){
var pattern = 'S[123][0-9a-f]{2}[0-5][0-9a-f]';
var matches = fsw.match(new RegExp(pattern,'g'));
for(i=0; i<matches.length; i+=1) {
key = matches[i];
fsw = fsw.replace(key,sw10.uni10(key,hexval));
}
return fsw;
}
key = sw10.key(text);
if (!key) {return '';}
var code = 0x40000 + ((parseInt(key.slice(1,4),16) - 256) * 96) + ((parseInt(key.slice(4,5),16))*16) + parseInt(key.slice(5,6),16) + 1;
return hexval?code.toString(16).toUpperCase():String.fromCharCode(0xD800 + ((code - 0x10000) >> 10), 0xDC00 + ((code - 0x10000) & 0x3FF));
},
uni8: function(text,hexval){
var key;
var i;
var fsw = sw10.fsw(text);
if (fsw){
var pattern = 'S[123][0-9a-f]{2}[0-5][0-9a-f]';
var matches = fsw.match(new RegExp(pattern,'g'));
for(i=0; i<matches.length; i+=1) {
key = matches[i];
fsw = fsw.replace(key,sw10.uni8(key,hexval));
}
return fsw;
}
key = sw10.key(text);
if (!key) {return '';}
var base = parseInt(key.substr(1,3),16) + parseInt('1D700',16);
var uni8 = hexval?base.toString(16).toUpperCase():String.fromCharCode(0xD800 + ((base - 0x10000) >> 10), 0xDC00 + ((base - 0x10000) & 0x3FF));
var fill = key.substr(4,1);
if (fill!="0"){
fill = parseInt(fill,16) + parseInt('1DA9A',16);
uni8 += hexval?fill.toString(16).toUpperCase():String.fromCharCode(0xD800 + ((fill - 0x10000) >> 10), 0xDC00 + ((fill - 0x10000) & 0x3FF));
}
var rotation = key.substr(5,1);
if (rotation!="0"){
rotation = parseInt(rotation,16) + parseInt('1DAA0',16);
uni8 += hexval?rotation.toString(16).toUpperCase():String.fromCharCode(0xD800 + ((rotation - 0x10000) >> 10), 0xDC00 + ((rotation - 0x10000) & 0x3FF));
}
return uni8;
},
pua: function(text,hexval){
var key;
var pua;
var fsw = sw10.fsw(text);
if (fsw){
var str;
var code;
var coord;
code = parseInt('FD800',16);
fsw = fsw.replace('A',hexval?code.toString(16).toUpperCase():String.fromCharCode(0xD800 + (((code) - 0x10000) >> 10), 0xDC00 + (((code) - 0x10000) & 0x3FF)));
fsw = fsw.replace('B',hexval?(code+1).toString(16).toUpperCase():String.fromCharCode(0xD800 + (((code+1) - 0x10000) >> 10), 0xDC00 + (((code+1) - 0x10000) & 0x3FF)));
fsw = fsw.replace('L',hexval?(code+2).toString(16).toUpperCase():String.fromCharCode(0xD800 + (((code+2) - 0x10000) >> 10), 0xDC00 + (((code+2) - 0x10000) & 0x3FF)));
fsw = fsw.replace('M',hexval?(code+3).toString(16).toUpperCase():String.fromCharCode(0xD800 + (((code+3) - 0x10000) >> 10), 0xDC00 + (((code+3) - 0x10000) & 0x3FF)));
fsw = fsw.replace('R',hexval?(code+4).toString(16).toUpperCase():String.fromCharCode(0xD800 + (((code+4) - 0x10000) >> 10), 0xDC00 + (((code+4) - 0x10000) & 0x3FF)));
var pattern = '[0-9]{3}x[0-9]{3}';
var matches = fsw.match(new RegExp(pattern,'g'));
var i;
for(i=0; i<matches.length; i+=1) {
str = matches[i];
coord = str.split('x');
coord[0] = parseInt(coord[0]) + parseInt('FDD0C',16);
coord[1] = parseInt(coord[1]) + parseInt('FDD0C',16);
pua = hexval?coord[0].toString(16).toUpperCase():String.fromCharCode(0xD800 + ((coord[0] - 0x10000) >> 10), 0xDC00 + ((coord[0] - 0x10000) & 0x3FF));
pua += hexval?coord[1].toString(16).toUpperCase():String.fromCharCode(0xD800 + ((coord[1] - 0x10000) >> 10), 0xDC00 + ((coord[1] - 0x10000) & 0x3FF));
fsw = fsw.replace(str,pua);
}
pattern = 'S[123][0-9a-f]{2}[0-5][0-9a-f]';
matches = fsw.match(new RegExp(pattern,'g'));
for(i=0; i<matches.length; i+=1) {
key = matches[i];
fsw = fsw.replace(key,sw10.pua(key,hexval));
}
return fsw;
}
key = sw10.key(text);
if (!key) {return '';}
var base = parseInt(key.substr(1,3),16) + parseInt('FD730',16);
pua = hexval?base.toString(16).toUpperCase():String.fromCharCode(0xD800 + ((base - 0x10000) >> 10), 0xDC00 + ((base - 0x10000) & 0x3FF));
var fill = key.substr(4,1);
fill = parseInt(fill,16) + parseInt('FD810',16);
pua += hexval?fill.toString(16).toUpperCase():String.fromCharCode(0xD800 + ((fill - 0x10000) >> 10), 0xDC00 + ((fill - 0x10000) & 0x3FF));
var rotation = key.substr(5,1);
rotation = parseInt(rotation,16) + parseInt('FD820',16);
pua += hexval?rotation.toString(16).toUpperCase():String.fromCharCode(0xD800 + ((rotation - 0x10000) >> 10), 0xDC00 + ((rotation - 0x10000) & 0x3FF));
return pua;
},
bbox: function(fsw) {
var rcoord = /[0-9]{3}x[0-9]{3}/g;
var x;
var y;
var x1;
var x2;
var y1;
var y2;
var coords = fsw.match(rcoord);
if (coords){
var i;
for (i=0; i < coords.length; i+=1) {
x = parseInt(coords[i].slice(0, 3));
y = parseInt(coords[i].slice(4, 7));
if (i===0){
x1 = x;
x2 = x;
y1 = y;
y2 = y;
} else {
x1 = Math.min(x1, x);
x2 = Math.max(x2, x);
y1 = Math.min(y1, y);
y2 = Math.max(y2, y);
}
}
if (x1==x2 && y1==y2){
x2 = 1000 - x1;
y2 = 1000 - y1;
}
return '' + x1 + ' ' + x2 + ' ' + y1 + ' ' + y2;
} else {
return '';
}
},
displace: function(text,x,y){
var xpos;
var ypos;
var re = '[0-9]{3}x[0-9]{3}';
var matches = text.match(new RegExp(re,'g'));
if (matches){
var i;
for(i=0; i<matches.length; i+=1) {
xpos = parseInt(matches[i].slice(0, 3)) + x;
ypos = parseInt(matches[i].slice(4, 7)) + y;
text = text.replace(matches[i],xpos + "X" + ypos);
}
text = text.replace(/X/g,"x");
}
return text;
},
sizes:{
},
size: function(text) {
var w;
var h;
var s;
var size;
var fsw = sw10.fsw(text);
if (fsw) {
var bbox = sw10.bbox(fsw);
bbox = bbox.split(' ');
var x1 = bbox[0];
var x2 = bbox[1];
var y1 = bbox[2];
var y2 = bbox[3];
size = (x2-x1) + 'x' + (y2-y1);
if (size=='0x0') {return '';}
return size;
}
var key = sw10.key(text);
if (!key) {return '';}
if (sw10.sizes[key]) {return sw10.sizes[key];}
var imgData;
var i;
var zoom = 2;
var bound = 76 * zoom;
if (!sw10.canvaser){
sw10.canvaser = document.createElement("canvas");
sw10.canvaser.width = bound;
sw10.canvaser.height = bound;
}
var canvas = sw10.canvaser;
var context = canvas.getContext("2d");
context.clearRect(0, 0, bound, bound);
context.font = (30*zoom) + "px 'SignWriting 2010'";
context.fillText(sw10.code(key),0,0);
imgData = context.getImageData(0,0,bound,bound).data;
wloop:
for (w=bound-1;w>=0;w--){
for (h=0;h<bound;h+=1){
for (s=0;s<4;s+=1){
i=w*4+(h*4*bound) +s;
if (imgData[i]){
break wloop;
}
}
}
}
var width = w;
hloop:
for (h=bound-1;h>=0;h--){
for (w=0;w<width;w+=1){
for (s=0;s<4;s+=1){
i=w*4+(h*4*bound) +s;
if (imgData[i]){
break hloop;
}
}
}
}
var height = h+1;
width= '' + Math.ceil(width/zoom);
height= '' + Math.ceil(height/zoom);
// Rounding error in chrome. Manual fixes.
if ('S1710d S1711d S1712d S17311 S17321 S17733 S1773f S17743 S1774f S17753 S1775f S16d33 S1713d S1714d S17301 S17329 S1715d'.indexOf(key)>-1){
width = '20';
}
if ('S24c15 S24c30'.indexOf(key)>-1){
width = '22';
}
if ('S2903b'.indexOf(key)>-1){
width = '23';
}
if ('S1d203 S1d233'.indexOf(key)>-1){
width = '25';
}
if ('S24c15'.indexOf(key)>-1){
width = '28';
}
if ('S2e629'.indexOf(key)>-1){
width = '29';
}
if ('S16541 S23425'.indexOf(key)>-1){
width = '30';
}
if ('S2d316'.indexOf(key)>-1){
width = '40';
}
if ('S2541a'.indexOf(key)>-1){
width = '50';
}
if ('S1732f S17731 S17741 S17751'.indexOf(key)>-1){
height = '20';
}
if ('S1412c'.indexOf(key)>-1){
height = '21';
}
if ('S2a903'.indexOf(key)>-1){
height = '31';
}
if ('S2b002'.indexOf(key)>-1){
height = '36';
}
size = width + 'x' + height;
// Error in chrome. Manual fix.
if (size=='0x0') {
var sizefix = 'S1000815x30 S1000921x30 S1000a30x15 S1000b30x21 S1000c15x30 S1000d21x30 ';
var ipos = sizefix.indexOf(key);
if (ipos ==-1) {
size = '';
} else {
var iend = sizefix.indexOf(' ',ipos);
size = sizefix.slice(ipos + 6,iend);
}
} else {
sw10.sizes[key]=size;
}
return size;
},
max: function(fsw,type){
var range = sw10.type(type);
var start = range[0];
var end = range[1];
var re = 'S' + sw10.range(start,end,1) + '[0-5][0-9a-f][0-9]{3}x[0-9]{3}';
var matches = fsw.match(new RegExp(re,'g'));
if (matches){
var key;
var x;
var y;
var size;
var output='';
var i;
for (i=0; i < matches.length; i+=1) {
key = matches[i].slice(0,6);
x = parseInt(matches[i].slice(6, 9));
y = parseInt(matches[i].slice(10, 13));
size =sw10.size(key).split('x');
output += key + x + "x" + y + (x+parseInt(size[0])) + 'x' + (y+parseInt(size[1]));
}
return output;
} else {
return '';
}
},
norm: function (fsw){
var minx;
var maxx;
var miny;
var maxy;
var hbox = sw10.bbox(sw10.max(fsw,'hcenter'));
var vbox = sw10.bbox(sw10.max(fsw,'vcenter'));
var box = sw10.bbox(sw10.max(fsw));
if (!box) {return "";}
if (vbox){
minx = parseInt(vbox.slice(0,3));
maxx = parseInt(vbox.slice(4,7));
} else {
minx = parseInt(box.slice(0,3));
maxx = parseInt(box.slice(4,7));
}
if (hbox){
miny = parseInt(hbox.slice(8,11));
maxy = parseInt(hbox.slice(12,15));
} else {
miny = parseInt(box.slice(8,11));
maxy = parseInt(box.slice(12,15));
}
var xcenter = parseInt((minx + maxx)/2);
var ycenter = parseInt((miny + maxy)/2);
var xdiff = 500 - xcenter;
var ydiff = 500 - ycenter;
var start = fsw.match(/(A(S[123][0-9a-f]{2}[0-5][0-9a-f])+)?[BLMR]/);
if (!start) {
start = 'M';
} else {
start = start[0];
}
fsw = start + parseInt(box.slice(4,7)) + "x" + parseInt(box.slice(12,15)) + sw10.filter(fsw);
return sw10.displace(fsw,xdiff,ydiff);
},
svg: function(text,options){
var fsw = sw10.fsw(text);
var styling = sw10.styling(text);
var stylings;
var pos;
var keysize;
var colors;
var i;
var size;
if (!fsw) {
var key = sw10.key(text);
keysize = sw10.size(key);
if (!keysize) {return '';}
if (key.length==6) {
fsw = key + "500x500";
} else {
fsw = key;
}
}
if (!options) {
options = {};
}
if (options.size) {
options.size = parseFloat(options.size) || 'x';
} else {
options.size = 1;
}
if (options.colorize) {
options.colorize = true;
} else {
options.colorize = false;
}
if (options.pad) {
options.pad = parseInt(options.pad);
} else {
options.pad = 0;
}
if (!options.line){
options.line="black";
} else {
options.line = /^[0-9a-fA-F]{3}([0-9a-fA-F]{3})?$/g.test(options.line)?"#"+options.line:options.line;
}
if (!options.fill){
options.fill="white";
} else {
options.fill = /^[0-9a-fA-F]{3}([0-9a-fA-F]{3})?$/g.test(options.fill)?"#"+options.fill:options.fill;
}
if (!options.back){
options.back="";
} else {
options.back = /^[0-9a-fA-F]{3}([0-9a-fA-F]{3})?$/g.test(options.back)?"#"+options.back:options.back;
}
options.E = [];
options.F = [];
options.view = options.view=="key"?"key":options.view=="uni8"?"uni8":options.view=="pua"?"pua":options.view=="uni10"?"uni10":"code";
options.copy = options.copy=="code"?"code":options.copy=="uni8"?"uni8":options.copy=="pua"?"pua":options.copy=="uni10"?"uni10":"key";
if (styling){
var rs;
rs = styling.match(/C/);
options.colorize = rs?true:false;
rs = styling.match(/P[0-9]{2}/);
if (rs){
options.pad = parseInt(rs[0].substring(1,rs[0].length));
}
rs = styling.match(/G_([0-9a-fA-F]{3}([0-9a-fA-F]{3})?|[a-zA-Z]+)_/);
if (rs){
var back = rs[0].substring(2,rs[0].length-1);
options.back = /^[0-9a-fA-F]{3}([0-9a-fA-F]{3})?$/g.test(back)?"#"+back:back;
}
//fix
stylings = styling.split('-');
rs = stylings[1].match(/D_([0-9a-f]{3}([0-9a-f]{3})?|[a-zA-Z]+)(,([0-9a-f]{3}([0-9a-f]{3})?|[a-zA-Z]+))?_/);
if (rs) {
colors = rs[0].substring(2,rs[0].length-1).split(',');
if (colors[0]) {
options.line = /^[0-9a-fA-F]{3}([0-9a-fA-F]{3})?$/g.test(colors[0])?"#"+colors[0]:colors[0];
}
if (colors[1]) {
options.fill = /^[0-9a-fA-F]{3}([0-9a-fA-F]{3})?$/g.test(colors[1])?"#"+colors[1]:colors[1];
}
}
rs = stylings[1].match(/Z([0-9]+(\.[0-9]+)?|x)/);
if (rs){
options.size = parseFloat(rs[0].substring(1,rs[0].length)) || 'x';
}
if (!stylings[2]) {
stylings[2]='';
}
rs = stylings[2].match(/D[0-9]{2}_([0-9a-f]{3}([0-9a-f]{3})?|[a-wyzA-Z]+)(,([0-9a-f]{3}([0-9a-f]{3})?|[a-wyzA-Z]+))?_/g);
if (rs) {
for (i=0; i < rs.length; i+=1) {
pos = parseInt(rs[i].substring(1,3));
colors = rs[i].substring(4,rs[i].length-1).split(',');
if (colors[0]) {
colors[0] = /^[0-9a-fA-F]{3}([0-9a-fA-F]{3})?$/g.test(colors[0])?"#"+colors[0]:colors[0];
}
if (colors[1]) {
colors[1] = /^[0-9a-fA-F]{3}([0-9a-fA-F]{3})?$/g.test(colors[1])?"#"+colors[1]:colors[1];
}
options.E[pos]=colors;
}
}
rs = stylings[2].match(/Z[0-9]{2},[0-9]+(\.[0-9]+)?(,[0-9]{3}x[0-9]{3})?/g);
if (rs){
for (i=0; i < rs.length; i+=1) {
pos = parseInt(rs[i].substring(1,3));
size = rs[i].substring(4,rs[i].length).split(',');
size[0]=parseFloat(size[0]);
options.F[pos]=size;
}
}
}
var sym;
var syms;
var gelem;
var rsym = /S[123][0-9a-f]{2}[0-5][0-9a-f][0-9]{3}x[0-9]{3}/g;
var o = {};
o.L = -1;
o.R = 1;
var x;
var x1 = 500;
var x2 = 500;
var y;
var y1 = 500;
var y2 = 500;
var k;
var w;
var h;
var l;
k = fsw.charAt(0);
var bbox = sw10.bbox(fsw);
bbox = bbox.split(' ');
x1 = parseInt(bbox[0]);
x2 = parseInt(bbox[1]);
y1 = parseInt(bbox[2]);
y2 = parseInt(bbox[3]);
if (k == 'S') {
if (x1==500 && y1==500){
size = keysize.split('x');
x2 = 500 + parseInt(size[0]);
y2 = 500 + parseInt(size[1]);
} else {
x2 = 1000-x1;
y2 = 1000-y1;
}
}
syms = fsw.match(rsym);
if (!syms) syms=[];
var keysized;
for (i=0; i < syms.length; i+=1) {
sym = syms[i].slice(0,6);
x = syms[i].slice(6, 9);
y = syms[i].slice(10, 13);
if (options.F[i+1]){
if (options.F[i+1][1]){
x = parseInt(x) + parseInt(options.F[i+1][1].slice(0,3))-500;
y = parseInt(y) + parseInt(options.F[i+1][1].slice(4,7))-500;
x1 = Math.min(x1,x);
y1 = Math.min(y1,y);
}
keysized = sw10.size(sym);
if (keysized) {
keysized = keysized.split('x');
x2 = Math.max(x2,parseInt(x) + (options.F[i+1][0] * parseInt(keysized[0])));
y2 = Math.max(y2,parseInt(y) + (options.F[i+1][0] * parseInt(keysized[1])));
}
}
gelem = '<g transform="translate(' + x + ',' + y + ')">';
gelem += '<text ';
gelem += 'class="sym-fill" ';
if (!options.css) {
gelem += 'style="pointer-events:none;font-family:\'SignWriting 2010 Filling\';font-size:' + (options.F[i+1]?30*options.F[i+1][0]:30) + 'px;fill:' + (options.E[i+1]?options.E[i+1][1]?options.E[i+1][1]:options.fill:options.fill) + ';';
gelem += options.view=='code'?'':'-webkit-font-feature-settings:\'liga\';font-feature-settings:\'liga\';';
gelem += '"';
//-moz-font-feature-settings:'liga';
}
gelem += '>';
gelem += options.view=="key"?sym:options.view=="uni8"?sw10.uni8(sym):options.view=="pua"?sw10.pua(sym):options.view=="uni10"?sw10.uni10(sym):sw10.code(sym);
gelem += '</text>';
gelem += '<text ';
gelem += 'class="sym-line" ';
if (!options.css) {
gelem += 'style="';
gelem += options.view==options.copy?'':'pointer-events:none;';
gelem += 'font-family:\'SignWriting 2010\';font-size:' + (options.F[i+1]?30*options.F[i+1][0]:30) + 'px;fill:' + (options.E[i+1]?options.E[i+1][0]:options.colorize?'#'+sw10.colorize(sym):options.line) + ';';
gelem += options.view=='code'?'':'-webkit-font-feature-settings:\'liga\';font-feature-settings:\'liga\';';
gelem += '"';
}
gelem += '>';
gelem += options.view=="key"?sym:options.view=="uni8"?sw10.uni8(sym):options.view=="pua"?sw10.pua(sym):options.view=="uni10"?sw10.uni10(sym):sw10.code(sym);
gelem += '</text>';
gelem += '</g>';
syms[i] = gelem;
}
x1 = x1 - options.pad;
x2 = x2 + options.pad;
y1 = y1 - options.pad;
y2 = y2 + options.pad;
w = x2 - x1;
h = y2 - y1;
l = o[k] || 0;
l = l * 75 + x1 - 400;
var svg = '<svg xmlns="http://www.w3.org/2000/svg" ';
if (options.class) {
svg += 'class="' + options.class + '" ';
}
if (options.size!='x') {
svg += 'width="' + (w * options.size) + '" height="' + (h * options.size) + '" ';
}
svg += 'viewBox="' + x1 + ' ' + y1 + ' ' + w + ' ' + h + '">';
if (options.view!=options.copy) {
svg += '<text style="font-size:0%;">';
svg += options.copy=="code"?sw10.code(text):options.copy=="uni8"?sw10.uni8(text):options.copy=="pua"?sw10.pua(text):options.copy=="uni10"?sw10.uni10(text):text;
svg += '</text>';
}
if (options.back) {
svg += ' <rect x="' + x1 + '" y="' + y1 + '" width="' + w + '" height="' + h + '" style="fill:' + options.back + ';" />';
}
svg += syms.join('') + "</svg>";
if (options.laned){
svg = '<div style="padding:10px;position:relative;width:' + w + 'px;height:' + h + 'px;left:' + l + 'px;">' + svg + '</div>';
}
return svg;
},
symbolsList: function (text, options) {
var fsw = sw10.fsw(text);
var styling = sw10.styling(text);
var stylings;
var pos;
var keysize;
var colors;
var i;
var size;
if (!fsw) {
var key = sw10.key(text);
keysize = sw10.size(key);
if (!keysize) { return ''; }
if (key.length == 6) {
fsw = key + "500x500";
} else {
fsw = key;
}
}
if (!options) {
options = {};
}
if (options.size) {
options.size = parseFloat(options.size) || 'x';
} else {
options.size = 1;
}
if (options.colorize) {
options.colorize = true;
} else {
options.colorize = false;
}
if (options.pad) {
options.pad = parseInt(options.pad);
} else {
options.pad = 0;
}
if (!options.line) {
options.line = "black";
} else {
options.line = /^[0-9a-fA-F]{3}([0-9a-fA-F]{3})?$/g.test(options.line) ? "#" + options.line : options.line;
}
if (!options.fill) {
options.fill = "white";
} else {
options.fill = /^[0-9a-fA-F]{3}([0-9a-fA-F]{3})?$/g.test(options.fill) ? "#" + options.fill : options.fill;
}
if (!options.back) {
options.back = "";
} else {
options.back = /^[0-9a-fA-F]{3}([0-9a-fA-F]{3})?$/g.test(options.back) ? "#" + options.back : options.back;
}
options.E = [];
options.F = [];
options.view = options.view == "key" ? "key" : options.view == "uni8" ? "uni8" : options.view == "pua" ? "pua" : options.view == "uni10" ? "uni10" : "code";
options.copy = options.copy == "code" ? "code" : options.copy == "uni8" ? "uni8" : options.copy == "pua" ? "pua" : options.copy == "uni10" ? "uni10" : "key";
if (styling) {
var rs;
rs = styling.match(/C/);
options.colorize = rs ? true : false;
rs = styling.match(/P[0-9]{2}/);
if (rs) {
options.pad = parseInt(rs[0].substring(1, rs[0].length));
}
rs = styling.match(/G_([0-9a-fA-F]{3}([0-9a-fA-F]{3})?|[a-zA-Z]+)_/);
if (rs) {
var back = rs[0].substring(2, rs[0].length - 1);
options.back = /^[0-9a-fA-F]{3}([0-9a-fA-F]{3})?$/g.test(back) ? "#" + back : back;
}
//fix
stylings = styling.split('-');
rs = stylings[1].match(/D_([0-9a-f]{3}([0-9a-f]{3})?|[a-zA-Z]+)(,([0-9a-f]{3}([0-9a-f]{3})?|[a-zA-Z]+))?_/);
if (rs) {
colors = rs[0].substring(2, rs[0].length - 1).split(',');
if (colors[0]) {
options.line = /^[0-9a-fA-F]{3}([0-9a-fA-F]{3})?$/g.test(colors[0]) ? "#" + colors[0] : colors[0];
}
if (colors[1]) {
options.fill = /^[0-9a-fA-F]{3}([0-9a-fA-F]{3})?$/g.test(colors[1]) ? "#" + colors[1] : colors[1];
}
}
rs = stylings[1].match(/Z([0-9]+(\.[0-9]+)?|x)/);
if (rs) {
options.size = parseFloat(rs[0].substring(1, rs[0].length)) || 'x';
}
if (!stylings[2]) {
stylings[2] = '';
}
rs = stylings[2].match(/D[0-9]{2}_([0-9a-f]{3}([0-9a-f]{3})?|[a-wyzA-Z]+)(,([0-9a-f]{3}([0-9a-f]{3})?|[a-wyzA-Z]+))?_/g);
if (rs) {
for (i = 0; i < rs.length; i += 1) {
pos = parseInt(rs[i].substring(1, 3));
colors = rs[i].substring(4, rs[i].length - 1).split(',');
if (colors[0]) {
colors[0] = /^[0-9a-fA-F]{3}([0-9a-fA-F]{3})?$/g.test(colors[0]) ? "#" + colors[0] : colors[0];
}
if (colors[1]) {
colors[1] = /^[0-9a-fA-F]{3}([0-9a-fA-F]{3})?$/g.test(colors[1]) ? "#" + colors[1] : colors[1];
}
options.E[pos] = colors;
}
}
rs = stylings[2].match(/Z[0-9]{2},[0-9]+(\.[0-9]+)?(,[0-9]{3}x[0-9]{3})?/g);
if (rs) {
for (i = 0; i < rs.length; i += 1) {
pos = parseInt(rs[i].substring(1, 3));
size = rs[i].substring(4, rs[i].length).split(',');
size[0] = parseFloat(size[0]);
options.F[pos] = size;
}
}
}
var sym;
var syms;
var gelem;
var exsyms, exsym;
var rsym = /S[123][0-9a-f]{2}[0-5][0-9a-f][0-9]{3}x[0-9]{3}/g;
var o = {};
o.L = -1;
o.R = 1;
var x;
var x1 = 500;
var x2 = 500;
var y;
var y1 = 500;
var y2 = 500;
var k;
var w;
var h;
var l;
k = fsw.charAt(0);
var bbox = sw10.bbox(fsw);
bbox = bbox.split(' ');
x1 = parseInt(bbox[0]);
x2 = parseInt(bbox[1]);
y1 = parseInt(bbox[2]);
y2 = parseInt(bbox[3]);
if (k == 'S') {
if (x1 == 500 && y1 == 500) {
size = keysize.split('x');
x2 = 500 + parseInt(size[0]);
y2 = 500 + parseInt(size[1]);
} else {
x2 = 1000 - x1;
y2 = 1000 - y1;
}
}
syms = fsw.match(rsym);
if (!syms) syms = [];
var keysized;
exsyms = [];
for (i = 0; i < syms.length; i += 1) {
sym = syms[i].slice(0, 6);
x = syms[i].slice(6, 9);
y = syms[i].slice(10, 13);
if (options.F[i + 1]) {
if (options.F[i + 1][1]) {
x = parseInt(x) + parseInt(options.F[i + 1][1].slice(0, 3)) - 500;
y = parseInt(y) + parseInt(options.F[i + 1][1].slice(4, 7)) - 500;
x1 = Math.min(x1, x);
y1 = Math.min(y1, y);
}
keysized = sw10.size(sym);
if (keysized) {
keysized = keysized.split('x');
x2 = Math.max(x2, parseInt(x) + (options.F[i + 1][0] * parseInt(keysized[0])));
y2 = Math.max(y2, parseInt(y) + (options.F[i + 1][0] * parseInt(keysized[1])));
}
}
exsym = new Object;
exsym.x = parseInt(x);
exsym.y = parseInt(y);
var keysized1 = this.size(sym);
keysized1 = keysized1.split('x');
exsym.width = parseInt(keysized1[0]);
exsym.height = parseInt(keysized1[1]);
gelem = '<g transform="translate(' + x + ',' + y + ')">';
gelem += '<text ';
gelem += 'class="sym-fill" ';
if (!options.css) {
exsym.fontsize = Math.round(options.F[i + 1] ? 30 * options.F[i + 1][0] : 30);
exsym.nwcolor = (options.E[i + 1] ? options.E[i + 1][1] ? options.E[i + 1][1] : options.fill : options.fill);
gelem += 'style="pointer-events:none;font-family:\'SignWriting 2010 Filling\';font-size:' + (options.F[i + 1] ? 30 * options.F[i + 1][0] : 30) + 'px;fill:' + (options.E[i + 1] ? options.E[i + 1][1] ? options.E[i + 1][1] : options.fill : options.fill) + ';';
gelem += options.view == 'code' ? '' : '-webkit-font-feature-settings:\'liga\';font-feature-settings:\'liga\';';
gelem += '"';
//-moz-font-feature-settings:'liga';
}
gelem += '>';
exsym.size = options.F[i + 1] ? options.F[i + 1][0] : 1;
exsym.pua = this.pua(sym);
exsym.code = this.code(sym).codePointAt();
exsym.key = sym;
gelem += options.view == "key" ? sym : options.view == "uni8" ? sw10.uni8(sym) : options.view == "pua" ? sw10.pua(sym) : options.view == "uni10" ? sw10.uni10(sym) : sw10.code(sym);
gelem += '</text>';
gelem += '<text ';
gelem += 'class="sym-line" ';
if (!options.css) {
gelem += 'style="';
gelem += options.view == options.copy ? '' : 'pointer-events:none;';
exsym.nbcolor = (options.E[i + 1] ? options.E[i + 1][0] : options.colorize ? '#' + colorize(sym) : options.line);
gelem += 'font-family:\'SignWriting 2010\';font-size:' + (options.F[i + 1] ? 30 * options.F[i + 1][0] : 30) + 'px;fill:' + (options.E[i + 1] ? options.E[i + 1][0] : options.colorize ? '#' + sw10.colorize(sym) : options.line) + ';';
gelem += options.view == 'code' ? '' : '-webkit-font-feature-settings:\'liga\';font-feature-settings:\'liga\';';
gelem += '"';
}
gelem += '>';
gelem += options.view == "key" ? sym : options.view == "uni8" ? sw10.uni8(sym) : options.view == "pua" ? sw10.pua(sym) : options.view == "uni10" ? sw10.uni10(sym) : sw10.code(sym);
gelem += '</text>';
gelem += '</g>';
syms[i] = gelem;
exsyms[i] = exsym;
}
x1 = x1 - options.pad;
x2 = x2 + options.pad;
y1 = y1 - options.pad;
y2 = y2 + options.pad;
w = x2 - x1;
h = y2 - y1;
l = o[k] || 0;
l = l * 75 + x1 - 400;
var exsign = new Object;
var svg = '<svg xmlns="http://www.w3.org/2000/svg" ';
if (options.class) {
svg += 'class="' + options.class + '" ';
exsign.class = options.classname;
}
if (options.size != 'x') {
svg += 'width="' + (w * options.size) + '" height="' + (h * options.size) + '" ';
}
exsign.width = (w * options.size);
exsign.height = (h * options.size);
svg += 'viewBox="' + x1 + ' ' + y1 + ' ' + w + ' ' + h + '">';
exsign.text = text;
if (options.view != options.copy) {
svg += '<text style="font-size:0%;">';
svg += options.copy == "code" ? sw10.code(text) : options.copy == "uni8" ? sw10.uni8(text) : options.copy == "pua" ? sw10.pua(text) : options.copy == "uni10" ? sw10.uni10(text) : text;
svg += '</text>';
}
if (options.back) {
svg += ' <rect x="' + x1 + '" y="' + y1 + '" width="' + w + '" height="' + h + '" style="fill:' + options.back + ';" />';
}
exsign.x = x1;
exsign.y = y1;
exsign.width = w;
exsign.height = h;
exsign.backfill = options.back;
svg += syms.join('') + "</svg>";
exsign.syms = exsyms;
if (options.laned) {
svg = '<div style="padding:10px;position:relative;width:' + w + 'px;height:' + h + 'px;left:' + l + 'px;">' + svg + '</div>';
}
exsign.laned = options.laned ? true : false;
exsign.left = l;
return exsign;
},
canvas: function (text, options) {
var canvas = document.createElement("canvas");
var fsw = sw10.fsw(text,true);
var styling = sw10.styling(text);
var stylings;
var colors;
var keysize;
var keysized;
var size;
var i;
var pos;
if (!fsw) {
var key = sw10.key(text);
keysize=sw10.size(key);
if (!key) {return '';}
if (key.length==6) {
fsw = key + "500x500";
} else {
fsw = key;
}
}
if (!options) {
options = {};
}
if (options.size) {
options.size = parseFloat(options.size);
} else {
options.size = 1;
}
if (options.colorize) {
options.colorize = true;
} else {
options.colorize = false;
}
if (options.pad) {
options.pad = parseInt(options.pad);
} else {
options.pad = 0;
}
if (!options.line){
options.line="black";
} else {
options.line = /^[0-9a-fA-F]{3}([0-9a-fA-F]{3})?$/g.test(options.line)?"#"+options.line:options.line;
}
if (!options.fill){
options.fill="white";
} else {
options.fill = /^[0-9a-fA-F]{3}([0-9a-fA-F]{3})?$/g.test(options.fill)?"#"+options.fill:options.fill;
}
if (!options.back){
options.back="";
} else {
options.back = /^[0-9a-fA-F]{3}([0-9a-fA-F]{3})?$/g.test(options.back)?"#"+options.back:options.back;
}
options.E = [];
options.F = [];
if (styling){
var rs;
rs = styling.match(/C/);
options.colorize = rs?true:false;
rs = styling.match(/P[0-9]{2}/);
if (rs){
options.pad = parseInt(rs[0].substring(1,rs[0].length));
}
rs = styling.match(/G_([0-9a-fA-F]{3}([0-9a-fA-F]{3})?|[a-zA-Z]+)_/);
if (rs){
var back = rs[0].substring(2,rs[0].length-1);
options.back = /^[0-9a-fA-F]{3}([0-9a-fA-F]{3})?$/g.test(back)?"#"+back:back;
}
//fix
stylings = styling.split('-');
rs = stylings[1].match(/D_([0-9a-f]{3}([0-9a-f]{3})?|[a-zA-Z]+)(,([0-9a-f]{3}([0-9a-f]{3})?|[a-zA-Z]+))?_/);
if (rs) {
colors = rs[0].substring(2,rs[0].length-1).split(',');
if (colors[0]) {
options.line = /^[0-9a-fA-F]{3}([0-9a-fA-F]{3})?$/g.test(colors[0])?"#"+colors[0]:colors[0];
}
if (colors[1]) {
options.fill = /^[0-9a-fA-F]{3}([0-9a-fA-F]{3})?$/g.test(colors[1])?"#"+colors[1]:colors[1];
}
}
rs = stylings[1].match(/Z[0-9]+(\.[0-9]+)?/);
if (rs){
options.size = rs[0].substring(1,rs[0].length);
}
if (!stylings[2]) {
stylings[2]='';
}
rs = stylings[2].match(/D[0-9]{2}_([0-9a-f]{3}([0-9a-f]{3})?|[a-wyzA-Z]+)(,([0-9a-f]{3}([0-9a-f]{3})?|[a-wyzA-Z]+))?_/g);
if (rs) {
for (i=0; i < rs.length; i+=1) {
pos = parseInt(rs[i].substring(1,3));
colors = rs[i].substring(4,rs[i].length-1).split(',');
if (colors[0]) {
colors[0] = /^[0-9a-fA-F]{3}([0-9a-fA-F]{3})?$/g.test(colors[0])?"#"+colors[0]:colors[0];
}
if (colors[1]) {
colors[1] = /^[0-9a-fA-F]{3}([0-9a-fA-F]{3})?$/g.test(colors[1])?"#"+colors[1]:colors[1];
}
options.E[pos]=colors;
}
}
rs = stylings[2].match(/Z[0-9]{2},[0-9]+(\.[0-9]+)?(,[0-9]{3}x[0-9]{3})?/g);
if (rs){
for (i=0; i < rs.length; i+=1) {
pos = parseInt(rs[i].substring(1,3));
size = rs[i].substring(4,rs[i].length).split(',');
size[0]=parseFloat(size[0]);
options.F[pos]=size;
}
}
}
var sym;
var syms;
var rsym = /S[123][0-9a-f]{2}[0-5][0-9a-f][0-9]{3}x[0-9]{3}/g;
var o = {};
o.L = -1;
o.R = 1;
var x;
var x1 = 500;
var x2 = 500;
var y;
var y1 = 500;
var y2 = 500;
var k;
var w;
var h;
k = fsw.charAt(0);
var bbox = sw10.bbox(fsw);
bbox = bbox.split(' ');
x1 = parseInt(bbox[0]);
x2 = parseInt(bbox[1]);
y1 = parseInt(bbox[2]);
y2 = parseInt(bbox[3]);
if (k == 'S') {
if (x1==500 && y1==500){
size = keysize.split('x');
x2 = 500 + parseInt(size[0]);
y2 = 500 + parseInt(size[1]);
} else {
x2 = 1000-x1;
y2 = 1000-y1;
}
}
syms = fsw.match(rsym);
for (i=0; i < syms.length; i+=1) {
sym = syms[i].slice(0,6);
x = syms[i].slice(6, 9);
y = syms[i].slice(10, 13);
if (options.F[i+1]){
if (options.F[i+1][1]){
x = parseInt(x) + parseInt(options.F[i+1][1].slice(0,3))-500;
y = parseInt(y) + parseInt(options.F[i+1][1].slice(4,7))-500;
x1 = Math.min(x1,x);
y1 = Math.min(y1,y);
}
keysized = sw10.size(sym);
if (keysized) {
keysized = keysized.split('x');
x2 = Math.max(x2,parseInt(x) + (options.F[i+1][0] * parseInt(keysized[0])));
y2 = Math.max(y2,parseInt(y) + (options.F[i+1][0] * parseInt(keysized[1])));
}
}
}
x1 = x1 - options.pad;
x2 = x2 + options.pad;
y1 = y1 - options.pad;
y2 = y2 + options.pad;
w = (x2-x1) * options.size;
h = (y2-y1) * options.size;
canvas.width = w;
canvas.height = h;
var context = canvas.getContext("2d");
if (options.back){
context.rect(0,0,w,h);
context.fillStyle=options.back;
context.fill();
// context.fillStyle = options.back;
// context.fillRect(0,0,w,h);
}
syms = fsw.match(rsym);
for (i=0; i < syms.length; i+=1) {
sym = syms[i].slice(0,6);
x = syms[i].slice(6, 9);
y = syms[i].slice(10, 13);
if (options.F[i+1]){
if (options.F[i+1][1]){
x = parseInt(x) + parseInt(options.F[i+1][1].slice(0,3))-500;
y = parseInt(y) + parseInt(options.F[i+1][1].slice(4,7))-500;
x1 = Math.min(x1,x);
y1 = Math.min(y1,y);
}
keysized = sw10.size(sym);
if (keysized) {
keysized = keysized.split('x');
x2 = Math.max(x2,parseInt(x) + (options.F[i+1][0] * parseInt(keysized[0])));
y2 = Math.max(y2,parseInt(y) + (options.F[i+1][0] * parseInt(keysized[1])));
}
}
context.font = (options.F[i+1]?30*options.size*options.F[i+1][0]:30*options.size) + "px 'SignWriting 2010 Filling'";
context.fillStyle = (options.E[i+1]?options.E[i+1][1]?options.E[i+1][1]:options.fill:options.fill);
context.fillText(sw10.code(sym),((x-x1)*options.size),((y-y1)*options.size));
context.font = (options.F[i+1]?30*options.size*options.F[i+1][0]:30*options.size) + "px 'SignWriting 2010'";
context.fillStyle = (options.E[i+1]?options.E[i+1][0]:options.colorize?'#'+sw10.colorize(sym):options.line);
context.fillText(sw10.code(sym),((x-x1)*options.size),((y-y1)*options.size));
}
return canvas;
},
png: function (fsw,options){
if (sw10.fsw(fsw,true) || sw10.key(fsw,true) ){
var canvas = sw10.canvas(fsw,options);
var png = canvas.toDataURL("image/png");
canvas.remove();
return png;
} else {
return '';
}
},
query: function (query){
query = query.match(/Q((A(S[123][0-9a-f]{2}[0-5u][0-9a-fu]|R[123][0-9a-f]{2}t[123][0-9a-f]{2})+)?T)?((R[123][0-9a-f]{2}t[123][0-9a-f]{2}([0-9]{3}x[0-9]{3})?)|(S[123][0-9a-f]{2}[0-5u][0-9a-fu]([0-9]{3}x[0-9]{3})?))*(V[0-9]+)?/);
if (query) {
return query[0];
} else {
return '';
}
},
range: function (min,max,hex){
var pattern;
var re;
var diff;
var tmax;
var cnt;
var minV;
var maxV;
if (!hex) {
hex='';
}
min = ("000" + min).slice(-3);
max = '' + max;
pattern='';
if (min===max) {return min;}
//ending pattern will be series of connected OR ranges
re = [];
//first pattern+ 10's don't match and the min 1's are not zero
//odd number to 9
if (!(min[0]==max[0] && min[1]==max[1])) {
if (min[2]!='0'){
pattern = min[0] + min[1];
if (hex) {
//switch for dex
switch (min[2]){
case "f":
pattern += 'f';
break;
case "e":
pattern += '[ef]';
break;
case "d":
case "c":
case "b":
case "a":
pattern += '[' + min[2] + '-f]';
break;
default:
switch (min[2]){
case "9":
pattern += '[9a-f]';
break;
case "8":
pattern += '[89a-f]';
break;
default:
pattern += '[' + min[2] + '-9a-f]';
break;
}
break;
}
diff = 15-parseInt(min[2],16) +1;
min = '' + ((parseInt(min,16)+diff)).toString(16);
re.push(pattern);
} else {
//switch for dex
switch (min[2]){
case "9":
pattern += '9';
break;
case "8":
pattern += '[89]';
break;
default:
pattern += '[' + min[2] + '-9]';
break;
}
diff = 9-min[2] +1;
min = '' + (min*1 + diff);
re.push(pattern);
}
}
}
pattern = '';
//if hundreds are different, get odd to 99 or ff
if (min[0]!=max[0]){
if (min[1]!='0'){
if (hex){
//scrape to ff
pattern = min[0];
switch (min[1]){
case "f":
pattern += 'f';
break;
case "e":
pattern += '[ef]';
break;
case "d":
case "c":
case "b":
case "a":
pattern += '[' + min[1] + '-f]';
break;
case "9":
pattern += '[9a-f]';
break;
case "8":
pattern += '[89a-f]';
break;
default:
pattern += '[' + min[1] + '-9a-f]';
break;
}
pattern += '[0-9a-f]';
diff = 15-parseInt(min[1],16) +1;
min = '' + (parseInt(min,16)+diff*16).toString(16);
re.push(pattern);
} else {
//scrape to 99
pattern = min[0];
diff = 9-min[1] +1;
switch (min[1]){
case "9":
pattern += '9';
break;
case "8":
pattern += '[89]';
break;
default:
pattern += '[' + min[1] + '-9]';
break;
}
pattern += '[0-9]';
diff = 9-min[1] +1;
min = '' + (min*1 + diff*10);
re.push(pattern);
}
}
}
pattern = '';
//if hundreds are different, get to same
if (min[0]!=max[0]){
if (hex){
diff = parseInt(max[0],16) - parseInt(min[0],16);
tmax = (parseInt(min[0],16) + diff-1).toString(16);
switch (diff){
case 1:
pattern = min[0];
break;
case 2:
pattern = '[' + min[0] + tmax + ']';
break;
default:
if (parseInt(min[0],16)>9){
minV = 'h';
} else {
minV = 'd';
}
if (parseInt(tmax,16)>9){
maxV = 'h';
} else {
maxV = 'd';
}
switch (minV + maxV){
case "dd":
pattern += '[' + min[0] + '-' + tmax + ']';
break;
case "dh":
diff = 9 - min[0];
//firs get up to 9
switch (diff){
case 0:
pattern += '[9';
break;
case 1:
pattern += '[89';
break;
default:
pattern += '[' + min[0] + '-9';
break;
}
switch (tmax[0]){
case 'a':
pattern += 'a]';
break;
case 'b':
pattern += 'ab]';
break;
default:
pattern += 'a-' + tmax + ']';
break;
}
break;
case "hh":
pattern += '[' + min[0] + '-' + tmax + ']';
break;
}
}
pattern += '[0-9a-f][0-9a-f]';
diff = parseInt(max[0],16) - parseInt(min[0],16);
min = '' + (parseInt(min,16)+diff*256).toString(16);
re.push(pattern);
} else {
diff = max[0] - min[0];
tmax = min[0]*1 + diff-1;
switch (diff){
case 1:
pattern = min[0];
break;
case 2:
pattern = '[' + min[0] + tmax + ']';
break;
default:
pattern = '[' + min[0] + '-' + tmax + ']';
break;
}
pattern += '[0-9][0-9]';
min = '' + (min*1 + diff*100);
re.push(pattern);
}
}
pattern = '';
//if tens are different, get to same
if (min[1]!=max[1]){
if (hex){
diff = parseInt(max[1],16) - parseInt(min[1],16);
tmax = (parseInt(min[1],16) + diff-1).toString(16);
pattern = min[0];
switch (diff){
case 1:
pattern += min[1];
break;
case 2:
pattern += '[' + min[1] + tmax + ']';
break;
default:
if (parseInt(min[1],16)>9){
minV = 'h';
} else {
minV = 'd';
}
if (parseInt(tmax,16)>9){
maxV = 'h';
} else {
maxV = 'd';
}
switch (minV + maxV){
case "dd":
pattern += '[' + min[1];
if (diff>1) {
pattern += '-';
}
pattern += tmax + ']';
break;
case "dh":
diff = 9 - min[1];
//firs get up to 9
switch (diff){
case 0:
pattern += '[9';
break;
case 1:
pattern += '[89';
break;
default:
pattern += '[' + min[1] + '-9';
break;
}
switch (max[1]){
case 'a':
pattern += ']';
break;
case 'b':
pattern += 'a]';
break;
default:
pattern += 'a-' + (parseInt(max[1],16)-1).toString(16) + ']';
break;
}
break;
case "hh":
pattern += '[' + min[1];
if (diff>1) {
pattern += '-';
}
pattern += (parseInt(max[1],16)-1).toString(16) + ']';
break;
}
break;
}
pattern += '[0-9a-f]';
diff = parseInt(max[1],16) - parseInt(min[1],16);
min = '' + (parseInt(min,16)+diff*16).toString(16);
re.push(pattern);
} else {
diff = max[1] - min[1];
tmax = min[1]*1 + diff-1;
pattern = min[0];
switch (diff){
case 1:
pattern += min[1];
break;
case 2:
pattern += '[' + min[1] + tmax + ']';
break;
default:
pattern += '[' + min[1] + '-' + tmax + ']';
break;
}
pattern += '[0-9]';
min = '' + (min*1 + diff*10);
re.push(pattern);
}
}
pattern = '';
//if digits are different, get to same
if (min[2]!=max[2]){
if (hex){
pattern = min[0] + min[1];
diff = parseInt(max[2],16) - parseInt(min[2],16);
if (parseInt(min[2],16)>9){
minV = 'h';
} else {
minV = 'd';
}
if (parseInt(max[2],16)>9){
maxV = 'h';
} else {
maxV = 'd';
}
switch (minV + maxV){
case "dd":
pattern += '[' + min[2];
if (diff>1) {
pattern += '-';
}
pattern += max[2] + ']';
break;
case "dh":
diff = 9 - min[2];
//firs get up to 9
switch (diff){
case 0:
pattern += '[9';
break;
case 1:
pattern += '[89';
break;
default:
pattern += '[' + min[2] + '-9';
break;
}
switch (max[2]){
case 'a':
pattern += 'a]';
break;
case 'b':
pattern += 'ab]';
break;
default:
pattern += 'a-' + max[2] + ']';
break;
}
break;
case "hh":
pattern += '[' + min[2];
if (diff>1) {
pattern += '-';
}
pattern += max[2] + ']';
break;
}
diff = parseInt(max[2],16) - parseInt(min[2],16);
min = '' + (parseInt(min,16) + diff).toString(16);
re.push(pattern);
} else {
diff = max[2] - min[2];
pattern = min[0] + min[1];
switch (diff){
case 0:
pattern += min[2];
break;
case 1:
pattern += '[' + min[2] + max[2] + ']';
break;
default:
pattern += '[' + min[2] + '-' + max[2] + ']';
break;
}
min = '' + (min*1 + diff);
re.push(pattern);
}
}
pattern = '';
//last place is whole hundred
if (min[2]=='0' && max[2]=='0') {
pattern = max;
re.push(pattern);
}
pattern = '';
cnt = re.length;
if (cnt==1){
pattern = re[0];
} else {
pattern = re.join(')|(');
pattern = '((' + pattern + '))';
}
return pattern;
},
regex: function (query,fuzz){
query = sw10.query(query);
if (!query) {
return '';
}
var matches;
var i;
var fsw_pattern;
var part;
var from;
var to;
var re_range;
var segment;
var x;
var y;
var base;
var fill;
var rotate;
if (!fuzz) {
fuzz = 20;
}
var re_sym = 'S[123][0-9a-f]{2}[0-5][0-9a-f]';
var re_coord = '[0-9]{3}x[0-9]{3}';
var re_word = '[BLMR](' + re_coord + ')(' + re_sym + re_coord + ')*';
var re_term = '(A(' + re_sym+ ')+)';
var q_range = 'R[123][0-9a-f]{2}t[123][0-9a-f]{2}';
var q_sym = 'S[123][0-9a-f]{2}[0-5u][0-9a-fu]';
var q_coord = '([0-9]{3}x[0-9]{3})?';
var q_var = '(V[0-9]+)';
var q_term;
query = sw10.query(query);
if (!query) {return '';}
if (query=='Q'){
return [re_term + "?" + re_word];
}
if (query=='QT'){
return [re_term + re_word];
}
var segments = [];
var term = query.indexOf('T')+1;
if (term){
q_term = '(A';
var qat = query.slice(0,term);
query = query.replace(qat,'');
if (qat == 'QT') {
q_term += '(' + re_sym + ')+)';
} else {
matches = qat.match(new RegExp('(' + q_sym + '|' + q_range + ')','g'));
if (matches){
var matched;
for(i=0; i<matches.length; i+=1) {
matched = matches[i].match(new RegExp(q_sym));
if (matched){
segment = matched[0].slice(0,4);
fill = matched[0].slice(4,5);
if (fill=='u') {
segment += '[0-5]';
} else {
segment += fill;
}
rotate = matched[0].slice(5,6);
if (rotate=='u') {
segment += '[0-9a-f]';
} else {
segment += rotate;
}
q_term += segment;
} else {
from = matches[i].slice(1,4);
to = matches[i].slice(5,8);
re_range = sw10.range(from,to,'hex');
segment = 'S' + re_range + '[0-5][0-9a-f]';
q_term += segment;
}
}
q_term += '(' + re_sym + ')*)';
}
}
}
//get the variance
matches = query.match(new RegExp(q_var,'g'));
if (matches) {
fuzz = matches.toString().slice(1)*1;
}
//this gets all symbols with or without location
fsw_pattern = q_sym + q_coord;
matches = query.match(new RegExp(fsw_pattern,'g'));
if (matches){
for(i=0; i<matches.length; i+=1) {
part = matches[i].toString();
base = part.slice(1,4);
segment = 'S' + base;
fill = part.slice(4,5);
if (fill=='u') {
segment += '[0-5]';
} else {
segment += fill;
}
rotate = part.slice(5,6);
if (rotate=='u') {
segment += '[0-9a-f]';
} else {
segment += rotate;
}
if (part.length>6){
x = part.slice(6,9)*1;
y = part.slice(10,13)*1;
//now get the x segment range+++
segment += sw10.range((x-fuzz),(x+fuzz));
segment += 'x';
segment += sw10.range((y-fuzz),(y+fuzz));
} else {
segment += re_coord;
}
//now I have the specific search symbol
// add to general ksw word
segment = re_word + segment + '(' + re_sym + re_coord + ')*';
if (term) {
segment = q_term + segment;
} else {
segment = re_term + "?" + segment;
}
segments.push(segment);
}
}
//this gets all ranges
fsw_pattern = q_range + q_coord;
matches = query.match(new RegExp(fsw_pattern,'g'));
if (matches){
for(i=0; i<matches.length; i+=1) {
part = matches[i].toString();
from = part.slice(1,4);
to = part.slice(5,8);
re_range = sw10.range(from,to,"hex");
segment = 'S' + re_range + '[0-5][0-9a-f]';
if (part.length>8){
x = part.slice(8,11)*1;
y = part.slice(12,15)*1;
//now get the x segment range+++
segment += sw10.range((x-fuzz),(x+fuzz));
segment += 'x';
segment += sw10.range((y-fuzz),(y+fuzz));
} else {
segment += re_coord;
}
// add to general ksw word
segment = re_word + segment + '(' + re_sym + re_coord + ')*';
if (term) {
segment = q_term + segment;
} else {
segment = re_term + "?" + segment;
}
segments.push(segment);
}
}
if (!segments.length){
segments.push(q_term + re_word);
}
return segments;
},
results: function (query,text,lane){
if (!text) {return [];}
if("BLMR".indexOf(lane) === -1 || lane.length>1) {
lane='';
}
var pattern;
var matches;
var parts;
var words;
var re = sw10.regex(query);
if (!re) {return [];}
var i;
for(i=0; i<re.length; i+=1) {
pattern = re[i];
matches = text.match(new RegExp(pattern,'g'));
if (matches){
text = matches.join(' ');
} else {
text ='';
}
}
if (text){
if (lane){
text = text.replace(/B/g,lane);
text = text.replace(/L/g,lane);
text = text.replace(/M/g,lane);
text = text.replace(/R/g,lane);
}
parts = text.split(' ');
words = parts.filter(function(element) {
return element in parts ? false : parts[element] = true;
}, {});
} else {
words = [];
}
return words;
},
lines: function (query,text,lane){
if (!text) {return [];}
if("BLMR".indexOf(lane) === -1 || lane.length>1) {
lane='';
}
var pattern;
var matches;
var parts;
var words;
var re = sw10.regex(query);
if (!re) {return [];}
var i;
for(i=0; i<re.length; i+=1) {
pattern = re[i];
pattern = '^' + pattern + '.*';
matches = text.match(new RegExp(pattern,'mg'));
if (matches){
text = matches.join("\n");
} else {
text ='';
}
}
if (text){
if (lane){
text = text.replace(/B/g,lane);
text = text.replace(/L/g,lane);
text = text.replace(/M/g,lane);
text = text.replace(/R/g,lane);
}
parts = text.split("\n");
words = parts.filter(function(element) {
return element in parts ? false : parts[element] = true;
}, {});
} else {
words = [];
}
return words;
},
convert: function (fsw,flags){
// update to new set of flags
// A - exact symbol in temporal prefix
// a - general symbol in temporal prefix
// S - exact symbol in spatial signbox
// s - general symbol in spatial signbox
// L - spatial signbox symbol at location
var i;
var query = '';
if (sw10.fsw(fsw)){
if (/^[Aa]?([Ss]L?)?$/.test(flags)){
var re_base = 'S[123][0-9a-f]{2}';
var re_sym = re_base + '[0-5][0-9a-f]';
var re_coord = '[0-9]{3}x[0-9]{3}';
var matches;
var matched;
if (flags.indexOf('A') > -1 || flags.indexOf('a') > -1) {
//exact symbols or general symbols in order
matches = fsw.match(new RegExp('A(' + re_sym + ')*','g'));
if (matches){
matched = matches[0];
if (flags.indexOf('A') > -1) {
query += matched + "T";
} else {
matches = matched.match(new RegExp(re_base,'g'));
query += "A";
for(i=0; i<matches.length; i+=1) {
query += matches[i] + "uu";
}
query += "T";
}
}
}
if (flags.indexOf('S') > -1 || flags.indexOf('s') > -1) {
//exact symbols or general symbols in spatial
matches = fsw.match(new RegExp(re_sym + re_coord,'g'));
if (matches){
for(i=0; i<matches.length; i+=1) {
if (flags.indexOf('S') > -1) {
query += matches[i].slice(0,6);
} else {
query += matches[i].slice(0,4) + "uu";
}
if (flags.indexOf('L') > -1) {
query += matches[i].slice(6,13);
}
}
}
}
}
}
return query?"Q" + query:'';
},
signtext: function (signtext){
var pattern = sw10.regex('Q');
pattern = pattern[0];
pattern = '(' + pattern + '|S3[0-9a-f]{2}[0-5][0-9a-f]([0-9]{3}x[0-9]{3})' + ')';
var matches = signtext.match(new RegExp(pattern,'mg'));
return matches?matches:[];
// var key = text.match(/S[123][0-9a-f]{2}[0-5][0-9a-f]([0-9]{3}x[0-9]{3})?/g);
}
};
|
var sql = require('mssql');
import * as PORTACTION from "../actions/PORTActionConst.js"
import * as PORTSTATE from "../actions/PORTState.js"
import * as PORTCHK from "../actions/PORTChkConst.js"
import * as CONNECT from "./PORTSQLConst.js"
import * as MISC from "./Misc.js"
var portCheck2Done=false;
var portCheck2Cnt=0;
var portCheck2Failed=false;
var contChecks=false;
/*******************CHECK IF PO HAS A VALID VENDOR IN CRIBMASTER****************/
export async function portCheck2(disp){
var dispatch=disp;
var cnt=0;
portCheck2Init();
portChk2(dispatch);
while(!isPortCheck2Done() && !portCheck2Failed){
if(++cnt>15){
dispatch({ type:PORTACTION.SET_REASON, reason:`portCheck2(disp) Cannot Connection` });
dispatch({ type:PORTACTION.SET_STATE, state:PORTSTATE.FAILURE });
break;
}else{
await MISC.sleep(2000);
}
}
if(isPortCheck2Done()){
if ('development'==process.env.NODE_ENV) {
console.log(`portCheck2() Done`)
}
}
}
function portCheck2Init(){
portCheck2Done=false;
portCheck2Cnt=0;
portCheck2Failed=false;
contChecks=false;
}
export function isPortCheck2Done(){
if(
(true==portCheck2Done)
)
{
return true;
} else{
return false;
}
}
export function didCheckFail(){
if(
(true==portCheck2Failed)
)
{
return true;
} else{
return false;
}
}
export function continueChecks(){
if(true==contChecks)
{
return true;
} else{
return false;
}
}
/********************CHECK IF ALL PO CATEGORIES HAVE BEEN SELECTED FOR EACH PO ITEM & THE RECORDS ARE NOT LOCKED****************/
function portChk2(disp){
var dispatch=disp;
if ('development'==process.env.NODE_ENV) {
console.log(`portChk2(disp) top=>${portCheck2Cnt}`);
}
var cribConnection = new sql.Connection(CONNECT.cribDefTO, function(err) {
// ... error checks
if(null==err){
if ('development'==process.env.NODE_ENV) {
console.log(`portChk2(disp) Connection Sucess`);
}
// Query
let qry;
if (MISC.PROD===true) {
qry = `
select ROW_NUMBER() OVER(ORDER BY PONumber) id, po.PONumber, po.Address1
from
(
SELECT PONumber,Vendor,Address1 FROM [PO] WHERE [PO].POSTATUSNO = 3 and [PO].SITEID <> '90'
) po
left outer join
vendor
on po.vendor = Vendor.VendorNumber
where Vendor.VendorNumber is null
`;
}else{
qry = `
select ROW_NUMBER() OVER(ORDER BY PONumber) id,po.PONumber, po.Address1
from
(
SELECT PONumber,Vendor,Address1 FROM [btPO] WHERE [btPO].POSTATUSNO = 3 and [btPO].SITEID <> '90'
) po
left outer join
vendor
on po.vendor = Vendor.VendorNumber
where Vendor.VendorNumber is null
`;
}
var request = new sql.Request(cribConnection); // or: var request = connection2.request();
request.query(
qry, function(err, recordset) {
if(null==err){
// ... error checks
if ('development'==process.env.NODE_ENV) {
console.log(`portChk2(disp) Query Sucess`);
console.dir(recordset);
}
portCheck2Done=true;
if(recordset.length!==0){
if ('development'==process.env.NODE_ENV) {
console.log("portCheck2 query had records.");
}
dispatch({ type:PORTACTION.SET_CHECK2, chk2:PORTCHK.FAILURE });
dispatch({ type: PORTACTION.SET_NO_CRIB_VEN, noCribVen:recordset });
dispatch({ type:PORTACTION.SET_STATE, state:PORTSTATE.STEP_20_FAIL});
dispatch({ type:PORTACTION.SET_STATUS, status:'Found PO(s) with a missing or invalid Cribmaster vendor...' });
}else {
dispatch({ type:PORTACTION.SET_CHECK2, chk2:PORTCHK.SUCCESS});
dispatch({ type:PORTACTION.SET_STATE, state:PORTSTATE.STEP_20_PASS });
contChecks=true;
}
}else{
if(++portCheck2Cnt<3) {
if ('development'==process.env.NODE_ENV) {
console.log(`portChk2.query: ${err.message}` );
console.log(`portCheck2Cnt = ${portCheck2Cnt}`);
}
}else{
dispatch({ type:PORTACTION.SET_REASON, reason:err.message });
dispatch({ type:PORTACTION.SET_STATE, state:PORTSTATE.FAILURE });
portCheck2Failed=true;
}
}
}
);
}else{
if(++portCheck2Cnt<3) {
if ('development'==process.env.NODE_ENV) {
console.log(`portChk2.Connection: ${err.message}` );
console.log(`portCheck2Cnt = ${portCheck2Cnt}`);
}
}else{
dispatch({ type:PORTACTION.SET_REASON, reason:err.message });
dispatch({ type:PORTACTION.SET_STATE, state:PORTSTATE.FAILURE });
portCheck2Failed=true;
}
}
});
cribConnection.on('error', function(err) {
if(++portCheck2Cnt<3) {
if ('development'==process.env.NODE_ENV) {
console.log(`portChk2.on('error', function(err): ${err.message}` );
console.log(`portCheck2Cnt = ${portCheck2Cnt}`);
}
}else{
dispatch({ type:PORTACTION.SET_REASON, reason:err.message });
dispatch({ type:PORTACTION.SET_STATE, state:PORTSTATE.FAILURE });
portCheck2Failed=true;
}
});
}
|
const express = require('express');
const router = express.Router();
const pc = require('./pathway-commons-router');
router.use('/api/search', require('./search'));
router.use('/api/pc', pc);
router.use('/api/pathways', require('./pathways'));
router.use('/api/interactions', require('./interactions'));
router.use('/api/enrichment', require('./enrichment'));
router.use('/api/factoids', require('./factoids'));
router.get('/api/test/', (req, res) => {
Promise.resolve().then( () => setTimeout( () => res.json({ msg:'hi'}), 10000));
});
/* GET home page.
All URLS not specified earlier in server/index.js (e.g. REST URLs) get handled by the React UI */
router.get('*', function (req, res/*, next*/) {
res.render('index.html');
});
module.exports = router;
|
var RuleEngine = require('../index');
describe("Rules", function() {
describe(".init()", function() {
it("should empty the existing rule array", function() {
var rules = [{
"condition": function(R) {
R.when(1);
},
"consequence": function(R) {
R.stop();
}
}];
var R = new RuleEngine(rules);
R.init();
expect(R.rules).toEqual([]);
});
});
describe(".register()", function() {
it("Rule should be turned on if the field - ON is absent in the rule", function() {
var rules = [{
"condition": function(R) {
R.when(1);
},
"consequence": function(R) {
R.stop();
}
}];
var R = new RuleEngine(rules);
expect(R.rules[0].on).toEqual(true);
});
it("Rule can be passed to register as both arrays and individual objects", function() {
var rule = {
"condition": function(R) {
R.when(1);
},
"consequence": function(R) {
R.stop();
}
};
var R1 = new RuleEngine(rule);
var R2 = new RuleEngine([rule]);
expect(R1.rules).toEqual(R2.rules);
});
it("Rules can be appended multiple times via register after creating rule engine instance", function() {
var rules = [{
"condition": function(R) {
R.when(1);
},
"consequence": function(R) {
R.stop();
}
}, {
"condition": function(R) {
R.when(0);
},
"consequence": function(R) {
R.stop();
}
}];
var R1 = new RuleEngine(rules);
var R2 = new RuleEngine(rules[0]);
var R3 = new RuleEngine();
R2.register(rules[1]);
expect(R1.rules).toEqual(R2.rules);
R3.register(rules);
expect(R1.rules).toEqual(R3.rules);
});
});
describe(".sync()", function() {
it("should only push active rules into active rules array", function() {
var rules = [{
"condition": function(R) {
R.when(1);
},
"consequence": function(R) {
R.stop();
},
"id": "one",
"on": true
}, {
"condition": function(R) {
R.when(0);
},
"consequence": function(R) {
R.stop();
},
"id": "one",
"on": false
}];
var R = new RuleEngine();
R.register(rules);
expect(R.activeRules).not.toEqual(R.rules);
});
it("should sort the rules accroding to priority, if priority is present", function() {
var rules = [{
"priority": 8,
"index": 1,
"condition": function(R) {
R.when(1);
},
"consequence": function(R) {
R.stop();
},
}, {
"priority": 6,
"index": 2,
"condition": function(R) {
R.when(1);
},
"consequence": function(R) {
R.stop();
},
}, {
"priority": 9,
"index": 0,
"condition": function(R) {
R.when(1);
},
"consequence": function(R) {
R.stop();
},
}];
var R = new RuleEngine();
R.register(rules);
expect(R.activeRules[2].index).toEqual(2);
});
});
describe(".exec()", function() {
it("should run consequnce when condition matches", function() {
var rule = {
"condition": function(R) {
R.when(this && (this.transactionTotal < 500));
},
"consequence": function(R) {
this.result = false;
R.stop();
}
};
var R = new RuleEngine(rule);
R.execute({
"transactionTotal": 200
}, function(result) {
expect(result.result).toEqual(false);
});
});
it("should chain rules and find result with next()", function() {
var rule = [{
"condition": function(R) {
R.when(this && (this.card == "VISA"));
},
"consequence": function(R) {
R.stop();
this.result = "Custom Result";
},
"priority": 4
}, {
"condition": function(R) {
R.when(this && (this.transactionTotal < 1000));
},
"consequence": function(R) {
R.next();
},
"priority": 8
}];
var R = new RuleEngine(rule);
R.execute({
"transactionTotal": 200,
"card": "VISA"
}, function(result) {
expect(result.result).toEqual("Custom Result");
});
});
it("should provide access to rule definition properties via rule()", function() {
var rule = {
"name": "sample rule name",
"id": "xyzzy",
"condition": function(R) {
R.when(this && (this.input === true));
},
"consequence": function(R) {
this.result = true;
this.ruleName = R.rule().name;
this.ruleID = R.rule().id;
R.stop();
}
};
var R = new RuleEngine(rule);
R.execute({
"input": true
}, function(result) {
expect(result.ruleName).toEqual(rule.name);
expect(result.ruleID).toEqual(rule.id);
});
});
it("should include the matched rule path", function() {
var rules = [
{
"name": "rule A",
"condition": function(R) {
R.when(this && (this.x === true));
},
"consequence": function(R) {
R.next();
}
},
{
"name": "rule B",
"condition": function(R) {
R.when(this && (this.y === true));
},
"consequence": function(R) {
R.next();
}
},
{
"id": "rule C",
"condition": function(R) {
R.when(this && (this.x === true && this.y === false));
},
"consequence": function(R) {
R.next();
}
},
{
"id": "rule D",
"condition": function(R) {
R.when(this && (this.x === false && this.y === false));
},
"consequence": function(R) {
R.next();
}
},
{
"condition": function(R) {
R.when(this && (this.x === true && this.y === false));
},
"consequence": function(R) {
R.next();
}
}
];
var lastMatch = 'index_' + ((rules.length)-1).toString();
var R = new RuleEngine(rules);
R.execute({
"x": true,
"y": false
}, function(result) {
expect(result.matchPath).toEqual([rules[0].name, rules[2].id, lastMatch]);
});
});
it("should support fact as optional second parameter for es6 compatibility", function() {
var rule = {
"condition": function(R, fact) {
R.when(fact && (fact.transactionTotal < 500));
},
"consequence": function(R, fact) {
fact.result = false;
R.stop();
}
};
var R = new RuleEngine(rule);
R.execute({
"transactionTotal": 200
}, function(result) {
expect(result.result).toEqual(false);
});
});
it("should work even when process.NextTick is unavailable", function() {
process.nextTick = undefined;
var rule = {
"condition": function(R) {
R.when(this && (this.transactionTotal < 500));
},
"consequence": function(R) {
this.result = false;
R.stop();
}
};
var R = new RuleEngine(rule);
R.execute({
"transactionTotal": 200
}, function(result) {
expect(result.result).toEqual(false);
});
});
});
describe(".findRules()", function() {
var rules = [{
"condition": function(R) {
R.when(1);
},
"consequence": function(R) {
R.stop();
},
"id": "one"
}, {
"condition": function(R) {
R.when(0);
},
"consequence": function(R) {
R.stop();
},
"id": "two"
}];
var R = new RuleEngine(rules);
it("find selector function for rules should exact number of matches", function() {
expect(R.findRules({
"id": "one"
}).length).toEqual(1);
});
it("find selector function for rules should give the correct match as result", function() {
expect(R.findRules({
"id": "one"
})[0].id).toEqual("one");
});
it("find selector function should filter off undefined entries in the query if any", function() {
expect(R.findRules({
"id": "one",
"myMistake": undefined
})[0].id).toEqual("one");
});
it("find without condition works fine", function() {
expect(R.findRules().length).toEqual(2);
});
});
describe(".turn()", function() {
var rules = [{
"condition": function(R) {
R.when(1);
},
"consequence": function(R) {
R.stop();
},
"id": "one"
}, {
"condition": function(R) {
R.when(0);
},
"consequence": function(R) {
R.stop();
},
"id": "two",
"on": false
}];
var R = new RuleEngine(rules);
it("checking whether turn off rules work as expected", function() {
R.turn("OFF", {
"id": "one"
});
expect(R.findRules({
"id": "one"
})[0].on).toEqual(false);
});
it("checking whether turn on rules work as expected", function() {
R.turn("ON", {
"id": "two"
});
expect(R.findRules({
"id": "two"
})[0].on).toEqual(true);
});
});
describe(".prioritize()", function() {
var rules = [{
"condition": function(R) {
R.when(1);
},
"consequence": function(R) {
R.stop();
},
"id": "two",
"priority": 1
}, {
"condition": function(R) {
R.when(0);
},
"consequence": function(R) {
R.stop();
},
"id": "zero",
"priority": 8
}, {
"condition": function(R) {
R.when(0);
},
"consequence": function(R) {
R.stop();
},
"id": "one",
"priority": 4
}];
var R = new RuleEngine(rules);
it("checking whether prioritize work", function() {
R.prioritize(10, {
"id": "one"
});
expect(R.findRules({
"id": "one"
})[0].priority).toEqual(10);
});
it("checking whether rules reorder after prioritize", function() {
R.prioritize(10, {
"id": "one"
});
expect(R.activeRules[0].id).toEqual("one");
});
});
describe("ignoreFactChanges", function() {
var rules = [{
"name": "rule1",
"condition": function(R) {
R.when(this.value1 > 5);
},
"consequence": function(R) {
this.result = false;
this.errors = this.errors || [];
this.errors.push('must be less than 5');
R.next();
}
}];
var fact = {
"value1": 6
};
it("doesn't rerun when a fact changes if ignoreFactChanges is true", function(done) {
var R = new RuleEngine(rules, { ignoreFactChanges: true });
R.execute(fact, function(result) {
expect(result.errors).toHaveLength(1);
done();
});
});
});
describe("test Parallelism", function() {
var rules = [
{
"name": "high credibility customer - avoid checks and bypass",
"priority": 4,
"on": true,
"condition": function(R) {
R.when(this.userCredibility && this.userCredibility > 5);
},
"consequence": function(R) {
this.result = true;
R.stop();
}
},
{
"name": "block guest payment above 10000",
"priority": 3,
"condition": function(R) {
R.when(this.customerType && this.transactionTotal > 10000 && this.customerType == "guest");
},
"consequence": function(R) {
this.result = false;
R.stop();
}
},
{
"name": "is customer guest?",
"priority": 2,
"condition": function(R) {
R.when(!this.userLoggedIn);
},
"consequence": function(R) {
this.customerType = "guest";
// the fact has been altered above, so all rules will run again since ignoreFactChanges is not set.
R.next();
}
},
{
"name": "block Cashcard Payment",
"priority": 1,
"condition": function(R) {
R.when(this.cardType == "Cash Card");
},
"consequence": function(R) {
this.result = false;
R.stop();
}
}
];
var straightFact = {
"name": "straightFact",
"userCredibility": 1,
"userLoggedIn": true,
"transactionTotal": 12000,
"cardType": "Cash Card"
};
/** example of a chaned up rule. will take two iterations. ****/
var chainedFact = {
"name": "chainedFact",
"userCredibility": 2,
"userLoggedIn": false,
"transactionTotal": 100000,
"cardType": "Credit Card"
};
it("context switches and finishes the fact which needs least iteration first", function(done) {
var R = new RuleEngine(rules);
var isStraightFactFast = false;
R.execute(chainedFact, function(result) {
expect(isStraightFactFast).toBe(true);
done();
});
R.execute(straightFact, function(result) {
isStraightFactFast = true;
});
});
});
}); |
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ({
/***/ 0:
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(959);
module.exports = __webpack_require__(959);
/***/ }),
/***/ 959:
/***/ (function(module, exports) {
(function ($, undefined) {
/* Filter cell operator messages */
if (kendo.ui.FilterCell) {
kendo.ui.FilterCell.prototype.options.operators =
$.extend(true, kendo.ui.FilterCell.prototype.options.operators,{
"date": {
"eq": "Est égal à",
"gte": "Est postérieur ou égal à",
"gt": "Est postérieur",
"lte": "Est antérieur ou égal à",
"lt": "Est antérieur",
"neq": "N’est pas égal à",
"isnull": "Est nulle",
"isnotnull": "N’est pas nulle"
},
"number": {
"eq": "Est égal à",
"gte": "Est supérieur ou égal à",
"gt": "Est supérieur à",
"lte": "Est inférieur ou égal à",
"lt": "Est inférieur à",
"neq": "N’est pas égal à",
"isnull": "Est nulle",
"isnotnull": "N’est pas nulle"
},
"string": {
"endswith": "Se termine par",
"eq": "Est égal à",
"neq": "N’est pas égal à",
"startswith": "Commence par",
"contains": "Contient",
"doesnotcontain": "Ne contient pas",
"isnull": "Est nulle",
"isnotnull": "N’est pas nulle",
"isempty": "Est vide",
"isnotempty": "N’est pas vide"
},
"enums": {
"eq": "Est égal à",
"neq": "N’est pas égal à",
"isnull": "Est nulle",
"isnotnull": "N’est pas nulle"
}
});
}
/* Filter menu operator messages */
if (kendo.ui.FilterMenu) {
kendo.ui.FilterMenu.prototype.options.operators =
$.extend(true, kendo.ui.FilterMenu.prototype.options.operators,{
"date": {
"eq": "Est égal à",
"gte": "Est postérieur ou égal à",
"gt": "Est postérieur",
"lte": "Est antérieur ou égal à",
"lt": "Est antérieur",
"neq": "N’est pas égal à",
"isnull": "Est nulle",
"isnotnull": "N’est pas nulle"
},
"number": {
"eq": "Est égal à",
"gte": "Est supérieur ou égal à",
"gt": "Est supérieur à",
"lte": "Est inférieur ou égal à",
"lt": "Est inférieur à",
"neq": "N’est pas égal à",
"isnull": "Est nulle",
"isnotnull": "N’est pas nulle"
},
"string": {
"endswith": "Se termine par",
"eq": "Est égal à",
"neq": "N’est pas égal à",
"startswith": "Commence par",
"contains": "Contient",
"doesnotcontain": "Ne contient pas",
"isnull": "Est nulle",
"isnotnull": "N’est pas nulle",
"isempty": "Est vide",
"isnotempty": "N’est pas vide"
},
"enums": {
"eq": "Est égal à",
"neq": "N’est pas égal à",
"isnull": "Est nulle",
"isnotnull": "N’est pas nulle"
}
});
}
/* ColumnMenu messages */
if (kendo.ui.ColumnMenu) {
kendo.ui.ColumnMenu.prototype.options.messages =
$.extend(true, kendo.ui.ColumnMenu.prototype.options.messages,{
"columns": "Colonnes",
"sortAscending": "Tri croissant",
"sortDescending": "Tri décroissant",
"settings": "Paramètres de colonne",
"done": "Fini",
"lock": "Bloquer",
"unlock": "Ouvrir"
});
}
/* RecurrenceEditor messages */
if (kendo.ui.RecurrenceEditor) {
kendo.ui.RecurrenceEditor.prototype.options.messages =
$.extend(true, kendo.ui.RecurrenceEditor.prototype.options.messages,{
"daily": {
"interval": "jour(s)",
"repeatEvery": "Répéter chaque:"
},
"end": {
"after": " Après",
"occurrence": "occurrence(s)",
"label": "Finir:",
"never": "Jamais",
"on": "Sur",
"mobileLabel": "Ends"
},
"frequencies": {
"daily": "Une fois par jour",
"monthly": "Une fois par mois",
"never": "Jamais",
"weekly": "Une fois par semaine",
"yearly": "Une fois par an"
},
"monthly": {
"day": "Jour",
"interval": "mois",
"repeatEvery": "Répéter chaque:",
"repeatOn": "Répéter l'opération sur:"
},
"offsetPositions": {
"first": "premier",
"fourth": "quatrième",
"last": "dernier",
"second": "second",
"third": "troisième"
},
"weekly": {
"repeatEvery": "Répéter chaque:",
"repeatOn": "Répéter l'opération sur:",
"interval": "semaine(s)"
},
"yearly": {
"of": "de",
"repeatEvery": "Répéter chaque:",
"repeatOn": "Répéter l'opération sur:",
"interval": "année(ans)"
},
"weekdays": {
"day": "jour",
"weekday": "jour de la semaine",
"weekend": "jour de week-end"
}
});
}
/* Grid messages */
if (kendo.ui.Grid) {
kendo.ui.Grid.prototype.options.messages =
$.extend(true, kendo.ui.Grid.prototype.options.messages,{
"commands": {
"create": "Insérer",
"destroy": "Effacer",
"canceledit": "Annuler",
"update": "Mettre à jour",
"edit": "Éditer",
"excel": "Export to Excel",
"pdf": "Export to PDF",
"select": "Sélectionner",
"cancel": "Annuler les modifications",
"save": "Enregistrer les modifications"
},
"editable": {
"confirmation": "Êtes-vous sûr de vouloir supprimer cet enregistrement?",
"cancelDelete": "Annuler",
"confirmDelete": "Effacer"
},
"noRecords": "Aucun enregistrement disponible."
});
}
/* Pager messages */
if (kendo.ui.Pager) {
kendo.ui.Pager.prototype.options.messages =
$.extend(true, kendo.ui.Pager.prototype.options.messages,{
"allPages": "Tous",
"page": "Page",
"display": "Afficher les items {0} - {1} de {2}",
"of": "de {0}",
"empty": "Aucun enregistrement à afficher.",
"refresh": "Actualiser",
"first": "Aller à la première page",
"itemsPerPage": "articles par page",
"last": "Aller à la dernière page",
"next": "Aller à la page suivante",
"previous": "Aller à la page précédente",
"morePages": "Plusieurs pages"
});
}
/* FilterCell messages */
if (kendo.ui.FilterCell) {
kendo.ui.FilterCell.prototype.options.messages =
$.extend(true, kendo.ui.FilterCell.prototype.options.messages,{
"filter": "Filtrer",
"clear": "Effacer filtre",
"isFalse": "est fausse",
"isTrue": "est vrai",
"operator": "Opérateur"
});
}
/* FilterMenu messages */
if (kendo.ui.FilterMenu) {
kendo.ui.FilterMenu.prototype.options.messages =
$.extend(true, kendo.ui.FilterMenu.prototype.options.messages,{
"filter": "Filtrer",
"and": "Et",
"clear": "Effacer filtre",
"info": "Afficher les lignes avec la valeur qui",
"selectValue": "-Sélectionner-",
"isFalse": "est fausse",
"isTrue": "est vrai",
"or": "Ou",
"cancel": "Annuler",
"operator": "Opérateur",
"value": "Valeur"
});
}
/* FilterMultiCheck messages */
if (kendo.ui.FilterMultiCheck) {
kendo.ui.FilterMultiCheck.prototype.options.messages =
$.extend(true, kendo.ui.FilterMultiCheck.prototype.options.messages,{
"checkAll": "Choisir toutes",
"clear": "Effacer filtre",
"filter": "Filtrer",
"search": "Recherche"
});
}
/* Groupable messages */
if (kendo.ui.Groupable) {
kendo.ui.Groupable.prototype.options.messages =
$.extend(true, kendo.ui.Groupable.prototype.options.messages,{
"empty": "Faites glisser un en-tête de colonne et déposer ici pour grouper par cette colonne."
});
}
/* Editor messages */
if (kendo.ui.Editor) {
kendo.ui.Editor.prototype.options.messages =
$.extend(true, kendo.ui.Editor.prototype.options.messages,{
"bold": "Gras",
"createLink": "Insérer un lien hypertexte",
"fontName": "Police",
"fontNameInherit": "(police héritée)",
"fontSize": "Taille de police",
"fontSizeInherit": "(taille héritée)",
"formatBlock": "Style du paragraphe",
"indent": "Augmenter le retrait",
"insertHtml": "Insérer HTML",
"insertImage": "Insérer image",
"insertOrderedList": "Liste numérotée",
"insertUnorderedList": "Liste à puces",
"italic": "Italique",
"justifyCenter": "Centrer",
"justifyFull": "Justifier",
"justifyLeft": "Aligner le texte à gauche",
"justifyRight": "Aligner le texte à droite",
"outdent": "Diminuer le retrait",
"strikethrough": "Barré",
"styles": "Styles",
"subscript": "Subscript",
"superscript": "Superscript",
"underline": "Souligné",
"unlink": "Supprimer le lien hypertexte",
"deleteFile": "Êtes-vous sûr de vouloir supprimer \"{0}\"?",
"directoryNotFound": "Un répertoire avec ce nom n'a pas été trouvé.",
"emptyFolder": "Vider le dossier",
"invalidFileType": "Le fichier sélectionné \"{0}\" n'est pas valide. Les types de fichiers supportés sont {1}.",
"orderBy": "Organiser par:",
"orderByName": "Nom",
"orderBySize": "Taille",
"overwriteFile": "Un fichier avec le nom \"{0}\" existe déjà dans le répertoire courant. Voulez-vous le remplacer?",
"uploadFile": "Télécharger",
"backColor": "Couleur de fond",
"foreColor": "Couleur",
"dialogButtonSeparator": "Ou",
"dialogCancel": "Fermer",
"dialogInsert": "Insérer",
"imageAltText": "Le texte de remplacement",
"imageWebAddress": "Adresse Web",
"imageWidth": "Largeur (px)",
"imageHeight": "Hauteur (px)",
"linkOpenInNewWindow": "Ouvrir dans une nouvelle fenêtre",
"linkText": "Text",
"linkToolTip": "Info-bulle",
"linkWebAddress": "Adresse Web",
"search": "Search",
"createTable": "Insérer un tableau",
"addColumnLeft": "Add column on the left",
"addColumnRight": "Add column on the right",
"addRowAbove": "Add row above",
"addRowBelow": "Add row below",
"deleteColumn": "Supprimer la colonne",
"deleteRow": "Supprimer ligne",
"dropFilesHere": "drop files here to upload",
"formatting": "Format",
"viewHtml": "View HTML",
"dialogUpdate": "Update",
"insertFile": "Insert file",
"dialogOk": "OK",
"tableWizard": "Assistant de tableau",
"tableTab": "Table",
"cellTab": "Cellule",
"accessibilityTab": "Accessibilité",
"caption": "Sous-titre",
"summary": "Sommaire",
"width": "Largeur",
"height": "Hauteur",
"cellSpacing": "Espacement des cellules",
"cellPadding": "Rembourrage des cellules",
"cellMargin": "Marge des cellules",
"alignment": "Alignement",
"background": "Fond",
"cssClass": "CSS Classe",
"id": "Id",
"border": "Bordure",
"borderStyle": "Style de bordure",
"collapseBorders": "Rétracter bordures",
"wrapText": "Renvoi à la ligne",
"associateCellsWithHeaders": "Cellules associées aux entêtes",
"alignLeft": "Aligner à gauche",
"alignCenter": "Aligner le centre",
"alignRight": "Aligner à droite",
"alignLeftTop": "Aligner à gauche et haut",
"alignCenterTop": "Aligner le centre et haut",
"alignRightTop": "Aligner à droite et haut",
"alignLeftMiddle": "Aligner à gauche et milieu",
"alignCenterMiddle": "Aligner le centre et milieu",
"alignRightMiddle": "Aligner à droite et milieu",
"alignLeftBottom": "Aligner à gauche et bas",
"alignCenterBottom": "Aligner le centre et bas",
"alignRightBottom": "Aligner à droite et bas",
"alignRemove": "Retirer alignement",
"columns": "Colonnes",
"rows": "Lignes",
"selectAllCells": "Sélectionner toutes les cellules"
});
}
/* FileBrowser and ImageBrowser messages */
var browserMessages = {
"uploadFile" : "Charger",
"orderBy" : "Trier par",
"orderByName" : "Nom",
"orderBySize" : "Taille",
"directoryNotFound" : "Aucun répértoire de ce nom.",
"emptyFolder" : "Répertoire vide",
"deleteFile" : 'Etes-vous sûr de vouloir supprimer "{0}"?',
"invalidFileType" : "Le fichier sélectionné \"{0}\" n'est pas valide. Les type fichiers supportés sont {1}.",
"overwriteFile" : "Un fichier du nom \"{0}\" existe déjà dans ce répertoire. Voulez-vous le remplacer?",
"dropFilesHere" : "glissez les fichiers ici pour les charger",
"search" : "Recherche"
};
if (kendo.ui.FileBrowser) {
kendo.ui.FileBrowser.prototype.options.messages =
$.extend(true, kendo.ui.FileBrowser.prototype.options.messages, browserMessages);
}
if (kendo.ui.ImageBrowser) {
kendo.ui.ImageBrowser.prototype.options.messages =
$.extend(true, kendo.ui.ImageBrowser.prototype.options.messages, browserMessages);
}
/* Upload messages */
if (kendo.ui.Upload) {
kendo.ui.Upload.prototype.options.localization =
$.extend(true, kendo.ui.Upload.prototype.options.localization,{
"cancel": "Annuler",
"dropFilesHere": "déposer les fichiers à télécharger ici",
"remove": "Retirer",
"retry": "Réessayer",
"select": "Sélectionner...",
"statusFailed": "échoué",
"statusUploaded": "téléchargé",
"statusUploading": "téléchargement",
"uploadSelectedFiles": "Télécharger des fichiers",
"headerStatusUploaded": "Done",
"headerStatusUploading": "Uploading..."
});
}
/* Scheduler messages */
if (kendo.ui.Scheduler) {
kendo.ui.Scheduler.prototype.options.messages =
$.extend(true, kendo.ui.Scheduler.prototype.options.messages,{
"allDay": "toute la journée",
"cancel": "Annuler",
"editable": {
"confirmation": "Etes-vous sûr de vouloir supprimer cet élément?"
},
"date": "Date",
"destroy": "Effacer",
"editor": {
"allDayEvent": "Toute la journée",
"description": "Description",
"editorTitle": "Evènement",
"end": "Fin",
"endTimezone": "End timezone",
"repeat": "Répéter",
"separateTimezones": "Use separate start and end time zones",
"start": "Début",
"startTimezone": "Start timezone",
"timezone": " ",
"timezoneEditorButton": "Fuseau horaire",
"timezoneEditorTitle": "Fuseaux horaires",
"title": "Titre",
"noTimezone": "Pas de fuseau horaire"
},
"event": "Evènement",
"recurrenceMessages": {
"deleteRecurring": "Voulez-vous supprimer seulement cet évènement ou toute la série?",
"deleteWindowOccurrence": "Suppression de l'élément courant",
"deleteWindowSeries": "Suppression de toute la série",
"deleteWindowTitle": "Suppression d'un élément récurrent",
"editRecurring": "Voulez-vous modifier seulement cet évènement ou toute la série?",
"editWindowOccurrence": "Modifier l'occurrence courante",
"editWindowSeries": "Modifier la série",
"editWindowTitle": "Modification de l'élément courant"
},
"save": "Sauvegarder",
"time": "Time",
"today": "Aujourd'hui",
"views": {
"agenda": "Agenda",
"day": "Jour",
"month": "Mois",
"week": "Semaine",
"workWeek": "Semaine de travail",
"timeline": "Chronologie"
},
"deleteWindowTitle": "Suppression de l'élément",
"showFullDay": "Montrer toute la journée",
"showWorkDay": "Montrer les heures ouvrables"
});
}
/* Validator messages */
if (kendo.ui.Validator) {
kendo.ui.Validator.prototype.options.messages =
$.extend(true, kendo.ui.Validator.prototype.options.messages,{
"required": "{0} est requis",
"pattern": "{0} n'est pas valide",
"min": "{0} doit être plus grand ou égal à {1}",
"max": "{0} doit être plus petit ou égal à {1}",
"step": "{0} n'est pas valide",
"email": "{0} n'est pas un courriel valide",
"url": "{0} n'est pas une adresse web valide",
"date": "{0} n'est pas une date valide",
"dateCompare": "La date de fin doit être postérieure à la date de début"
});
}
/* Dialog */
if (kendo.ui.Dialog) {
kendo.ui.Dialog.prototype.options.messages =
$.extend(true, kendo.ui.Dialog.prototype.options.localization, {
"close": "Fermer"
});
}
/* Alert */
if (kendo.ui.Alert) {
kendo.ui.Alert.prototype.options.messages =
$.extend(true, kendo.ui.Alert.prototype.options.localization, {
"okText": "OK"
});
}
/* Confirm */
if (kendo.ui.Confirm) {
kendo.ui.Confirm.prototype.options.messages =
$.extend(true, kendo.ui.Confirm.prototype.options.localization, {
"okText": "OK",
"cancel": "Annuler"
});
}
/* Prompt */
if (kendo.ui.Prompt) {
kendo.ui.Prompt.prototype.options.messages =
$.extend(true, kendo.ui.Prompt.prototype.options.localization, {
"okText": "OK",
"cancel": "Annuler"
});
}
})(window.kendo.jQuery);
/***/ })
/******/ }); |
/**
* Created by saf on 1/6/17.
*/
import React, {Component} from 'react';
import {observer} from 'mobx-react';
import {observable, computed} from 'mobx';
import * as Table from 'reactabular-table';
import * as search from 'searchtabular';
import * as resolve from 'table-resolver';
@observer
export default class AsyncFilterTable extends Component {
@observable query = {};
constructor(props) {
super(props);
this.onRow = this.onRow.bind(this);
}
fetch() {
this.props.fetch()
}
onRow(row, {rowIndex}) {
return {
onClick: () => this.props.onSelectRow(this._data[rowIndex])
};
}
componentDidMount() {
this.fetch()
}
@computed get _data() {
return this.props.data.slice()
}
@computed get resolvedColumns() {
return resolve.columnChildren({columns: this.props.columns});
}
@computed get resolvedRows() {
return resolve.resolve({
columns: this.resolvedColumns,
method: resolve.nested
})(this._data);
}
@computed get searchedRows() {
return search.multipleColumns({
columns: this.resolvedColumns,
query: this.query
})(this.resolvedRows);
}
@computed get headerRows() {
return resolve.headerRows({columns: this.props.columns})
}
render() {
return (
<Table.Provider
className="table is-striped"
columns={this.resolvedColumns}
>
<Table.Header headerRows={this.headerRows}>
<search.Columns
query={this.query}
columns={this.resolvedColumns}
onChange={query => this.query = query}
/>
</Table.Header>
<Table.Body
rows={this.searchedRows}
rowKey={this.props.rowKey}
onRow={this.onRow}
/>
</Table.Provider>
)
}
}
AsyncFilterTable.propTypes = {
columns: React.PropTypes.array.isRequired,
data: React.PropTypes.object.isRequired,
rowKey: React.PropTypes.string.isRequired,
fetch: React.PropTypes.func.isRequired,
}; |
/*
* Copyright (C) 2013-2015 Uncharted Software Inc.
*
* Property of Uncharted(TM), formerly Oculus Info Inc.
* http://uncharted.software/
*
* Released under the MIT License.
*
* 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.
*/
define(
[
'lib/communication/accountsViewChannels',
'views/components/resultComponentBase'
],
function(
accountsChannel,
resultComponentBase
) {
//--------------------------------------------------------------------------------------------------------------
var _add = function(xfId, container, headerInfo, result, snippet) {
resultComponentBase.addSearchResult(
xfId,
container,
headerInfo,
result,
snippet,
accountsChannel.RESULT_SELECTION_CHANGE,
accountsChannel.RESULT_ENTITY_FULL_DETAILS_SHOW
);
};
//--------------------------------------------------------------------------------------------------------------
return {
addSearchResult : _add
};
}
); |
'use strict';
/**
* Module dependencies.
*/
var mongoose = require('mongoose'),
Schema = mongoose.Schema;
/**
* Tutorial Schema
*/
var TutorialSchema = new Schema({
name: {
type: String,
default: '',
required: 'Please fill Tutorial name',
trim: true
},
created: {
type: Date,
default: Date.now
},
user: {
type: Schema.ObjectId,
ref: 'User'
}
});
mongoose.model('Tutorial', TutorialSchema); |
define(['./utilities/cookie'], function(cookie) {
/**
* sails.io.js
*
* This file is completely optional, and merely here for your convenience.
*
* It reduces the amount of browser code necessary to send and receive messages
* to & from Sails by simulating a REST client interface on top of socket.io.
* It models its API after the pattern in jQuery you might be familiar with.
*
* So to switch from using AJAX to Socket.io, instead of:
* `$.post( url, [data], [cb] )`
*
* You would use:
* `socket.post( url, [data], [cb] )`
*
* For more information, visit:
* http://sailsjs.org/#documentation
*/
// We'll be adding methods to `io.SocketNamespace.prototype`, the prototype for the
// Socket instance returned when the browser connects with `io.connect()`
var Socket = io.SocketNamespace;
/**
* Simulate a GET request to sails
* e.g.
* `socket.get('/user/3', Stats.populate)`
*
* @param {String} url :: destination URL
* @param {Object} params :: parameters to send with the request [optional]
* @param {Function} cb :: callback function to call when finished [optional]
*/
Socket.prototype.get = function(url, data, cb) {
return this.request(url, data, cb, 'get');
};
/**
* Simulate a POST request to sails
* e.g.
* `socket.post('/event', newMeeting, $spinner.hide)`
*
* @param {String} url :: destination URL
* @param {Object} params :: parameters to send with the request [optional]
* @param {Function} cb :: callback function to call when finished [optional]
*/
Socket.prototype.post = function(url, data, cb) {
return this.request(url, data, cb, 'post');
};
/**
* Simulate a PUT request to sails
* e.g.
* `socket.post('/event/3', changedFields, $spinner.hide)`
*
* @param {String} url :: destination URL
* @param {Object} params :: parameters to send with the request [optional]
* @param {Function} cb :: callback function to call when finished [optional]
*/
Socket.prototype.put = function(url, data, cb) {
return this.request(url, data, cb, 'put');
};
/**
* Simulate a DELETE request to sails
* e.g.
* `socket.delete('/event', $spinner.hide)`
*
* @param {String} url :: destination URL
* @param {Object} params :: parameters to send with the request [optional]
* @param {Function} cb :: callback function to call when finished [optional]
*/
Socket.prototype['delete'] = function(url, data, cb) {
return this.request(url, data, cb, 'delete');
};
/**
* Simulate HTTP over Socket.io
* @api private :: but exposed for backwards compatibility w/ <= sails@~0.8
*/
Socket.prototype.request = request;
function request(url, data, cb, method) {
var socket = this;
var usage = 'Usage:\n socket.' +
(method || 'request') +
'( destinationURL, dataToSend, fnToCallWhenComplete )';
// Remove trailing slashes and spaces
url = url.replace(/^(.+)\/*\s*$/, '$1');
// If method is undefined, use 'get'
method = method || 'get';
if (typeof url !== 'string') {
throw new Error('Invalid or missing URL!\n' + usage);
}
// Allow data arg to be optional
if (typeof data === 'function') {
cb = data;
data = {};
}
data.token = cookie.read('sx_jwt');
// Build to request
var json = window.io.JSON.stringify({
url : url,
data : data
});
// Send the message over the socket
socket.emit(method, json, function afterEmitted(result) {
var parsedResult = result;
try {
parsedResult = window.io.JSON.parse(result);
} catch (e) {
if (typeof console !== 'undefined') {
console.warn("Could not parse:", result, e);
}
throw new Error("Server response could not be parsed!\n" + result);
}
// TODO: Handle errors more effectively
if (parsedResult === 404) throw new Error("404: Not found");
if (parsedResult === 403) throw new Error("403: Forbidden");
if (parsedResult === 500) throw new Error("500: Server error");
cb && cb(parsedResult);
});
}
return io;
});
|
cc._RFpush({ exports: {} }, '414458STphLF75+aFmYFzfh', 'EffectPreview');
"use strict";
var Editor = parent.Editor;
cc.Class({
"extends": cc.Component,
properties: {
isAllChildrenUser: false,
frag_glsl: {
"default": null,
visible: false
},
vert_glsl_no_mvp: {
"default": null,
visible: false
},
vert_glsl: {
"default": null,
visible: false
}
},
onLoad: function onLoad() {
/*
cc.eventManager.addCustomListener(cc.Director.EVENT_AFTER_DRAW, function() {
cc.game.emit(cc.game.EVENT_HIDE, cc.game);
});
*/
/* map the attribute indexes for texture coordinates to the default */
cc.macro.VERTEX_ATTRIB_TEX_COORD = cc.macro.VERTEX_ATTRIB_TEX_COORDS;
cc.macro.VERTEX_ATTRIB_TEX_COORD1 = cc.macro.VERTEX_ATTRIB_TEX_COORDS;
cc.macro.VERTEX_ATTRIB_TEX_COORD2 = cc.macro.VERTEX_ATTRIB_TEX_COORDS;
cc.macro.VERTEX_ATTRIB_TEX_COORD3 = cc.macro.VERTEX_ATTRIB_TEX_COORDS;
this.parameters = {
startTime: Date.now(),
time: 0.0,
mouse_touch: [0.0, 0.0],
resolution: [0.0, 0.0]
};
this.uniformLocation = {};
this.node.on(cc.Node.EventType.MOUSE_MOVE, function (event) {
this.parameters.mouse_touch[0] = this.node.getContentSize().width / event.getLocationX();
this.parameters.mouse_touch[1] = this.node.getContentSize().height / event.getLocationY();
}, this);
this.node.on( cc.Node.EventType.TOUCH_MOVE, function (event) {
this.parameters.mouse_touch[0] = this.node.getContentSize().width / event.getLocationX();
this.parameters.mouse_touch[1] = this.node.getContentSize().height / event.getLocationY();
}, this);
var self = cc.EffectPreview = this;
cc.loader.loadRes("EffectPreview.fs.glsl", function(err, txt) {
if (err) {
cc.log(err);
} else {
self.frag_glsl = txt;
cc.loader.loadRes("EffectPreview_noMVP.vs", function(err, txt) {
if (err) {
cc.log(err);
} else {
self.vert_glsl_no_mvp = txt;
cc.loader.loadRes("EffectPreview.vs", function(err, txt) {
if (err) {
cc.log(err);
} else {
self.vert_glsl = txt;
self.updateShader();
}
});
}
});
}
});
cc.director.visit(cc.director._deltaTime);
cc.director.render(cc.director._deltaTime);
cc.game.emit(cc.game.EVENT_HIDE, cc.game);
cc.eventManager.dispatchCustomEvent("preview_did_load");
},
updateGLParameters(){
this.parameters.time = (Date.now() - this.parameters.startTime)/1000;
this.parameters.resolution[0] = ( this.node.getContentSize().width );
this.parameters.resolution[1] = ( this.node.getContentSize().height );
},
updateShader: function updateShader(shaderDef) {
this.shaderDef = shaderDef;
this.vert_glsl = shaderDef.vshader();
this.frag_glsl = shaderDef.fshader();
//fs = fs.split("uniform sampler2D texture12;").join("");
//fs = fs.split("texture12").join("CC_Texture0");
//parent.Editor.log("!", shaderDef.attributes);
//{ vertexUV0: 'TEXCOORD0', vertexPosition: 'POSITION' }
//parent.Editor.log("!", shaderDef.uniforms);
//{ viewProjectionMatrix: 'VIEW_PROJECTION_MATRIX', worldMatrix: 'WORLD_MATRIX' }
var linked = false;
this._program = new cc.GLProgram();
if (cc.sys.isNative) {
cc.log("use native GLProgram");
this._program.initWithString(this.vert_glsl_no_mvp, this.frag_glsl);
linked = this._program.link();
} else {
this._program.initWithVertexShaderByteArray(this.vert_glsl, this.frag_glsl);
for(var i = 0; i < shaderDef.attributes.length; i++) {
var attribute = shaderDef.attributes[i];
this._program.addAttribute(cc.macro["ATTRIBUTE_NAME_" + attribute.key], cc.macro["VERTEX_ATTRIB_" + attribute.key]);
}
linked = this._program.link();
}
if (linked) {
this._program.updateUniforms();
if (cc.sys.isNative) {
} else {
for(var i = 0; i < shaderDef.uniforms.length; i++) {
var uniform = shaderDef.uniforms[i];
this.uniformLocation[uniform.name] = this._program.getUniformLocationForName( uniform.name );
}
}
this.setProgram(this.node._sgNode, this._program);
} else {
Editor.error("Could't link custom shader; using the default one.");
this.setProgram(this.node._sgNode, cc.shaderCache.programForKey("ShaderPositionTextureColor"));
}
cc.director.visit(cc.director._deltaTime);
cc.director.render(cc.director._deltaTime);
cc.game.emit(cc.game.EVENT_HIDE, cc.game);
},
setProgram: function setProgram(node, program) {
if (cc.sys.isNative) {
var glProgram_state = cc.GLProgramState.getOrCreateWithGLProgram(program);
node.setGLProgramState(glProgram_state);
} else {
node.setShaderProgram(program);
}
var children = node.children;
if (!children) return;
for (var i = 0; i < children.length; i++) {
this.setProgram(children[i], program);
}
},
update: function(dt) {
if(this._program && this.shaderDef){
this.updateGLParameters();
if(cc.sys.isNative){
var glProgram_state = cc.GLProgramState.getOrCreateWithGLProgram(this._program);
for(var i = 0; i < this.shaderDef.uniforms.length; i++) {
var uniform = this.shaderDef.uniforms[i];
switch (uniform.type) {
case "float":
glProgram_state.setUniformFloat( uniform.name, this.parameters[uniform.name] );
break;
case "vec2":
glProgram_state.setUniformVec2( uniform.name, this.parameters[uniform.name] );
break;
}
}
}else{
for(var i = 0; i < this.shaderDef.uniforms.length; i++) {
var uniform = this.shaderDef.uniforms[i];
switch (uniform.type) {
case "float":
this._program.setUniformLocationWith1f( this.uniformLocation[uniform.name], this.parameters[uniform.name] );
break;
case "vec2":
this._program.setUniformLocationWith2f( this.uniformLocation[uniform.name], this.parameters[uniform.name][0], this.parameters[uniform.name][1] );
break;
}
}
}
}
}
});
cc._RFpop();
|
define(["module-a"], function(moduleA) {
return {
"name":"main",
"submodule":moduleA,
"project":"foo"
};
}) |
System.config({
defaultJSExtensions: true,
transpiler: "babel",
babelOptions: {
"optional": [
"runtime",
"es7.decorators"
]
},
paths: {
"github:*": "jspm_packages/github/*",
"aurelia-router/*": "dist/*.js",
"npm:*": "jspm_packages/npm/*"
},
map: {
"aurelia-dependency-injection": "npm:aurelia-dependency-injection@1.0.0-beta.1.0.1",
"aurelia-event-aggregator": "npm:aurelia-event-aggregator@1.0.0-beta.1",
"aurelia-history": "npm:aurelia-history@1.0.0-beta.1",
"aurelia-logging": "npm:aurelia-logging@1.0.0-beta.1",
"aurelia-path": "npm:aurelia-path@1.0.0-beta.1",
"aurelia-route-recognizer": "npm:aurelia-route-recognizer@1.0.0-beta.1",
"babel": "npm:babel-core@5.8.34",
"babel-runtime": "npm:babel-runtime@5.8.34",
"core-js": "npm:core-js@1.2.6",
"github:jspm/nodelibs-assert@0.1.0": {
"assert": "npm:assert@1.3.0"
},
"github:jspm/nodelibs-path@0.1.0": {
"path-browserify": "npm:path-browserify@0.0.0"
},
"github:jspm/nodelibs-process@0.1.2": {
"process": "npm:process@0.11.2"
},
"github:jspm/nodelibs-util@0.1.0": {
"util": "npm:util@0.10.3"
},
"npm:assert@1.3.0": {
"util": "npm:util@0.10.3"
},
"npm:aurelia-dependency-injection@1.0.0-beta.1.0.1": {
"aurelia-logging": "npm:aurelia-logging@1.0.0-beta.1",
"aurelia-metadata": "npm:aurelia-metadata@1.0.0-beta.1",
"aurelia-pal": "npm:aurelia-pal@1.0.0-beta.1.0.2",
"core-js": "npm:core-js@1.2.6"
},
"npm:aurelia-event-aggregator@1.0.0-beta.1": {
"aurelia-logging": "npm:aurelia-logging@1.0.0-beta.1"
},
"npm:aurelia-metadata@1.0.0-beta.1": {
"aurelia-pal": "npm:aurelia-pal@1.0.0-beta.1.0.2",
"core-js": "npm:core-js@1.2.6"
},
"npm:aurelia-route-recognizer@1.0.0-beta.1": {
"aurelia-path": "npm:aurelia-path@1.0.0-beta.1",
"core-js": "npm:core-js@1.2.6"
},
"npm:babel-runtime@5.8.34": {
"process": "github:jspm/nodelibs-process@0.1.2"
},
"npm:core-js@1.2.6": {
"fs": "github:jspm/nodelibs-fs@0.1.2",
"path": "github:jspm/nodelibs-path@0.1.0",
"process": "github:jspm/nodelibs-process@0.1.2",
"systemjs-json": "github:systemjs/plugin-json@0.1.0"
},
"npm:inherits@2.0.1": {
"util": "github:jspm/nodelibs-util@0.1.0"
},
"npm:path-browserify@0.0.0": {
"process": "github:jspm/nodelibs-process@0.1.2"
},
"npm:process@0.11.2": {
"assert": "github:jspm/nodelibs-assert@0.1.0"
},
"npm:util@0.10.3": {
"inherits": "npm:inherits@2.0.1",
"process": "github:jspm/nodelibs-process@0.1.2"
}
}
});
|
/**
* Created by Ron on 26/5/2016.
*/
"use strict";
import ReactNative, {
StyleSheet,
Text,
View,
Dimensions,
TouchableWithoutFeedback,
Image
} from 'react-native';
import React, { Component , PropTypes } from 'react';
import CommonModules,{
ThemeStyle,
dismissKeyboard,
} from '../../utils/CommonModules'
class SearchEmptyPage extends Component {
// 默认属性
static defaultProps = {};
// 属性类型
static propTypes = {};
// 构造
constructor(props) {
super(props);
// 初始状态
this.state = {};
}
// 自定义方法
onTapPage() {
dismissKeyboard()
}
// 渲染
render() {
const {_theme} = this.props
const backgroundColor = ThemeStyle[_theme].color.listBackground
return (
<TouchableWithoutFeedback onPress={this.onTapPage}>
<View style={[styles.emptypageContainer,{backgroundColor:backgroundColor}]}>
<Image source={require('./../../resources/icon-search-gray.png')} style={styles.icon}/>
<Text style={styles.text}>暂无相关搜索结果</Text>
</View>
</TouchableWithoutFeedback>
);
}
}
const styles = StyleSheet.create({
emptypageContainer: {
flex: 1,
backgroundColor: 'rgb(238,238,238)',
justifyContent: 'center',
flexDirection: 'row',
flexWrap: 'nowrap',
},
icon:{
marginTop: 200,
width: 19,
height: 19,
marginRight: 19,
},
text:{
marginTop: 200,
fontSize: 19,
color: 'rgb(143,143,143)'
}
});
export default SearchEmptyPage; |
import {
injectDeps
} from 'react-simple-di';
export default class App {
constructor(context) {
if (!context) {
const message = `Context is required when creating a new app.`;
throw new Error(message);
}
this.context = context;
this.actions = {};
this._routeFns = [];
}
_bindContext(_actions) {
const actions = {};
for (let key in _actions) {
if (_actions.hasOwnProperty(key)) {
const actionMap = _actions[key];
const newActionMap = {};
for (let actionName in actionMap) {
if (actionMap.hasOwnProperty(actionName)) {
newActionMap[actionName] =
actionMap[actionName].bind(null, this.context);
}
}
actions[key] = newActionMap;
}
}
return actions;
}
loadModule(module) {
this._checkForInit();
if (!module) {
const message = `Should provide a module to load.`;
throw new Error(message);
}
if (module.__loaded) {
const message = `This module is already loaded.`;
throw new Error(message);
}
if (module.routes) {
if (typeof module.routes !== 'function') {
const message = `Module's routes field should be a function.`;
throw new Error(message);
}
this._routeFns.push(module.routes);
}
const actions = module.actions || {};
this.actions = {
...this.actions,
...actions
};
if (module.load) {
if (typeof module.load !== 'function') {
const message = `module.load should be a function`;
throw new Error(message);
}
// This module has no access to the actions loaded after this module.
const boundedActions = this._bindContext(this.actions);
module.load(this.context, boundedActions);
}
module.__loaded = true;
}
init() {
this._checkForInit();
for (const routeFn of this._routeFns) {
const inject = comp => {
return injectDeps(this.context, this.actions)(comp);
};
routeFn(inject, this.context, this.actions);
}
this._routeFns = [];
this.__initialized = true;
}
_checkForInit() {
if (this.__initialized) {
const message = `App is already initialized`;
throw new Error(message);
}
}
}
|
export type Path = {
parent: Path,
node: ASTNode,
replace: Function,
remove: Function,
}
|
'use strict';
var mongoose = require('mongoose');
/**
* Schema defining the 'ticket' model.
*/
var TicketSchema = module.exports = new mongoose.Schema({
/**
* Describes on which board does this ticket belong.
*
* TODO Should we actually group the ticket's under the 'board' model as
* references, or keep this style?
*/
board: {
ref: 'board',
type: mongoose.Schema.Types.ObjectId,
required: true
},
/**
* Who created the ticket.
*/
createdBy: {
ref: 'user',
type: mongoose.Schema.Types.ObjectId
},
/**
* Who last edited the ticket.
*/
lastEditedBy: {
ref: 'user',
type: mongoose.Schema.Types.ObjectId
},
/**
* The ticket header.
*/
heading: {
type: String,
default: ''
},
/**
* The ticket contents.
*
* TODO Should we allow HTML content?
*/
content: {
type: String,
default: ''
},
/**
* The ticket color.
*
* TODO Enumerate the color, eg. #FFF, #BABABA...
*/
color: {
type: String,
default: '#FFFFFF'
},
/**
* Comments of the ticket
*/
comments: {
type: Number,
default: 0
},
/**
* The ticket's position. The ticket moves in a 2D-plane (x, y) with z
* indicating the 'z-index' of the ticket.
*
* TODO Clamp these to the board's size? We would need to know the ticket's
* pixel size in order to clamp the x, y -coordinates to the board's
* maximum size.
*/
position: {
x: {
type: Number,
default: 0
},
y: {
type: Number,
default: 0
}
}
});
if(!TicketSchema.options.toJSON) TicketSchema.options.toJSON = { }
if(!TicketSchema.options.toObject) TicketSchema.options.toObject = { }
TicketSchema.options.toJSON.transform = function(doc, ret) {
ret.id = doc.id;
delete ret._id;
delete ret.__v;
}
/**
* BUG See 'config/schemas/board.js' for details.
*/
TicketSchema.options.toObject.transform = TicketSchema.options.toJSON.transform;
|
'use strict';
/**
* Module dependencies.
*/
var _ = require('lodash'),
errorHandler = require('../errors.server.controller'),
mongoose = require('mongoose'),
passport = require('passport'),
User = mongoose.model('User'),
Client = mongoose.model('Client');
/**
* Signup
*/
exports.signup = function(req, res) {
// For security measurement we remove the roles from the req.body object
delete req.body.roles;
// Init Variables
var user = new User(req.body);
var message = null;
// Add missing user fields
user.provider = 'local';
user.displayName = user.firstName + ' ' + user.lastName;
// Then save the user
user.save(function(err) {
if (err) {
return res.status(400).send({
message: errorHandler.getErrorMessage(err)
});
} else {
// Remove sensitive data before login
user.password = undefined;
user.salt = undefined;
req.login(user, function(err) {
if (err) {
res.status(400).send(err);
} else {
res.json(user);
}
});
}
});
};
/**
* Signup New clients user
*/
exports.signupForClient = function(req, res) {
// For security measurement we remove the roles from the req.body object
delete req.body.roles;
// Init Variables
var user = new User(req.body);
var message = null;
// Add missing user fields
user.provider = 'local';
user.displayName = user.firstName + ' ' + user.lastName;
// Then save the user
user.save(function(err) {
if (err) {
return res.status(400).send({
message: errorHandler.getErrorMessage(err)
});
} else {
// Remove sensitive data before login
user.password = undefined;
user.salt = undefined;
Client.findById(user.client).exec(function(error,clientres){
if(error){
return res.status(400).send({
message: errorHandler.getErrorMessage(error)
});
}else{
if(clientres) {
if (clientres.users) {
clientres.users.push(user._id);
}
else {
clientres.users = [];
clientres.users.push(user._id);
}
clientres.save(function (saveerr) {
if (saveerr) {
return res.status(400).send({
message: errorHandler.getErrorMessage(error)
});
}
});
}
}
});
/*
req.login(user, function(err) {
if (err) {
res.status(400).send(err);
} else {
res.json(user);
}
});*/
}
});
};
/**
* Signin after passport authentication
*/
exports.signin = function(req, res, next) {
passport.authenticate('local', function(err, user, info) {
if (err || !user) {
res.status(400).send(info);
} else {
// Remove sensitive data before login
user.password = undefined;
user.salt = undefined;
req.login(user, function(err) {
if (err) {
res.status(400).send(err);
} else {
res.json(user);
}
});
}
})(req, res, next);
};
/**
* Signout
*/
exports.signout = function(req, res) {
req.logout();
res.redirect('/');
};
/**
* OAuth callback
*/
exports.oauthCallback = function(strategy) {
return function(req, res, next) {
passport.authenticate(strategy, function(err, user, redirectURL) {
if (err || !user) {
return res.redirect('/#!/signin');
}
req.login(user, function(err) {
if (err) {
return res.redirect('/#!/signin');
}
return res.redirect(redirectURL || '/');
});
})(req, res, next);
};
};
/**
* Helper function to save or update a OAuth user profile
*/
exports.saveOAuthUserProfile = function(req, providerUserProfile, done) {
if (!req.user) {
// Define a search query fields
var searchMainProviderIdentifierField = 'providerData.' + providerUserProfile.providerIdentifierField;
var searchAdditionalProviderIdentifierField = 'additionalProvidersData.' + providerUserProfile.provider + '.' + providerUserProfile.providerIdentifierField;
// Define main provider search query
var mainProviderSearchQuery = {};
mainProviderSearchQuery.provider = providerUserProfile.provider;
mainProviderSearchQuery[searchMainProviderIdentifierField] = providerUserProfile.providerData[providerUserProfile.providerIdentifierField];
// Define additional provider search query
var additionalProviderSearchQuery = {};
additionalProviderSearchQuery[searchAdditionalProviderIdentifierField] = providerUserProfile.providerData[providerUserProfile.providerIdentifierField];
// Define a search query to find existing user with current provider profile
var searchQuery = {
$or: [mainProviderSearchQuery, additionalProviderSearchQuery]
};
User.findOne(searchQuery, function(err, user) {
if (err) {
return done(err);
} else {
if (!user) {
var possibleUsername = providerUserProfile.username || ((providerUserProfile.email) ? providerUserProfile.email.split('@')[0] : '');
User.findUniqueUsername(possibleUsername, null, function(availableUsername) {
user = new User({
firstName: providerUserProfile.firstName,
lastName: providerUserProfile.lastName,
username: availableUsername,
displayName: providerUserProfile.displayName,
email: providerUserProfile.email,
provider: providerUserProfile.provider,
providerData: providerUserProfile.providerData
});
// And save the user
user.save(function(err) {
return done(err, user);
});
});
} else {
return done(err, user);
}
}
});
} else {
// User is already logged in, join the provider data to the existing user
var user = req.user;
// Check if user exists, is not signed in using this provider, and doesn't have that provider data already configured
if (user.provider !== providerUserProfile.provider && (!user.additionalProvidersData || !user.additionalProvidersData[providerUserProfile.provider])) {
// Add the provider data to the additional provider data field
if (!user.additionalProvidersData) user.additionalProvidersData = {};
user.additionalProvidersData[providerUserProfile.provider] = providerUserProfile.providerData;
// Then tell mongoose that we've updated the additionalProvidersData field
user.markModified('additionalProvidersData');
// And save the user
user.save(function(err) {
return done(err, user, '/#!/settings/accounts');
});
} else {
return done(new Error('User is already connected using this provider'), user);
}
}
};
/**
* Remove OAuth provider
*/
exports.removeOAuthProvider = function(req, res, next) {
var user = req.user;
var provider = req.param('provider');
if (user && provider) {
// Delete the additional provider
if (user.additionalProvidersData[provider]) {
delete user.additionalProvidersData[provider];
// Then tell mongoose that we've updated the additionalProvidersData field
user.markModified('additionalProvidersData');
}
user.save(function(err) {
if (err) {
return res.status(400).send({
message: errorHandler.getErrorMessage(err)
});
} else {
req.login(user, function(err) {
if (err) {
res.status(400).send(err);
} else {
res.json(user);
}
});
}
});
}
};
|
/*
* Copyright (C) 2009, 2010 Google Inc. All rights reserved.
* Copyright (C) 2009 Joseph Pecoraro
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* @constructor
* @param {!WebInspector.DOMAgent} domAgent
* @param {?WebInspector.DOMDocument} doc
* @param {boolean} isInShadowTree
* @param {!DOMAgent.Node} payload
*/
WebInspector.DOMNode = function(domAgent, doc, isInShadowTree, payload) {
this._domAgent = domAgent;
this.ownerDocument = doc;
this._isInShadowTree = isInShadowTree;
this.id = payload.nodeId;
domAgent._idToDOMNode[this.id] = this;
this._nodeType = payload.nodeType;
this._nodeName = payload.nodeName;
this._localName = payload.localName;
this._nodeValue = payload.nodeValue;
this._pseudoType = payload.pseudoType;
this._shadowRootType = payload.shadowRootType;
this._shadowRoots = [];
this._attributes = [];
this._attributesMap = {};
if (payload.attributes)
this._setAttributesPayload(payload.attributes);
this._userProperties = {};
this._descendantUserPropertyCounters = {};
this._childNodeCount = payload.childNodeCount || 0;
this._children = null;
this.nextSibling = null;
this.previousSibling = null;
this.firstChild = null;
this.lastChild = null;
this.parentNode = null;
if (payload.shadowRoots) {
for (var i = 0; i < payload.shadowRoots.length; ++i) {
var root = payload.shadowRoots[i];
var node = new WebInspector.DOMNode(this._domAgent, this.ownerDocument, true, root);
this._shadowRoots.push(node);
node.parentNode = this;
}
}
if (payload.templateContent) {
this._templateContent = new WebInspector.DOMNode(this._domAgent, this.ownerDocument, true, payload.templateContent);
this._templateContent.parentNode = this;
}
if (payload.children)
this._setChildrenPayload(payload.children);
this._setPseudoElements(payload.pseudoElements);
if (payload.contentDocument) {
this._contentDocument = new WebInspector.DOMDocument(domAgent, payload.contentDocument);
this._children = [this._contentDocument];
this._renumber();
}
if (this._nodeType === Node.ELEMENT_NODE) {
// HTML and BODY from internal iframes should not overwrite top-level ones.
if (this.ownerDocument && !this.ownerDocument.documentElement && this._nodeName === "HTML")
this.ownerDocument.documentElement = this;
if (this.ownerDocument && !this.ownerDocument.body && this._nodeName === "BODY")
this.ownerDocument.body = this;
} else if (this._nodeType === Node.DOCUMENT_TYPE_NODE) {
this.publicId = payload.publicId;
this.systemId = payload.systemId;
this.internalSubset = payload.internalSubset;
} else if (this._nodeType === Node.ATTRIBUTE_NODE) {
this.name = payload.name;
this.value = payload.value;
}
}
WebInspector.DOMNode.PseudoElementNames = {
Before: "before",
After: "after"
}
WebInspector.DOMNode.ShadowRootTypes = {
UserAgent: "user-agent",
Author: "author"
}
WebInspector.DOMNode.prototype = {
/**
* @return {?Array.<!WebInspector.DOMNode>}
*/
children: function()
{
return this._children ? this._children.slice() : null;
},
/**
* @return {boolean}
*/
hasAttributes: function()
{
return this._attributes.length > 0;
},
/**
* @return {number}
*/
childNodeCount: function()
{
return this._childNodeCount;
},
/**
* @return {boolean}
*/
hasShadowRoots: function()
{
return !!this._shadowRoots.length;
},
/**
* @return {!Array.<!WebInspector.DOMNode>}
*/
shadowRoots: function()
{
return this._shadowRoots.slice();
},
/**
* @return {!WebInspector.DOMNode}
*/
templateContent: function()
{
return this._templateContent;
},
/**
* @return {number}
*/
nodeType: function()
{
return this._nodeType;
},
/**
* @return {string}
*/
nodeName: function()
{
return this._nodeName;
},
/**
* @return {string|undefined}
*/
pseudoType: function()
{
return this._pseudoType;
},
/**
* @return {boolean}
*/
hasPseudoElements: function()
{
return Object.keys(this._pseudoElements).length !== 0;
},
/**
* @return {!Object.<string, !WebInspector.DOMNode>}
*/
pseudoElements: function()
{
return this._pseudoElements;
},
/**
* @return {boolean}
*/
isInShadowTree: function()
{
return this._isInShadowTree;
},
/**
* @return {?string}
*/
shadowRootType: function()
{
return this._shadowRootType || null;
},
/**
* @return {string}
*/
nodeNameInCorrectCase: function()
{
return this.isXMLNode() ? this.nodeName() : this.nodeName().toLowerCase();
},
/**
* @param {string} name
* @param {function(?Protocol.Error)=} callback
*/
setNodeName: function(name, callback)
{
DOMAgent.setNodeName(this.id, name, WebInspector.domAgent._markRevision(this, callback));
},
/**
* @return {string}
*/
localName: function()
{
return this._localName;
},
/**
* @return {string}
*/
nodeValue: function()
{
return this._nodeValue;
},
/**
* @param {string} value
* @param {function(?Protocol.Error)=} callback
*/
setNodeValue: function(value, callback)
{
DOMAgent.setNodeValue(this.id, value, WebInspector.domAgent._markRevision(this, callback));
},
/**
* @param {string} name
* @return {string}
*/
getAttribute: function(name)
{
var attr = this._attributesMap[name];
return attr ? attr.value : undefined;
},
/**
* @param {string} name
* @param {string} text
* @param {function(?Protocol.Error)=} callback
*/
setAttribute: function(name, text, callback)
{
DOMAgent.setAttributesAsText(this.id, text, name, WebInspector.domAgent._markRevision(this, callback));
},
/**
* @param {string} name
* @param {string} value
* @param {function(?Protocol.Error)=} callback
*/
setAttributeValue: function(name, value, callback)
{
DOMAgent.setAttributeValue(this.id, name, value, WebInspector.domAgent._markRevision(this, callback));
},
/**
* @return {!Object}
*/
attributes: function()
{
return this._attributes;
},
/**
* @param {string} name
* @param {function(?Protocol.Error)=} callback
*/
removeAttribute: function(name, callback)
{
/**
* @param {?Protocol.Error} error
* @this {WebInspector.DOMNode}
*/
function mycallback(error)
{
if (!error) {
delete this._attributesMap[name];
for (var i = 0; i < this._attributes.length; ++i) {
if (this._attributes[i].name === name) {
this._attributes.splice(i, 1);
break;
}
}
}
WebInspector.domAgent._markRevision(this, callback)(error);
}
DOMAgent.removeAttribute(this.id, name, mycallback.bind(this));
},
/**
* @param {function(?Array.<!WebInspector.DOMNode>)=} callback
*/
getChildNodes: function(callback)
{
if (this._children) {
if (callback)
callback(this.children());
return;
}
/**
* @this {WebInspector.DOMNode}
* @param {?Protocol.Error} error
*/
function mycallback(error)
{
if (callback)
callback(error ? null : this.children());
}
DOMAgent.requestChildNodes(this.id, undefined, mycallback.bind(this));
},
/**
* @param {number} depth
* @param {function(?Array.<!WebInspector.DOMNode>)=} callback
*/
getSubtree: function(depth, callback)
{
/**
* @this {WebInspector.DOMNode}
* @param {?Protocol.Error} error
*/
function mycallback(error)
{
if (callback)
callback(error ? null : this._children);
}
DOMAgent.requestChildNodes(this.id, depth, mycallback.bind(this));
},
/**
* @param {function(?Protocol.Error)=} callback
*/
getOuterHTML: function(callback)
{
DOMAgent.getOuterHTML(this.id, callback);
},
/**
* @param {string} html
* @param {function(?Protocol.Error)=} callback
*/
setOuterHTML: function(html, callback)
{
DOMAgent.setOuterHTML(this.id, html, WebInspector.domAgent._markRevision(this, callback));
},
/**
* @param {function(?Protocol.Error, !DOMAgent.NodeId=)=} callback
*/
removeNode: function(callback)
{
DOMAgent.removeNode(this.id, WebInspector.domAgent._markRevision(this, callback));
},
copyNode: function()
{
function copy(error, text)
{
if (!error)
InspectorFrontendHost.copyText(text);
}
DOMAgent.getOuterHTML(this.id, copy);
},
/**
* @param {string} objectGroupId
* @param {function(?Protocol.Error)=} callback
*/
eventListeners: function(objectGroupId, callback)
{
DOMAgent.getEventListenersForNode(this.id, objectGroupId, callback);
},
/**
* @return {string}
*/
path: function()
{
var path = [];
var node = this;
while (node && "index" in node && node._nodeName.length) {
path.push([node.index, node._nodeName]);
node = node.parentNode;
}
path.reverse();
return path.join(",");
},
/**
* @param {!WebInspector.DOMNode} node
* @return {boolean}
*/
isAncestor: function(node)
{
if (!node)
return false;
var currentNode = node.parentNode;
while (currentNode) {
if (this === currentNode)
return true;
currentNode = currentNode.parentNode;
}
return false;
},
/**
* @param {!WebInspector.DOMNode} descendant
* @return {boolean}
*/
isDescendant: function(descendant)
{
return descendant !== null && descendant.isAncestor(this);
},
/**
* @param {!Array.<string>} attrs
* @return {boolean}
*/
_setAttributesPayload: function(attrs)
{
var attributesChanged = !this._attributes || attrs.length !== this._attributes.length * 2;
var oldAttributesMap = this._attributesMap || {};
this._attributes = [];
this._attributesMap = {};
for (var i = 0; i < attrs.length; i += 2) {
var name = attrs[i];
var value = attrs[i + 1];
this._addAttribute(name, value);
if (attributesChanged)
continue;
if (!oldAttributesMap[name] || oldAttributesMap[name].value !== value)
attributesChanged = true;
}
return attributesChanged;
},
/**
* @param {!WebInspector.DOMNode} prev
* @param {!DOMAgent.Node} payload
* @return {!WebInspector.DOMNode}
*/
_insertChild: function(prev, payload)
{
var node = new WebInspector.DOMNode(this._domAgent, this.ownerDocument, this._isInShadowTree, payload);
this._children.splice(this._children.indexOf(prev) + 1, 0, node);
this._renumber();
return node;
},
/**
* @param {!WebInspector.DOMNode} node
*/
_removeChild: function(node)
{
if (node.pseudoType()) {
delete this._pseudoElements[node.pseudoType()];
} else {
var shadowRootIndex = this._shadowRoots.indexOf(node);
if (shadowRootIndex !== -1)
this._shadowRoots.splice(shadowRootIndex, 1);
else
this._children.splice(this._children.indexOf(node), 1);
}
node.parentNode = null;
node._updateChildUserPropertyCountsOnRemoval(this);
this._renumber();
},
/**
* @param {!Array.<!DOMAgent.Node>} payloads
*/
_setChildrenPayload: function(payloads)
{
// We set children in the constructor.
if (this._contentDocument)
return;
this._children = [];
for (var i = 0; i < payloads.length; ++i) {
var payload = payloads[i];
var node = new WebInspector.DOMNode(this._domAgent, this.ownerDocument, this._isInShadowTree, payload);
this._children.push(node);
}
this._renumber();
},
/**
* @param {!Array.<!DOMAgent.Node>|undefined} payloads
*/
_setPseudoElements: function(payloads)
{
this._pseudoElements = {};
if (!payloads)
return;
for (var i = 0; i < payloads.length; ++i) {
var node = new WebInspector.DOMNode(this._domAgent, this.ownerDocument, this._isInShadowTree, payloads[i]);
node.parentNode = this;
this._pseudoElements[node.pseudoType()] = node;
}
},
_renumber: function()
{
this._childNodeCount = this._children.length;
if (this._childNodeCount == 0) {
this.firstChild = null;
this.lastChild = null;
return;
}
this.firstChild = this._children[0];
this.lastChild = this._children[this._childNodeCount - 1];
for (var i = 0; i < this._childNodeCount; ++i) {
var child = this._children[i];
child.index = i;
child.nextSibling = i + 1 < this._childNodeCount ? this._children[i + 1] : null;
child.previousSibling = i - 1 >= 0 ? this._children[i - 1] : null;
child.parentNode = this;
}
},
/**
* @param {string} name
* @param {string} value
*/
_addAttribute: function(name, value)
{
var attr = {
name: name,
value: value,
_node: this
};
this._attributesMap[name] = attr;
this._attributes.push(attr);
},
/**
* @param {string} name
* @param {string} value
*/
_setAttribute: function(name, value)
{
var attr = this._attributesMap[name];
if (attr)
attr.value = value;
else
this._addAttribute(name, value);
},
/**
* @param {string} name
*/
_removeAttribute: function(name)
{
var attr = this._attributesMap[name];
if (attr) {
this._attributes.remove(attr);
delete this._attributesMap[name];
}
},
/**
* @param {!WebInspector.DOMNode} targetNode
* @param {?WebInspector.DOMNode} anchorNode
* @param {function(?Protocol.Error, !DOMAgent.NodeId=)=} callback
*/
moveTo: function(targetNode, anchorNode, callback)
{
DOMAgent.moveTo(this.id, targetNode.id, anchorNode ? anchorNode.id : undefined, WebInspector.domAgent._markRevision(this, callback));
},
/**
* @return {boolean}
*/
isXMLNode: function()
{
return !!this.ownerDocument && !!this.ownerDocument.xmlVersion;
},
_updateChildUserPropertyCountsOnRemoval: function(parentNode)
{
var result = {};
if (this._userProperties) {
for (var name in this._userProperties)
result[name] = (result[name] || 0) + 1;
}
if (this._descendantUserPropertyCounters) {
for (var name in this._descendantUserPropertyCounters) {
var counter = this._descendantUserPropertyCounters[name];
result[name] = (result[name] || 0) + counter;
}
}
for (var name in result)
parentNode._updateDescendantUserPropertyCount(name, -result[name]);
},
_updateDescendantUserPropertyCount: function(name, delta)
{
if (!this._descendantUserPropertyCounters.hasOwnProperty(name))
this._descendantUserPropertyCounters[name] = 0;
this._descendantUserPropertyCounters[name] += delta;
if (!this._descendantUserPropertyCounters[name])
delete this._descendantUserPropertyCounters[name];
if (this.parentNode)
this.parentNode._updateDescendantUserPropertyCount(name, delta);
},
setUserProperty: function(name, value)
{
if (value === null) {
this.removeUserProperty(name);
return;
}
if (this.parentNode && !this._userProperties.hasOwnProperty(name))
this.parentNode._updateDescendantUserPropertyCount(name, 1);
this._userProperties[name] = value;
},
removeUserProperty: function(name)
{
if (!this._userProperties.hasOwnProperty(name))
return;
delete this._userProperties[name];
if (this.parentNode)
this.parentNode._updateDescendantUserPropertyCount(name, -1);
},
getUserProperty: function(name)
{
return this._userProperties ? this._userProperties[name] : null;
},
descendantUserPropertyCount: function(name)
{
return this._descendantUserPropertyCounters && this._descendantUserPropertyCounters[name] ? this._descendantUserPropertyCounters[name] : 0;
},
/**
* @param {string} url
* @return {?string}
*/
resolveURL: function(url)
{
if (!url)
return url;
for (var frameOwnerCandidate = this; frameOwnerCandidate; frameOwnerCandidate = frameOwnerCandidate.parentNode) {
if (frameOwnerCandidate.baseURL)
return WebInspector.ParsedURL.completeURL(frameOwnerCandidate.baseURL, url);
}
return null;
}
}
/**
* @extends {WebInspector.DOMNode}
* @constructor
* @param {!WebInspector.DOMAgent} domAgent
* @param {!DOMAgent.Node} payload
*/
WebInspector.DOMDocument = function(domAgent, payload)
{
WebInspector.DOMNode.call(this, domAgent, this, false, payload);
this.documentURL = payload.documentURL || "";
this.baseURL = payload.baseURL || "";
this.xmlVersion = payload.xmlVersion;
this._listeners = {};
}
WebInspector.DOMDocument.prototype = {
__proto__: WebInspector.DOMNode.prototype
}
/**
* @extends {WebInspector.Object}
* @constructor
*/
WebInspector.DOMAgent = function() {
/** @type {!Object.<number, !WebInspector.DOMNode>} */
this._idToDOMNode = {};
/** @type {?WebInspector.DOMDocument} */
this._document = null;
/** @type {!Object.<number, boolean>} */
this._attributeLoadNodeIds = {};
InspectorBackend.registerDOMDispatcher(new WebInspector.DOMDispatcher(this));
this._defaultHighlighter = new WebInspector.DefaultDOMNodeHighlighter();
this._highlighter = this._defaultHighlighter;
}
WebInspector.DOMAgent.Events = {
AttrModified: "AttrModified",
AttrRemoved: "AttrRemoved",
CharacterDataModified: "CharacterDataModified",
NodeInserted: "NodeInserted",
NodeRemoved: "NodeRemoved",
DocumentUpdated: "DocumentUpdated",
ChildNodeCountUpdated: "ChildNodeCountUpdated",
UndoRedoRequested: "UndoRedoRequested",
UndoRedoCompleted: "UndoRedoCompleted",
InspectNodeRequested: "InspectNodeRequested",
PseudoStateChanged: "PseudoStateChanged"
}
WebInspector.DOMAgent.prototype = {
/**
* @param {function(!WebInspector.DOMDocument)=} callback
*/
requestDocument: function(callback)
{
if (this._document) {
if (callback)
callback(this._document);
return;
}
if (this._pendingDocumentRequestCallbacks) {
this._pendingDocumentRequestCallbacks.push(callback);
return;
}
this._pendingDocumentRequestCallbacks = [callback];
/**
* @this {WebInspector.DOMAgent}
* @param {?Protocol.Error} error
* @param {!DOMAgent.Node} root
*/
function onDocumentAvailable(error, root)
{
if (!error)
this._setDocument(root);
for (var i = 0; i < this._pendingDocumentRequestCallbacks.length; ++i) {
var callback = this._pendingDocumentRequestCallbacks[i];
if (callback)
callback(this._document);
}
delete this._pendingDocumentRequestCallbacks;
}
DOMAgent.getDocument(onDocumentAvailable.bind(this));
},
/**
* @return {?WebInspector.DOMDocument}
*/
existingDocument: function()
{
return this._document;
},
/**
* @param {!RuntimeAgent.RemoteObjectId} objectId
* @param {function(?DOMAgent.NodeId)=} callback
*/
pushNodeToFrontend: function(objectId, callback)
{
this._dispatchWhenDocumentAvailable(DOMAgent.requestNode.bind(DOMAgent, objectId), callback);
},
/**
* @param {string} path
* @param {function(?number)=} callback
*/
pushNodeByPathToFrontend: function(path, callback)
{
this._dispatchWhenDocumentAvailable(DOMAgent.pushNodeByPathToFrontend.bind(DOMAgent, path), callback);
},
/**
* @param {number} backendNodeId
* @param {function(?number)=} callback
*/
pushNodeByBackendIdToFrontend: function(backendNodeId, callback)
{
this._dispatchWhenDocumentAvailable(DOMAgent.pushNodeByBackendIdToFrontend.bind(DOMAgent, backendNodeId), callback);
},
/**
* @param {function(!T)=} callback
* @return {function(?Protocol.Error, !T=)|undefined}
* @template T
*/
_wrapClientCallback: function(callback)
{
if (!callback)
return;
/**
* @param {?Protocol.Error} error
* @param {!T=} result
* @template T
*/
return function(error, result)
{
// Caller is responsible for handling the actual error.
callback(error ? null : result);
}
},
/**
* @param {function(function(?Protocol.Error, !T=)=)} func
* @param {function(!T)=} callback
* @template T
*/
_dispatchWhenDocumentAvailable: function(func, callback)
{
var callbackWrapper = this._wrapClientCallback(callback);
/**
* @this {WebInspector.DOMAgent}
*/
function onDocumentAvailable()
{
if (this._document)
func(callbackWrapper);
else {
if (callbackWrapper)
callbackWrapper("No document");
}
}
this.requestDocument(onDocumentAvailable.bind(this));
},
/**
* @param {!DOMAgent.NodeId} nodeId
* @param {string} name
* @param {string} value
*/
_attributeModified: function(nodeId, name, value)
{
var node = this._idToDOMNode[nodeId];
if (!node)
return;
node._setAttribute(name, value);
this.dispatchEventToListeners(WebInspector.DOMAgent.Events.AttrModified, { node: node, name: name });
},
/**
* @param {!DOMAgent.NodeId} nodeId
* @param {string} name
*/
_attributeRemoved: function(nodeId, name)
{
var node = this._idToDOMNode[nodeId];
if (!node)
return;
node._removeAttribute(name);
this.dispatchEventToListeners(WebInspector.DOMAgent.Events.AttrRemoved, { node: node, name: name });
},
/**
* @param {!Array.<!DOMAgent.NodeId>} nodeIds
*/
_inlineStyleInvalidated: function(nodeIds)
{
for (var i = 0; i < nodeIds.length; ++i)
this._attributeLoadNodeIds[nodeIds[i]] = true;
if ("_loadNodeAttributesTimeout" in this)
return;
this._loadNodeAttributesTimeout = setTimeout(this._loadNodeAttributes.bind(this), 0);
},
_loadNodeAttributes: function()
{
/**
* @this {WebInspector.DOMAgent}
* @param {!DOMAgent.NodeId} nodeId
* @param {?Protocol.Error} error
* @param {!Array.<string>} attributes
*/
function callback(nodeId, error, attributes)
{
if (error) {
// We are calling _loadNodeAttributes asynchronously, it is ok if node is not found.
return;
}
var node = this._idToDOMNode[nodeId];
if (node) {
if (node._setAttributesPayload(attributes))
this.dispatchEventToListeners(WebInspector.DOMAgent.Events.AttrModified, { node: node, name: "style" });
}
}
delete this._loadNodeAttributesTimeout;
for (var nodeId in this._attributeLoadNodeIds) {
var nodeIdAsNumber = parseInt(nodeId, 10);
DOMAgent.getAttributes(nodeIdAsNumber, callback.bind(this, nodeIdAsNumber));
}
this._attributeLoadNodeIds = {};
},
/**
* @param {!DOMAgent.NodeId} nodeId
* @param {string} newValue
*/
_characterDataModified: function(nodeId, newValue)
{
var node = this._idToDOMNode[nodeId];
node._nodeValue = newValue;
this.dispatchEventToListeners(WebInspector.DOMAgent.Events.CharacterDataModified, node);
},
/**
* @param {!DOMAgent.NodeId} nodeId
* @return {?WebInspector.DOMNode}
*/
nodeForId: function(nodeId)
{
return this._idToDOMNode[nodeId] || null;
},
_documentUpdated: function()
{
this._setDocument(null);
},
/**
* @param {?DOMAgent.Node} payload
*/
_setDocument: function(payload)
{
this._idToDOMNode = {};
if (payload && "nodeId" in payload)
this._document = new WebInspector.DOMDocument(this, payload);
else
this._document = null;
this.dispatchEventToListeners(WebInspector.DOMAgent.Events.DocumentUpdated, this._document);
},
/**
* @param {!DOMAgent.Node} payload
*/
_setDetachedRoot: function(payload)
{
if (payload.nodeName === "#document")
new WebInspector.DOMDocument(this, payload);
else
new WebInspector.DOMNode(this, null, false, payload);
},
/**
* @param {!DOMAgent.NodeId} parentId
* @param {!Array.<!DOMAgent.Node>} payloads
*/
_setChildNodes: function(parentId, payloads)
{
if (!parentId && payloads.length) {
this._setDetachedRoot(payloads[0]);
return;
}
var parent = this._idToDOMNode[parentId];
parent._setChildrenPayload(payloads);
},
/**
* @param {!DOMAgent.NodeId} nodeId
* @param {number} newValue
*/
_childNodeCountUpdated: function(nodeId, newValue)
{
var node = this._idToDOMNode[nodeId];
node._childNodeCount = newValue;
this.dispatchEventToListeners(WebInspector.DOMAgent.Events.ChildNodeCountUpdated, node);
},
/**
* @param {!DOMAgent.NodeId} parentId
* @param {!DOMAgent.NodeId} prevId
* @param {!DOMAgent.Node} payload
*/
_childNodeInserted: function(parentId, prevId, payload)
{
var parent = this._idToDOMNode[parentId];
var prev = this._idToDOMNode[prevId];
var node = parent._insertChild(prev, payload);
this._idToDOMNode[node.id] = node;
this.dispatchEventToListeners(WebInspector.DOMAgent.Events.NodeInserted, node);
},
/**
* @param {!DOMAgent.NodeId} parentId
* @param {!DOMAgent.NodeId} nodeId
*/
_childNodeRemoved: function(parentId, nodeId)
{
var parent = this._idToDOMNode[parentId];
var node = this._idToDOMNode[nodeId];
parent._removeChild(node);
this._unbind(node);
this.dispatchEventToListeners(WebInspector.DOMAgent.Events.NodeRemoved, {node: node, parent: parent});
},
/**
* @param {!DOMAgent.NodeId} hostId
* @param {!DOMAgent.Node} root
*/
_shadowRootPushed: function(hostId, root)
{
var host = this._idToDOMNode[hostId];
if (!host)
return;
var node = new WebInspector.DOMNode(this, host.ownerDocument, true, root);
node.parentNode = host;
this._idToDOMNode[node.id] = node;
host._shadowRoots.push(node);
this.dispatchEventToListeners(WebInspector.DOMAgent.Events.NodeInserted, node);
},
/**
* @param {!DOMAgent.NodeId} hostId
* @param {!DOMAgent.NodeId} rootId
*/
_shadowRootPopped: function(hostId, rootId)
{
var host = this._idToDOMNode[hostId];
if (!host)
return;
var root = this._idToDOMNode[rootId];
if (!root)
return;
host._removeChild(root);
this._unbind(root);
this.dispatchEventToListeners(WebInspector.DOMAgent.Events.NodeRemoved, {node: root, parent: host});
},
/**
* @param {!DOMAgent.NodeId} parentId
* @param {!DOMAgent.Node} pseudoElement
*/
_pseudoElementAdded: function(parentId, pseudoElement)
{
var parent = this._idToDOMNode[parentId];
if (!parent)
return;
var node = new WebInspector.DOMNode(this, parent.ownerDocument, false, pseudoElement);
node.parentNode = parent;
this._idToDOMNode[node.id] = node;
console.assert(!parent._pseudoElements[node.pseudoType()]);
parent._pseudoElements[node.pseudoType()] = node;
this.dispatchEventToListeners(WebInspector.DOMAgent.Events.NodeInserted, node);
},
/**
* @param {!DOMAgent.NodeId} parentId
* @param {!DOMAgent.NodeId} pseudoElementId
*/
_pseudoElementRemoved: function(parentId, pseudoElementId)
{
var parent = this._idToDOMNode[parentId];
if (!parent)
return;
var pseudoElement = this._idToDOMNode[pseudoElementId];
if (!pseudoElement)
return;
parent._removeChild(pseudoElement);
this._unbind(pseudoElement);
this.dispatchEventToListeners(WebInspector.DOMAgent.Events.NodeRemoved, {node: pseudoElement, parent: parent});
},
/**
* @param {!DOMAgent.NodeId} elementId
*/
_pseudoStateChanged: function(elementId)
{
var node = this._idToDOMNode[elementId];
if (!node)
return;
this.dispatchEventToListeners(WebInspector.DOMAgent.Events.PseudoStateChanged, node);
},
/**
* @param {!WebInspector.DOMNode} node
*/
_unbind: function(node)
{
delete this._idToDOMNode[node.id];
for (var i = 0; node._children && i < node._children.length; ++i)
this._unbind(node._children[i]);
for (var i = 0; i < node._shadowRoots.length; ++i)
this._unbind(node._shadowRoots[i]);
var pseudoElements = node.pseudoElements();
for (var id in pseudoElements)
this._unbind(pseudoElements[id]);
if (node._templateContent)
this._unbind(node._templateContent);
},
/**
* @param {number} nodeId
*/
inspectElement: function(nodeId)
{
var node = this._idToDOMNode[nodeId];
if (node)
this.dispatchEventToListeners(WebInspector.DOMAgent.Events.InspectNodeRequested, nodeId);
},
/**
* @param {!DOMAgent.NodeId} nodeId
*/
_inspectNodeRequested: function(nodeId)
{
this.dispatchEventToListeners(WebInspector.DOMAgent.Events.InspectNodeRequested, nodeId);
},
/**
* @param {string} query
* @param {function(number)} searchCallback
*/
performSearch: function(query, searchCallback)
{
this.cancelSearch();
/**
* @param {?Protocol.Error} error
* @param {string} searchId
* @param {number} resultsCount
* @this {WebInspector.DOMAgent}
*/
function callback(error, searchId, resultsCount)
{
this._searchId = searchId;
searchCallback(resultsCount);
}
DOMAgent.performSearch(query, callback.bind(this));
},
/**
* @param {number} index
* @param {?function(?WebInspector.DOMNode)} callback
*/
searchResult: function(index, callback)
{
if (this._searchId)
DOMAgent.getSearchResults(this._searchId, index, index + 1, searchResultsCallback.bind(this));
else
callback(null);
/**
* @param {?Protocol.Error} error
* @param {!Array.<number>} nodeIds
* @this {WebInspector.DOMAgent}
*/
function searchResultsCallback(error, nodeIds)
{
if (error) {
console.error(error);
callback(null);
return;
}
if (nodeIds.length != 1)
return;
callback(this.nodeForId(nodeIds[0]));
}
},
cancelSearch: function()
{
if (this._searchId) {
DOMAgent.discardSearchResults(this._searchId);
delete this._searchId;
}
},
/**
* @param {!DOMAgent.NodeId} nodeId
* @param {string} selectors
* @param {function(?DOMAgent.NodeId)=} callback
*/
querySelector: function(nodeId, selectors, callback)
{
DOMAgent.querySelector(nodeId, selectors, this._wrapClientCallback(callback));
},
/**
* @param {!DOMAgent.NodeId} nodeId
* @param {string} selectors
* @param {function(!Array.<!DOMAgent.NodeId>=)=} callback
*/
querySelectorAll: function(nodeId, selectors, callback)
{
DOMAgent.querySelectorAll(nodeId, selectors, this._wrapClientCallback(callback));
},
/**
* @param {!DOMAgent.NodeId=} nodeId
* @param {string=} mode
* @param {!RuntimeAgent.RemoteObjectId=} objectId
*/
highlightDOMNode: function(nodeId, mode, objectId)
{
if (this._hideDOMNodeHighlightTimeout) {
clearTimeout(this._hideDOMNodeHighlightTimeout);
delete this._hideDOMNodeHighlightTimeout;
}
this._highlighter.highlightDOMNode(nodeId || 0, this._buildHighlightConfig(mode), objectId);
},
hideDOMNodeHighlight: function()
{
this.highlightDOMNode(0);
},
/**
* @param {!DOMAgent.NodeId} nodeId
*/
highlightDOMNodeForTwoSeconds: function(nodeId)
{
this.highlightDOMNode(nodeId);
this._hideDOMNodeHighlightTimeout = setTimeout(this.hideDOMNodeHighlight.bind(this), 2000);
},
/**
* @param {boolean} enabled
* @param {boolean} inspectShadowDOM
* @param {function(?Protocol.Error)=} callback
*/
setInspectModeEnabled: function(enabled, inspectShadowDOM, callback)
{
/**
* @this {WebInspector.DOMAgent}
*/
function onDocumentAvailable()
{
this._highlighter.setInspectModeEnabled(enabled, inspectShadowDOM, this._buildHighlightConfig(), callback);
}
this.requestDocument(onDocumentAvailable.bind(this));
},
/**
* @param {string=} mode
* @return {!DOMAgent.HighlightConfig}
*/
_buildHighlightConfig: function(mode)
{
mode = mode || "all";
var highlightConfig = { showInfo: mode === "all", showRulers: WebInspector.settings.showMetricsRulers.get() };
if (mode === "all" || mode === "content")
highlightConfig.contentColor = WebInspector.Color.PageHighlight.Content.toProtocolRGBA();
if (mode === "all" || mode === "padding")
highlightConfig.paddingColor = WebInspector.Color.PageHighlight.Padding.toProtocolRGBA();
if (mode === "all" || mode === "border")
highlightConfig.borderColor = WebInspector.Color.PageHighlight.Border.toProtocolRGBA();
if (mode === "all" || mode === "margin")
highlightConfig.marginColor = WebInspector.Color.PageHighlight.Margin.toProtocolRGBA();
if (mode === "all")
highlightConfig.eventTargetColor = WebInspector.Color.PageHighlight.EventTarget.toProtocolRGBA();
return highlightConfig;
},
/**
* @param {!WebInspector.DOMNode} node
* @param {function(?Protocol.Error, !A=, !B=)=} callback
* @return {function(?Protocol.Error, !A=, !B=)}
* @template A,B
*/
_markRevision: function(node, callback)
{
/**
* @param {?Protocol.Error} error
* @this {WebInspector.DOMAgent}
*/
function wrapperFunction(error)
{
if (!error)
this.markUndoableState();
if (callback)
callback.apply(this, arguments);
}
return wrapperFunction.bind(this);
},
/**
* @param {boolean} emulationEnabled
*/
emulateTouchEventObjects: function(emulationEnabled)
{
const injectedFunction = function() {
const touchEvents = ["ontouchstart", "ontouchend", "ontouchmove", "ontouchcancel"];
var recepients = [window.__proto__, document.__proto__];
for (var i = 0; i < touchEvents.length; ++i) {
for (var j = 0; j < recepients.length; ++j) {
if (!(touchEvents[i] in recepients[j]))
Object.defineProperty(recepients[j], touchEvents[i], { value: null, writable: true, configurable: true, enumerable: true });
}
}
}
if (emulationEnabled && !this._addTouchEventsScriptInjecting) {
this._addTouchEventsScriptInjecting = true;
PageAgent.addScriptToEvaluateOnLoad("(" + injectedFunction.toString() + ")()", scriptAddedCallback.bind(this));
} else {
if (typeof this._addTouchEventsScriptId !== "undefined") {
PageAgent.removeScriptToEvaluateOnLoad(this._addTouchEventsScriptId);
delete this._addTouchEventsScriptId;
}
}
/**
* @param {?Protocol.Error} error
* @param {string} scriptId
* @this {WebInspector.DOMAgent}
*/
function scriptAddedCallback(error, scriptId)
{
delete this._addTouchEventsScriptInjecting;
if (error)
return;
this._addTouchEventsScriptId = scriptId;
}
PageAgent.setTouchEmulationEnabled(emulationEnabled);
},
markUndoableState: function()
{
DOMAgent.markUndoableState();
},
/**
* @param {function(?Protocol.Error)=} callback
*/
undo: function(callback)
{
/**
* @param {?Protocol.Error} error
* @this {WebInspector.DOMAgent}
*/
function mycallback(error)
{
this.dispatchEventToListeners(WebInspector.DOMAgent.Events.UndoRedoCompleted);
callback(error);
}
this.dispatchEventToListeners(WebInspector.DOMAgent.Events.UndoRedoRequested);
DOMAgent.undo(callback);
},
/**
* @param {function(?Protocol.Error)=} callback
*/
redo: function(callback)
{
/**
* @param {?Protocol.Error} error
* @this {WebInspector.DOMAgent}
*/
function mycallback(error)
{
this.dispatchEventToListeners(WebInspector.DOMAgent.Events.UndoRedoCompleted);
callback(error);
}
this.dispatchEventToListeners(WebInspector.DOMAgent.Events.UndoRedoRequested);
DOMAgent.redo(callback);
},
/**
* @param {?WebInspector.DOMNodeHighlighter} highlighter
*/
setHighlighter: function(highlighter)
{
this._highlighter = highlighter || this._defaultHighlighter;
},
__proto__: WebInspector.Object.prototype
}
/**
* @constructor
* @implements {DOMAgent.Dispatcher}
* @param {!WebInspector.DOMAgent} domAgent
*/
WebInspector.DOMDispatcher = function(domAgent)
{
this._domAgent = domAgent;
}
WebInspector.DOMDispatcher.prototype = {
documentUpdated: function()
{
this._domAgent._documentUpdated();
},
/**
* @param {!DOMAgent.NodeId} nodeId
*/
inspectNodeRequested: function(nodeId)
{
this._domAgent._inspectNodeRequested(nodeId);
},
/**
* @param {!DOMAgent.NodeId} nodeId
* @param {string} name
* @param {string} value
*/
attributeModified: function(nodeId, name, value)
{
this._domAgent._attributeModified(nodeId, name, value);
},
/**
* @param {!DOMAgent.NodeId} nodeId
* @param {string} name
*/
attributeRemoved: function(nodeId, name)
{
this._domAgent._attributeRemoved(nodeId, name);
},
/**
* @param {!Array.<!DOMAgent.NodeId>} nodeIds
*/
inlineStyleInvalidated: function(nodeIds)
{
this._domAgent._inlineStyleInvalidated(nodeIds);
},
/**
* @param {!DOMAgent.NodeId} nodeId
* @param {string} characterData
*/
characterDataModified: function(nodeId, characterData)
{
this._domAgent._characterDataModified(nodeId, characterData);
},
/**
* @param {!DOMAgent.NodeId} parentId
* @param {!Array.<!DOMAgent.Node>} payloads
*/
setChildNodes: function(parentId, payloads)
{
this._domAgent._setChildNodes(parentId, payloads);
},
/**
* @param {!DOMAgent.NodeId} nodeId
* @param {number} childNodeCount
*/
childNodeCountUpdated: function(nodeId, childNodeCount)
{
this._domAgent._childNodeCountUpdated(nodeId, childNodeCount);
},
/**
* @param {!DOMAgent.NodeId} parentNodeId
* @param {!DOMAgent.NodeId} previousNodeId
* @param {!DOMAgent.Node} payload
*/
childNodeInserted: function(parentNodeId, previousNodeId, payload)
{
this._domAgent._childNodeInserted(parentNodeId, previousNodeId, payload);
},
/**
* @param {!DOMAgent.NodeId} parentNodeId
* @param {!DOMAgent.NodeId} nodeId
*/
childNodeRemoved: function(parentNodeId, nodeId)
{
this._domAgent._childNodeRemoved(parentNodeId, nodeId);
},
/**
* @param {!DOMAgent.NodeId} hostId
* @param {!DOMAgent.Node} root
*/
shadowRootPushed: function(hostId, root)
{
this._domAgent._shadowRootPushed(hostId, root);
},
/**
* @param {!DOMAgent.NodeId} hostId
* @param {!DOMAgent.NodeId} rootId
*/
shadowRootPopped: function(hostId, rootId)
{
this._domAgent._shadowRootPopped(hostId, rootId);
},
/**
* @param {!DOMAgent.NodeId} parentId
* @param {!DOMAgent.Node} pseudoElement
*/
pseudoElementAdded: function(parentId, pseudoElement)
{
this._domAgent._pseudoElementAdded(parentId, pseudoElement);
},
/**
* @param {!DOMAgent.NodeId} parentId
* @param {!DOMAgent.NodeId} pseudoElementId
*/
pseudoElementRemoved: function(parentId, pseudoElementId)
{
this._domAgent._pseudoElementRemoved(parentId, pseudoElementId);
},
/**
* @param {!DOMAgent.NodeId} elementId
*/
pseudoStateChanged: function(elementId)
{
this._domAgent._pseudoStateChanged(elementId);
}
}
/**
* @interface
*/
WebInspector.DOMNodeHighlighter = function() {
}
WebInspector.DOMNodeHighlighter.prototype = {
/**
* @param {!DOMAgent.NodeId} nodeId
* @param {!DOMAgent.HighlightConfig} config
* @param {!RuntimeAgent.RemoteObjectId=} objectId
*/
highlightDOMNode: function(nodeId, config, objectId) {},
/**
* @param {boolean} enabled
* @param {boolean} inspectShadowDOM
* @param {!DOMAgent.HighlightConfig} config
* @param {function(?Protocol.Error)=} callback
*/
setInspectModeEnabled: function(enabled, inspectShadowDOM, config, callback) {}
}
/**
* @constructor
* @implements {WebInspector.DOMNodeHighlighter}
*/
WebInspector.DefaultDOMNodeHighlighter = function() {
}
WebInspector.DefaultDOMNodeHighlighter.prototype = {
/**
* @param {!DOMAgent.NodeId} nodeId
* @param {!DOMAgent.HighlightConfig} config
* @param {!RuntimeAgent.RemoteObjectId=} objectId
*/
highlightDOMNode: function(nodeId, config, objectId)
{
if (objectId || nodeId)
DOMAgent.highlightNode(config, objectId ? undefined : nodeId, objectId);
else
DOMAgent.hideHighlight();
},
/**
* @param {boolean} enabled
* @param {boolean} inspectShadowDOM
* @param {!DOMAgent.HighlightConfig} config
* @param {function(?Protocol.Error)=} callback
*/
setInspectModeEnabled: function(enabled, inspectShadowDOM, config, callback)
{
DOMAgent.setInspectModeEnabled(enabled, inspectShadowDOM, config, callback);
}
}
/**
* @type {!WebInspector.DOMAgent}
*/
WebInspector.domAgent;
|
import RSVP from 'rsvp';
import XFlowHarness from './xflow-harness';
import DocRegistry from './helper/docregistry';
class XFlowRunner {
constructor(opts) {
this.name = 'XFlowRunner';
this.xfmap = new DocRegistry();
this.factory = opts.factory;
this.tickLimit = opts.tickLimit || 4096;
}
_makeHarness(xflow) {
return new XFlowHarness(xflow, {
tickLimit: this.tickLimit,
});
}
run(xflowId, state) {
if (!this.xfmap.has(xflowId)) {
throw new Error(
`${this.name}.run : No xflow with ID '${xflowId} found in registry`
);
}
const xflow = this.factory.buildFlow(
this.xfmap.get(xflowId),
state
);
const harness = this._makeHarness(xflow);
return harness.runFlow();
}
runQ(xflowId, state) {
const defer = RSVP.defer();
if (!this.xfmap.has(xflowId)) {
defer.reject(
`${this.name}.run : No xflow with ID '${xflowId} found in registry`
);
}
const xflow = this.factory.buildFlow(
this.xfmap.get(xflowId),
state
);
const harness = this._makeHarness(xflow);
harness.runFlowQ().then(
(res)=> {
// console.log('qrunner.harness.resolve ', res);
defer.resolve(res);
return res;
},
(err)=> defer.reject(err)
);
return defer.promise;
}
addFlow(flowJson) {
this.xfmap.add(flowJson);
}
removeFlow(id) {
this.xfmap.remove(id);
}
hasFlow(id) {
return this.xfmap.has(id);
}
}
export default XFlowRunner;
|
import toUniqueStringsArray from "../toUniqueStringsArray";
describe("toUniqueStringsArray", () => {
it("sane defaults", () => {
expect(toUniqueStringsArray()).toEqual([]);
expect(toUniqueStringsArray(null)).toEqual([]);
expect(toUniqueStringsArray({})).toEqual([]);
expect(toUniqueStringsArray("")).toEqual([]);
expect(toUniqueStringsArray([])).toEqual([]);
});
it("handles a single string", () => {
expect(toUniqueStringsArray("red")).toEqual(["red"]);
});
it("handles comma separated string", () => {
expect(toUniqueStringsArray("red, blue, red, green, blue")).toEqual([
"red",
"blue",
"green",
]);
});
it("handles array of strings", () => {
expect(toUniqueStringsArray(["red", "blue", "red", "green", "blue"])).toEqual([
"red",
"blue",
"green",
]);
});
});
|
#!/usr/bin/env node
'use strict';
var meow = require('meow');
var clc = require('cli-color');
var terminalWallet = require('./');
var cli = meow({
help: [
'Usage',
' wallet debit <value> <purchase details> [-c <category>][-d <date in yyyy-mm-dd format>]',
' wallet credit <value> <source details> [-c <category>][-d <date in yyyy-mm-dd format>]',
' wallet stats',
' wallet export',
' wallet clear',
'',
'Example',
" wallet debit 10 'Breakfast, Coffee at Canteen' -c 'Food'",
'',
' ✔ Expense written to file!',
'',
" wallet credit 2000 'Salary for July 2015' -c 'Salary'",
'',
' ✔ Expense written to file!',
'',
' wallet stats',
'',
' Total Credit : 13920',
' Total Debit : 590',
' Balance : 13330',
' Stashed : 0',
'',
'',
' wallet export',
'',
' ✔ Your file can be found at',
' /home/siddharth/.local/share/wallet/exported/export-2015-07-06.csv',
'',
' wallet clear',
'',
' ✔ Account closed. Expense details have been exported to :-',
' /home/siddharth/.local/share/wallet/closed/closed-2015-07-06.csv',
' Prepared a clean slate, for the next accounting period.',
'',
' wallet-open # or just wo',
' This will open the wallet csv file in a less session, in a',
' in a reverse chronographic order, which is convenient for viewing',
' latest transactions',
'',
' wallet file_path',
' Shows the file path of the wallet expenses file. Can be used to',
' see it in your editor of choice. Editing it is not advised',
'',
'Options',
" -c Category ; Default: '' ; Optional",
" -d yyyy-mm-dd ; Default: Today's date; Optional"
].join('\n')
});
try {
terminalWallet(cli.input, cli.flags);
} catch (err) {
console.log(clc.red(err.message));
process.exit(1);
}
|
/* eslint-disable no-sync */
const readPackages = require('./readPackages')
const writePkg = require('write-pkg')
module.exports = function transformPkgs(mapFn) {
readPackages().forEach(pkg => {
const transformedManifest = mapFn(pkg.manifest)
writePkg(pkg.path, transformedManifest)
})
}
|
// Temporary code to test sending files to the server
import fs from "fs";
import net from "net";
import path from "path";
const { SERVER_PORT, SERVER_ADDRESS } = process.env;
const SERVER_OPTIONS = { port: SERVER_PORT, address: SERVER_ADDRESS };
export function send(name) {
console.log("About to send", name);
var encodedName = new Buffer(name, "utf8");
var size = new Buffer(2);
size.writeUInt16BE(Buffer.byteLength(name, "utf8"), 0);
fs.readFile(path.join(process.env.WORK_DIRECTORY, name), (err, data) => {
if (err) throw err;
var payload = Buffer.concat([size, encodedName, data]);
var client = net.connect(SERVER_OPTIONS, () => {
console.log("Connected, sending...");
client.end(payload, "utf8");
});
});
}
|
// All code points in the `So` category as per Unicode v9.0.0:
[
0xA6,
0xA9,
0xAE,
0xB0,
0x482,
0x58D,
0x58E,
0x60E,
0x60F,
0x6DE,
0x6E9,
0x6FD,
0x6FE,
0x7F6,
0x9FA,
0xB70,
0xBF3,
0xBF4,
0xBF5,
0xBF6,
0xBF7,
0xBF8,
0xBFA,
0xC7F,
0xD4F,
0xD79,
0xF01,
0xF02,
0xF03,
0xF13,
0xF15,
0xF16,
0xF17,
0xF1A,
0xF1B,
0xF1C,
0xF1D,
0xF1E,
0xF1F,
0xF34,
0xF36,
0xF38,
0xFBE,
0xFBF,
0xFC0,
0xFC1,
0xFC2,
0xFC3,
0xFC4,
0xFC5,
0xFC7,
0xFC8,
0xFC9,
0xFCA,
0xFCB,
0xFCC,
0xFCE,
0xFCF,
0xFD5,
0xFD6,
0xFD7,
0xFD8,
0x109E,
0x109F,
0x1390,
0x1391,
0x1392,
0x1393,
0x1394,
0x1395,
0x1396,
0x1397,
0x1398,
0x1399,
0x1940,
0x19DE,
0x19DF,
0x19E0,
0x19E1,
0x19E2,
0x19E3,
0x19E4,
0x19E5,
0x19E6,
0x19E7,
0x19E8,
0x19E9,
0x19EA,
0x19EB,
0x19EC,
0x19ED,
0x19EE,
0x19EF,
0x19F0,
0x19F1,
0x19F2,
0x19F3,
0x19F4,
0x19F5,
0x19F6,
0x19F7,
0x19F8,
0x19F9,
0x19FA,
0x19FB,
0x19FC,
0x19FD,
0x19FE,
0x19FF,
0x1B61,
0x1B62,
0x1B63,
0x1B64,
0x1B65,
0x1B66,
0x1B67,
0x1B68,
0x1B69,
0x1B6A,
0x1B74,
0x1B75,
0x1B76,
0x1B77,
0x1B78,
0x1B79,
0x1B7A,
0x1B7B,
0x1B7C,
0x2100,
0x2101,
0x2103,
0x2104,
0x2105,
0x2106,
0x2108,
0x2109,
0x2114,
0x2116,
0x2117,
0x211E,
0x211F,
0x2120,
0x2121,
0x2122,
0x2123,
0x2125,
0x2127,
0x2129,
0x212E,
0x213A,
0x213B,
0x214A,
0x214C,
0x214D,
0x214F,
0x218A,
0x218B,
0x2195,
0x2196,
0x2197,
0x2198,
0x2199,
0x219C,
0x219D,
0x219E,
0x219F,
0x21A1,
0x21A2,
0x21A4,
0x21A5,
0x21A7,
0x21A8,
0x21A9,
0x21AA,
0x21AB,
0x21AC,
0x21AD,
0x21AF,
0x21B0,
0x21B1,
0x21B2,
0x21B3,
0x21B4,
0x21B5,
0x21B6,
0x21B7,
0x21B8,
0x21B9,
0x21BA,
0x21BB,
0x21BC,
0x21BD,
0x21BE,
0x21BF,
0x21C0,
0x21C1,
0x21C2,
0x21C3,
0x21C4,
0x21C5,
0x21C6,
0x21C7,
0x21C8,
0x21C9,
0x21CA,
0x21CB,
0x21CC,
0x21CD,
0x21D0,
0x21D1,
0x21D3,
0x21D5,
0x21D6,
0x21D7,
0x21D8,
0x21D9,
0x21DA,
0x21DB,
0x21DC,
0x21DD,
0x21DE,
0x21DF,
0x21E0,
0x21E1,
0x21E2,
0x21E3,
0x21E4,
0x21E5,
0x21E6,
0x21E7,
0x21E8,
0x21E9,
0x21EA,
0x21EB,
0x21EC,
0x21ED,
0x21EE,
0x21EF,
0x21F0,
0x21F1,
0x21F2,
0x21F3,
0x2300,
0x2301,
0x2302,
0x2303,
0x2304,
0x2305,
0x2306,
0x2307,
0x230C,
0x230D,
0x230E,
0x230F,
0x2310,
0x2311,
0x2312,
0x2313,
0x2314,
0x2315,
0x2316,
0x2317,
0x2318,
0x2319,
0x231A,
0x231B,
0x231C,
0x231D,
0x231E,
0x231F,
0x2322,
0x2323,
0x2324,
0x2325,
0x2326,
0x2327,
0x2328,
0x232B,
0x232C,
0x232D,
0x232E,
0x232F,
0x2330,
0x2331,
0x2332,
0x2333,
0x2334,
0x2335,
0x2336,
0x2337,
0x2338,
0x2339,
0x233A,
0x233B,
0x233C,
0x233D,
0x233E,
0x233F,
0x2340,
0x2341,
0x2342,
0x2343,
0x2344,
0x2345,
0x2346,
0x2347,
0x2348,
0x2349,
0x234A,
0x234B,
0x234C,
0x234D,
0x234E,
0x234F,
0x2350,
0x2351,
0x2352,
0x2353,
0x2354,
0x2355,
0x2356,
0x2357,
0x2358,
0x2359,
0x235A,
0x235B,
0x235C,
0x235D,
0x235E,
0x235F,
0x2360,
0x2361,
0x2362,
0x2363,
0x2364,
0x2365,
0x2366,
0x2367,
0x2368,
0x2369,
0x236A,
0x236B,
0x236C,
0x236D,
0x236E,
0x236F,
0x2370,
0x2371,
0x2372,
0x2373,
0x2374,
0x2375,
0x2376,
0x2377,
0x2378,
0x2379,
0x237A,
0x237B,
0x237D,
0x237E,
0x237F,
0x2380,
0x2381,
0x2382,
0x2383,
0x2384,
0x2385,
0x2386,
0x2387,
0x2388,
0x2389,
0x238A,
0x238B,
0x238C,
0x238D,
0x238E,
0x238F,
0x2390,
0x2391,
0x2392,
0x2393,
0x2394,
0x2395,
0x2396,
0x2397,
0x2398,
0x2399,
0x239A,
0x23B4,
0x23B5,
0x23B6,
0x23B7,
0x23B8,
0x23B9,
0x23BA,
0x23BB,
0x23BC,
0x23BD,
0x23BE,
0x23BF,
0x23C0,
0x23C1,
0x23C2,
0x23C3,
0x23C4,
0x23C5,
0x23C6,
0x23C7,
0x23C8,
0x23C9,
0x23CA,
0x23CB,
0x23CC,
0x23CD,
0x23CE,
0x23CF,
0x23D0,
0x23D1,
0x23D2,
0x23D3,
0x23D4,
0x23D5,
0x23D6,
0x23D7,
0x23D8,
0x23D9,
0x23DA,
0x23DB,
0x23E2,
0x23E3,
0x23E4,
0x23E5,
0x23E6,
0x23E7,
0x23E8,
0x23E9,
0x23EA,
0x23EB,
0x23EC,
0x23ED,
0x23EE,
0x23EF,
0x23F0,
0x23F1,
0x23F2,
0x23F3,
0x23F4,
0x23F5,
0x23F6,
0x23F7,
0x23F8,
0x23F9,
0x23FA,
0x23FB,
0x23FC,
0x23FD,
0x23FE,
0x2400,
0x2401,
0x2402,
0x2403,
0x2404,
0x2405,
0x2406,
0x2407,
0x2408,
0x2409,
0x240A,
0x240B,
0x240C,
0x240D,
0x240E,
0x240F,
0x2410,
0x2411,
0x2412,
0x2413,
0x2414,
0x2415,
0x2416,
0x2417,
0x2418,
0x2419,
0x241A,
0x241B,
0x241C,
0x241D,
0x241E,
0x241F,
0x2420,
0x2421,
0x2422,
0x2423,
0x2424,
0x2425,
0x2426,
0x2440,
0x2441,
0x2442,
0x2443,
0x2444,
0x2445,
0x2446,
0x2447,
0x2448,
0x2449,
0x244A,
0x249C,
0x249D,
0x249E,
0x249F,
0x24A0,
0x24A1,
0x24A2,
0x24A3,
0x24A4,
0x24A5,
0x24A6,
0x24A7,
0x24A8,
0x24A9,
0x24AA,
0x24AB,
0x24AC,
0x24AD,
0x24AE,
0x24AF,
0x24B0,
0x24B1,
0x24B2,
0x24B3,
0x24B4,
0x24B5,
0x24B6,
0x24B7,
0x24B8,
0x24B9,
0x24BA,
0x24BB,
0x24BC,
0x24BD,
0x24BE,
0x24BF,
0x24C0,
0x24C1,
0x24C2,
0x24C3,
0x24C4,
0x24C5,
0x24C6,
0x24C7,
0x24C8,
0x24C9,
0x24CA,
0x24CB,
0x24CC,
0x24CD,
0x24CE,
0x24CF,
0x24D0,
0x24D1,
0x24D2,
0x24D3,
0x24D4,
0x24D5,
0x24D6,
0x24D7,
0x24D8,
0x24D9,
0x24DA,
0x24DB,
0x24DC,
0x24DD,
0x24DE,
0x24DF,
0x24E0,
0x24E1,
0x24E2,
0x24E3,
0x24E4,
0x24E5,
0x24E6,
0x24E7,
0x24E8,
0x24E9,
0x2500,
0x2501,
0x2502,
0x2503,
0x2504,
0x2505,
0x2506,
0x2507,
0x2508,
0x2509,
0x250A,
0x250B,
0x250C,
0x250D,
0x250E,
0x250F,
0x2510,
0x2511,
0x2512,
0x2513,
0x2514,
0x2515,
0x2516,
0x2517,
0x2518,
0x2519,
0x251A,
0x251B,
0x251C,
0x251D,
0x251E,
0x251F,
0x2520,
0x2521,
0x2522,
0x2523,
0x2524,
0x2525,
0x2526,
0x2527,
0x2528,
0x2529,
0x252A,
0x252B,
0x252C,
0x252D,
0x252E,
0x252F,
0x2530,
0x2531,
0x2532,
0x2533,
0x2534,
0x2535,
0x2536,
0x2537,
0x2538,
0x2539,
0x253A,
0x253B,
0x253C,
0x253D,
0x253E,
0x253F,
0x2540,
0x2541,
0x2542,
0x2543,
0x2544,
0x2545,
0x2546,
0x2547,
0x2548,
0x2549,
0x254A,
0x254B,
0x254C,
0x254D,
0x254E,
0x254F,
0x2550,
0x2551,
0x2552,
0x2553,
0x2554,
0x2555,
0x2556,
0x2557,
0x2558,
0x2559,
0x255A,
0x255B,
0x255C,
0x255D,
0x255E,
0x255F,
0x2560,
0x2561,
0x2562,
0x2563,
0x2564,
0x2565,
0x2566,
0x2567,
0x2568,
0x2569,
0x256A,
0x256B,
0x256C,
0x256D,
0x256E,
0x256F,
0x2570,
0x2571,
0x2572,
0x2573,
0x2574,
0x2575,
0x2576,
0x2577,
0x2578,
0x2579,
0x257A,
0x257B,
0x257C,
0x257D,
0x257E,
0x257F,
0x2580,
0x2581,
0x2582,
0x2583,
0x2584,
0x2585,
0x2586,
0x2587,
0x2588,
0x2589,
0x258A,
0x258B,
0x258C,
0x258D,
0x258E,
0x258F,
0x2590,
0x2591,
0x2592,
0x2593,
0x2594,
0x2595,
0x2596,
0x2597,
0x2598,
0x2599,
0x259A,
0x259B,
0x259C,
0x259D,
0x259E,
0x259F,
0x25A0,
0x25A1,
0x25A2,
0x25A3,
0x25A4,
0x25A5,
0x25A6,
0x25A7,
0x25A8,
0x25A9,
0x25AA,
0x25AB,
0x25AC,
0x25AD,
0x25AE,
0x25AF,
0x25B0,
0x25B1,
0x25B2,
0x25B3,
0x25B4,
0x25B5,
0x25B6,
0x25B8,
0x25B9,
0x25BA,
0x25BB,
0x25BC,
0x25BD,
0x25BE,
0x25BF,
0x25C0,
0x25C2,
0x25C3,
0x25C4,
0x25C5,
0x25C6,
0x25C7,
0x25C8,
0x25C9,
0x25CA,
0x25CB,
0x25CC,
0x25CD,
0x25CE,
0x25CF,
0x25D0,
0x25D1,
0x25D2,
0x25D3,
0x25D4,
0x25D5,
0x25D6,
0x25D7,
0x25D8,
0x25D9,
0x25DA,
0x25DB,
0x25DC,
0x25DD,
0x25DE,
0x25DF,
0x25E0,
0x25E1,
0x25E2,
0x25E3,
0x25E4,
0x25E5,
0x25E6,
0x25E7,
0x25E8,
0x25E9,
0x25EA,
0x25EB,
0x25EC,
0x25ED,
0x25EE,
0x25EF,
0x25F0,
0x25F1,
0x25F2,
0x25F3,
0x25F4,
0x25F5,
0x25F6,
0x25F7,
0x2600,
0x2601,
0x2602,
0x2603,
0x2604,
0x2605,
0x2606,
0x2607,
0x2608,
0x2609,
0x260A,
0x260B,
0x260C,
0x260D,
0x260E,
0x260F,
0x2610,
0x2611,
0x2612,
0x2613,
0x2614,
0x2615,
0x2616,
0x2617,
0x2618,
0x2619,
0x261A,
0x261B,
0x261C,
0x261D,
0x261E,
0x261F,
0x2620,
0x2621,
0x2622,
0x2623,
0x2624,
0x2625,
0x2626,
0x2627,
0x2628,
0x2629,
0x262A,
0x262B,
0x262C,
0x262D,
0x262E,
0x262F,
0x2630,
0x2631,
0x2632,
0x2633,
0x2634,
0x2635,
0x2636,
0x2637,
0x2638,
0x2639,
0x263A,
0x263B,
0x263C,
0x263D,
0x263E,
0x263F,
0x2640,
0x2641,
0x2642,
0x2643,
0x2644,
0x2645,
0x2646,
0x2647,
0x2648,
0x2649,
0x264A,
0x264B,
0x264C,
0x264D,
0x264E,
0x264F,
0x2650,
0x2651,
0x2652,
0x2653,
0x2654,
0x2655,
0x2656,
0x2657,
0x2658,
0x2659,
0x265A,
0x265B,
0x265C,
0x265D,
0x265E,
0x265F,
0x2660,
0x2661,
0x2662,
0x2663,
0x2664,
0x2665,
0x2666,
0x2667,
0x2668,
0x2669,
0x266A,
0x266B,
0x266C,
0x266D,
0x266E,
0x2670,
0x2671,
0x2672,
0x2673,
0x2674,
0x2675,
0x2676,
0x2677,
0x2678,
0x2679,
0x267A,
0x267B,
0x267C,
0x267D,
0x267E,
0x267F,
0x2680,
0x2681,
0x2682,
0x2683,
0x2684,
0x2685,
0x2686,
0x2687,
0x2688,
0x2689,
0x268A,
0x268B,
0x268C,
0x268D,
0x268E,
0x268F,
0x2690,
0x2691,
0x2692,
0x2693,
0x2694,
0x2695,
0x2696,
0x2697,
0x2698,
0x2699,
0x269A,
0x269B,
0x269C,
0x269D,
0x269E,
0x269F,
0x26A0,
0x26A1,
0x26A2,
0x26A3,
0x26A4,
0x26A5,
0x26A6,
0x26A7,
0x26A8,
0x26A9,
0x26AA,
0x26AB,
0x26AC,
0x26AD,
0x26AE,
0x26AF,
0x26B0,
0x26B1,
0x26B2,
0x26B3,
0x26B4,
0x26B5,
0x26B6,
0x26B7,
0x26B8,
0x26B9,
0x26BA,
0x26BB,
0x26BC,
0x26BD,
0x26BE,
0x26BF,
0x26C0,
0x26C1,
0x26C2,
0x26C3,
0x26C4,
0x26C5,
0x26C6,
0x26C7,
0x26C8,
0x26C9,
0x26CA,
0x26CB,
0x26CC,
0x26CD,
0x26CE,
0x26CF,
0x26D0,
0x26D1,
0x26D2,
0x26D3,
0x26D4,
0x26D5,
0x26D6,
0x26D7,
0x26D8,
0x26D9,
0x26DA,
0x26DB,
0x26DC,
0x26DD,
0x26DE,
0x26DF,
0x26E0,
0x26E1,
0x26E2,
0x26E3,
0x26E4,
0x26E5,
0x26E6,
0x26E7,
0x26E8,
0x26E9,
0x26EA,
0x26EB,
0x26EC,
0x26ED,
0x26EE,
0x26EF,
0x26F0,
0x26F1,
0x26F2,
0x26F3,
0x26F4,
0x26F5,
0x26F6,
0x26F7,
0x26F8,
0x26F9,
0x26FA,
0x26FB,
0x26FC,
0x26FD,
0x26FE,
0x26FF,
0x2700,
0x2701,
0x2702,
0x2703,
0x2704,
0x2705,
0x2706,
0x2707,
0x2708,
0x2709,
0x270A,
0x270B,
0x270C,
0x270D,
0x270E,
0x270F,
0x2710,
0x2711,
0x2712,
0x2713,
0x2714,
0x2715,
0x2716,
0x2717,
0x2718,
0x2719,
0x271A,
0x271B,
0x271C,
0x271D,
0x271E,
0x271F,
0x2720,
0x2721,
0x2722,
0x2723,
0x2724,
0x2725,
0x2726,
0x2727,
0x2728,
0x2729,
0x272A,
0x272B,
0x272C,
0x272D,
0x272E,
0x272F,
0x2730,
0x2731,
0x2732,
0x2733,
0x2734,
0x2735,
0x2736,
0x2737,
0x2738,
0x2739,
0x273A,
0x273B,
0x273C,
0x273D,
0x273E,
0x273F,
0x2740,
0x2741,
0x2742,
0x2743,
0x2744,
0x2745,
0x2746,
0x2747,
0x2748,
0x2749,
0x274A,
0x274B,
0x274C,
0x274D,
0x274E,
0x274F,
0x2750,
0x2751,
0x2752,
0x2753,
0x2754,
0x2755,
0x2756,
0x2757,
0x2758,
0x2759,
0x275A,
0x275B,
0x275C,
0x275D,
0x275E,
0x275F,
0x2760,
0x2761,
0x2762,
0x2763,
0x2764,
0x2765,
0x2766,
0x2767,
0x2794,
0x2795,
0x2796,
0x2797,
0x2798,
0x2799,
0x279A,
0x279B,
0x279C,
0x279D,
0x279E,
0x279F,
0x27A0,
0x27A1,
0x27A2,
0x27A3,
0x27A4,
0x27A5,
0x27A6,
0x27A7,
0x27A8,
0x27A9,
0x27AA,
0x27AB,
0x27AC,
0x27AD,
0x27AE,
0x27AF,
0x27B0,
0x27B1,
0x27B2,
0x27B3,
0x27B4,
0x27B5,
0x27B6,
0x27B7,
0x27B8,
0x27B9,
0x27BA,
0x27BB,
0x27BC,
0x27BD,
0x27BE,
0x27BF,
0x2800,
0x2801,
0x2802,
0x2803,
0x2804,
0x2805,
0x2806,
0x2807,
0x2808,
0x2809,
0x280A,
0x280B,
0x280C,
0x280D,
0x280E,
0x280F,
0x2810,
0x2811,
0x2812,
0x2813,
0x2814,
0x2815,
0x2816,
0x2817,
0x2818,
0x2819,
0x281A,
0x281B,
0x281C,
0x281D,
0x281E,
0x281F,
0x2820,
0x2821,
0x2822,
0x2823,
0x2824,
0x2825,
0x2826,
0x2827,
0x2828,
0x2829,
0x282A,
0x282B,
0x282C,
0x282D,
0x282E,
0x282F,
0x2830,
0x2831,
0x2832,
0x2833,
0x2834,
0x2835,
0x2836,
0x2837,
0x2838,
0x2839,
0x283A,
0x283B,
0x283C,
0x283D,
0x283E,
0x283F,
0x2840,
0x2841,
0x2842,
0x2843,
0x2844,
0x2845,
0x2846,
0x2847,
0x2848,
0x2849,
0x284A,
0x284B,
0x284C,
0x284D,
0x284E,
0x284F,
0x2850,
0x2851,
0x2852,
0x2853,
0x2854,
0x2855,
0x2856,
0x2857,
0x2858,
0x2859,
0x285A,
0x285B,
0x285C,
0x285D,
0x285E,
0x285F,
0x2860,
0x2861,
0x2862,
0x2863,
0x2864,
0x2865,
0x2866,
0x2867,
0x2868,
0x2869,
0x286A,
0x286B,
0x286C,
0x286D,
0x286E,
0x286F,
0x2870,
0x2871,
0x2872,
0x2873,
0x2874,
0x2875,
0x2876,
0x2877,
0x2878,
0x2879,
0x287A,
0x287B,
0x287C,
0x287D,
0x287E,
0x287F,
0x2880,
0x2881,
0x2882,
0x2883,
0x2884,
0x2885,
0x2886,
0x2887,
0x2888,
0x2889,
0x288A,
0x288B,
0x288C,
0x288D,
0x288E,
0x288F,
0x2890,
0x2891,
0x2892,
0x2893,
0x2894,
0x2895,
0x2896,
0x2897,
0x2898,
0x2899,
0x289A,
0x289B,
0x289C,
0x289D,
0x289E,
0x289F,
0x28A0,
0x28A1,
0x28A2,
0x28A3,
0x28A4,
0x28A5,
0x28A6,
0x28A7,
0x28A8,
0x28A9,
0x28AA,
0x28AB,
0x28AC,
0x28AD,
0x28AE,
0x28AF,
0x28B0,
0x28B1,
0x28B2,
0x28B3,
0x28B4,
0x28B5,
0x28B6,
0x28B7,
0x28B8,
0x28B9,
0x28BA,
0x28BB,
0x28BC,
0x28BD,
0x28BE,
0x28BF,
0x28C0,
0x28C1,
0x28C2,
0x28C3,
0x28C4,
0x28C5,
0x28C6,
0x28C7,
0x28C8,
0x28C9,
0x28CA,
0x28CB,
0x28CC,
0x28CD,
0x28CE,
0x28CF,
0x28D0,
0x28D1,
0x28D2,
0x28D3,
0x28D4,
0x28D5,
0x28D6,
0x28D7,
0x28D8,
0x28D9,
0x28DA,
0x28DB,
0x28DC,
0x28DD,
0x28DE,
0x28DF,
0x28E0,
0x28E1,
0x28E2,
0x28E3,
0x28E4,
0x28E5,
0x28E6,
0x28E7,
0x28E8,
0x28E9,
0x28EA,
0x28EB,
0x28EC,
0x28ED,
0x28EE,
0x28EF,
0x28F0,
0x28F1,
0x28F2,
0x28F3,
0x28F4,
0x28F5,
0x28F6,
0x28F7,
0x28F8,
0x28F9,
0x28FA,
0x28FB,
0x28FC,
0x28FD,
0x28FE,
0x28FF,
0x2B00,
0x2B01,
0x2B02,
0x2B03,
0x2B04,
0x2B05,
0x2B06,
0x2B07,
0x2B08,
0x2B09,
0x2B0A,
0x2B0B,
0x2B0C,
0x2B0D,
0x2B0E,
0x2B0F,
0x2B10,
0x2B11,
0x2B12,
0x2B13,
0x2B14,
0x2B15,
0x2B16,
0x2B17,
0x2B18,
0x2B19,
0x2B1A,
0x2B1B,
0x2B1C,
0x2B1D,
0x2B1E,
0x2B1F,
0x2B20,
0x2B21,
0x2B22,
0x2B23,
0x2B24,
0x2B25,
0x2B26,
0x2B27,
0x2B28,
0x2B29,
0x2B2A,
0x2B2B,
0x2B2C,
0x2B2D,
0x2B2E,
0x2B2F,
0x2B45,
0x2B46,
0x2B4D,
0x2B4E,
0x2B4F,
0x2B50,
0x2B51,
0x2B52,
0x2B53,
0x2B54,
0x2B55,
0x2B56,
0x2B57,
0x2B58,
0x2B59,
0x2B5A,
0x2B5B,
0x2B5C,
0x2B5D,
0x2B5E,
0x2B5F,
0x2B60,
0x2B61,
0x2B62,
0x2B63,
0x2B64,
0x2B65,
0x2B66,
0x2B67,
0x2B68,
0x2B69,
0x2B6A,
0x2B6B,
0x2B6C,
0x2B6D,
0x2B6E,
0x2B6F,
0x2B70,
0x2B71,
0x2B72,
0x2B73,
0x2B76,
0x2B77,
0x2B78,
0x2B79,
0x2B7A,
0x2B7B,
0x2B7C,
0x2B7D,
0x2B7E,
0x2B7F,
0x2B80,
0x2B81,
0x2B82,
0x2B83,
0x2B84,
0x2B85,
0x2B86,
0x2B87,
0x2B88,
0x2B89,
0x2B8A,
0x2B8B,
0x2B8C,
0x2B8D,
0x2B8E,
0x2B8F,
0x2B90,
0x2B91,
0x2B92,
0x2B93,
0x2B94,
0x2B95,
0x2B98,
0x2B99,
0x2B9A,
0x2B9B,
0x2B9C,
0x2B9D,
0x2B9E,
0x2B9F,
0x2BA0,
0x2BA1,
0x2BA2,
0x2BA3,
0x2BA4,
0x2BA5,
0x2BA6,
0x2BA7,
0x2BA8,
0x2BA9,
0x2BAA,
0x2BAB,
0x2BAC,
0x2BAD,
0x2BAE,
0x2BAF,
0x2BB0,
0x2BB1,
0x2BB2,
0x2BB3,
0x2BB4,
0x2BB5,
0x2BB6,
0x2BB7,
0x2BB8,
0x2BB9,
0x2BBD,
0x2BBE,
0x2BBF,
0x2BC0,
0x2BC1,
0x2BC2,
0x2BC3,
0x2BC4,
0x2BC5,
0x2BC6,
0x2BC7,
0x2BC8,
0x2BCA,
0x2BCB,
0x2BCC,
0x2BCD,
0x2BCE,
0x2BCF,
0x2BD0,
0x2BD1,
0x2BEC,
0x2BED,
0x2BEE,
0x2BEF,
0x2CE5,
0x2CE6,
0x2CE7,
0x2CE8,
0x2CE9,
0x2CEA,
0x2E80,
0x2E81,
0x2E82,
0x2E83,
0x2E84,
0x2E85,
0x2E86,
0x2E87,
0x2E88,
0x2E89,
0x2E8A,
0x2E8B,
0x2E8C,
0x2E8D,
0x2E8E,
0x2E8F,
0x2E90,
0x2E91,
0x2E92,
0x2E93,
0x2E94,
0x2E95,
0x2E96,
0x2E97,
0x2E98,
0x2E99,
0x2E9B,
0x2E9C,
0x2E9D,
0x2E9E,
0x2E9F,
0x2EA0,
0x2EA1,
0x2EA2,
0x2EA3,
0x2EA4,
0x2EA5,
0x2EA6,
0x2EA7,
0x2EA8,
0x2EA9,
0x2EAA,
0x2EAB,
0x2EAC,
0x2EAD,
0x2EAE,
0x2EAF,
0x2EB0,
0x2EB1,
0x2EB2,
0x2EB3,
0x2EB4,
0x2EB5,
0x2EB6,
0x2EB7,
0x2EB8,
0x2EB9,
0x2EBA,
0x2EBB,
0x2EBC,
0x2EBD,
0x2EBE,
0x2EBF,
0x2EC0,
0x2EC1,
0x2EC2,
0x2EC3,
0x2EC4,
0x2EC5,
0x2EC6,
0x2EC7,
0x2EC8,
0x2EC9,
0x2ECA,
0x2ECB,
0x2ECC,
0x2ECD,
0x2ECE,
0x2ECF,
0x2ED0,
0x2ED1,
0x2ED2,
0x2ED3,
0x2ED4,
0x2ED5,
0x2ED6,
0x2ED7,
0x2ED8,
0x2ED9,
0x2EDA,
0x2EDB,
0x2EDC,
0x2EDD,
0x2EDE,
0x2EDF,
0x2EE0,
0x2EE1,
0x2EE2,
0x2EE3,
0x2EE4,
0x2EE5,
0x2EE6,
0x2EE7,
0x2EE8,
0x2EE9,
0x2EEA,
0x2EEB,
0x2EEC,
0x2EED,
0x2EEE,
0x2EEF,
0x2EF0,
0x2EF1,
0x2EF2,
0x2EF3,
0x2F00,
0x2F01,
0x2F02,
0x2F03,
0x2F04,
0x2F05,
0x2F06,
0x2F07,
0x2F08,
0x2F09,
0x2F0A,
0x2F0B,
0x2F0C,
0x2F0D,
0x2F0E,
0x2F0F,
0x2F10,
0x2F11,
0x2F12,
0x2F13,
0x2F14,
0x2F15,
0x2F16,
0x2F17,
0x2F18,
0x2F19,
0x2F1A,
0x2F1B,
0x2F1C,
0x2F1D,
0x2F1E,
0x2F1F,
0x2F20,
0x2F21,
0x2F22,
0x2F23,
0x2F24,
0x2F25,
0x2F26,
0x2F27,
0x2F28,
0x2F29,
0x2F2A,
0x2F2B,
0x2F2C,
0x2F2D,
0x2F2E,
0x2F2F,
0x2F30,
0x2F31,
0x2F32,
0x2F33,
0x2F34,
0x2F35,
0x2F36,
0x2F37,
0x2F38,
0x2F39,
0x2F3A,
0x2F3B,
0x2F3C,
0x2F3D,
0x2F3E,
0x2F3F,
0x2F40,
0x2F41,
0x2F42,
0x2F43,
0x2F44,
0x2F45,
0x2F46,
0x2F47,
0x2F48,
0x2F49,
0x2F4A,
0x2F4B,
0x2F4C,
0x2F4D,
0x2F4E,
0x2F4F,
0x2F50,
0x2F51,
0x2F52,
0x2F53,
0x2F54,
0x2F55,
0x2F56,
0x2F57,
0x2F58,
0x2F59,
0x2F5A,
0x2F5B,
0x2F5C,
0x2F5D,
0x2F5E,
0x2F5F,
0x2F60,
0x2F61,
0x2F62,
0x2F63,
0x2F64,
0x2F65,
0x2F66,
0x2F67,
0x2F68,
0x2F69,
0x2F6A,
0x2F6B,
0x2F6C,
0x2F6D,
0x2F6E,
0x2F6F,
0x2F70,
0x2F71,
0x2F72,
0x2F73,
0x2F74,
0x2F75,
0x2F76,
0x2F77,
0x2F78,
0x2F79,
0x2F7A,
0x2F7B,
0x2F7C,
0x2F7D,
0x2F7E,
0x2F7F,
0x2F80,
0x2F81,
0x2F82,
0x2F83,
0x2F84,
0x2F85,
0x2F86,
0x2F87,
0x2F88,
0x2F89,
0x2F8A,
0x2F8B,
0x2F8C,
0x2F8D,
0x2F8E,
0x2F8F,
0x2F90,
0x2F91,
0x2F92,
0x2F93,
0x2F94,
0x2F95,
0x2F96,
0x2F97,
0x2F98,
0x2F99,
0x2F9A,
0x2F9B,
0x2F9C,
0x2F9D,
0x2F9E,
0x2F9F,
0x2FA0,
0x2FA1,
0x2FA2,
0x2FA3,
0x2FA4,
0x2FA5,
0x2FA6,
0x2FA7,
0x2FA8,
0x2FA9,
0x2FAA,
0x2FAB,
0x2FAC,
0x2FAD,
0x2FAE,
0x2FAF,
0x2FB0,
0x2FB1,
0x2FB2,
0x2FB3,
0x2FB4,
0x2FB5,
0x2FB6,
0x2FB7,
0x2FB8,
0x2FB9,
0x2FBA,
0x2FBB,
0x2FBC,
0x2FBD,
0x2FBE,
0x2FBF,
0x2FC0,
0x2FC1,
0x2FC2,
0x2FC3,
0x2FC4,
0x2FC5,
0x2FC6,
0x2FC7,
0x2FC8,
0x2FC9,
0x2FCA,
0x2FCB,
0x2FCC,
0x2FCD,
0x2FCE,
0x2FCF,
0x2FD0,
0x2FD1,
0x2FD2,
0x2FD3,
0x2FD4,
0x2FD5,
0x2FF0,
0x2FF1,
0x2FF2,
0x2FF3,
0x2FF4,
0x2FF5,
0x2FF6,
0x2FF7,
0x2FF8,
0x2FF9,
0x2FFA,
0x2FFB,
0x3004,
0x3012,
0x3013,
0x3020,
0x3036,
0x3037,
0x303E,
0x303F,
0x3190,
0x3191,
0x3196,
0x3197,
0x3198,
0x3199,
0x319A,
0x319B,
0x319C,
0x319D,
0x319E,
0x319F,
0x31C0,
0x31C1,
0x31C2,
0x31C3,
0x31C4,
0x31C5,
0x31C6,
0x31C7,
0x31C8,
0x31C9,
0x31CA,
0x31CB,
0x31CC,
0x31CD,
0x31CE,
0x31CF,
0x31D0,
0x31D1,
0x31D2,
0x31D3,
0x31D4,
0x31D5,
0x31D6,
0x31D7,
0x31D8,
0x31D9,
0x31DA,
0x31DB,
0x31DC,
0x31DD,
0x31DE,
0x31DF,
0x31E0,
0x31E1,
0x31E2,
0x31E3,
0x3200,
0x3201,
0x3202,
0x3203,
0x3204,
0x3205,
0x3206,
0x3207,
0x3208,
0x3209,
0x320A,
0x320B,
0x320C,
0x320D,
0x320E,
0x320F,
0x3210,
0x3211,
0x3212,
0x3213,
0x3214,
0x3215,
0x3216,
0x3217,
0x3218,
0x3219,
0x321A,
0x321B,
0x321C,
0x321D,
0x321E,
0x322A,
0x322B,
0x322C,
0x322D,
0x322E,
0x322F,
0x3230,
0x3231,
0x3232,
0x3233,
0x3234,
0x3235,
0x3236,
0x3237,
0x3238,
0x3239,
0x323A,
0x323B,
0x323C,
0x323D,
0x323E,
0x323F,
0x3240,
0x3241,
0x3242,
0x3243,
0x3244,
0x3245,
0x3246,
0x3247,
0x3250,
0x3260,
0x3261,
0x3262,
0x3263,
0x3264,
0x3265,
0x3266,
0x3267,
0x3268,
0x3269,
0x326A,
0x326B,
0x326C,
0x326D,
0x326E,
0x326F,
0x3270,
0x3271,
0x3272,
0x3273,
0x3274,
0x3275,
0x3276,
0x3277,
0x3278,
0x3279,
0x327A,
0x327B,
0x327C,
0x327D,
0x327E,
0x327F,
0x328A,
0x328B,
0x328C,
0x328D,
0x328E,
0x328F,
0x3290,
0x3291,
0x3292,
0x3293,
0x3294,
0x3295,
0x3296,
0x3297,
0x3298,
0x3299,
0x329A,
0x329B,
0x329C,
0x329D,
0x329E,
0x329F,
0x32A0,
0x32A1,
0x32A2,
0x32A3,
0x32A4,
0x32A5,
0x32A6,
0x32A7,
0x32A8,
0x32A9,
0x32AA,
0x32AB,
0x32AC,
0x32AD,
0x32AE,
0x32AF,
0x32B0,
0x32C0,
0x32C1,
0x32C2,
0x32C3,
0x32C4,
0x32C5,
0x32C6,
0x32C7,
0x32C8,
0x32C9,
0x32CA,
0x32CB,
0x32CC,
0x32CD,
0x32CE,
0x32CF,
0x32D0,
0x32D1,
0x32D2,
0x32D3,
0x32D4,
0x32D5,
0x32D6,
0x32D7,
0x32D8,
0x32D9,
0x32DA,
0x32DB,
0x32DC,
0x32DD,
0x32DE,
0x32DF,
0x32E0,
0x32E1,
0x32E2,
0x32E3,
0x32E4,
0x32E5,
0x32E6,
0x32E7,
0x32E8,
0x32E9,
0x32EA,
0x32EB,
0x32EC,
0x32ED,
0x32EE,
0x32EF,
0x32F0,
0x32F1,
0x32F2,
0x32F3,
0x32F4,
0x32F5,
0x32F6,
0x32F7,
0x32F8,
0x32F9,
0x32FA,
0x32FB,
0x32FC,
0x32FD,
0x32FE,
0x3300,
0x3301,
0x3302,
0x3303,
0x3304,
0x3305,
0x3306,
0x3307,
0x3308,
0x3309,
0x330A,
0x330B,
0x330C,
0x330D,
0x330E,
0x330F,
0x3310,
0x3311,
0x3312,
0x3313,
0x3314,
0x3315,
0x3316,
0x3317,
0x3318,
0x3319,
0x331A,
0x331B,
0x331C,
0x331D,
0x331E,
0x331F,
0x3320,
0x3321,
0x3322,
0x3323,
0x3324,
0x3325,
0x3326,
0x3327,
0x3328,
0x3329,
0x332A,
0x332B,
0x332C,
0x332D,
0x332E,
0x332F,
0x3330,
0x3331,
0x3332,
0x3333,
0x3334,
0x3335,
0x3336,
0x3337,
0x3338,
0x3339,
0x333A,
0x333B,
0x333C,
0x333D,
0x333E,
0x333F,
0x3340,
0x3341,
0x3342,
0x3343,
0x3344,
0x3345,
0x3346,
0x3347,
0x3348,
0x3349,
0x334A,
0x334B,
0x334C,
0x334D,
0x334E,
0x334F,
0x3350,
0x3351,
0x3352,
0x3353,
0x3354,
0x3355,
0x3356,
0x3357,
0x3358,
0x3359,
0x335A,
0x335B,
0x335C,
0x335D,
0x335E,
0x335F,
0x3360,
0x3361,
0x3362,
0x3363,
0x3364,
0x3365,
0x3366,
0x3367,
0x3368,
0x3369,
0x336A,
0x336B,
0x336C,
0x336D,
0x336E,
0x336F,
0x3370,
0x3371,
0x3372,
0x3373,
0x3374,
0x3375,
0x3376,
0x3377,
0x3378,
0x3379,
0x337A,
0x337B,
0x337C,
0x337D,
0x337E,
0x337F,
0x3380,
0x3381,
0x3382,
0x3383,
0x3384,
0x3385,
0x3386,
0x3387,
0x3388,
0x3389,
0x338A,
0x338B,
0x338C,
0x338D,
0x338E,
0x338F,
0x3390,
0x3391,
0x3392,
0x3393,
0x3394,
0x3395,
0x3396,
0x3397,
0x3398,
0x3399,
0x339A,
0x339B,
0x339C,
0x339D,
0x339E,
0x339F,
0x33A0,
0x33A1,
0x33A2,
0x33A3,
0x33A4,
0x33A5,
0x33A6,
0x33A7,
0x33A8,
0x33A9,
0x33AA,
0x33AB,
0x33AC,
0x33AD,
0x33AE,
0x33AF,
0x33B0,
0x33B1,
0x33B2,
0x33B3,
0x33B4,
0x33B5,
0x33B6,
0x33B7,
0x33B8,
0x33B9,
0x33BA,
0x33BB,
0x33BC,
0x33BD,
0x33BE,
0x33BF,
0x33C0,
0x33C1,
0x33C2,
0x33C3,
0x33C4,
0x33C5,
0x33C6,
0x33C7,
0x33C8,
0x33C9,
0x33CA,
0x33CB,
0x33CC,
0x33CD,
0x33CE,
0x33CF,
0x33D0,
0x33D1,
0x33D2,
0x33D3,
0x33D4,
0x33D5,
0x33D6,
0x33D7,
0x33D8,
0x33D9,
0x33DA,
0x33DB,
0x33DC,
0x33DD,
0x33DE,
0x33DF,
0x33E0,
0x33E1,
0x33E2,
0x33E3,
0x33E4,
0x33E5,
0x33E6,
0x33E7,
0x33E8,
0x33E9,
0x33EA,
0x33EB,
0x33EC,
0x33ED,
0x33EE,
0x33EF,
0x33F0,
0x33F1,
0x33F2,
0x33F3,
0x33F4,
0x33F5,
0x33F6,
0x33F7,
0x33F8,
0x33F9,
0x33FA,
0x33FB,
0x33FC,
0x33FD,
0x33FE,
0x33FF,
0x4DC0,
0x4DC1,
0x4DC2,
0x4DC3,
0x4DC4,
0x4DC5,
0x4DC6,
0x4DC7,
0x4DC8,
0x4DC9,
0x4DCA,
0x4DCB,
0x4DCC,
0x4DCD,
0x4DCE,
0x4DCF,
0x4DD0,
0x4DD1,
0x4DD2,
0x4DD3,
0x4DD4,
0x4DD5,
0x4DD6,
0x4DD7,
0x4DD8,
0x4DD9,
0x4DDA,
0x4DDB,
0x4DDC,
0x4DDD,
0x4DDE,
0x4DDF,
0x4DE0,
0x4DE1,
0x4DE2,
0x4DE3,
0x4DE4,
0x4DE5,
0x4DE6,
0x4DE7,
0x4DE8,
0x4DE9,
0x4DEA,
0x4DEB,
0x4DEC,
0x4DED,
0x4DEE,
0x4DEF,
0x4DF0,
0x4DF1,
0x4DF2,
0x4DF3,
0x4DF4,
0x4DF5,
0x4DF6,
0x4DF7,
0x4DF8,
0x4DF9,
0x4DFA,
0x4DFB,
0x4DFC,
0x4DFD,
0x4DFE,
0x4DFF,
0xA490,
0xA491,
0xA492,
0xA493,
0xA494,
0xA495,
0xA496,
0xA497,
0xA498,
0xA499,
0xA49A,
0xA49B,
0xA49C,
0xA49D,
0xA49E,
0xA49F,
0xA4A0,
0xA4A1,
0xA4A2,
0xA4A3,
0xA4A4,
0xA4A5,
0xA4A6,
0xA4A7,
0xA4A8,
0xA4A9,
0xA4AA,
0xA4AB,
0xA4AC,
0xA4AD,
0xA4AE,
0xA4AF,
0xA4B0,
0xA4B1,
0xA4B2,
0xA4B3,
0xA4B4,
0xA4B5,
0xA4B6,
0xA4B7,
0xA4B8,
0xA4B9,
0xA4BA,
0xA4BB,
0xA4BC,
0xA4BD,
0xA4BE,
0xA4BF,
0xA4C0,
0xA4C1,
0xA4C2,
0xA4C3,
0xA4C4,
0xA4C5,
0xA4C6,
0xA828,
0xA829,
0xA82A,
0xA82B,
0xA836,
0xA837,
0xA839,
0xAA77,
0xAA78,
0xAA79,
0xFDFD,
0xFFE4,
0xFFE8,
0xFFED,
0xFFEE,
0xFFFC,
0xFFFD,
0x10137,
0x10138,
0x10139,
0x1013A,
0x1013B,
0x1013C,
0x1013D,
0x1013E,
0x1013F,
0x10179,
0x1017A,
0x1017B,
0x1017C,
0x1017D,
0x1017E,
0x1017F,
0x10180,
0x10181,
0x10182,
0x10183,
0x10184,
0x10185,
0x10186,
0x10187,
0x10188,
0x10189,
0x1018C,
0x1018D,
0x1018E,
0x10190,
0x10191,
0x10192,
0x10193,
0x10194,
0x10195,
0x10196,
0x10197,
0x10198,
0x10199,
0x1019A,
0x1019B,
0x101A0,
0x101D0,
0x101D1,
0x101D2,
0x101D3,
0x101D4,
0x101D5,
0x101D6,
0x101D7,
0x101D8,
0x101D9,
0x101DA,
0x101DB,
0x101DC,
0x101DD,
0x101DE,
0x101DF,
0x101E0,
0x101E1,
0x101E2,
0x101E3,
0x101E4,
0x101E5,
0x101E6,
0x101E7,
0x101E8,
0x101E9,
0x101EA,
0x101EB,
0x101EC,
0x101ED,
0x101EE,
0x101EF,
0x101F0,
0x101F1,
0x101F2,
0x101F3,
0x101F4,
0x101F5,
0x101F6,
0x101F7,
0x101F8,
0x101F9,
0x101FA,
0x101FB,
0x101FC,
0x10877,
0x10878,
0x10AC8,
0x1173F,
0x16B3C,
0x16B3D,
0x16B3E,
0x16B3F,
0x16B45,
0x1BC9C,
0x1D000,
0x1D001,
0x1D002,
0x1D003,
0x1D004,
0x1D005,
0x1D006,
0x1D007,
0x1D008,
0x1D009,
0x1D00A,
0x1D00B,
0x1D00C,
0x1D00D,
0x1D00E,
0x1D00F,
0x1D010,
0x1D011,
0x1D012,
0x1D013,
0x1D014,
0x1D015,
0x1D016,
0x1D017,
0x1D018,
0x1D019,
0x1D01A,
0x1D01B,
0x1D01C,
0x1D01D,
0x1D01E,
0x1D01F,
0x1D020,
0x1D021,
0x1D022,
0x1D023,
0x1D024,
0x1D025,
0x1D026,
0x1D027,
0x1D028,
0x1D029,
0x1D02A,
0x1D02B,
0x1D02C,
0x1D02D,
0x1D02E,
0x1D02F,
0x1D030,
0x1D031,
0x1D032,
0x1D033,
0x1D034,
0x1D035,
0x1D036,
0x1D037,
0x1D038,
0x1D039,
0x1D03A,
0x1D03B,
0x1D03C,
0x1D03D,
0x1D03E,
0x1D03F,
0x1D040,
0x1D041,
0x1D042,
0x1D043,
0x1D044,
0x1D045,
0x1D046,
0x1D047,
0x1D048,
0x1D049,
0x1D04A,
0x1D04B,
0x1D04C,
0x1D04D,
0x1D04E,
0x1D04F,
0x1D050,
0x1D051,
0x1D052,
0x1D053,
0x1D054,
0x1D055,
0x1D056,
0x1D057,
0x1D058,
0x1D059,
0x1D05A,
0x1D05B,
0x1D05C,
0x1D05D,
0x1D05E,
0x1D05F,
0x1D060,
0x1D061,
0x1D062,
0x1D063,
0x1D064,
0x1D065,
0x1D066,
0x1D067,
0x1D068,
0x1D069,
0x1D06A,
0x1D06B,
0x1D06C,
0x1D06D,
0x1D06E,
0x1D06F,
0x1D070,
0x1D071,
0x1D072,
0x1D073,
0x1D074,
0x1D075,
0x1D076,
0x1D077,
0x1D078,
0x1D079,
0x1D07A,
0x1D07B,
0x1D07C,
0x1D07D,
0x1D07E,
0x1D07F,
0x1D080,
0x1D081,
0x1D082,
0x1D083,
0x1D084,
0x1D085,
0x1D086,
0x1D087,
0x1D088,
0x1D089,
0x1D08A,
0x1D08B,
0x1D08C,
0x1D08D,
0x1D08E,
0x1D08F,
0x1D090,
0x1D091,
0x1D092,
0x1D093,
0x1D094,
0x1D095,
0x1D096,
0x1D097,
0x1D098,
0x1D099,
0x1D09A,
0x1D09B,
0x1D09C,
0x1D09D,
0x1D09E,
0x1D09F,
0x1D0A0,
0x1D0A1,
0x1D0A2,
0x1D0A3,
0x1D0A4,
0x1D0A5,
0x1D0A6,
0x1D0A7,
0x1D0A8,
0x1D0A9,
0x1D0AA,
0x1D0AB,
0x1D0AC,
0x1D0AD,
0x1D0AE,
0x1D0AF,
0x1D0B0,
0x1D0B1,
0x1D0B2,
0x1D0B3,
0x1D0B4,
0x1D0B5,
0x1D0B6,
0x1D0B7,
0x1D0B8,
0x1D0B9,
0x1D0BA,
0x1D0BB,
0x1D0BC,
0x1D0BD,
0x1D0BE,
0x1D0BF,
0x1D0C0,
0x1D0C1,
0x1D0C2,
0x1D0C3,
0x1D0C4,
0x1D0C5,
0x1D0C6,
0x1D0C7,
0x1D0C8,
0x1D0C9,
0x1D0CA,
0x1D0CB,
0x1D0CC,
0x1D0CD,
0x1D0CE,
0x1D0CF,
0x1D0D0,
0x1D0D1,
0x1D0D2,
0x1D0D3,
0x1D0D4,
0x1D0D5,
0x1D0D6,
0x1D0D7,
0x1D0D8,
0x1D0D9,
0x1D0DA,
0x1D0DB,
0x1D0DC,
0x1D0DD,
0x1D0DE,
0x1D0DF,
0x1D0E0,
0x1D0E1,
0x1D0E2,
0x1D0E3,
0x1D0E4,
0x1D0E5,
0x1D0E6,
0x1D0E7,
0x1D0E8,
0x1D0E9,
0x1D0EA,
0x1D0EB,
0x1D0EC,
0x1D0ED,
0x1D0EE,
0x1D0EF,
0x1D0F0,
0x1D0F1,
0x1D0F2,
0x1D0F3,
0x1D0F4,
0x1D0F5,
0x1D100,
0x1D101,
0x1D102,
0x1D103,
0x1D104,
0x1D105,
0x1D106,
0x1D107,
0x1D108,
0x1D109,
0x1D10A,
0x1D10B,
0x1D10C,
0x1D10D,
0x1D10E,
0x1D10F,
0x1D110,
0x1D111,
0x1D112,
0x1D113,
0x1D114,
0x1D115,
0x1D116,
0x1D117,
0x1D118,
0x1D119,
0x1D11A,
0x1D11B,
0x1D11C,
0x1D11D,
0x1D11E,
0x1D11F,
0x1D120,
0x1D121,
0x1D122,
0x1D123,
0x1D124,
0x1D125,
0x1D126,
0x1D129,
0x1D12A,
0x1D12B,
0x1D12C,
0x1D12D,
0x1D12E,
0x1D12F,
0x1D130,
0x1D131,
0x1D132,
0x1D133,
0x1D134,
0x1D135,
0x1D136,
0x1D137,
0x1D138,
0x1D139,
0x1D13A,
0x1D13B,
0x1D13C,
0x1D13D,
0x1D13E,
0x1D13F,
0x1D140,
0x1D141,
0x1D142,
0x1D143,
0x1D144,
0x1D145,
0x1D146,
0x1D147,
0x1D148,
0x1D149,
0x1D14A,
0x1D14B,
0x1D14C,
0x1D14D,
0x1D14E,
0x1D14F,
0x1D150,
0x1D151,
0x1D152,
0x1D153,
0x1D154,
0x1D155,
0x1D156,
0x1D157,
0x1D158,
0x1D159,
0x1D15A,
0x1D15B,
0x1D15C,
0x1D15D,
0x1D15E,
0x1D15F,
0x1D160,
0x1D161,
0x1D162,
0x1D163,
0x1D164,
0x1D16A,
0x1D16B,
0x1D16C,
0x1D183,
0x1D184,
0x1D18C,
0x1D18D,
0x1D18E,
0x1D18F,
0x1D190,
0x1D191,
0x1D192,
0x1D193,
0x1D194,
0x1D195,
0x1D196,
0x1D197,
0x1D198,
0x1D199,
0x1D19A,
0x1D19B,
0x1D19C,
0x1D19D,
0x1D19E,
0x1D19F,
0x1D1A0,
0x1D1A1,
0x1D1A2,
0x1D1A3,
0x1D1A4,
0x1D1A5,
0x1D1A6,
0x1D1A7,
0x1D1A8,
0x1D1A9,
0x1D1AE,
0x1D1AF,
0x1D1B0,
0x1D1B1,
0x1D1B2,
0x1D1B3,
0x1D1B4,
0x1D1B5,
0x1D1B6,
0x1D1B7,
0x1D1B8,
0x1D1B9,
0x1D1BA,
0x1D1BB,
0x1D1BC,
0x1D1BD,
0x1D1BE,
0x1D1BF,
0x1D1C0,
0x1D1C1,
0x1D1C2,
0x1D1C3,
0x1D1C4,
0x1D1C5,
0x1D1C6,
0x1D1C7,
0x1D1C8,
0x1D1C9,
0x1D1CA,
0x1D1CB,
0x1D1CC,
0x1D1CD,
0x1D1CE,
0x1D1CF,
0x1D1D0,
0x1D1D1,
0x1D1D2,
0x1D1D3,
0x1D1D4,
0x1D1D5,
0x1D1D6,
0x1D1D7,
0x1D1D8,
0x1D1D9,
0x1D1DA,
0x1D1DB,
0x1D1DC,
0x1D1DD,
0x1D1DE,
0x1D1DF,
0x1D1E0,
0x1D1E1,
0x1D1E2,
0x1D1E3,
0x1D1E4,
0x1D1E5,
0x1D1E6,
0x1D1E7,
0x1D1E8,
0x1D200,
0x1D201,
0x1D202,
0x1D203,
0x1D204,
0x1D205,
0x1D206,
0x1D207,
0x1D208,
0x1D209,
0x1D20A,
0x1D20B,
0x1D20C,
0x1D20D,
0x1D20E,
0x1D20F,
0x1D210,
0x1D211,
0x1D212,
0x1D213,
0x1D214,
0x1D215,
0x1D216,
0x1D217,
0x1D218,
0x1D219,
0x1D21A,
0x1D21B,
0x1D21C,
0x1D21D,
0x1D21E,
0x1D21F,
0x1D220,
0x1D221,
0x1D222,
0x1D223,
0x1D224,
0x1D225,
0x1D226,
0x1D227,
0x1D228,
0x1D229,
0x1D22A,
0x1D22B,
0x1D22C,
0x1D22D,
0x1D22E,
0x1D22F,
0x1D230,
0x1D231,
0x1D232,
0x1D233,
0x1D234,
0x1D235,
0x1D236,
0x1D237,
0x1D238,
0x1D239,
0x1D23A,
0x1D23B,
0x1D23C,
0x1D23D,
0x1D23E,
0x1D23F,
0x1D240,
0x1D241,
0x1D245,
0x1D300,
0x1D301,
0x1D302,
0x1D303,
0x1D304,
0x1D305,
0x1D306,
0x1D307,
0x1D308,
0x1D309,
0x1D30A,
0x1D30B,
0x1D30C,
0x1D30D,
0x1D30E,
0x1D30F,
0x1D310,
0x1D311,
0x1D312,
0x1D313,
0x1D314,
0x1D315,
0x1D316,
0x1D317,
0x1D318,
0x1D319,
0x1D31A,
0x1D31B,
0x1D31C,
0x1D31D,
0x1D31E,
0x1D31F,
0x1D320,
0x1D321,
0x1D322,
0x1D323,
0x1D324,
0x1D325,
0x1D326,
0x1D327,
0x1D328,
0x1D329,
0x1D32A,
0x1D32B,
0x1D32C,
0x1D32D,
0x1D32E,
0x1D32F,
0x1D330,
0x1D331,
0x1D332,
0x1D333,
0x1D334,
0x1D335,
0x1D336,
0x1D337,
0x1D338,
0x1D339,
0x1D33A,
0x1D33B,
0x1D33C,
0x1D33D,
0x1D33E,
0x1D33F,
0x1D340,
0x1D341,
0x1D342,
0x1D343,
0x1D344,
0x1D345,
0x1D346,
0x1D347,
0x1D348,
0x1D349,
0x1D34A,
0x1D34B,
0x1D34C,
0x1D34D,
0x1D34E,
0x1D34F,
0x1D350,
0x1D351,
0x1D352,
0x1D353,
0x1D354,
0x1D355,
0x1D356,
0x1D800,
0x1D801,
0x1D802,
0x1D803,
0x1D804,
0x1D805,
0x1D806,
0x1D807,
0x1D808,
0x1D809,
0x1D80A,
0x1D80B,
0x1D80C,
0x1D80D,
0x1D80E,
0x1D80F,
0x1D810,
0x1D811,
0x1D812,
0x1D813,
0x1D814,
0x1D815,
0x1D816,
0x1D817,
0x1D818,
0x1D819,
0x1D81A,
0x1D81B,
0x1D81C,
0x1D81D,
0x1D81E,
0x1D81F,
0x1D820,
0x1D821,
0x1D822,
0x1D823,
0x1D824,
0x1D825,
0x1D826,
0x1D827,
0x1D828,
0x1D829,
0x1D82A,
0x1D82B,
0x1D82C,
0x1D82D,
0x1D82E,
0x1D82F,
0x1D830,
0x1D831,
0x1D832,
0x1D833,
0x1D834,
0x1D835,
0x1D836,
0x1D837,
0x1D838,
0x1D839,
0x1D83A,
0x1D83B,
0x1D83C,
0x1D83D,
0x1D83E,
0x1D83F,
0x1D840,
0x1D841,
0x1D842,
0x1D843,
0x1D844,
0x1D845,
0x1D846,
0x1D847,
0x1D848,
0x1D849,
0x1D84A,
0x1D84B,
0x1D84C,
0x1D84D,
0x1D84E,
0x1D84F,
0x1D850,
0x1D851,
0x1D852,
0x1D853,
0x1D854,
0x1D855,
0x1D856,
0x1D857,
0x1D858,
0x1D859,
0x1D85A,
0x1D85B,
0x1D85C,
0x1D85D,
0x1D85E,
0x1D85F,
0x1D860,
0x1D861,
0x1D862,
0x1D863,
0x1D864,
0x1D865,
0x1D866,
0x1D867,
0x1D868,
0x1D869,
0x1D86A,
0x1D86B,
0x1D86C,
0x1D86D,
0x1D86E,
0x1D86F,
0x1D870,
0x1D871,
0x1D872,
0x1D873,
0x1D874,
0x1D875,
0x1D876,
0x1D877,
0x1D878,
0x1D879,
0x1D87A,
0x1D87B,
0x1D87C,
0x1D87D,
0x1D87E,
0x1D87F,
0x1D880,
0x1D881,
0x1D882,
0x1D883,
0x1D884,
0x1D885,
0x1D886,
0x1D887,
0x1D888,
0x1D889,
0x1D88A,
0x1D88B,
0x1D88C,
0x1D88D,
0x1D88E,
0x1D88F,
0x1D890,
0x1D891,
0x1D892,
0x1D893,
0x1D894,
0x1D895,
0x1D896,
0x1D897,
0x1D898,
0x1D899,
0x1D89A,
0x1D89B,
0x1D89C,
0x1D89D,
0x1D89E,
0x1D89F,
0x1D8A0,
0x1D8A1,
0x1D8A2,
0x1D8A3,
0x1D8A4,
0x1D8A5,
0x1D8A6,
0x1D8A7,
0x1D8A8,
0x1D8A9,
0x1D8AA,
0x1D8AB,
0x1D8AC,
0x1D8AD,
0x1D8AE,
0x1D8AF,
0x1D8B0,
0x1D8B1,
0x1D8B2,
0x1D8B3,
0x1D8B4,
0x1D8B5,
0x1D8B6,
0x1D8B7,
0x1D8B8,
0x1D8B9,
0x1D8BA,
0x1D8BB,
0x1D8BC,
0x1D8BD,
0x1D8BE,
0x1D8BF,
0x1D8C0,
0x1D8C1,
0x1D8C2,
0x1D8C3,
0x1D8C4,
0x1D8C5,
0x1D8C6,
0x1D8C7,
0x1D8C8,
0x1D8C9,
0x1D8CA,
0x1D8CB,
0x1D8CC,
0x1D8CD,
0x1D8CE,
0x1D8CF,
0x1D8D0,
0x1D8D1,
0x1D8D2,
0x1D8D3,
0x1D8D4,
0x1D8D5,
0x1D8D6,
0x1D8D7,
0x1D8D8,
0x1D8D9,
0x1D8DA,
0x1D8DB,
0x1D8DC,
0x1D8DD,
0x1D8DE,
0x1D8DF,
0x1D8E0,
0x1D8E1,
0x1D8E2,
0x1D8E3,
0x1D8E4,
0x1D8E5,
0x1D8E6,
0x1D8E7,
0x1D8E8,
0x1D8E9,
0x1D8EA,
0x1D8EB,
0x1D8EC,
0x1D8ED,
0x1D8EE,
0x1D8EF,
0x1D8F0,
0x1D8F1,
0x1D8F2,
0x1D8F3,
0x1D8F4,
0x1D8F5,
0x1D8F6,
0x1D8F7,
0x1D8F8,
0x1D8F9,
0x1D8FA,
0x1D8FB,
0x1D8FC,
0x1D8FD,
0x1D8FE,
0x1D8FF,
0x1D900,
0x1D901,
0x1D902,
0x1D903,
0x1D904,
0x1D905,
0x1D906,
0x1D907,
0x1D908,
0x1D909,
0x1D90A,
0x1D90B,
0x1D90C,
0x1D90D,
0x1D90E,
0x1D90F,
0x1D910,
0x1D911,
0x1D912,
0x1D913,
0x1D914,
0x1D915,
0x1D916,
0x1D917,
0x1D918,
0x1D919,
0x1D91A,
0x1D91B,
0x1D91C,
0x1D91D,
0x1D91E,
0x1D91F,
0x1D920,
0x1D921,
0x1D922,
0x1D923,
0x1D924,
0x1D925,
0x1D926,
0x1D927,
0x1D928,
0x1D929,
0x1D92A,
0x1D92B,
0x1D92C,
0x1D92D,
0x1D92E,
0x1D92F,
0x1D930,
0x1D931,
0x1D932,
0x1D933,
0x1D934,
0x1D935,
0x1D936,
0x1D937,
0x1D938,
0x1D939,
0x1D93A,
0x1D93B,
0x1D93C,
0x1D93D,
0x1D93E,
0x1D93F,
0x1D940,
0x1D941,
0x1D942,
0x1D943,
0x1D944,
0x1D945,
0x1D946,
0x1D947,
0x1D948,
0x1D949,
0x1D94A,
0x1D94B,
0x1D94C,
0x1D94D,
0x1D94E,
0x1D94F,
0x1D950,
0x1D951,
0x1D952,
0x1D953,
0x1D954,
0x1D955,
0x1D956,
0x1D957,
0x1D958,
0x1D959,
0x1D95A,
0x1D95B,
0x1D95C,
0x1D95D,
0x1D95E,
0x1D95F,
0x1D960,
0x1D961,
0x1D962,
0x1D963,
0x1D964,
0x1D965,
0x1D966,
0x1D967,
0x1D968,
0x1D969,
0x1D96A,
0x1D96B,
0x1D96C,
0x1D96D,
0x1D96E,
0x1D96F,
0x1D970,
0x1D971,
0x1D972,
0x1D973,
0x1D974,
0x1D975,
0x1D976,
0x1D977,
0x1D978,
0x1D979,
0x1D97A,
0x1D97B,
0x1D97C,
0x1D97D,
0x1D97E,
0x1D97F,
0x1D980,
0x1D981,
0x1D982,
0x1D983,
0x1D984,
0x1D985,
0x1D986,
0x1D987,
0x1D988,
0x1D989,
0x1D98A,
0x1D98B,
0x1D98C,
0x1D98D,
0x1D98E,
0x1D98F,
0x1D990,
0x1D991,
0x1D992,
0x1D993,
0x1D994,
0x1D995,
0x1D996,
0x1D997,
0x1D998,
0x1D999,
0x1D99A,
0x1D99B,
0x1D99C,
0x1D99D,
0x1D99E,
0x1D99F,
0x1D9A0,
0x1D9A1,
0x1D9A2,
0x1D9A3,
0x1D9A4,
0x1D9A5,
0x1D9A6,
0x1D9A7,
0x1D9A8,
0x1D9A9,
0x1D9AA,
0x1D9AB,
0x1D9AC,
0x1D9AD,
0x1D9AE,
0x1D9AF,
0x1D9B0,
0x1D9B1,
0x1D9B2,
0x1D9B3,
0x1D9B4,
0x1D9B5,
0x1D9B6,
0x1D9B7,
0x1D9B8,
0x1D9B9,
0x1D9BA,
0x1D9BB,
0x1D9BC,
0x1D9BD,
0x1D9BE,
0x1D9BF,
0x1D9C0,
0x1D9C1,
0x1D9C2,
0x1D9C3,
0x1D9C4,
0x1D9C5,
0x1D9C6,
0x1D9C7,
0x1D9C8,
0x1D9C9,
0x1D9CA,
0x1D9CB,
0x1D9CC,
0x1D9CD,
0x1D9CE,
0x1D9CF,
0x1D9D0,
0x1D9D1,
0x1D9D2,
0x1D9D3,
0x1D9D4,
0x1D9D5,
0x1D9D6,
0x1D9D7,
0x1D9D8,
0x1D9D9,
0x1D9DA,
0x1D9DB,
0x1D9DC,
0x1D9DD,
0x1D9DE,
0x1D9DF,
0x1D9E0,
0x1D9E1,
0x1D9E2,
0x1D9E3,
0x1D9E4,
0x1D9E5,
0x1D9E6,
0x1D9E7,
0x1D9E8,
0x1D9E9,
0x1D9EA,
0x1D9EB,
0x1D9EC,
0x1D9ED,
0x1D9EE,
0x1D9EF,
0x1D9F0,
0x1D9F1,
0x1D9F2,
0x1D9F3,
0x1D9F4,
0x1D9F5,
0x1D9F6,
0x1D9F7,
0x1D9F8,
0x1D9F9,
0x1D9FA,
0x1D9FB,
0x1D9FC,
0x1D9FD,
0x1D9FE,
0x1D9FF,
0x1DA37,
0x1DA38,
0x1DA39,
0x1DA3A,
0x1DA6D,
0x1DA6E,
0x1DA6F,
0x1DA70,
0x1DA71,
0x1DA72,
0x1DA73,
0x1DA74,
0x1DA76,
0x1DA77,
0x1DA78,
0x1DA79,
0x1DA7A,
0x1DA7B,
0x1DA7C,
0x1DA7D,
0x1DA7E,
0x1DA7F,
0x1DA80,
0x1DA81,
0x1DA82,
0x1DA83,
0x1DA85,
0x1DA86,
0x1F000,
0x1F001,
0x1F002,
0x1F003,
0x1F004,
0x1F005,
0x1F006,
0x1F007,
0x1F008,
0x1F009,
0x1F00A,
0x1F00B,
0x1F00C,
0x1F00D,
0x1F00E,
0x1F00F,
0x1F010,
0x1F011,
0x1F012,
0x1F013,
0x1F014,
0x1F015,
0x1F016,
0x1F017,
0x1F018,
0x1F019,
0x1F01A,
0x1F01B,
0x1F01C,
0x1F01D,
0x1F01E,
0x1F01F,
0x1F020,
0x1F021,
0x1F022,
0x1F023,
0x1F024,
0x1F025,
0x1F026,
0x1F027,
0x1F028,
0x1F029,
0x1F02A,
0x1F02B,
0x1F030,
0x1F031,
0x1F032,
0x1F033,
0x1F034,
0x1F035,
0x1F036,
0x1F037,
0x1F038,
0x1F039,
0x1F03A,
0x1F03B,
0x1F03C,
0x1F03D,
0x1F03E,
0x1F03F,
0x1F040,
0x1F041,
0x1F042,
0x1F043,
0x1F044,
0x1F045,
0x1F046,
0x1F047,
0x1F048,
0x1F049,
0x1F04A,
0x1F04B,
0x1F04C,
0x1F04D,
0x1F04E,
0x1F04F,
0x1F050,
0x1F051,
0x1F052,
0x1F053,
0x1F054,
0x1F055,
0x1F056,
0x1F057,
0x1F058,
0x1F059,
0x1F05A,
0x1F05B,
0x1F05C,
0x1F05D,
0x1F05E,
0x1F05F,
0x1F060,
0x1F061,
0x1F062,
0x1F063,
0x1F064,
0x1F065,
0x1F066,
0x1F067,
0x1F068,
0x1F069,
0x1F06A,
0x1F06B,
0x1F06C,
0x1F06D,
0x1F06E,
0x1F06F,
0x1F070,
0x1F071,
0x1F072,
0x1F073,
0x1F074,
0x1F075,
0x1F076,
0x1F077,
0x1F078,
0x1F079,
0x1F07A,
0x1F07B,
0x1F07C,
0x1F07D,
0x1F07E,
0x1F07F,
0x1F080,
0x1F081,
0x1F082,
0x1F083,
0x1F084,
0x1F085,
0x1F086,
0x1F087,
0x1F088,
0x1F089,
0x1F08A,
0x1F08B,
0x1F08C,
0x1F08D,
0x1F08E,
0x1F08F,
0x1F090,
0x1F091,
0x1F092,
0x1F093,
0x1F0A0,
0x1F0A1,
0x1F0A2,
0x1F0A3,
0x1F0A4,
0x1F0A5,
0x1F0A6,
0x1F0A7,
0x1F0A8,
0x1F0A9,
0x1F0AA,
0x1F0AB,
0x1F0AC,
0x1F0AD,
0x1F0AE,
0x1F0B1,
0x1F0B2,
0x1F0B3,
0x1F0B4,
0x1F0B5,
0x1F0B6,
0x1F0B7,
0x1F0B8,
0x1F0B9,
0x1F0BA,
0x1F0BB,
0x1F0BC,
0x1F0BD,
0x1F0BE,
0x1F0BF,
0x1F0C1,
0x1F0C2,
0x1F0C3,
0x1F0C4,
0x1F0C5,
0x1F0C6,
0x1F0C7,
0x1F0C8,
0x1F0C9,
0x1F0CA,
0x1F0CB,
0x1F0CC,
0x1F0CD,
0x1F0CE,
0x1F0CF,
0x1F0D1,
0x1F0D2,
0x1F0D3,
0x1F0D4,
0x1F0D5,
0x1F0D6,
0x1F0D7,
0x1F0D8,
0x1F0D9,
0x1F0DA,
0x1F0DB,
0x1F0DC,
0x1F0DD,
0x1F0DE,
0x1F0DF,
0x1F0E0,
0x1F0E1,
0x1F0E2,
0x1F0E3,
0x1F0E4,
0x1F0E5,
0x1F0E6,
0x1F0E7,
0x1F0E8,
0x1F0E9,
0x1F0EA,
0x1F0EB,
0x1F0EC,
0x1F0ED,
0x1F0EE,
0x1F0EF,
0x1F0F0,
0x1F0F1,
0x1F0F2,
0x1F0F3,
0x1F0F4,
0x1F0F5,
0x1F110,
0x1F111,
0x1F112,
0x1F113,
0x1F114,
0x1F115,
0x1F116,
0x1F117,
0x1F118,
0x1F119,
0x1F11A,
0x1F11B,
0x1F11C,
0x1F11D,
0x1F11E,
0x1F11F,
0x1F120,
0x1F121,
0x1F122,
0x1F123,
0x1F124,
0x1F125,
0x1F126,
0x1F127,
0x1F128,
0x1F129,
0x1F12A,
0x1F12B,
0x1F12C,
0x1F12D,
0x1F12E,
0x1F130,
0x1F131,
0x1F132,
0x1F133,
0x1F134,
0x1F135,
0x1F136,
0x1F137,
0x1F138,
0x1F139,
0x1F13A,
0x1F13B,
0x1F13C,
0x1F13D,
0x1F13E,
0x1F13F,
0x1F140,
0x1F141,
0x1F142,
0x1F143,
0x1F144,
0x1F145,
0x1F146,
0x1F147,
0x1F148,
0x1F149,
0x1F14A,
0x1F14B,
0x1F14C,
0x1F14D,
0x1F14E,
0x1F14F,
0x1F150,
0x1F151,
0x1F152,
0x1F153,
0x1F154,
0x1F155,
0x1F156,
0x1F157,
0x1F158,
0x1F159,
0x1F15A,
0x1F15B,
0x1F15C,
0x1F15D,
0x1F15E,
0x1F15F,
0x1F160,
0x1F161,
0x1F162,
0x1F163,
0x1F164,
0x1F165,
0x1F166,
0x1F167,
0x1F168,
0x1F169,
0x1F16A,
0x1F16B,
0x1F170,
0x1F171,
0x1F172,
0x1F173,
0x1F174,
0x1F175,
0x1F176,
0x1F177,
0x1F178,
0x1F179,
0x1F17A,
0x1F17B,
0x1F17C,
0x1F17D,
0x1F17E,
0x1F17F,
0x1F180,
0x1F181,
0x1F182,
0x1F183,
0x1F184,
0x1F185,
0x1F186,
0x1F187,
0x1F188,
0x1F189,
0x1F18A,
0x1F18B,
0x1F18C,
0x1F18D,
0x1F18E,
0x1F18F,
0x1F190,
0x1F191,
0x1F192,
0x1F193,
0x1F194,
0x1F195,
0x1F196,
0x1F197,
0x1F198,
0x1F199,
0x1F19A,
0x1F19B,
0x1F19C,
0x1F19D,
0x1F19E,
0x1F19F,
0x1F1A0,
0x1F1A1,
0x1F1A2,
0x1F1A3,
0x1F1A4,
0x1F1A5,
0x1F1A6,
0x1F1A7,
0x1F1A8,
0x1F1A9,
0x1F1AA,
0x1F1AB,
0x1F1AC,
0x1F1E6,
0x1F1E7,
0x1F1E8,
0x1F1E9,
0x1F1EA,
0x1F1EB,
0x1F1EC,
0x1F1ED,
0x1F1EE,
0x1F1EF,
0x1F1F0,
0x1F1F1,
0x1F1F2,
0x1F1F3,
0x1F1F4,
0x1F1F5,
0x1F1F6,
0x1F1F7,
0x1F1F8,
0x1F1F9,
0x1F1FA,
0x1F1FB,
0x1F1FC,
0x1F1FD,
0x1F1FE,
0x1F1FF,
0x1F200,
0x1F201,
0x1F202,
0x1F210,
0x1F211,
0x1F212,
0x1F213,
0x1F214,
0x1F215,
0x1F216,
0x1F217,
0x1F218,
0x1F219,
0x1F21A,
0x1F21B,
0x1F21C,
0x1F21D,
0x1F21E,
0x1F21F,
0x1F220,
0x1F221,
0x1F222,
0x1F223,
0x1F224,
0x1F225,
0x1F226,
0x1F227,
0x1F228,
0x1F229,
0x1F22A,
0x1F22B,
0x1F22C,
0x1F22D,
0x1F22E,
0x1F22F,
0x1F230,
0x1F231,
0x1F232,
0x1F233,
0x1F234,
0x1F235,
0x1F236,
0x1F237,
0x1F238,
0x1F239,
0x1F23A,
0x1F23B,
0x1F240,
0x1F241,
0x1F242,
0x1F243,
0x1F244,
0x1F245,
0x1F246,
0x1F247,
0x1F248,
0x1F250,
0x1F251,
0x1F300,
0x1F301,
0x1F302,
0x1F303,
0x1F304,
0x1F305,
0x1F306,
0x1F307,
0x1F308,
0x1F309,
0x1F30A,
0x1F30B,
0x1F30C,
0x1F30D,
0x1F30E,
0x1F30F,
0x1F310,
0x1F311,
0x1F312,
0x1F313,
0x1F314,
0x1F315,
0x1F316,
0x1F317,
0x1F318,
0x1F319,
0x1F31A,
0x1F31B,
0x1F31C,
0x1F31D,
0x1F31E,
0x1F31F,
0x1F320,
0x1F321,
0x1F322,
0x1F323,
0x1F324,
0x1F325,
0x1F326,
0x1F327,
0x1F328,
0x1F329,
0x1F32A,
0x1F32B,
0x1F32C,
0x1F32D,
0x1F32E,
0x1F32F,
0x1F330,
0x1F331,
0x1F332,
0x1F333,
0x1F334,
0x1F335,
0x1F336,
0x1F337,
0x1F338,
0x1F339,
0x1F33A,
0x1F33B,
0x1F33C,
0x1F33D,
0x1F33E,
0x1F33F,
0x1F340,
0x1F341,
0x1F342,
0x1F343,
0x1F344,
0x1F345,
0x1F346,
0x1F347,
0x1F348,
0x1F349,
0x1F34A,
0x1F34B,
0x1F34C,
0x1F34D,
0x1F34E,
0x1F34F,
0x1F350,
0x1F351,
0x1F352,
0x1F353,
0x1F354,
0x1F355,
0x1F356,
0x1F357,
0x1F358,
0x1F359,
0x1F35A,
0x1F35B,
0x1F35C,
0x1F35D,
0x1F35E,
0x1F35F,
0x1F360,
0x1F361,
0x1F362,
0x1F363,
0x1F364,
0x1F365,
0x1F366,
0x1F367,
0x1F368,
0x1F369,
0x1F36A,
0x1F36B,
0x1F36C,
0x1F36D,
0x1F36E,
0x1F36F,
0x1F370,
0x1F371,
0x1F372,
0x1F373,
0x1F374,
0x1F375,
0x1F376,
0x1F377,
0x1F378,
0x1F379,
0x1F37A,
0x1F37B,
0x1F37C,
0x1F37D,
0x1F37E,
0x1F37F,
0x1F380,
0x1F381,
0x1F382,
0x1F383,
0x1F384,
0x1F385,
0x1F386,
0x1F387,
0x1F388,
0x1F389,
0x1F38A,
0x1F38B,
0x1F38C,
0x1F38D,
0x1F38E,
0x1F38F,
0x1F390,
0x1F391,
0x1F392,
0x1F393,
0x1F394,
0x1F395,
0x1F396,
0x1F397,
0x1F398,
0x1F399,
0x1F39A,
0x1F39B,
0x1F39C,
0x1F39D,
0x1F39E,
0x1F39F,
0x1F3A0,
0x1F3A1,
0x1F3A2,
0x1F3A3,
0x1F3A4,
0x1F3A5,
0x1F3A6,
0x1F3A7,
0x1F3A8,
0x1F3A9,
0x1F3AA,
0x1F3AB,
0x1F3AC,
0x1F3AD,
0x1F3AE,
0x1F3AF,
0x1F3B0,
0x1F3B1,
0x1F3B2,
0x1F3B3,
0x1F3B4,
0x1F3B5,
0x1F3B6,
0x1F3B7,
0x1F3B8,
0x1F3B9,
0x1F3BA,
0x1F3BB,
0x1F3BC,
0x1F3BD,
0x1F3BE,
0x1F3BF,
0x1F3C0,
0x1F3C1,
0x1F3C2,
0x1F3C3,
0x1F3C4,
0x1F3C5,
0x1F3C6,
0x1F3C7,
0x1F3C8,
0x1F3C9,
0x1F3CA,
0x1F3CB,
0x1F3CC,
0x1F3CD,
0x1F3CE,
0x1F3CF,
0x1F3D0,
0x1F3D1,
0x1F3D2,
0x1F3D3,
0x1F3D4,
0x1F3D5,
0x1F3D6,
0x1F3D7,
0x1F3D8,
0x1F3D9,
0x1F3DA,
0x1F3DB,
0x1F3DC,
0x1F3DD,
0x1F3DE,
0x1F3DF,
0x1F3E0,
0x1F3E1,
0x1F3E2,
0x1F3E3,
0x1F3E4,
0x1F3E5,
0x1F3E6,
0x1F3E7,
0x1F3E8,
0x1F3E9,
0x1F3EA,
0x1F3EB,
0x1F3EC,
0x1F3ED,
0x1F3EE,
0x1F3EF,
0x1F3F0,
0x1F3F1,
0x1F3F2,
0x1F3F3,
0x1F3F4,
0x1F3F5,
0x1F3F6,
0x1F3F7,
0x1F3F8,
0x1F3F9,
0x1F3FA,
0x1F400,
0x1F401,
0x1F402,
0x1F403,
0x1F404,
0x1F405,
0x1F406,
0x1F407,
0x1F408,
0x1F409,
0x1F40A,
0x1F40B,
0x1F40C,
0x1F40D,
0x1F40E,
0x1F40F,
0x1F410,
0x1F411,
0x1F412,
0x1F413,
0x1F414,
0x1F415,
0x1F416,
0x1F417,
0x1F418,
0x1F419,
0x1F41A,
0x1F41B,
0x1F41C,
0x1F41D,
0x1F41E,
0x1F41F,
0x1F420,
0x1F421,
0x1F422,
0x1F423,
0x1F424,
0x1F425,
0x1F426,
0x1F427,
0x1F428,
0x1F429,
0x1F42A,
0x1F42B,
0x1F42C,
0x1F42D,
0x1F42E,
0x1F42F,
0x1F430,
0x1F431,
0x1F432,
0x1F433,
0x1F434,
0x1F435,
0x1F436,
0x1F437,
0x1F438,
0x1F439,
0x1F43A,
0x1F43B,
0x1F43C,
0x1F43D,
0x1F43E,
0x1F43F,
0x1F440,
0x1F441,
0x1F442,
0x1F443,
0x1F444,
0x1F445,
0x1F446,
0x1F447,
0x1F448,
0x1F449,
0x1F44A,
0x1F44B,
0x1F44C,
0x1F44D,
0x1F44E,
0x1F44F,
0x1F450,
0x1F451,
0x1F452,
0x1F453,
0x1F454,
0x1F455,
0x1F456,
0x1F457,
0x1F458,
0x1F459,
0x1F45A,
0x1F45B,
0x1F45C,
0x1F45D,
0x1F45E,
0x1F45F,
0x1F460,
0x1F461,
0x1F462,
0x1F463,
0x1F464,
0x1F465,
0x1F466,
0x1F467,
0x1F468,
0x1F469,
0x1F46A,
0x1F46B,
0x1F46C,
0x1F46D,
0x1F46E,
0x1F46F,
0x1F470,
0x1F471,
0x1F472,
0x1F473,
0x1F474,
0x1F475,
0x1F476,
0x1F477,
0x1F478,
0x1F479,
0x1F47A,
0x1F47B,
0x1F47C,
0x1F47D,
0x1F47E,
0x1F47F,
0x1F480,
0x1F481,
0x1F482,
0x1F483,
0x1F484,
0x1F485,
0x1F486,
0x1F487,
0x1F488,
0x1F489,
0x1F48A,
0x1F48B,
0x1F48C,
0x1F48D,
0x1F48E,
0x1F48F,
0x1F490,
0x1F491,
0x1F492,
0x1F493,
0x1F494,
0x1F495,
0x1F496,
0x1F497,
0x1F498,
0x1F499,
0x1F49A,
0x1F49B,
0x1F49C,
0x1F49D,
0x1F49E,
0x1F49F,
0x1F4A0,
0x1F4A1,
0x1F4A2,
0x1F4A3,
0x1F4A4,
0x1F4A5,
0x1F4A6,
0x1F4A7,
0x1F4A8,
0x1F4A9,
0x1F4AA,
0x1F4AB,
0x1F4AC,
0x1F4AD,
0x1F4AE,
0x1F4AF,
0x1F4B0,
0x1F4B1,
0x1F4B2,
0x1F4B3,
0x1F4B4,
0x1F4B5,
0x1F4B6,
0x1F4B7,
0x1F4B8,
0x1F4B9,
0x1F4BA,
0x1F4BB,
0x1F4BC,
0x1F4BD,
0x1F4BE,
0x1F4BF,
0x1F4C0,
0x1F4C1,
0x1F4C2,
0x1F4C3,
0x1F4C4,
0x1F4C5,
0x1F4C6,
0x1F4C7,
0x1F4C8,
0x1F4C9,
0x1F4CA,
0x1F4CB,
0x1F4CC,
0x1F4CD,
0x1F4CE,
0x1F4CF,
0x1F4D0,
0x1F4D1,
0x1F4D2,
0x1F4D3,
0x1F4D4,
0x1F4D5,
0x1F4D6,
0x1F4D7,
0x1F4D8,
0x1F4D9,
0x1F4DA,
0x1F4DB,
0x1F4DC,
0x1F4DD,
0x1F4DE,
0x1F4DF,
0x1F4E0,
0x1F4E1,
0x1F4E2,
0x1F4E3,
0x1F4E4,
0x1F4E5,
0x1F4E6,
0x1F4E7,
0x1F4E8,
0x1F4E9,
0x1F4EA,
0x1F4EB,
0x1F4EC,
0x1F4ED,
0x1F4EE,
0x1F4EF,
0x1F4F0,
0x1F4F1,
0x1F4F2,
0x1F4F3,
0x1F4F4,
0x1F4F5,
0x1F4F6,
0x1F4F7,
0x1F4F8,
0x1F4F9,
0x1F4FA,
0x1F4FB,
0x1F4FC,
0x1F4FD,
0x1F4FE,
0x1F4FF,
0x1F500,
0x1F501,
0x1F502,
0x1F503,
0x1F504,
0x1F505,
0x1F506,
0x1F507,
0x1F508,
0x1F509,
0x1F50A,
0x1F50B,
0x1F50C,
0x1F50D,
0x1F50E,
0x1F50F,
0x1F510,
0x1F511,
0x1F512,
0x1F513,
0x1F514,
0x1F515,
0x1F516,
0x1F517,
0x1F518,
0x1F519,
0x1F51A,
0x1F51B,
0x1F51C,
0x1F51D,
0x1F51E,
0x1F51F,
0x1F520,
0x1F521,
0x1F522,
0x1F523,
0x1F524,
0x1F525,
0x1F526,
0x1F527,
0x1F528,
0x1F529,
0x1F52A,
0x1F52B,
0x1F52C,
0x1F52D,
0x1F52E,
0x1F52F,
0x1F530,
0x1F531,
0x1F532,
0x1F533,
0x1F534,
0x1F535,
0x1F536,
0x1F537,
0x1F538,
0x1F539,
0x1F53A,
0x1F53B,
0x1F53C,
0x1F53D,
0x1F53E,
0x1F53F,
0x1F540,
0x1F541,
0x1F542,
0x1F543,
0x1F544,
0x1F545,
0x1F546,
0x1F547,
0x1F548,
0x1F549,
0x1F54A,
0x1F54B,
0x1F54C,
0x1F54D,
0x1F54E,
0x1F54F,
0x1F550,
0x1F551,
0x1F552,
0x1F553,
0x1F554,
0x1F555,
0x1F556,
0x1F557,
0x1F558,
0x1F559,
0x1F55A,
0x1F55B,
0x1F55C,
0x1F55D,
0x1F55E,
0x1F55F,
0x1F560,
0x1F561,
0x1F562,
0x1F563,
0x1F564,
0x1F565,
0x1F566,
0x1F567,
0x1F568,
0x1F569,
0x1F56A,
0x1F56B,
0x1F56C,
0x1F56D,
0x1F56E,
0x1F56F,
0x1F570,
0x1F571,
0x1F572,
0x1F573,
0x1F574,
0x1F575,
0x1F576,
0x1F577,
0x1F578,
0x1F579,
0x1F57A,
0x1F57B,
0x1F57C,
0x1F57D,
0x1F57E,
0x1F57F,
0x1F580,
0x1F581,
0x1F582,
0x1F583,
0x1F584,
0x1F585,
0x1F586,
0x1F587,
0x1F588,
0x1F589,
0x1F58A,
0x1F58B,
0x1F58C,
0x1F58D,
0x1F58E,
0x1F58F,
0x1F590,
0x1F591,
0x1F592,
0x1F593,
0x1F594,
0x1F595,
0x1F596,
0x1F597,
0x1F598,
0x1F599,
0x1F59A,
0x1F59B,
0x1F59C,
0x1F59D,
0x1F59E,
0x1F59F,
0x1F5A0,
0x1F5A1,
0x1F5A2,
0x1F5A3,
0x1F5A4,
0x1F5A5,
0x1F5A6,
0x1F5A7,
0x1F5A8,
0x1F5A9,
0x1F5AA,
0x1F5AB,
0x1F5AC,
0x1F5AD,
0x1F5AE,
0x1F5AF,
0x1F5B0,
0x1F5B1,
0x1F5B2,
0x1F5B3,
0x1F5B4,
0x1F5B5,
0x1F5B6,
0x1F5B7,
0x1F5B8,
0x1F5B9,
0x1F5BA,
0x1F5BB,
0x1F5BC,
0x1F5BD,
0x1F5BE,
0x1F5BF,
0x1F5C0,
0x1F5C1,
0x1F5C2,
0x1F5C3,
0x1F5C4,
0x1F5C5,
0x1F5C6,
0x1F5C7,
0x1F5C8,
0x1F5C9,
0x1F5CA,
0x1F5CB,
0x1F5CC,
0x1F5CD,
0x1F5CE,
0x1F5CF,
0x1F5D0,
0x1F5D1,
0x1F5D2,
0x1F5D3,
0x1F5D4,
0x1F5D5,
0x1F5D6,
0x1F5D7,
0x1F5D8,
0x1F5D9,
0x1F5DA,
0x1F5DB,
0x1F5DC,
0x1F5DD,
0x1F5DE,
0x1F5DF,
0x1F5E0,
0x1F5E1,
0x1F5E2,
0x1F5E3,
0x1F5E4,
0x1F5E5,
0x1F5E6,
0x1F5E7,
0x1F5E8,
0x1F5E9,
0x1F5EA,
0x1F5EB,
0x1F5EC,
0x1F5ED,
0x1F5EE,
0x1F5EF,
0x1F5F0,
0x1F5F1,
0x1F5F2,
0x1F5F3,
0x1F5F4,
0x1F5F5,
0x1F5F6,
0x1F5F7,
0x1F5F8,
0x1F5F9,
0x1F5FA,
0x1F5FB,
0x1F5FC,
0x1F5FD,
0x1F5FE,
0x1F5FF,
0x1F600,
0x1F601,
0x1F602,
0x1F603,
0x1F604,
0x1F605,
0x1F606,
0x1F607,
0x1F608,
0x1F609,
0x1F60A,
0x1F60B,
0x1F60C,
0x1F60D,
0x1F60E,
0x1F60F,
0x1F610,
0x1F611,
0x1F612,
0x1F613,
0x1F614,
0x1F615,
0x1F616,
0x1F617,
0x1F618,
0x1F619,
0x1F61A,
0x1F61B,
0x1F61C,
0x1F61D,
0x1F61E,
0x1F61F,
0x1F620,
0x1F621,
0x1F622,
0x1F623,
0x1F624,
0x1F625,
0x1F626,
0x1F627,
0x1F628,
0x1F629,
0x1F62A,
0x1F62B,
0x1F62C,
0x1F62D,
0x1F62E,
0x1F62F,
0x1F630,
0x1F631,
0x1F632,
0x1F633,
0x1F634,
0x1F635,
0x1F636,
0x1F637,
0x1F638,
0x1F639,
0x1F63A,
0x1F63B,
0x1F63C,
0x1F63D,
0x1F63E,
0x1F63F,
0x1F640,
0x1F641,
0x1F642,
0x1F643,
0x1F644,
0x1F645,
0x1F646,
0x1F647,
0x1F648,
0x1F649,
0x1F64A,
0x1F64B,
0x1F64C,
0x1F64D,
0x1F64E,
0x1F64F,
0x1F650,
0x1F651,
0x1F652,
0x1F653,
0x1F654,
0x1F655,
0x1F656,
0x1F657,
0x1F658,
0x1F659,
0x1F65A,
0x1F65B,
0x1F65C,
0x1F65D,
0x1F65E,
0x1F65F,
0x1F660,
0x1F661,
0x1F662,
0x1F663,
0x1F664,
0x1F665,
0x1F666,
0x1F667,
0x1F668,
0x1F669,
0x1F66A,
0x1F66B,
0x1F66C,
0x1F66D,
0x1F66E,
0x1F66F,
0x1F670,
0x1F671,
0x1F672,
0x1F673,
0x1F674,
0x1F675,
0x1F676,
0x1F677,
0x1F678,
0x1F679,
0x1F67A,
0x1F67B,
0x1F67C,
0x1F67D,
0x1F67E,
0x1F67F,
0x1F680,
0x1F681,
0x1F682,
0x1F683,
0x1F684,
0x1F685,
0x1F686,
0x1F687,
0x1F688,
0x1F689,
0x1F68A,
0x1F68B,
0x1F68C,
0x1F68D,
0x1F68E,
0x1F68F,
0x1F690,
0x1F691,
0x1F692,
0x1F693,
0x1F694,
0x1F695,
0x1F696,
0x1F697,
0x1F698,
0x1F699,
0x1F69A,
0x1F69B,
0x1F69C,
0x1F69D,
0x1F69E,
0x1F69F,
0x1F6A0,
0x1F6A1,
0x1F6A2,
0x1F6A3,
0x1F6A4,
0x1F6A5,
0x1F6A6,
0x1F6A7,
0x1F6A8,
0x1F6A9,
0x1F6AA,
0x1F6AB,
0x1F6AC,
0x1F6AD,
0x1F6AE,
0x1F6AF,
0x1F6B0,
0x1F6B1,
0x1F6B2,
0x1F6B3,
0x1F6B4,
0x1F6B5,
0x1F6B6,
0x1F6B7,
0x1F6B8,
0x1F6B9,
0x1F6BA,
0x1F6BB,
0x1F6BC,
0x1F6BD,
0x1F6BE,
0x1F6BF,
0x1F6C0,
0x1F6C1,
0x1F6C2,
0x1F6C3,
0x1F6C4,
0x1F6C5,
0x1F6C6,
0x1F6C7,
0x1F6C8,
0x1F6C9,
0x1F6CA,
0x1F6CB,
0x1F6CC,
0x1F6CD,
0x1F6CE,
0x1F6CF,
0x1F6D0,
0x1F6D1,
0x1F6D2,
0x1F6E0,
0x1F6E1,
0x1F6E2,
0x1F6E3,
0x1F6E4,
0x1F6E5,
0x1F6E6,
0x1F6E7,
0x1F6E8,
0x1F6E9,
0x1F6EA,
0x1F6EB,
0x1F6EC,
0x1F6F0,
0x1F6F1,
0x1F6F2,
0x1F6F3,
0x1F6F4,
0x1F6F5,
0x1F6F6,
0x1F700,
0x1F701,
0x1F702,
0x1F703,
0x1F704,
0x1F705,
0x1F706,
0x1F707,
0x1F708,
0x1F709,
0x1F70A,
0x1F70B,
0x1F70C,
0x1F70D,
0x1F70E,
0x1F70F,
0x1F710,
0x1F711,
0x1F712,
0x1F713,
0x1F714,
0x1F715,
0x1F716,
0x1F717,
0x1F718,
0x1F719,
0x1F71A,
0x1F71B,
0x1F71C,
0x1F71D,
0x1F71E,
0x1F71F,
0x1F720,
0x1F721,
0x1F722,
0x1F723,
0x1F724,
0x1F725,
0x1F726,
0x1F727,
0x1F728,
0x1F729,
0x1F72A,
0x1F72B,
0x1F72C,
0x1F72D,
0x1F72E,
0x1F72F,
0x1F730,
0x1F731,
0x1F732,
0x1F733,
0x1F734,
0x1F735,
0x1F736,
0x1F737,
0x1F738,
0x1F739,
0x1F73A,
0x1F73B,
0x1F73C,
0x1F73D,
0x1F73E,
0x1F73F,
0x1F740,
0x1F741,
0x1F742,
0x1F743,
0x1F744,
0x1F745,
0x1F746,
0x1F747,
0x1F748,
0x1F749,
0x1F74A,
0x1F74B,
0x1F74C,
0x1F74D,
0x1F74E,
0x1F74F,
0x1F750,
0x1F751,
0x1F752,
0x1F753,
0x1F754,
0x1F755,
0x1F756,
0x1F757,
0x1F758,
0x1F759,
0x1F75A,
0x1F75B,
0x1F75C,
0x1F75D,
0x1F75E,
0x1F75F,
0x1F760,
0x1F761,
0x1F762,
0x1F763,
0x1F764,
0x1F765,
0x1F766,
0x1F767,
0x1F768,
0x1F769,
0x1F76A,
0x1F76B,
0x1F76C,
0x1F76D,
0x1F76E,
0x1F76F,
0x1F770,
0x1F771,
0x1F772,
0x1F773,
0x1F780,
0x1F781,
0x1F782,
0x1F783,
0x1F784,
0x1F785,
0x1F786,
0x1F787,
0x1F788,
0x1F789,
0x1F78A,
0x1F78B,
0x1F78C,
0x1F78D,
0x1F78E,
0x1F78F,
0x1F790,
0x1F791,
0x1F792,
0x1F793,
0x1F794,
0x1F795,
0x1F796,
0x1F797,
0x1F798,
0x1F799,
0x1F79A,
0x1F79B,
0x1F79C,
0x1F79D,
0x1F79E,
0x1F79F,
0x1F7A0,
0x1F7A1,
0x1F7A2,
0x1F7A3,
0x1F7A4,
0x1F7A5,
0x1F7A6,
0x1F7A7,
0x1F7A8,
0x1F7A9,
0x1F7AA,
0x1F7AB,
0x1F7AC,
0x1F7AD,
0x1F7AE,
0x1F7AF,
0x1F7B0,
0x1F7B1,
0x1F7B2,
0x1F7B3,
0x1F7B4,
0x1F7B5,
0x1F7B6,
0x1F7B7,
0x1F7B8,
0x1F7B9,
0x1F7BA,
0x1F7BB,
0x1F7BC,
0x1F7BD,
0x1F7BE,
0x1F7BF,
0x1F7C0,
0x1F7C1,
0x1F7C2,
0x1F7C3,
0x1F7C4,
0x1F7C5,
0x1F7C6,
0x1F7C7,
0x1F7C8,
0x1F7C9,
0x1F7CA,
0x1F7CB,
0x1F7CC,
0x1F7CD,
0x1F7CE,
0x1F7CF,
0x1F7D0,
0x1F7D1,
0x1F7D2,
0x1F7D3,
0x1F7D4,
0x1F800,
0x1F801,
0x1F802,
0x1F803,
0x1F804,
0x1F805,
0x1F806,
0x1F807,
0x1F808,
0x1F809,
0x1F80A,
0x1F80B,
0x1F810,
0x1F811,
0x1F812,
0x1F813,
0x1F814,
0x1F815,
0x1F816,
0x1F817,
0x1F818,
0x1F819,
0x1F81A,
0x1F81B,
0x1F81C,
0x1F81D,
0x1F81E,
0x1F81F,
0x1F820,
0x1F821,
0x1F822,
0x1F823,
0x1F824,
0x1F825,
0x1F826,
0x1F827,
0x1F828,
0x1F829,
0x1F82A,
0x1F82B,
0x1F82C,
0x1F82D,
0x1F82E,
0x1F82F,
0x1F830,
0x1F831,
0x1F832,
0x1F833,
0x1F834,
0x1F835,
0x1F836,
0x1F837,
0x1F838,
0x1F839,
0x1F83A,
0x1F83B,
0x1F83C,
0x1F83D,
0x1F83E,
0x1F83F,
0x1F840,
0x1F841,
0x1F842,
0x1F843,
0x1F844,
0x1F845,
0x1F846,
0x1F847,
0x1F850,
0x1F851,
0x1F852,
0x1F853,
0x1F854,
0x1F855,
0x1F856,
0x1F857,
0x1F858,
0x1F859,
0x1F860,
0x1F861,
0x1F862,
0x1F863,
0x1F864,
0x1F865,
0x1F866,
0x1F867,
0x1F868,
0x1F869,
0x1F86A,
0x1F86B,
0x1F86C,
0x1F86D,
0x1F86E,
0x1F86F,
0x1F870,
0x1F871,
0x1F872,
0x1F873,
0x1F874,
0x1F875,
0x1F876,
0x1F877,
0x1F878,
0x1F879,
0x1F87A,
0x1F87B,
0x1F87C,
0x1F87D,
0x1F87E,
0x1F87F,
0x1F880,
0x1F881,
0x1F882,
0x1F883,
0x1F884,
0x1F885,
0x1F886,
0x1F887,
0x1F890,
0x1F891,
0x1F892,
0x1F893,
0x1F894,
0x1F895,
0x1F896,
0x1F897,
0x1F898,
0x1F899,
0x1F89A,
0x1F89B,
0x1F89C,
0x1F89D,
0x1F89E,
0x1F89F,
0x1F8A0,
0x1F8A1,
0x1F8A2,
0x1F8A3,
0x1F8A4,
0x1F8A5,
0x1F8A6,
0x1F8A7,
0x1F8A8,
0x1F8A9,
0x1F8AA,
0x1F8AB,
0x1F8AC,
0x1F8AD,
0x1F910,
0x1F911,
0x1F912,
0x1F913,
0x1F914,
0x1F915,
0x1F916,
0x1F917,
0x1F918,
0x1F919,
0x1F91A,
0x1F91B,
0x1F91C,
0x1F91D,
0x1F91E,
0x1F920,
0x1F921,
0x1F922,
0x1F923,
0x1F924,
0x1F925,
0x1F926,
0x1F927,
0x1F930,
0x1F933,
0x1F934,
0x1F935,
0x1F936,
0x1F937,
0x1F938,
0x1F939,
0x1F93A,
0x1F93B,
0x1F93C,
0x1F93D,
0x1F93E,
0x1F940,
0x1F941,
0x1F942,
0x1F943,
0x1F944,
0x1F945,
0x1F946,
0x1F947,
0x1F948,
0x1F949,
0x1F94A,
0x1F94B,
0x1F950,
0x1F951,
0x1F952,
0x1F953,
0x1F954,
0x1F955,
0x1F956,
0x1F957,
0x1F958,
0x1F959,
0x1F95A,
0x1F95B,
0x1F95C,
0x1F95D,
0x1F95E,
0x1F980,
0x1F981,
0x1F982,
0x1F983,
0x1F984,
0x1F985,
0x1F986,
0x1F987,
0x1F988,
0x1F989,
0x1F98A,
0x1F98B,
0x1F98C,
0x1F98D,
0x1F98E,
0x1F98F,
0x1F990,
0x1F991,
0x1F9C0
]; |
$(document).ready(function() {
/* Done setting the chart up? Time to render it!*/
var data = [
{
values: [],
key: 'Event queue length',
color: '#000000'
},
]
/*These lines are all chart setup. Pick and choose which chart features you want to utilize. */
nv.addGraph(function() {
var chart = nv.models.lineChart()
.margin({right: 80}) //Adjust chart margins to give the x-axis some breathing room.
.useInteractiveGuideline(true) //We want nice looking tooltips and a guideline!
.transitionDuration(350) //how fast do you want the lines to transition?
.showLegend(false) //Show the legend, allowing users to turn on/off line series.
.showYAxis(true) //Show the y-axis
.showXAxis(true) //Show the x-axis
.noData("Waiting for queue length data...")
;
// Chart x-axis settings
chart.xAxis
.tickPadding(9)
.tickFormat(function(d) {
return d3.time.format('%H:%M:%S')(new Date(d))
});
// Chart y-axis settings
chart.yAxis
.tickPadding(7)
.tickFormat(d3.format(',d'));
d3.select('#chart svg')
.datum(data)
.call(chart);
updateData();
chart.update();
// Poll every 5 seconds
setInterval(function() {
updateData()
d3.select('#chart svg')
.datum(data)
.transition();
d3.select("#chart svg rect")
.style("opacity", 1)
.style("fill", '#fff')
chart.update()
}, 3000);
// Update the chart when window resizes.
nv.utils.windowResize(function() { chart.update() });
return chart;
});
function updateData() {
var api_url = $('div#data-api-url').data('api-url');
$.get(api_url + 'metrics?fields=event_queue_length', function(json) {
var d = new Date().getTime();
var value = {x: d, y: json.event_queue_length}
data[0].values.push(value);
// Remove old data, to keep the graph performant
if (data[0].values.length > 100) {
data[0].values.shift()
}
}, 'json')
}
});
|
const chai = require('chai')
const expect = chai.expect
const path = require('path')
const fs = require('fs')
const os = require('os')
const YAML = require('yamljs')
const pkg = require('../package')
describe('grql', () => {
let config, grql, sampleServer
before(() => {
process.env['NODE_ENV'] = 'test'
config = require('../lib/config')
config.configFile = path.join(os.tmpdir(), `.${pkg.name}.yml`)
grql = require('../lib/grql')
sampleServer = require('./sample-server')
process.stdin.isTTY = true
})
after(() => {
if (!config.configFile) {
return
}
fs.unlinkSync(config.configFile)
})
describe('exec', () => {
it('should return an error if no argument', async () => {
try {
await grql.exec()
throw new Error('should not return a result')
} catch (err) {
expect(err).to.be.an('error')
expect(err).to.have.property('message', grql.__('Error : missing argument (try --help)'))
}
})
it('should show help', async () => {
const stdout = {}
const stderr = {}
await grql.exec({ stdout, stderr, args: ['--nocolor', '--help'] })
expect(stderr).to.have.property('data').that.is.a('string')
})
describe('sample server', () => {
let stdout
let stderr
before(async () => {
await sampleServer.start()
const port = sampleServer.getPort()
await grql.exec({
args: [
'--nocolor',
'-e', 'test',
'-b', `http://localhost:${port}/graphql`,
'-s'
]
})
})
after(() => sampleServer.stop())
beforeEach(() => {
stdout = {}
stderr = {}
})
it('should return schema', async () => {
await grql.exec({ stdout, stderr, args: ['--nocolor', 'schema'] })
expect(stdout).to.have.property('data').that.is.a('string')
const out = JSON.parse(stdout.data)
expect(Object.keys(out)).to.eql(['queryType',
'mutationType',
'subscriptionType',
'types',
'directives'
])
})
it('should return hello', async () => {
await grql.exec({ stdout, stderr, args: ['--nocolor', 'query', '{ hello }'] })
expect(stdout).to.have.property('data').that.is.a('string')
const out = JSON.parse(stdout.data)
expect(out).to.eql({ hello: 'world' })
})
it('should return hello in yaml format', async () => {
await grql.exec({ stdout, stderr, args: ['--nocolor', '-y', 'query', '{ hello }'] })
expect(stdout).to.have.property('data').that.is.a('string')
const out = YAML.parse(stdout.data)
expect(out).to.eql({ hello: 'world' })
})
})
})
})
|
export const fourUp = {"viewBox":"0 0 8 8","children":[{"name":"path","attribs":{"d":"M0 0v1h1v-1h-1zm2 0v1h1v-1h-1zm2 0v1h1v-1h-1zm2 0v1h1v-1h-1zm-6 2v1h1v-1h-1zm2 0v1h1v-1h-1zm2 0v1h1v-1h-1zm2 0v1h1v-1h-1zm-6 2v1h1v-1h-1zm2 0v1h1v-1h-1zm2 0v1h1v-1h-1zm2 0v1h1v-1h-1zm-6 2v1h1v-1h-1zm2 0v1h1v-1h-1zm2 0v1h1v-1h-1zm2 0v1h1v-1h-1z"}}]}; |
var express = require('express');
var router = express.Router();
var path = require('path')
router.route('/')
.get(function (req, res) {
res.render('index', {
pageTitle: "Carl Schriever",
pageDescription: "My personal website.",
pageCss: ['main'],
pageScripts: ['main.bundle'],
});
});
module.exports = router; |
import {
Function as FunctionToken,
RightParenthesis
} from '../../tokenizer/index.js';
export const name = 'Function';
export const walkContext = 'function';
export const structure = {
name: String,
children: [[]]
};
// <function-token> <sequence> )
export function parse(readSequence, recognizer) {
const start = this.tokenStart;
const name = this.consumeFunctionName();
const nameLowerCase = name.toLowerCase();
let children;
children = recognizer.hasOwnProperty(nameLowerCase)
? recognizer[nameLowerCase].call(this, recognizer)
: readSequence.call(this, recognizer);
if (!this.eof) {
this.eat(RightParenthesis);
}
return {
type: 'Function',
loc: this.getLocation(start, this.tokenStart),
name,
children
};
}
export function generate(node) {
this.token(FunctionToken, node.name + '(');
this.children(node);
this.token(RightParenthesis, ')');
}
|
define(['app'], function (app) {
app.controller('CalendarController', ['breadcrumb', function(breadcrumb) {
breadcrumb.title = 'Calendar';
breadcrumb.subTitle = 'Control panel';
breadcrumb.list = [
{ name: 'Calendar' }
];
}]);
});
|
//var osString = Components.classes["@mozilla.org/xre/app-info;1"]
// .getService(Components.interfaces.nsIXULRuntime).OS;
//if(true)
pref("extensions.vlc_shortcut.vlc_filepath", "");
pref("extensions.vlc_shortcut.middleclick", 0);
pref("extensions.vlc_shortcut.ctrlmiddleclick", 0);
pref("extensions.vlc_shortcut.shiftmiddleclick", 0);
pref("extensions.vlc_shortcut.vq", -1);
//else
// pref("extensions.vlc_shortcut.vlc_filepath", "BLABLABLA");
//Components.classes["@mozilla.org/preferences-service;1"]
// .getService(Components.interfaces.nsIPrefService)
// .getBranch("extensions.vlc_shortcut.").setCharPref("vlc_filepath", "bdsds");
|
$(document).ready(function(){
$("table.step").click(function(){
if($(this).next().length) {
$(this).toggle();
$(this).next().toggle();
} else {
$(this).toggle();
$("#step1").toggle();
}
});
}); |
import React, { PropTypes } from 'react';
import Actions from '../../actions/lists';
import PageClick from 'react-page-click';
export default class ListForm extends React.Component {
componentDidMount() {
this.refs.name.focus();
}
_handleSubmit(e) {
e.preventDefault();
const { dispatch, channel, list } = this.props;
const { name } = this.refs;
const data = {
id: list ? list.id : null,
name: name.value,
};
dispatch(Actions.save(channel, data));
}
_renderErrors(field) {
const { errors } = this.props;
if (!errors) return false;
return errors.map((error, i) => {
if (error[field]) {
return (
<div key={i} className="error">
{error[field]}
</div>
);
}
});
}
_handleCancelClick(e) {
e.preventDefault();
this.props.onCancelClick();
}
render() {
const defaultValue = this.props.list ? this.props.list.name : '';
const buttonText = this.props.list ? 'Update list' : 'Save list';
return (
<PageClick onClick={::this._handleCancelClick}>
<div className="list form">
<div className="inner">
<form id="new_list_form" onSubmit={::this._handleSubmit}>
<input ref="name" id="list_name" type="text" defaultValue={defaultValue} placeholder="Add a new list..." required="true"/>
{::this._renderErrors('name')}
<button type="submit">{buttonText}</button> or <a href="#" onClick={::this._handleCancelClick}>cancel</a>
</form>
</div>
</div>
</PageClick>
);
}
}
ListForm.propTypes = {
};
|
const $ = require('gulp-load-plugins')();
const gulp = require('gulp');
const config = require('../config');
const path = require('path');
gulp.task('pug', () => {
return gulp.src(path.join(config.paths.pug, '*.pug'))
.pipe($.plumber({
errorHandler: $.notify.onError(err => ({
title : 'Pug',
message: err.message
}))
}))
//.pipe($.cached('pug'))
.pipe($.pug({
pretty: true
}))
.pipe(gulp.dest(config.paths.views))
.pipe($.size({ title: 'PUG', gzip: false }));
});
|
suite('angular-mask', function() {
});
|
var React = require('../../node_modules/react');
var ReactDOM = require('../../node_modules/react-dom');
var PopupComponent = require('./components/popup/popup_component.js.jsx');
ReactDOM.render(
<PopupComponent />,
//<p>Hey</p>,
document.getElementById('popup-content')
); |
const gtmTpl = () => `
<!-- Google Tag Manager -->
<noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-WBQ2PN"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-WBQ2PN');</script>
<!-- End Google Tag Manager -->
`
module.exports = {
gtmTpl
}
|
angular.module('markticle').service('StorageService', markticleStorageService);
|
(function(){
'use strict';
/**
* @ngdoc function
* @name 343LandingPageApp.controller:NewjobpostCtrl
* @description
* # NewjobpostCtrl
* Controller of the 343LandingPageApp
*/
angular.module('343LandingPageApp')
.controller('NewjobpostCtrl', ['$scope', '$http', 'authFact', function ($scope, $http, authFact) {
var token = JSON.parse(authFact.getToken()).token;
// init the datab model
$scope.job = {
title: '',
description:'',
requirements:'',
location:'',
compensation:'',
benefits:'',
howToApply:'',
token: token
};
var req = {
method: 'POST',
url: 'http://neadcom.wwwss24.a2hosted.com/343TruckingAPI/api/v1/trucking/job',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
data: $scope.job
};
$scope.save = function(){
$http(req)
.then(function(response){
// success
window.alert(response.data.message);
// clear input fields
$scope.clearInputFields();
}, function(response){
// error
window.alert(response.status+' '+ response.statusText + ' error');
$scope.errorMessages = response.data;
});
};
$scope.clearInputFields = function(){
$scope.job = null;
};
}]);
}()); |
const group = require('../../src/models/Groups');
const mongojs = require('mongojs');
const mongoose = require('mongoose');
const config = require('../../config');
//create a group
exports.createGroup = function(req, res) {
const db = mongoose.connect(config.database);
var member = req.body.member;
//adding the data to schema
var newGroup = new group({
groupName: req.body.groupName,
groupOwner: req.body.adminName,
phone: req.body.phone
});
//pushing all the
for (var i in req.body.member) {
newGroup.members.push(req.body.member[i]);
}
console.log('newGroup', newGroup);
/* console.log(group);*/
newGroup.save(function(err) {
if (err) {
console.log('Error Inserting New Data');
if (err.name === 'ValidationError') {
for (field in err.errors) {
console.log(err.errors[field].message);
}
}
if (err.name === 'MongoError' && err.code === 11000) {
console.log("mongo error");
return res.json({ success: false, message: "groupName already exists" });
}
} else {
console.log("I am coming here");
res.status(200).json({ success: true, message: 'Group had been created successfully' });
//db.connection.close();
//db.close();
db.disconnect();
}
});
};
exports.updateFieldInGroup = function(req, res) {
const db = mongoose.connect(config.database);
/* var qname = req.body.qname;
var qvalue = req.body.qvalue;*/
var phones = req.body.phones;
var updateName = req.body.updateName;
var updateValue = req.body.updateValue;
/* var query = {};
query[qname] = qvalue;*/
var updateInfo = {};
updateInfo['$set'] = {};
updateInfo['$set'][updateName] = updateValue;
console.log('updateInfo', updateInfo);
if (updateName == "members") {
for (var i in updateValue) {
updateInfo['$set'][updateName].push(updateValue[i]);
}
} else {
updateInfo['$set'][updateName] = updateValue;
}
group.findOneAndUpdate({ phone: phones }, updateInfo, function(err, result) {
if (err) {
res.json({ success: false, message: 'Group Not found' });
} else {
// console.log(result);
res.status(200).json({ success: true, message: 'Group had been updated successfully' });
db.disconnect();
}
});
};
exports.updateGroup = function(req, res) {
const db = mongoose.connect(config.database);
//var phones = req.body.phones;
var updateInfo = {
groupName: req.body.groupName,
groupOwner: req.body.adminName,
phone: req.body.phone,
members: []
};
for (var i in req.body.member) {
updateInfo.members.push(req.body.member[i]);
}
// console.log(updateInfo);
group.findOneAndUpdate({ groupName: req.body.groupName }, { '$set': updateInfo }, function(err, result) {
if (err) {
res.json({ success: false, message: 'Group Not found' });
} else if (result == null) {
res.json({ success: false, message: 'Group Not found' });
} else {
console.log(result);
res.status(200).json({ success: true, message: 'Group had been updated successfully' });
db.disconnect();
}
});
};
exports.listOfGroups = function(req, res) {
const db = mongoose.connect(config.database);
var phone = req.param('phone');
group.find({ phone: phone }, function(err, result) {
if (err) {
res.json({ success: false, message: 'No groups on this account' });
} else {
res.send(result);
db.disconnect();
}
});
};
/*exports.deleteGroupMe*/ |
import { filtersToCQL, getISODateTimeString } from '../core/util';
import FiltersModel from '../core/models/FiltersModel';
function getCoverageXML(coverageid, options = {}) {
let subsetX = options.subsetX;
let subsetY = options.subsetY;
if (!coverageid) {
throw new Error('Parameters "coverageid" is mandatory.');
}
const subsetCRS = options.subsetCRS || 'http://www.opengis.net/def/crs/EPSG/0/4326';
const params = [
`<wcs:GetCoverage service="WCS" version="2.0.1" xmlns:wcs="http://www.opengis.net/wcs/2.0" xmlns:wcscrs="http://www.opengis.net/wcs/crs/1.0" xmlns:wcsmask="http://www.opengis.net/wcs/mask/1.0" xmlns:int="http://www.opengis.net/wcs/interpolation/1.0" xmlns:scal="http://www.opengis.net/wcs/scaling/1.0">
<wcs:CoverageId>${coverageid}</wcs:CoverageId>`,
];
const extension = [];
let axisNames;
if (!options.axisNames) {
axisNames = {
x: 'x',
y: 'y',
};
} else if (Array.isArray(options.axisNames)) {
axisNames = {
x: options.axisNames[0],
y: options.axisNames[1],
};
} else {
axisNames = options.axisNames;
}
if (options.format) {
params.push(`<wcs:format>${options.format}</wcs:format>`);
}
if (options.bbox && !options.subsetX && !options.subsetY) {
subsetX = [options.bbox[0], options.bbox[2]];
subsetY = [options.bbox[1], options.bbox[3]];
}
if (subsetX) {
params.push(`<wcs:DimensionTrim><wcs:Dimension>${axisNames.x}</wcs:Dimension>
<wcs:TrimLow>${subsetX[0]}</wcs:TrimLow>
<wcs:TrimHigh>${subsetX[1]}</wcs:TrimHigh>
</wcs:DimensionTrim>`);
}
if (subsetY) {
params.push(`<wcs:DimensionTrim><wcs:Dimension>${axisNames.y}</wcs:Dimension>
<wcs:TrimLow>${subsetY[0]}</wcs:TrimLow>
<wcs:TrimHigh>${subsetY[1]}</wcs:TrimHigh>
</wcs:DimensionTrim>`);
}
if (options.outputCRS) {
extension.push(`<wcscrs:outputCrs>${options.outputCRS}</wcscrs:outputCrs>`);
}
if (options.sizeX && options.sizeY) {
extension.push(`
<scal:ScaleToSize>
<scal:TargetAxisSize>
<scal:axis>${axisNames.x}</scal:axis>
<scal:targetSize>${options.sizeX}</scal:targetSize>
</scal:TargetAxisSize>
<scal:TargetAxisSize>
<scal:axis>${axisNames.y}</scal:axis>
<scal:targetSize>${options.sizeY}</scal:targetSize>
</scal:TargetAxisSize>
</scal:ScaleToSize>
`);
}
extension.push(`<wcscrs:subsettingCrs>${subsetCRS}</wcscrs:subsettingCrs>`);
if (options.mask) {
extension.push(`<wcsmask:polygonMask>${options.mask}</wcsmask:polygonMask>`);
}
if (options.scale) {
extension.push(`<scal:ScaleByFactor><scal:scaleFactor>${options.scale}</scal:scaleFactor></scal:ScaleByFactor>`);
}
if (options.interpolation) {
extension.push(`<int:Interpolation><int:globalInterpolation>${options.interpolation}</int:globalInterpolation></int:Interpolation>`);
}
if (options.multipart) {
params.push('<wcs:mediaType>multipart/related</wcs:mediaType>');
}
if (extension.length > 0) {
params.push('<wcs:Extension>');
for (let i = 0; i < extension.length; ++i) {
params.push(extension[i]);
}
params.push('</wcs:Extension>');
}
params.push('</wcs:GetCoverage>');
return params.join('');
}
function getEOCoverageSetXML(eoids, options = {}) {
let subsetX = options.subsetX;
let subsetY = options.subsetY;
if (!eoids) {
throw new Error('Parameters "coverageid" is mandatory.');
}
if (!options.package) {
throw new Error('Parameters "packageFormat" is missing.');
}
const subsetCRS = options.subsetCRS || 'http://www.opengis.net/def/crs/EPSG/0/4326';
const params = [
`<wcseo:GetEOCoverageSet xmlns:wcseo="http://www.opengis.net/wcs/wcseo/1.1" xmlns:wcs="http://www.opengis.net/wcs/2.0" xmlns:int="http://www.opengis.net/wcs/interpolation/1.0" xmlns:scal="http://www.opengis.net/wcs/scaling/1.0" xmlns:crs="http://www.opengis.net/wcs/crs/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wcs/wcseo/1.1 http://schemas.opengis.net/wcs/wcseo/1.1/wcsEOAll.xsd" service="WCS" version="2.0.1">
<wcseo:eoId>${eoids}</wcseo:eoId>`,
];
const extension = [];
let axisNames;
if (!options.axisNames) {
axisNames = {
x: 'x',
y: 'y',
};
} else if (Array.isArray(options.axisNames)) {
axisNames = {
x: options.axisNames[0],
y: options.axisNames[1],
};
} else {
axisNames = options.axisNames;
}
if (options.package) {
params.push(`<wcs:format>${options.package}</wcs:format>`);
}
if (options.package) {
params.push(`<wcseo:packageFormat>${options.package}</wcseo:packageFormat>`);
}
if (options.bbox && !options.subsetX && !options.subsetY) {
subsetX = [options.bbox[0], options.bbox[2]];
subsetY = [options.bbox[1], options.bbox[3]];
}
if (subsetX) {
params.push(`<wcs:DimensionTrim><wcs:Dimension>${axisNames.x}</wcs:Dimension>
<wcs:TrimLow>${subsetX[0]}</wcs:TrimLow>
<wcs:TrimHigh>${subsetX[1]}</wcs:TrimHigh>
</wcs:DimensionTrim>`);
}
if (subsetY) {
params.push(`<wcs:DimensionTrim><wcs:Dimension>${axisNames.y}</wcs:Dimension>
<wcs:TrimLow>${subsetY[0]}</wcs:TrimLow>
<wcs:TrimHigh>${subsetY[1]}</wcs:TrimHigh>
</wcs:DimensionTrim>`);
}
if (options.outputCRS) {
extension.push(`<wcscrs:outputCrs>${options.outputCRS}</wcscrs:outputCrs>`);
}
if (options.sizeX && options.sizeY) {
extension.push(`
<scal:ScaleToSize>
<scal:TargetAxisSize>
<scal:axis>${axisNames.x}</scal:axis>
<scal:targetSize>${options.sizeX}</scal:targetSize>
</scal:TargetAxisSize>
<scal:TargetAxisSize>
<scal:axis>${axisNames.y}</scal:axis>
<scal:targetSize>${options.sizeY}</scal:targetSize>
</scal:TargetAxisSize>
</scal:ScaleToSize>
`);
}
extension.push(`<wcscrs:subsettingCrs>${subsetCRS}</wcscrs:subsettingCrs>`);
if (options.scale) {
extension.push(`<scal:ScaleByFactor><scal:scaleFactor>${options.scale}</scal:scaleFactor></scal:ScaleByFactor>`);
}
if (options.interpolation) {
extension.push(`<int:Interpolation><int:globalInterpolation>${options.interpolation}</int:globalInterpolation></int:Interpolation>`);
}
if (options.multipart) {
params.push('<wcs:mediaType>multipart/related</wcs:mediaType>');
}
params.push('</wcseo:GetEOCoverageSet>');
return params.join('');
}
function getEOCoverageSetKVP(eoids, options = {}) {
const params = [
['service', 'WCS'],
['version', '2.0.1'],
['request', 'GetEOCoverageSet'],
['eoid', eoids],
];
const subsetCRS = options.subsetCRS || 'http://www.opengis.net/def/crs/EPSG/0/4326';
if (options.format) {
params.push(['format', options.format]);
}
if (options.package) {
params.push(['packageFormat', options.package]);
}
let axisNames;
if (!options.axisNames) {
axisNames = {
x: 'x',
y: 'y',
};
} else if (Array.isArray(options.axisNames)) {
axisNames = {
x: options.axisNames[0],
y: options.axisNames[1],
};
} else {
axisNames = options.axisNames;
}
let subsetX = options.subsetX;
let subsetY = options.subsetY;
if (options.bbox && !options.subsetX && !options.subsetY) {
subsetX = [options.bbox[0], options.bbox[2]];
subsetY = [options.bbox[1], options.bbox[3]];
}
if (subsetX) {
params.push(['subset', `${axisNames.x || 'x'}(${subsetX[0]},${subsetX[1]})`]);
}
if (subsetY) {
params.push(['subset', `${axisNames.y || 'y'}(${subsetY[0]},${subsetY[1]})`]);
}
if (options.outputCRS) {
params.push(['outputCRS', options.outputCRS]);
}
if (subsetCRS && (subsetX || subsetY)) {
params.push(['subsettingCRS', subsetCRS]);
}
if (options.multipart) {
params.push(['mediatype', 'multipart/related']);
}
if (options.rangeSubset) {
params.push(['rangesubset', options.rangeSubset.join(',')]);
}
// scaling related stuff
if (options.scale) {
params.push(['scaleFactor', options.scale]);
}
if (options.sizeX && options.sizeY) {
params.push(['scaleSize', `${axisNames.x}(${options.sizeX}),${axisNames.y}(${options.sizeY})`]);
}
if (options.interpolation) {
params.push(['interpolation', options.interpolation]);
}
return params
.map(param => param.join('='))
.join('&');
}
function getCoverageKVP(coverageid, options = {}) {
const params = [
['service', 'WCS'],
['version', '2.0.1'],
['request', 'GetCoverage'],
['coverageid', coverageid],
];
const subsetCRS = options.subsetCRS || 'http://www.opengis.net/def/crs/EPSG/0/4326';
if (options.format) {
params.push(['format', options.format]);
}
let axisNames;
if (!options.axisNames) {
axisNames = {
x: 'x',
y: 'y',
};
} else if (Array.isArray(options.axisNames)) {
axisNames = {
x: options.axisNames[0],
y: options.axisNames[1],
};
} else {
axisNames = options.axisNames;
}
let subsetX = options.subsetX;
let subsetY = options.subsetY;
if (options.bbox && !options.subsetX && !options.subsetY) {
subsetX = [options.bbox[0], options.bbox[2]];
subsetY = [options.bbox[1], options.bbox[3]];
}
if (subsetX) {
params.push(['subset', `${axisNames.x || 'x'}(${subsetX[0]},${subsetX[1]})`]);
}
if (subsetY) {
params.push(['subset', `${axisNames.y || 'y'}(${subsetY[0]},${subsetY[1]})`]);
}
if (options.outputCRS) {
params.push(['outputCRS', options.outputCRS]);
}
if (subsetCRS && (subsetX || subsetY)) {
params.push(['subsettingCRS', subsetCRS]);
}
if (options.multipart) {
params.push(['mediatype', 'multipart/related']);
}
if (options.rangeSubset) {
params.push(['rangesubset', options.rangeSubset.join(',')]);
}
// scaling related stuff
if (options.scale) {
params.push(['scaleFactor', options.scale]);
}
if (options.sizeX && options.sizeY) {
params.push(['scaleSize', `${axisNames.x}(${options.sizeX}),${axisNames.y}(${options.sizeY})`]);
}
if (options.interpolation) {
params.push(['interpolation', options.interpolation]);
}
return params
.map(param => param.join('='))
.join('&');
}
function getIntersectingBbox(r1, r2) {
// computes intersection bbox of two bboxes, returns false if no intersect
// does not find intersection if any bbox crosses dateline and non-over 180 coordinates are used
const noIntersect = r2[0] > r1[2] || r2[2] < r1[0] ||
r2[1] > r1[3] || r2[3] < r1[1];
return noIntersect ? false : [
Math.max(r1[0], r2[0]),
Math.max(r1[1], r2[1]),
Math.min(r1[2], r2[2]),
Math.min(r1[3], r2[3])
];
}
function computeSizeFromResolution(recordModel, filterBbox, resolutionX, resolutionY) {
let sizeX = null;
let sizeY = null;
let computedBbox = null;
const recordBbox = recordModel.get('bbox');
if (!recordBbox && !filterBbox) {
// can not compute resolution
return [null, null];
} else if (!filterBbox) {
// use bounding box of record as is
computedBbox = recordBbox;
} else {
// get intersection of two bboxes
computedBbox = getIntersectingBbox(recordBbox, filterBbox);
if (!computedBbox) {
// no intersection
return [null, null];
}
}
sizeX = Math.round((computedBbox[2] - computedBbox[0]) / resolutionX);
sizeY = Math.round((computedBbox[3] - computedBbox[1]) / resolutionY);
sizeX = sizeX < 1 ? 1 : sizeX;
sizeY = sizeY < 1 ? 1 : sizeY;
return [sizeX, sizeY];
}
export function download(layerModel, filtersModel, recordModel, options) {
const requestOptions = {
bbox: filtersModel.get('area'),
outputCRS: options.outputCRS,
subsetCRS: options.subsetCRS,
format: options.format,
scale: options.scale,
interpolation: options.interpolation,
axisNames: layerModel.get('download.axisNames'),
};
if (options.resolutionX && options.resolutionY) {
// compute size based on specified resolution
const [sizeX, sizeY] = computeSizeFromResolution(recordModel, filtersModel.get('area'), options.resolutionX, options.resolutionY);
requestOptions.sizeX = sizeX;
requestOptions.sizeY = sizeY;
} else {
// use sizes directly
requestOptions.sizeX = options.sizeX;
requestOptions.sizeY = options.sizeY;
}
if (layerModel.get('download.method') === 'GET') {
const kvp = getCoverageKVP(recordModel.get('id'), requestOptions);
return `${layerModel.get('download.url')}?${kvp}`;
}
return getCoverageXML(recordModel.get('id'), requestOptions);
}
export function multiDownload(layerModel, filtersModel, options) {
const requestOptions = {
bbox: filtersModel.get('area'),
outputCRS: options.outputCRS,
subsetCRS: options.subsetCRS,
format: options.format,
package: options.package,
scale: options.scale,
interpolation: options.interpolation,
};
// use sizes directly
requestOptions.sizeX = options.sizeX;
requestOptions.sizeY = options.sizeY;
return getEOCoverageSetKVP(layerModel, requestOptions);
}
export function getDownloadInfos(layerModel, filtersModel, recordModel, options = {}) {
const kvp = getCoverageKVP(
recordModel.get('id'), {
bbox: filtersModel.get('area'),
outputCRS: options.outputCRS,
format: options.format,
}
);
const url = `${layerModel.get('download.url')}?${kvp}`;
return Promise.resolve([{
href: url,
name: recordModel.get('id'),
}]);
}
export function downloadFullResolution(layerModel, mapModel, filtersModel, options) {
const requestOptions = {
bbox: options.bbox || mapModel.get('bbox'),
outputCRS: options.outputCRS,
subsetCRS: options.subsetCRS,
rangeSubset: options.fields,
format: options.format,
scale: options.scale,
sizeX: options.sizeX,
sizeY: options.sizeY,
interpolation: options.interpolation,
axisNames: layerModel.get('fullResolution.axisNames'),
};
const id = layerModel.get('fullResolution.id');
let kvp = getCoverageKVP(id, requestOptions);
const time = mapModel.get('time');
if (time && !layerModel.get('fullResolution.disableTimeSubsetting')) {
kvp = `${kvp}&subset=http://www.opengis.net/def/axis/OGC/0/time("${getISODateTimeString(time[0])}","${getISODateTimeString(time[1])}")`;
}
const cqlMapping = layerModel.get('fullResolution.cqlMapping');
const cqlParameterName = layerModel.get('fullResolution.cqlParameterName');
if (cqlParameterName) {
const filtersModelCopy = new FiltersModel(filtersModel.attributes);
const cql = filtersToCQL(filtersModelCopy, cqlMapping);
if (cql.length) {
kvp = `${kvp}&${cqlParameterName}=${cql}`;
}
}
const fullResolutionUrl = layerModel.get('fullResolution.url');
let char = '?';
if (fullResolutionUrl.includes('?')) {
char = (fullResolutionUrl.endsWith('?') || fullResolutionUrl.endsWith('&')) ? '' : '&';
}
return `${fullResolutionUrl}${char}${kvp}`;
}
|
{
"Integrations": "Integrações",
"Pricing": "Preços",
"Apps": "Aplicativos",
"Existing user login": "Usuários existentes login",
"login": "login",
"Chat, for GitHub.": "Chat, para GitHub.",
"Get unlimited public rooms and one-to-one chats, free forever. Private team plans start from $2 per user per month. No credit card required.": "Obtenha salas de conversas públicas ou um-a-um, grátis! Há Planos para Times privados começando a partir de $2 por usuário/mês. Não precisa informar seu cartão de crédito no cadastro.",
"Sign up free with Github": "Entre agora com sua conta GitHub, grátis!",
"Sign up with Github": "Entre com GitHub",
"By signing up you agree to our <a %s>Terms and Conditions</a>": "Ao cadastrar-se agora você concorda com o nosso <a %s>Termos e Condições de Uso</a>",
"Markdown power": "Markdown power",
"Ever wanted full markdown support in chat? How about syntax highlighting?": "Nunca quis suporte ao Markdown no chat? E o que acha de usar 'syntax highlighting'?",
"Yip, we got your back.": "Ufa! Você voltou!",
"Private conversations": "Conversas privadas",
"Public rooms are awesome (and free), but we get that some stuff is private. So we've got <a %s>plans for that</a>.": "Salas Públicas são incríveis (e grátis), mas as vezes queremos algumas coisas privadas. Então, nós temos <a %s>planos para isso</a>.",
"Developer friendly": "Developer friendly",
"This is a picture of a cloud against a background of clouds. OMG! We <a %s>integrate</a> with a bunch of stuff in the cloud.": "Essa é uma figura de uma nuvem contra um fundo de nuvens. UOW! <a %s>Integramos</a> com um monte de coisas na nuvem.",
"Some of our communities": "Algumas de nossas comunidades",
"Create your own": "Crie a sua própria",
"Explore rooms": "Explore salas",
"Explore": "Explore",
"Integrated with your workflow": "Integrado com seu jeito de trabalhar",
"Gitter is built on top of GitHub and is tightly integrated with your organisations, repositories, issues and activity.": "Gitter é feito sobre o GitHub e fortemente integrado com suas organizações, repositórios, issues e atividades.",
"We provide integrations with Trello, Jenkins, Travis CI, Heroku, Sentry, BitBucket, HuBoard, Logentries, Pagerduty & Sprintly. We also accept custom webhooks, have an <a %s>open source repository</a> for integrations as well as a <a %s>flexible API</a>.": "Provemos integrações com Trello, Jenkins, Travis CI, Heroku, Sentry, BitBucket, HuBoard, Logentries, Pagerduty & Sprintly. Também integramos com Webhooks personalizados e temos um <a %s>repositório de Código Aberto</a> para integrações, bem como uma <a %s>API muito flexível</a>.",
"Loved by our users": "Amado por nossos úsuários",
"Gitter is nothing without the people using it day in and day out.": "Gitter não é nada se não fosse pelas pessoas usando-o no dia-a-dia à fora.",
"We asked a few what Gitter means to them, this is what they had to say. If you love Gitter, Tweet us <a %s>%s</a> and we'll update these quotes every month.": "Perguntamos para alguns usuários o que o Gitter significa para eles, e isso é o que eles disseram. Se você também ama o Gitter, tweet para <a %s>%s</a> e nós atualizaremos essas frases todo mês.",
"Personal pricing": "Preço por pessoa",
"Free": "Grátis",
"Forever": "Para sempre",
"<b>Unlimited</b> public rooms": "<b>Ilimitado</b> salas públicas",
"<b>1</b> private room": "<b>1</b> sala privadas",
"<b>2 weeks’</b> chat history": "<b>2 semanas</b> histórico",
"<b>Get started</b> for free": "<b>Comece grátis</b>",
"Individual": "Individual",
"monthly": "mensal",
"<b>Unlimited</b> private rooms": "<b>Ilimitado</b> salas privadas",
"<b>Unlimited</b> chat history": "<b>Ilimitado</b> histórico",
"<b>Purchase</b> now": "<b>Compre</b> agora",
"Organisation pricing": "Preço para Empresas",
"Bronze": "Bronze",
"per user/month": "por usuário/mês",
"<b>6 months’</b> chat history": "<b>6 meses</b> histórico",
"Silver": "Prata",
"Our free plan includes one private room per organisation you belong to on GitHub": "Nosso plano gratuito inclui uma Sala Privada por Organização que você pertença no Github",
"Our Individual plan allows you to create private rooms using your personal account as the owner": "Nosso plano Individual permite que você crie salas privadas usando sua conta pessoal como 'dono da sala'",
"Our organisation plans allow you to create private rooms using your GitHub organisation as the owner": "Nossos Planos Empresariais permitem que você crie salas privadas usando sua Organização do GitHub como 'dona da sala'",
"Prices may be subject to VAT. By signing up you agree to our <a %s>Terms and Conditions</a>.": "Preços estão sujeitos a Taxas (impostos), de acordo com a legislação de seu País. Ao cadastrar-se, você concorda com o nosso <a %s>Termos e Condições de Uso</a>.",
"Get Gitter now!": "Obtenha o Gitter agora!",
"Gitter is available in all modern browsers as well as apps for desktops and mobile phones.": "Gitter está disponível em todos os navegadores modernos, bem como em aplicativo Desktop e para celulares/tablets.",
"We currently have apps for OSX, iOS, Android and Windows with a Linux app coming soon. We also have a sweet little <a %s>IRC bridge</a>": "Atualmente, temos aplicativos para OSX, iOS, Android e Windows. Uma versão para Linux estará chegando em breve. Também temos uma pequena 'ponte' para <a %s>canais IRC</a>",
"Mac": "Mac",
"Windows": "Windows",
"Coming soon": "Em breve",
"iPhone": "iPhone",
"Android": "Android",
"By developers, for developers": "Por desenvolvedores, para desenvolvedores",
"Gitter is built in London by a team of developers just like you. Hell even the product guy writes code, although we generally end up rewriting those bits.": "Gitter é feito em Londres por um time de desenvolvedores como você. E cara, mesmo o responsável pelo produto escreve código, embora geralmente nós acabamos re-escrevendo esses bits.",
"If you're ever around Silicon Roundabout, give us a shout, we love meeting up with other developers.": "Se você estiver na área de Silicon Roundabout, dá um 'Aloo' pra gente, adoramos conhecer outros desenvolvedores.",
"Support": "Suporte",
"API": "API",
"Blog": "Blog",
"Twitter": "Twitter",
"Gitter — Where developers come to talk.": "Gitter — Onde desenvolvedores vêm conversar.",
"Translated By": "<a href='https://github.com/mariojunior' target='_blank'>Mario Junior</a>"
}
|
import BlitzLead from '../../models/BlitzLead';
export default function blitzLeadCreate(req) {
var leadObject = req.body;
leadObject.createdate = new Date();
return new Promise((resolve, reject) => {
BlitzLead.findOneAndUpdate({ phone: leadObject.phone }, leadObject, {
upsert: true
}, (err, doc) => {
if(err) {
reject(err);
} else {
resolve(doc)
}
});
});
}
|
'use strict';
var async = require('async');
var SQLite = require('react-native-sqlite');
var eventsModel = require('festivals-model').model;
var EventResponseBuilder = eventsModel.eventResponse.EventResponseBuilder;
var EventPlaceResponseBuilder = eventsModel.eventPlaceResponse.EventPlaceResponseBuilder;
var EventCategoryResponseBuilder = eventsModel.eventCategoryResponse.EventCategoryResponseBuilder;
var DurationResponseBuilder = eventsModel.durationResponse.DurationResponseBuilder;
var LocationResponseBuilder = eventsModel.locationResponse.LocationResponseBuilder;
var MainImageResponseBuilder = eventsModel.mainImageResponse.MainImageResponseBuilder;
var AuthorResponseBuilder = eventsModel.authorResponse.AuthorResponseBuilder;
var DATABASE_FILENAME = 'events.sqlite';
var API_URL = 'http://localhost:3000/api';
var EVENTS_RESOURCE_NAME = '/festivals/{id}/events';
var EVENTS_QUERY = '?sort=duration.startAt';
var EventsAdapter = function EventsAdapter() {
var database = SQLite.open(DATABASE_FILENAME);
var loadEvents = function loadEvents(festival, callback) {
var events = [];
database.executeSQL(
'SELECT * FROM "events" ' +
'WHERE festival = ? ' +
'ORDER BY start_at ASC ',
//'LIMIT 5', //TODO,
[
festival.id
],
(row) => {
var duration = new DurationResponseBuilder()
.withStartAt(row.start_at)
.withFinishAt(row.end_at)
.withPeriodMs(null)
.build();
var mainImage = null;
if (row.image) {
mainImage = new MainImageResponseBuilder()
.withSmall(row.image)
.withMedium(row.image)
.withLarge(row.image)
.build();
}
var place = null;
if (row.place_name) {
place = new EventPlaceResponseBuilder()
.withId(row.place_id)
.withName(row.place_name)
.withBreadcrumbs(null)
.withOpeningTimes(null)
.withCoordinates(null)
.build();
}
var category = null;
if (row.category_name) {
category = new EventCategoryResponseBuilder()
.withId(row.category_id)
.withName(row.category_name)
.withBreadcrumbs(null)
.build();
}
var authors = [];
if (row.authors) {
var splited = row.authors.split(',');
if (splited.length) {
authors = splited.map(function (author) {
var authorSplit = author.split('|');
var organization = authorSplit[1];
if (organization === 'null') {
organization = null;
}
return new AuthorResponseBuilder()
.withName(authorSplit[0])
.withOrganization(organization)
.build();
});
}
//console.log(row.authors, authors);
}
var eventResponseModel = new EventResponseBuilder()
.withId(row.id)
.withName(row.name)
.withDescription(row.description)
.withStatus(row.status)
.withMainImage(mainImage)
.withDuration(duration)
.withPlace(place)
.withCategory(category)
.withAuthors(authors)
.withPublishedAt(row.published_at)
.withCreatedAt(row.created_at)
.withUpdatedAt(row.updated_at)
.build();
events.push(eventResponseModel);
},
(error) => {
//if (error) {
// throw error;
//}
return callback(error, events);
});
};
var initTable = function initTable(callback) {
var sql = 'create table "events" (' +
'"id" char(36) not null primary key, ' +
'"festival" char(36), ' +
'"name" varchar(255), ' +
'"description" text, ' +
'"start_at" datetime, ' +
'"end_at" datetime, ' +
'"image" varchar(255), ' +
'"authors" text, ' +
'"place_id" char(36), ' +
'"place_name" varchar(255), ' +
'"category_id" char(36), ' +
'"category_name" varchar(255), ' +
'"status" varchar(255), ' +
'"created_at" datetime, ' +
'"updated_at" datetime,' +
'"published_at" datetime' +
')';
database.executeSQL(sql,
[],
(row) => {
console.log('on initTable row : ', row);
},
(error) => {
//if (error) {
// throw error;
//}
console.log('on initTable completed ', error);
return callback(error, null);
});
};
var dropTable = function dropTable(callback) {
var sql = 'drop table "events"';
database.executeSQL(sql,
[],
(row) => {
console.log('on dropTable row : ', row);
},
(error) => {
//if (error) {
// throw error;
//}
console.log('on dropTable completed ', error);
return callback(error, null);
});
};
var saveEvent = function saveEvent(event, callback) {
var sql = 'insert into "events" ' +
'(' +
'"id",' +
'"festival",' +
'"name",' +
'"description",' +
'"start_at",' +
'"end_at",' +
'"image",' +
'"authors",' +
'"place_id",' +
'"place_name",' +
'"category_id",' +
'"category_name",' +
'"status",' +
'"created_at",' +
'"updated_at",' +
'"published_at"' +
') values (' +
'?,' +
'?,' +
'?,' +
'?,' +
'?,' +
'?,' +
'?,' +
'?,' +
'?,' +
'?,' +
'?,' +
'?,' +
'?,' +
'?,' +
'?,' +
'?' +
')';
var authors = '';
if (event.authors && event.authors.length) {
var joins = event.authors.map(function (author) {
return author.name + '|' + author.organization;
});
authors = joins.join(',');
}
//console.log('save event', event);
database.executeSQL(sql,
[
event.id,
event.festival,
event.name,
event.description,
event.duration.startAt,
event.duration.finishAt,
event.mainImage ? event.mainImage.large : null,
authors,
event.place ? event.place.id : null,
event.place ? event.place.name : null,
event.category ? event.category.id : null,
event.category ? event.category.name : null,
event.status,
event.createdAt,
event.updatedAt,
event.publishedAt
],
(row) => {
console.log('on saveEvent row : ', row);
},
(error) => {
console.log('on saveEvent completed ', error);
return callback(error, null);
});
};
var saveEvents = function saveEvents(events, callback) {
async.map(events, saveEvent, callback);
};
var fetchEvents = function fetchEvents(festival, callback) {
var url = API_URL;
url += EVENTS_RESOURCE_NAME.replace('{id}', festival.id);
url += EVENTS_QUERY;
//console.log('get events from ' + url);
fetch(url)
.then((response) => {
if (response.headers.get('content-type') === 'application/json') {
return response.json();
}
throw new TypeError();
})
.catch((error) => {
console.error(error);
return callback(error, []);
})
.then((responseData) => {
var events = responseData.events.map(function (event) {
event.festival = festival.id;
return event;
});
//filter?
saveEvents(events, function (err) {
return callback(err, events);
});
})
.done();
};
var getEvents = function getEvents(festival, callback) {
loadEvents(festival, function (err, events) {
//console.log(err, events);
if (err) {
console.error(err);
return callback(err, events);
}
if (events && events.length > 0) {
console.log(events);
return callback(null, events);
}
return forceRefreshData(festival, callback);
});
};
var forceRefreshData = function forceRefreshData(festival, callback) {
dropTable(function (/*err*/) {
initTable(function (/*err*/) {
fetchEvents(festival, function (err, events) {
if (err) {
console.error(err);
}
return callback(err, events);
});
});
});
};
console.log('CREATE EventsAdapter!');
initTable(function (err) {
});
return {
getEvents: getEvents,
forceRefreshData: forceRefreshData
};
};
module.exports = {
EventsAdapter: EventsAdapter
};
|
define([
"backbone",
"react",
"underscore"
], function(
Backbone,
React,
_
) {
var Router = Backbone.Router.extend({
routes: {
"repository/:id": "repository",
"repository/:id/branch/:bid": "repository",
"repository/:id/branch/:bid/:lang": "repository",
"repository/create": "repository_create",
"login(?*next)": "login",
"*default": "repositories"
},
render: function(View, props) {
props = props || {};
require(["jquery", "jsx!views/Main"], function($, Main) {
props = _.extend(props, {
currentView: View
});
React.render(
React.createElement(Main, props),
$("body").get(0)
);
});
},
repositories: function() {
require([
"collections/RepositoryCollection",
"jsx!views/repository/ListView"
], function(
RepositoryCollection,
ListView
) {
this.render(ListView, {
collection: new RepositoryCollection()
});
}.bind(this));
},
repository: function(id, bid, lang) {
require([
"models/Repository",
"models/Branch",
"jsx!views/repository/View"
], function(
Repository,
Branch,
View
) {
var branch;
if(bid) {
branch = new Branch({ id: bid });
}
this.render(View, {
model: new Repository({ id: id }),
branch: branch,
language: lang
});
}.bind(this));
},
login: function(next) {
require([
"jsx!views/Login"
], function(
Login
) {
this.render(Login);
}.bind(this));
}
});
return new Router();
});
|
/**
* Module dependencies.
*/
var utils = require('../utils/utils');
/**
* HLEN <key>
*/
exports.hlen = function(key){
var obj = this.lookup(key);
if (!!obj && 'hash' == obj.type) {
return Object.keys(obj.val).length;
} else {
return -1;
}
};
/**
* HVALS <key>
*/
exports.hvals = function(key){
var obj = this.lookup(key);
if (!!obj && 'hash' == obj.type) {
return (obj.val);
} else {
return null;
}
};
/**
* HKEYS <key>
*/
exports.hkeys = function(key){
var obj = this.lookup(key);
if (!!obj && 'hash' == obj.type) {
return Object.keys(obj.val);
} else {
return null;
}
};
/**
* HSET <key> <field> <val>
*/
(exports.hset = function(key, field, val){
var obj = this.lookup(key);
if (obj && 'hash' != obj.type) { return false;}
obj = obj || (this.db.data[key] = { type: 'hash', val: {} });
obj.val[field] = val;
return true;
}).mutates = true;
/**
* HMSET <key> (<field> <val>)+
*/
(exports.hmset = function(data){
var len = data.length , key = data[0] , obj = this.lookup(key) , field , val;
if (obj && 'hash' != obj.type) { return false;}
obj = obj || (this.db.data[key] = { type: 'hash', val: {} });
var i = 1;
for (i = 1; i < len; ++i) {
field = data[i++];
val = data[i];
obj.val[field] = val;
}
return true;
}).mutates = true;
exports.hmset.multiple = 2;
exports.hmset.skip = 1;
/**
* HGET <key> <field>
*/
exports.hget = function(key, field){
var obj = this.lookup(key) , val;
if (!obj) {
return null;
} else if ('hash' == obj.type) {
return obj.val[field] || null;
} else {
return null;
}
};
/**
* HGETALL <key>
*/
exports.hgetall = function(key){
var obj = this.lookup(key);
var list = [];
var field;
if (!!obj && 'hash' == obj.type) {
for (field in obj.val) {
list.push(field, obj.val[field]);
}
return list;
} else {
return null;
}
};
/**
* HEXISTS <key> <field>
*/
exports.hexists = function(key, field){
var obj = this.lookup(key);
if (!!obj && 'hash' == obj.type) {
var result = (hfield in obj.val);
return result;
} else {
return false;
}
};
|
var React = require("react");
var Reflux = require("reflux");
// Required for cuAPI.handlesFriendlyTarget
var cuAPI = require('../../cu-lib/API.js');
// The FriendlyTarget UI component pulls together the FriendlyTargetStore which
// tracks the "handlesFriendlyTarget": true events and the UnitFrame that
// will render the unitframe.
var FriendlyTargetStore = require("../../cu-lib/stores/FriendlyTarget.js");
var UnitFrame = require("../../cu-lib/views/unitframe.js");
var FriendlyTarget = React.createClass({
// Hook store up to component. Each time FriendlyTarget data is changed,
// our state is updated, triggering a render
mixins: [
Reflux.connect(FriendlyTargetStore, 'target')
],
// Provide an initial state (TODO: is there a better way to do this?)
getInitialState: function() {
return { target: FriendlyTargetStore.info };
},
// Render the unit frame using target data
render: function() {
var state = this.state, target = state.target;
return (<UnitFrame
className="friendly"
name={target.name} race={target.race}
health={target.health} maxHealth={target.maxHealth}
stamina={target.stamina} maxStamina={target.maxStamina} />
);
}
});
module.exports = FriendlyTarget;
|
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
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; }; }(); /**
* @name SGoogleSearch
* This class let you make with ease search requests to the google custom search service
* with useful features like:
* - Simple pagination system
* - Promise support
*
* @example js
* // create a google search instance
* const googleSearch = new SGoogleSearch('myApiKey', 'myCustomSearchContextKey');
*
* // make a search...
* googleSearch.search('hello world').then((response) => {
* // do something with the google response...
* });
*
* // get the nexts results
* googleSearch.next().then((response) => {
* // do something with the new response...
* });
*
* @see https://developers.google.com/custom-search/
* @author Olivier Bossel<olivier.bossel@gmail.com>
*/
var _SAjax = require('../classes/SAjax');
var _SAjax2 = _interopRequireDefault(_SAjax);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var SGoogleSearch = function () {
/**
* @constructor
* @param {String} apiKey The google api key to reach the services
* @param {String} cx The google custom search context
*/
/**
* Store the current page
* @private
* @name _page
* @type {Integer}
*/
/**
* Store the actual query object to be able to call
* next page etc...
* @private
* @name _settings
* @type {Object}
*/
/**
* Store the api key used to reach the google services
* @private
* @name _apiKey
* @type {String}
*/
function SGoogleSearch(apiKey, cx) {
_classCallCheck(this, SGoogleSearch);
this._apiKey = null;
this._cx = null;
this._settings = {
/**
* How many results by page wanted
* Can be between 1 and 10
* @setting
* @name num
* @type {Integer}
* @default 10
*/
num: 10,
/**
* The page to request
* @setting
* @name page
* @type {Integer}
* @default 1
*/
page: 1
};
this._searchUrl = 'https://www.googleapis.com/customsearch/v1';
this._page = 1;
this._keywords = null;
// save the props
this._apiKey = apiKey;
this._cx = cx;
}
/**
* Generate and return the correct search url depending on
* parameters like the current page, etc...
* @private
* @name _generateSearchUrl
* @return {String} The generated url
*/
/**
* The keywords searched
* @private
* @name _keywords
* @type {String}
*/
/**
* Store the google search url
* @private
* @name _searchUrl
* @type {String}
*/
/**
* Store the context key used to reach the good google search instance
* @private
* @name _cx
* @type {String}
*/
_createClass(SGoogleSearch, [{
key: '_generateSearchUrl',
value: function _generateSearchUrl() {
// construct url
var queryString = '';
for (var key in this._settings) {
queryString += '&' + key + '=' + this._settings[key];
}
queryString = queryString.substr(1);
queryString = '?' + queryString;
// process the url
return this._searchUrl + queryString;
}
/**
* Launch a search
* @name search
* @param {String} keywords The keywords to search
* @param {Object} settings The settings object
* @return {Promise} A promise of results
*/
}, {
key: 'search',
value: function search(keywords) {
var _this = this;
var settings = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
return new Promise(function (resolve, reject) {
// save the keywords into the instance
_this._keywords = keywords;
// reset the page count
_this._page = settings.page || 1;
// construct query object
var num = settings.num || 10;
_this._settings = _extends({
key: _this._apiKey,
cx: _this._cx,
q: keywords,
num: num,
start: (_this._page - 1) * num + 1
}, settings);
// get the url
var url = _this._generateSearchUrl();
// process to the ajax query
var ajx = new _SAjax2.default({
method: 'GET',
url: url,
dataType: 'JSON'
});
ajx.send().then(function (response) {
// resolve the promise
resolve(response);
}, function (error) {
// reject the promise
reject(error);
});
});
}
/**
* Load the next page
* @name next
* @return {Promise} The promise of next page results
*/
}, {
key: 'next',
value: function next() {
// update the page count
return this.search(this._keywords, _extends({}, this.query, {
page: this._page + 1
}));
}
}]);
return SGoogleSearch;
}();
exports.default = SGoogleSearch; |
import React from 'react';
import ReactDOM from 'react-dom';
import { Helmet } from 'react-helmet';
import PropTypes from 'prop-types';
import Field from '../util/styled/Field';
import Logo from '../svg/Logo';
import NotificationList from '../util/NotificationList';
class Login extends React.Component {
constructor(props) {
super(props);
this.state = {
view: this.props.match.path.substring(1) || 'login',
name: '',
email: '',
password: '',
passwordAgain: '',
attempts: 0,
next: Date.now(),
max: 5,
lockout: 1000 * 60 * 5 // 5 minutes
}
this.register = this.register.bind(this);
this.login = this.login.bind(this);
this.onChange = this.onChange.bind(this);
this.handleFormKeyPress = this.handleFormKeyPress.bind(this);
this.handleFormLogin = this.handleFormLogin.bind(this);
this.handleFormPasswordRecovery = this.handleFormPasswordRecovery.bind(this);
this.handleFormRegister = this.handleFormRegister.bind(this);
this.handleFormPasswordReset = this.handleFormPasswordReset.bind(this);
this.handleViewLogin = this.handleViewLogin.bind(this);
this.handleViewRegister = this.handleViewRegister.bind(this);
this.handleViewPasswordRecovery = this.handleViewPasswordRecovery.bind(this);
this.renderLogin = this.renderLogin.bind(this);
this.renderRegister = this.renderRegister.bind(this);
this.renderRequestPassword = this.renderRequestPassword.bind(this);
this.renderResetPassword = this.renderResetPassword.bind(this);
}
componentDidMount() {
if(this.props.match.params.hasOwnProperty('token'))
this.setState({view: 'password-reset'});
if(this.props.user._id)
this.props.history.push('/account');
}
register(credentials) {
this.props.api.register(credentials)
.then(() => {
NotificationList.info('Please check your email for verification.');
this.props.history.push('/account');
})
.then(() => this.props.api.login(credentials))
.then(user => this.props.setUser(user))
.catch(error => NotificationList.alert(error.message, error.name));
}
login(credentials) {
this.props.api.login(credentials)
.then(user => this.props.setUser(user))
.then(() => this.props.history.push('/account'))
.catch(error => NotificationList.alert(error.message, error.name));
}
onChange(payload) {
this.setState((prevState, props) => {
let nextState = Object.assign({}, prevState);
nextState[payload.type] = payload.data;
return nextState;
});
}
handleFormKeyPress(e) {
if(e.key != 'Enter')
return;
if(this.state.view == 'login')
this.handleFormLogin(e);
else if(this.state.view == 'register')
this.handleFormRegister(e);
else if(this.state.view == 'password-recovery')
this.handleFormPasswordRecovery(e);
}
handleFormLogin(e) {
e.stopPropagation();
const credentials = !this.state.email || !this.state.password ? null :
{ email: this.state.email,
password: this.state.password
};
this.login(credentials);
}
handleFormPasswordRecovery(e) {
e.stopPropagation();
if(!this.state.email)
return;
this.props.api.accountRequestPassword(this.state.email).then(r => {
NotificationList.info('Password recovery email sent');
}).catch(e => {
NotificationList.alert('Error sending password recovery email');
});
}
handleFormRegister(e) {
e.stopPropagation();
if(!this.state.password) {
NotificationList.alert('Please enter a password');
return;
}
if(this.state.password != this.state.passwordAgain) {
NotificationList.alert('Password entries do not match');
return;
}
const credentials = {
email: this.state.email,
password: this.state.password,
name: this.state.name
};
this.register(credentials);
}
handleFormPasswordReset() {
if(this.state.password != this.state.passwordAgain) {
NotificationList.alert('Password entries do not match');
return;
}
this.props.api.accountResetPassword(this.props.match.params.token, this.state.password).then(r => {
NotificationList.info('Password updated');
this.props.history.replace('/login');
this.setState({
view: 'login',
name: '',
email: '',
password: '',
passwordAgain: ''
});
}).catch(e => {
NotificationList.alert('Error during password update');
this.props.history.replace('/login');
this.setState({
view: 'password-recovery',
name: '',
email: '',
password: '',
passwordAgain: ''
});
});
}
handleViewLogin() {
this.setState({view: 'login'});
}
handleViewRegister() {
this.setState({view: 'register'});
}
handleViewPasswordRecovery() {
this.setState({view: 'password-recovery'});
}
renderLogin() {
return (
<form name='login'>
<span className='logo'>
<Logo alt='logo' />
</span>
<label>Email</label>
<Field type='text' decorated
name='email'
value={this.state.email}
onChange={this.onChange}
/>
<label>Password</label>
<Field type='password' decorated
name='password'
value={this.state.password}
onChange={this.onChange}
onKeyPress={this.handleFormKeyPress}
/>
<button type='button' value="submit"
onClick={this.handleFormLogin}
>
Sign In
</button>
<span className='option-left'
onClick={this.handleViewPasswordRecovery}
>
Forgot your password?
</span>
<span className='option-right'
onClick={this.handleViewRegister}
>
Sign Up
</span>
</form>
);
}
renderRegister() {
return (
<form name='register'>
<span className='logo'>
<Logo alt='logo' />
</span>
<label>Name</label>
<Field type='text' decorated
name='name'
value={this.state.name}
onChange={this.onChange}
/>
<label>Email</label>
<Field type='text' decorated
name='email'
value={this.state.email}
onChange={this.onChange}
/>
<label>Password</label>
<Field type='password' decorated
name='password'
value={this.state.password}
onChange={this.onChange}
/>
<label>Enter again:</label>
<Field type='password' decorated
name='passwordAgain'
value={this.state.passwordAgain}
onChange={this.onChange}
alert={this.state.passwordAgain && this.state.passwordAgain != this.state.password}
/>
<button type='button' value="submit"
onClick={this.handleFormRegister}
>
Sign Up
</button>
<span className='option-right'
onClick={this.handleViewLogin}
>
Sign In
</span>
</form>
);
}
renderRequestPassword() {
return (
<form name='password-recovery'>
<span className='logo'>
<Logo alt='logo' />
</span>
<label>Email</label>
<Field type='text' decorated
name='email'
value={this.state.email}
onChange={this.onChange}
onKeyPress={this.handleFormKeyPress}
/>
<button type='button' value='submit'
onClick={this.handleFormPasswordRecovery}
>
Reset Password
</button>
<span className='option-left'
onClick={this.handleViewLogin}
>
Sign In
</span>
</form>
);
}
renderResetPassword() {
return (
<form name='password-reset'>
<span className='logo'>
<Logo alt='logo' />
</span>
<label>Password</label>
<Field type='password' decorated
name='password'
value={this.state.password}
onChange={this.onChange}
/>
<label>Enter again:</label>
<Field type='password' decorated
name='passwordAgain'
value={this.state.passwordAgain}
onChange={this.onChange}
onKeyPress={this.handleFormKeyPress}
alert={this.state.passwordAgain && this.state.passwordAgain != this.state.password}
/>
<button type='button' value="submit"
onClick={this.handleFormPasswordReset}
>
Reset Password
</button>
</form>
);
}
render() {
const rest = Object.assign({}, this.props);
delete rest.location;
delete rest.match;
delete rest.history;
delete rest.staticContext;
delete rest.register;
delete rest.login;
delete rest.user;
delete rest.setUser;
let form = null;
switch(this.state.view) {
case 'register':
form = this.renderRegister();
break;
case 'password-recovery':
form = this.renderRequestPassword();
break;
case 'password-reset':
form = this.renderResetPassword();
break;
default:
form = this.renderLogin();
}
return (
<div {...rest}>
<Helmet>
<title>Login | Vanguard LARP</title>
<meta name="description" content="Vanguard LARP site login" />
</Helmet>
{form}
</div>
);
}
}
Login.defaultProps = {
location: {},
match: {
path: '/login',
params: {}
},
history: {
push: () => null,
goBack: () => null
},
staticContext: {},
api: {},
user: {},
setUser: () => null
};
Login.propTypes = {
location: PropTypes.object,
match: PropTypes.object,
history: PropTypes.object,
staticContext: PropTypes.object,
api: PropTypes.object,
user: PropTypes.object,
setUser: PropTypes.func
};
export default Login;
|
'use strict';
var fs = require('fs');
exports.modularize = {
compile: function (test) {
var code = fs.readFileSync('test/tmp/fixture.js', 'utf8');
var expected = fs.readFileSync('test/expected.js', 'utf8');
test.ok(code === expected);
test.done();
}
}; |
'use strict';
// coffeescript's for in loop
var __indexOf = [].indexOf || function(item) {
for (var i = 0, l = this.length; i < l; i++) {
if (i in this && this[i] === item) return i;
}
return -1;
};
angularApp.directive('fieldDirective', function($http, $compile, $sce, $parse) {
var getTemplateUrl = function(field) {
console.log(field);
var type = field.field_type;
var templateUrl = './views/directive-templates/field/';
var supported_fields = [
'textfield',
'email',
'textarea',
'checkbox',
'date',
'dropdown',
'hidden',
'password',
'radio',
'photo'
]
if (__indexOf.call(supported_fields, type) >= 0) {
return templateUrl += type + '.html';
}
}
var linker = function(scope, element) {
// GET template content from path
scope.blob_key = ""
var templateUrl = getTemplateUrl(scope.field);
$http.get(templateUrl).then(function(data) {
element.html(data.data);
$compile(element.contents())(scope);
});
}
var controller = ['$scope', 'fileUploadService', function($scope, fileUploadService, $http)
{
$scope.uploadFile = function(){
$scope.file_uploaded = false;
var file = $scope.myFile;
console.log('file is ' );
console.dir($scope.upload_url);
var uploadUrl = $scope.upload_url;
fileUploadService.uploadFileToUrl(file, uploadUrl).then(function(data)
{
console.log(data);
$scope.blob_key = data.key;
$scope.field.field_value = $scope.blob_key;
$scope.file_uploaded = true;
});
};
$scope.removeBlob = function()
{
fileUploadService.deleteBlob($scope.blob_key).then(function(data)
{
console.log(data);
$scope.file_uploaded = false;
$scope.getUploadUrl();
$scope.field.field_value = "";
})
}
$scope.getUploadUrl = function()
{
if($scope.field.field_type == 'photo')
{
fileUploadService.getUploadUrl().then(function(data)
{
$scope.upload_url = data;
console.log(data);
});
}
}
$scope.getUploadUrl();
}]
return {
template: '<div ng-bind="field"></div>',
restrict: 'E',
controller: controller,
scope: {
field: '='
},
link: linker
};
}); |
#!/usr/bin/env node
const program = require('commander')
const download = require('download-git-repo')
const chalk = require('chalk')
const exists = require('fs').existsSync
const path = require('path')
const inquirer = require('inquirer')
const ora = require('ora')
const rm = require('rimraf').sync
const home = require('user-home')
const tildify = require('tildify')
const logger = require('../lib/logger')
const generate = require('../lib/generate')
const { isLocalPath, getTemplatePath } = require('../lib/local-path')
program
.usage('<template-name> [project-name]')
.option('-c, --clone', 'use git clone')
.option('--offline', 'use cached template')
program.on('--help', function () {
console.log(`
Examples:
${chalk.gray('# create a new project from an offical template')}
$ ease init sdk my-project
${chalk.gray('# create a new project from a github template')}
$ ease init username/repo my-project
`)
})
function helpIfNeed () {
program.parse(process.argv)
if (program.args.length < 1) return program.help()
}
helpIfNeed()
let [ template, rawName ] = program.args
const hasSlash = template.indexOf('/') > -1
const inPlace = !rawName || rawName === '.'
const to = path.resolve(rawName || '.')
const name = path.relative(path.resolve(to, '../'), to)
const clone = program.clone || false
let tmp = path.join(home, '.ease-templates', template.replace(/\//g, '-'))
if (program.offline) {
console.log(`> Use cached template at ${chalk.yellow(tildify(tmp))}`)
template = tmp
}
console.log()
process.on('exit', function () {
console.log()
})
if (exists(to)) {
inquirer.prompt([{
type: 'confirm',
message: inPlace
? 'Generate project in current directory?'
: 'Target directory exists. Continue?',
name: 'ok'
}], function (answers) {
if (answers.ok) {
run()
}
})
} else {
run()
}
/**
* Check, download and generate the project.
*/
function run () {
// check if template is local
if (isLocalPath(template)) {
let templatePath = getTemplatePath(template)
if (exists(templatePath)) {
generate(name, templatePath, to, function (err) {
if (err) logger.fatal(err)
console.log()
logger.success('Generated "%s".', name)
})
} else {
logger.fatal('Local template "%s" not found.', template)
}
} else {
if (!hasSlash) {
// use official templates
let officialTemplate = 'ease-templates/' + template
downloadAndGenerate(officialTemplate)
} else {
downloadAndGenerate(template)
}
}
}
/**
* Download and generate from a template repo.
*
* @param {String} template
*/
function downloadAndGenerate (template) {
const spinner = ora('downloading template')
spinner.start()
// Remove if local template exists
if (exists(tmp)) rm(tmp)
download(template, tmp, { clone }, function (err) {
spinner.stop()
if (err) logger.fatal('Failed to download repo ' + template + ': ' + err.message.trim())
generate(name, tmp, to, function (err) {
if (err) logger.fatal(err)
console.log()
logger.success('Generated "%s".', name)
})
})
}
|
import Ember from 'ember';
import PressGestureMixinMixin from '../../../mixins/press-gesture-mixin';
import { module, test } from 'qunit';
module('PressGestureMixinMixin');
// Replace this with your real tests.
test('it works', function(assert) {
var PressGestureMixinObject = Ember.Object.extend(PressGestureMixinMixin);
var subject = PressGestureMixinObject.create();
assert.ok(subject);
});
|
import test from 'ava';
import sinon from 'sinon';
import { create } from '../../../core/index.js';
import { getWindow } from '../../../utils.js';
import {
createVNode as h,
getVNodeFragment,
getVNodeDOM,
attachEventListeners,
isEvent,
detatchEventListeners,
} from '../utils.js';
test('It should be able to parse a basic vnode tree;', async (t) => {
const main = h('section', {}, 'Hello Adam!');
const node = await getVNodeDOM(main);
t.snapshot(node.outerHTML);
});
test('It should be able to parse a vnode tree that begins with an array;', async (t) => {
const main = [h('section', {}, 'Hello Adam!'), h('section', {}, 'Hello Maria!'), h('section', {}, 'Hello Imogen!')];
t.plan(main.length);
const nodes = await getVNodeDOM(main);
nodes.forEach((node) => t.snapshot(node.outerHTML));
});
test('It should be able to parse a vnode tree with children;', async (t) => {
const name = ({ name }) => h('li', {}, name);
const main = h('ul', {}, [h(name, { name: 'Adam' }), h(name, { name: 'Maria' }), h(name, { name: 'Imogen' })]);
const node = await getVNodeDOM(main);
t.snapshot(node.outerHTML);
});
test('It should be able to parse a vnode tree with children that yield arrays;', async (t) => {
const name = ({ name, age }) => [h('div', {}, name), h('div', {}, age)];
const main = h('section', {}, [
h(name, { name: 'Adam', age: 34 }),
h(name, { name: 'Maria', age: 29 }),
h(name, { name: 'Imogen', age: 0.9 }),
]);
const node = await getVNodeDOM(main);
t.snapshot(node.outerHTML);
});
test('It should be able to parse a vnode tree that yields a Swiss component;', async (t) => {
function view({ use }) {
const attrs = use.attributes();
return h('div', {}, `Hello ${attrs.name}!`);
}
const Name = create('x-name', view);
const main = h('section', {}, [h(Name, { name: 'Adam' }), h(Name, { name: 'Maria' }), h(Name, { name: 'Imogen' })]);
const node = await getVNodeDOM(main);
t.snapshot(node.outerHTML);
});
test('It should be able to parse a vnode tree with children that yield nested arrays;', async (t) => {
const name = ({ name, age }) => [[[h('div', {}, name), h('div', {}, age)]]];
const main = h('section', {}, [
[h(name, { name: 'Adam', age: 34 })],
[h(name, { name: 'Maria', age: 29 })],
[h(name, { name: 'Imogen', age: 0.9 })],
]);
const node = await getVNodeDOM(main);
t.snapshot(node.outerHTML);
});
test('It should be able to parse a vnode tree with children that yield nested arrays as parameters;', async (t) => {
const name = ({ name, age }) => [[[h('div', {}, name), h('div', {}, age)]]];
const main = h(
'section',
{},
h(name, { name: 'Adam', age: 34 }),
h(name, { name: 'Maria', age: 29 }),
h(name, { name: 'Imogen', age: 0.9 })
);
const node = await getVNodeDOM(main);
t.snapshot(node.outerHTML);
});
test('It should be able to yield a document fragment of the parsed DOM tree;', async (t) => {
const window = await getWindow();
const main = [h('section', {}, 'Hello Adam!'), h('section', {}, 'Hello Maria!'), h('section', {}, 'Hello Imogen!')];
const nodes = await getVNodeDOM(main);
const fragment = await getVNodeFragment(nodes);
t.true(fragment instanceof window.DocumentFragment);
});
test('It should be able to determine when an event is actually an event;', (t) => {
t.true(isEvent('onClick', () => {}));
t.false(isEvent('onClick', {}));
t.false(isEvent('click', () => {}));
});
test('It should be able to handle of attaching events to any given node;', (t) => {
const node = document.createElement('x-imogen');
node.addEventListener = sinon.spy();
const click = () => {};
const onClick = () => {};
const onChange = {};
attachEventListeners(h('button', { click, onClick, onChange }))(node);
t.is(node.addEventListener.callCount, 1);
t.true(node.addEventListener.calledWith('click', onClick));
});
test('It should be able to handle of detatching events from any given node;', (t) => {
const node = document.createElement('x-imogen');
node.addEventListener = sinon.spy();
node.removeEventListener = sinon.spy();
const onClick = () => {};
attachEventListeners(h('button', { onClick }))(node);
detatchEventListeners(node);
t.is(node.removeEventListener.callCount, 1);
t.true(node.removeEventListener.calledWith('click', onClick));
});
|
'use strict';
const _ = require('lodash');
const { has_method } = require('helpers/util');
const EXCLUDE_PROTOTYPE_METHODS = [
'constructor', 'hasOwnProperty', 'isPrototypeOf',
'propertyIsEnumerable', 'toString', 'valueOf',
'toLocaleString', 'log', 'getInstanceMethodNames'
];
/**
* @class
* @classdesc Base class for all
*/
class BaseClass {
constructor() {
const methods = this.getInstanceMethodNames();
_.bindAll(this, methods);
}
/**
* Based from: http://code.fitness/post/2016/01/javascript-enumerate-methods.html
*
* @param {String} options
* @param {String} options.excludePrefix - exclude method leading by prefix
* @param {Array} options.excludeMethods - exclude methods in this array
* @returns {Array} list method of instance
*/
getInstanceMethodNames (options) {
options = _.defaults(options, {excludePrefix: '_', excludeMethods: []});
const methods = [];
const excludeMethods = _.concat(
options.excludeMethods,
EXCLUDE_PROTOTYPE_METHODS
);
let proto = Object.getPrototypeOf(this);
while (proto) {
const propertyNames = Object.getOwnPropertyNames(proto);
for (let name of propertyNames) {
if (!_.startsWith(name, options.excludePrefix)
&& !_.includes(excludeMethods, name)
&& has_method(proto, name)
) {
methods.push(name);
}
}
proto = Object.getPrototypeOf(proto);
}
return methods;
}
}
module.exports = BaseClass;
|
/**
* @fileOverview An extension to Exhibit adding a view using SIMILE Timeline.
* @author David Huynh
* @author <a href="mailto:ryanlee@zepheira.com">Ryan Lee</a>
* @example Load this file like so:
* <script src="http://host/exhibit/3.0.0/exhibit-api.js"></script>
* <script src="http://host/exhibit/3.0.0/extensions/time-extension.js"></script>
* where "host" is wherever the Exhibit files are based on the web. Valid
* parameters are:
* bundle [true|false]: load extension files one by one or bundled in one file
* timelinePrefix <String>: Which host to find Timeline, defaults to
* "http://api.simile-widgets.org"
* timelineVersion <String>: Which version of Timeline to use, defaults to
* "2.3.1"
*/
/**
* This extension is subject to ugly, ugly hacks because Timeline a) relies
* on SimileAjax, which Exhibit 3.0 no longer does, and b) Timeline's method
* of loading (via SimileAjax) is outdated and not compatible with Exhibit.
*
* In order to compensate, this file uses one polling loop and a modified
* version of the SimileAjax loader. The polling loop waits until Timeline
* has loaded and is defined in the window context. The extension must take
* advantage of Exhibit's delay mechanism so Exhibit will delay creation
* until Timeline has finished loading. The modified SimileAjax loader does
* not load SimileAjax jQuery or allow SimileAjax to modify jQuery but has to
* define some of the material in SimileAjax as a consequence. See
* load-simile-ajax.js.
*/
Exhibit.onjQueryLoaded(function() {
var loader;
loader = function() {
var javascriptFiles, cssFiles, paramTypes, url, scriptURLs, cssURLs, ajaxURLs, i, delayID, finishedLoading, localesToLoad
, proto = document.location.protocol === "https:" ?
"https:" : "http:";
delayID = Exhibit.generateDelayID();
Exhibit.jQuery(document).trigger(
"delayCreation.exhibit",
delayID
);
Exhibit.TimeExtension = {
"params": {
"bundle": true,
"timelinePrefix": proto + "//api.simile-widgets.org",
"timelineVersion": "2.3.1"
},
"urlPrefix": null,
"locales": [
"en",
"de",
"es",
"fr",
"nl",
"sv"
]
};
javascriptFiles = [
"timeline-view.js"
];
cssFiles = [
"timeline-view.css"
];
paramTypes = {
"bundle": Boolean,
"timelinePrefix": String,
"timelineVersion": String
};
if (typeof Exhibit_TimeExtension_urlPrefix === "string") {
Exhibit.TimeExtension.urlPrefix = Exhibit_TimeExtension_urlPrefix;
if (typeof Exhibit_TimeExtension_parameters !== "undefined") {
Exhibit.parseURLParameters(Exhibit_TimeExtension_parameters,
Exhibit.TimeExtension.params,
paramTypes);
}
} else {
url = Exhibit.findScript(document, "/time-extension.js");
if (url === null) {
Exhibit.Debug.exception(new Error("Failed to derive URL prefix for SIMILE Exhibit Time Extension files"));
return;
}
Exhibit.TimeExtension.urlPrefix = url.substr(0, url.indexOf("time-extension.js"));
Exhibit.parseURLParameters(url, Exhibit.TimeExtension.params, paramTypes);
}
scriptURLs = [];
cssURLs = [];
if (typeof SimileAjax === "undefined") {
/**
* Ugly SimileAjax hack. See load-simile-ajax.js.
*/
scriptURLs.push(Exhibit.TimeExtension.urlPrefix + "load-simile-ajax.js");
}
if (typeof Timeline === "undefined") {
scriptURLs.push(Exhibit.TimeExtension.params.timelinePrefix + "/timeline/" + Exhibit.TimeExtension.params.timelineVersion + "/timeline-api.js?bundle=true");
}
if (Exhibit.TimeExtension.params.bundle) {
scriptURLs.push(Exhibit.TimeExtension.urlPrefix + "time-extension-bundle.js");
cssURLs.push(Exhibit.TimeExtension.urlPrefix + "styles/time-extension-bundle.css");
} else {
Exhibit.prefixURLs(scriptURLs, Exhibit.TimeExtension.urlPrefix + "scripts/", javascriptFiles);
Exhibit.prefixURLs(cssURLs, Exhibit.TimeExtension.urlPrefix + "styles/", cssFiles);
}
localesToLoad = Exhibit.Localization.getLoadableLocales(Exhibit.TimeExtension.locales);
for (i = 0; i < localesToLoad.length; i++) {
scriptURLs.push(Exhibit.TimeExtension.urlPrefix + "locales/" + localesToLoad[i] + "/locale.js");
}
Exhibit.includeCssFiles(document, null, cssURLs);
Exhibit.includeJavascriptFiles(null, scriptURLs);
// Ugly polling hack
finishedLoading = function() {
if (typeof Timeline !== "undefined") {
Exhibit.jQuery(document).trigger("delayFinished.exhibit", delayID);
} else {
setTimeout(finishedLoading, 500);
}
};
finishedLoading();
};
Exhibit.jQuery(document).one("loadExtensions.exhibit", loader);
});
|
module.exports = require('./src/Search'); |
/*
* The MIT License (MIT)
*
* Copyright (c) 2014 Boucher, Antoni <bouanto@gmail.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.
*/
asyncTest('this Keyword', function() {
expect(58);
ces.download('test16.ces', function(source) {
stop();
var body = document.querySelector('#qunit-fixture');
var div1 = document.createElement('div');
div1.className = 'inside';
body.appendChild(div1);
var color1 = document.createElement('span');
color1.className = 'color';
color1.innerHTML = 'Color';
color1.title = 'Color';
div1.appendChild(color1);
var div2 = document.createElement('div');
div2.className = 'inside';
body.appendChild(div2);
var color2 = document.createElement('span');
color2.className = 'color';
color2.innerHTML = 'Color';
color2.title = 'Color';
div2.appendChild(color2);
var div3 = document.createElement('div');
div3.className = 'inside';
body.appendChild(div3);
var color3 = document.createElement('span');
color3.className = 'color';
color3.innerHTML = 'Color';
color3.title = 'Color';
div3.appendChild(color3);
var js = ces.ces2js(source, 'test16.ces');
ces.execute(js);
ok(!color1.style.getPropertyValue('color'), 'Property color is not set.');
ok(!color2.style.getPropertyValue('color'), 'Property color is not set.');
ok(!color3.style.getPropertyValue('color'), 'Property color is not set.');
trigger(div1, 'click');
equal(color1.style.getPropertyValue('color'), 'green', 'Property color is set to "green".');
ok(!color2.style.getPropertyValue('color'), 'Property color is not set.');
ok(!color3.style.getPropertyValue('color'), 'Property color is not set.');
color1.style.setProperty('color', '');
ok(!color1.style.getPropertyValue('color'), 'Property color is not set.');
ok(!color2.style.getPropertyValue('color'), 'Property color is not set.');
ok(!color3.style.getPropertyValue('color'), 'Property color is not set.');
trigger(div2, 'click');
ok(!color1.style.getPropertyValue('color'), 'Property color is not set.');
equal(color2.style.getPropertyValue('color'), 'green', 'Property color is set to "green".');
ok(!color3.style.getPropertyValue('color'), 'Property color is not set.');
color2.style.setProperty('color', '');
ok(!color1.style.getPropertyValue('color'), 'Property color is not set.');
ok(!color2.style.getPropertyValue('color'), 'Property color is not set.');
ok(!color3.style.getPropertyValue('color'), 'Property color is not set.');
trigger(div3, 'click');
ok(!color1.style.getPropertyValue('color'), 'Property color is not set.');
ok(!color2.style.getPropertyValue('color'), 'Property color is not set.');
equal(color3.style.getPropertyValue('color'), 'green', 'Property color is set to "green".');
start();
});
ces.download('test17.ces', function(source) {
stop();
var body = document.querySelector('#qunit-fixture');
var div1 = document.createElement('div');
div1.className = 'inside';
body.appendChild(div1);
var color1 = document.createElement('span');
color1.className = '_color-this';
color1.setAttribute('data-this', 'this')
color1.innerHTML = 'Color';
div1.appendChild(color1);
var div2 = document.createElement('div');
div2.className = 'inside';
body.appendChild(div2);
var color2 = document.createElement('span');
color2.className = '_color-this';
color2.setAttribute('data-this', 'this')
color2.innerHTML = 'Color';
div2.appendChild(color2);
var div3 = document.createElement('div');
div3.className = 'inside';
body.appendChild(div3);
var color3 = document.createElement('span');
color3.className = '_color-this';
color3.setAttribute('data-this', 'this')
color3.innerHTML = 'Color';
div3.appendChild(color3);
var setId = document.createElement('div');
setId.className = 'set-id';
body.appendChild(setId);
var links = document.createElement('div');
links.className = 'links';
body.appendChild(links);
var link1 = document.createElement('a');
link1.href = 'https://github.com';
links.appendChild(link1);
var js = ces.ces2js(source, 'test17.ces');
ces.execute(js);
ok(!color1.style.getPropertyValue('color'), 'Property color is not set.');
ok(!color2.style.getPropertyValue('color'), 'Property color is not set.');
ok(!color3.style.getPropertyValue('color'), 'Property color is not set.');
equal(div1.id, '', 'Id is not set.');
trigger(div1, 'click');
equal(color1.style.getPropertyValue('color'), 'green', 'Property color is set to "green".');
ok(!color2.style.getPropertyValue('color'), 'Property color is not set.');
ok(!color3.style.getPropertyValue('color'), 'Property color is not set.');
equal(div1.id, '', 'Id is not set.');
color1.style.setProperty('color', '');
ok(!color1.style.getPropertyValue('color'), 'Property color is not set.');
ok(!color2.style.getPropertyValue('color'), 'Property color is not set.');
ok(!color3.style.getPropertyValue('color'), 'Property color is not set.');
equal(div2.id, '', 'Id is not set.');
trigger(div2, 'click');
ok(!color1.style.getPropertyValue('color'), 'Property color is not set.');
equal(color2.style.getPropertyValue('color'), 'green', 'Property color is set to "green".');
ok(!color3.style.getPropertyValue('color'), 'Property color is not set.');
equal(div2.id, '', 'Id is not set.');
color2.style.setProperty('color', '');
ok(!color1.style.getPropertyValue('color'), 'Property color is not set.');
ok(!color2.style.getPropertyValue('color'), 'Property color is not set.');
ok(!color3.style.getPropertyValue('color'), 'Property color is not set.');
equal(div3.id, '', 'Id is not set.');
trigger(div3, 'click');
ok(!color1.style.getPropertyValue('color'), 'Property color is not set.');
ok(!color2.style.getPropertyValue('color'), 'Property color is not set.');
equal(color3.style.getPropertyValue('color'), 'green', 'Property color is set to "green".');
equal(div3.id, '', 'Id is not set.');
equal(setId.id, '', 'Id is not set.');
trigger(setId, 'click');
equal(setId.id, 'new-id', 'Id is set to "new-id".');
ok(!link1.style.getPropertyValue('color'), 'Property color is not set.');
trigger(links, 'click');
equal(link1.style.getPropertyValue('color'), 'red', 'Property color is set to "red".');
start();
});
ces.download('test26.ces', function(source) {
var body = document.querySelector('#qunit-fixture');
var div = document.createElement('div');
body.appendChild(div);
var div2 = document.createElement('div');
div.appendChild(div2);
var div3 = document.createElement('div');
div2.appendChild(div3);
var button = document.createElement('button');
button.className = 'myButton';
button.textContent = 'Button';
div3.appendChild(button);
var js = ces.ces2js(source, 'test26.ces');
ces.execute(js);
ok(!div.style.getPropertyValue('background-color'), 'Property background-color is not set.');
ok(!div2.style.getPropertyValue('background-color'), 'Property background-color is not set.');
ok(!div3.style.getPropertyValue('background-color'), 'Property background-color is not set.');
equal(div.id, '', 'Id is not set.');
equal(div2.id, '', 'Id is not set.');
equal(div3.id, '', 'Id is not set.');
trigger(button, 'click');
equal(div.style.getPropertyValue('background-color'), 'red', 'Property background-color is set to "red".');
ok(!div2.style.getPropertyValue('background-color'), 'Property background-color is not set.');
equal(div3.style.getPropertyValue('background-color'), 'green', 'Property background-color is set to "green".');
equal(div.id, '', 'Id is not set.');
equal(div2.id, '', 'Id is not set.');
equal(div3.id, '', 'Id is not set.');
start();
});
});
|
/**
* Pipedrive API v1
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*
*/
import ApiClient from '../ApiClient';
import ActivityInfo from './ActivityInfo';
import DealsCountInfo from './DealsCountInfo';
/**
* The DealsCountAndActivityInfo model module.
* @module model/DealsCountAndActivityInfo
* @version 1.0.0
*/
class DealsCountAndActivityInfo {
/**
* Constructs a new <code>DealsCountAndActivityInfo</code>.
* @alias module:model/DealsCountAndActivityInfo
* @implements module:model/DealsCountInfo
* @implements module:model/ActivityInfo
*/
constructor() {
DealsCountInfo.initialize(this);ActivityInfo.initialize(this);
DealsCountAndActivityInfo.initialize(this);
}
/**
* Initializes the fields of this object.
* This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins).
* Only for internal use.
*/
static initialize(obj) {
}
/**
* Constructs a <code>DealsCountAndActivityInfo</code> from a plain JavaScript object, optionally creating a new instance.
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
* @param {Object} data The plain JavaScript object bearing properties of interest.
* @param {module:model/DealsCountAndActivityInfo} obj Optional instance to populate.
* @return {module:model/DealsCountAndActivityInfo} The populated <code>DealsCountAndActivityInfo</code> instance.
*/
static constructFromObject(data, obj) {
if (data) {
obj = obj || new DealsCountAndActivityInfo();
DealsCountInfo.constructFromObject(data, obj);
ActivityInfo.constructFromObject(data, obj);
if (data.hasOwnProperty('open_deals_count')) {
obj['open_deals_count'] = ApiClient.convertToType(data['open_deals_count'], 'Number');
delete data['open_deals_count'];
}
if (data.hasOwnProperty('related_open_deals_count')) {
obj['related_open_deals_count'] = ApiClient.convertToType(data['related_open_deals_count'], 'Number');
delete data['related_open_deals_count'];
}
if (data.hasOwnProperty('closed_deals_count')) {
obj['closed_deals_count'] = ApiClient.convertToType(data['closed_deals_count'], 'Number');
delete data['closed_deals_count'];
}
if (data.hasOwnProperty('related_closed_deals_count')) {
obj['related_closed_deals_count'] = ApiClient.convertToType(data['related_closed_deals_count'], 'Number');
delete data['related_closed_deals_count'];
}
if (data.hasOwnProperty('won_deals_count')) {
obj['won_deals_count'] = ApiClient.convertToType(data['won_deals_count'], 'Number');
delete data['won_deals_count'];
}
if (data.hasOwnProperty('related_won_deals_count')) {
obj['related_won_deals_count'] = ApiClient.convertToType(data['related_won_deals_count'], 'Number');
delete data['related_won_deals_count'];
}
if (data.hasOwnProperty('lost_deals_count')) {
obj['lost_deals_count'] = ApiClient.convertToType(data['lost_deals_count'], 'Number');
delete data['lost_deals_count'];
}
if (data.hasOwnProperty('related_lost_deals_count')) {
obj['related_lost_deals_count'] = ApiClient.convertToType(data['related_lost_deals_count'], 'Number');
delete data['related_lost_deals_count'];
}
if (data.hasOwnProperty('next_activity_date')) {
obj['next_activity_date'] = ApiClient.convertToType(data['next_activity_date'], 'String');
delete data['next_activity_date'];
}
if (data.hasOwnProperty('next_activity_time')) {
obj['next_activity_time'] = ApiClient.convertToType(data['next_activity_time'], 'String');
delete data['next_activity_time'];
}
if (data.hasOwnProperty('next_activity_id')) {
obj['next_activity_id'] = ApiClient.convertToType(data['next_activity_id'], 'Number');
delete data['next_activity_id'];
}
if (data.hasOwnProperty('last_activity_id')) {
obj['last_activity_id'] = ApiClient.convertToType(data['last_activity_id'], 'Number');
delete data['last_activity_id'];
}
if (data.hasOwnProperty('last_activity_date')) {
obj['last_activity_date'] = ApiClient.convertToType(data['last_activity_date'], 'String');
delete data['last_activity_date'];
}
if (Object.keys(data).length > 0) {
Object.assign(obj, data);
}
}
return obj;
}
}
/**
* The count of open deals related with the item
* @member {Number} open_deals_count
*/
DealsCountAndActivityInfo.prototype['open_deals_count'] = undefined;
/**
* The count of related open deals related with the item
* @member {Number} related_open_deals_count
*/
DealsCountAndActivityInfo.prototype['related_open_deals_count'] = undefined;
/**
* The count of closed deals related with the item
* @member {Number} closed_deals_count
*/
DealsCountAndActivityInfo.prototype['closed_deals_count'] = undefined;
/**
* The count of related closed deals related with the item
* @member {Number} related_closed_deals_count
*/
DealsCountAndActivityInfo.prototype['related_closed_deals_count'] = undefined;
/**
* The count of won deals related with the item
* @member {Number} won_deals_count
*/
DealsCountAndActivityInfo.prototype['won_deals_count'] = undefined;
/**
* The count of related won deals related with the item
* @member {Number} related_won_deals_count
*/
DealsCountAndActivityInfo.prototype['related_won_deals_count'] = undefined;
/**
* The count of lost deals related with the item
* @member {Number} lost_deals_count
*/
DealsCountAndActivityInfo.prototype['lost_deals_count'] = undefined;
/**
* The count of related lost deals related with the item
* @member {Number} related_lost_deals_count
*/
DealsCountAndActivityInfo.prototype['related_lost_deals_count'] = undefined;
/**
* The date of the next activity associated with the deal
* @member {String} next_activity_date
*/
DealsCountAndActivityInfo.prototype['next_activity_date'] = undefined;
/**
* The time of the next activity associated with the deal
* @member {String} next_activity_time
*/
DealsCountAndActivityInfo.prototype['next_activity_time'] = undefined;
/**
* The ID of the next activity associated with the deal
* @member {Number} next_activity_id
*/
DealsCountAndActivityInfo.prototype['next_activity_id'] = undefined;
/**
* The ID of the last activity associated with the deal
* @member {Number} last_activity_id
*/
DealsCountAndActivityInfo.prototype['last_activity_id'] = undefined;
/**
* The date of the last activity associated with the deal
* @member {String} last_activity_date
*/
DealsCountAndActivityInfo.prototype['last_activity_date'] = undefined;
// Implement DealsCountInfo interface:
/**
* The count of open deals related with the item
* @member {Number} open_deals_count
*/
DealsCountInfo.prototype['open_deals_count'] = undefined;
/**
* The count of related open deals related with the item
* @member {Number} related_open_deals_count
*/
DealsCountInfo.prototype['related_open_deals_count'] = undefined;
/**
* The count of closed deals related with the item
* @member {Number} closed_deals_count
*/
DealsCountInfo.prototype['closed_deals_count'] = undefined;
/**
* The count of related closed deals related with the item
* @member {Number} related_closed_deals_count
*/
DealsCountInfo.prototype['related_closed_deals_count'] = undefined;
/**
* The count of won deals related with the item
* @member {Number} won_deals_count
*/
DealsCountInfo.prototype['won_deals_count'] = undefined;
/**
* The count of related won deals related with the item
* @member {Number} related_won_deals_count
*/
DealsCountInfo.prototype['related_won_deals_count'] = undefined;
/**
* The count of lost deals related with the item
* @member {Number} lost_deals_count
*/
DealsCountInfo.prototype['lost_deals_count'] = undefined;
/**
* The count of related lost deals related with the item
* @member {Number} related_lost_deals_count
*/
DealsCountInfo.prototype['related_lost_deals_count'] = undefined;
// Implement ActivityInfo interface:
/**
* The date of the next activity associated with the deal
* @member {String} next_activity_date
*/
ActivityInfo.prototype['next_activity_date'] = undefined;
/**
* The time of the next activity associated with the deal
* @member {String} next_activity_time
*/
ActivityInfo.prototype['next_activity_time'] = undefined;
/**
* The ID of the next activity associated with the deal
* @member {Number} next_activity_id
*/
ActivityInfo.prototype['next_activity_id'] = undefined;
/**
* The ID of the last activity associated with the deal
* @member {Number} last_activity_id
*/
ActivityInfo.prototype['last_activity_id'] = undefined;
/**
* The date of the last activity associated with the deal
* @member {String} last_activity_date
*/
ActivityInfo.prototype['last_activity_date'] = undefined;
export default DealsCountAndActivityInfo;
|
var Promise = require('es6-promise').Promise;
var DelayTask = function(timeMs) {
this.execute = function() {
var promise = new Promise(function(resolve) {
setTimeout(function() {
resolve('Finished sleeping: ' + timeMs + 'ms');
}, timeMs);
});
return promise;
};
};
module.exports = DelayTask;
|
module.exports = function (content) {
return content.replace(/_/g,' ');
}
|
(function() {
"use strict";
var module = angular.module("QMCUtilities");
function doSomething($http) {
return $http.get("./hworld/hworld")
.then(function(result) {
return result.data;
});
}
function getVersion($http) {
return $http.get("./version")
.then(function(result) {
return result.data
});
}
function hWorldController($http) {
var model = this;
model.response = "";
model.$onInit = function() {
model.response = "Argghhhh";
getVersion($http)
.then(function(result) {
model.version = result;
});
}
model.clickMe = function() {
doSomething($http)
.then(function(result) {
model.response = result;
});
};
}
module.component("helloWorld", {
transclude: true,
templateUrl: "plugins/hworld/helloWorld.html",
controllerAs: "model",
controller: ["$http", hWorldController]
});
}()); |
import { BehaviorSubject } from 'rxjs/BehaviorSubject'
import { combineEpics } from 'redux-observable'
import conformsTo from 'lodash/conformsTo'
import isEmpty from 'lodash/isEmpty'
import isFunction from 'lodash/isFunction'
import isObject from 'lodash/isObject'
import isString from 'lodash/isString'
import invariant from 'invariant'
import warning from 'warning'
import createReducer from 'reducers'
/**
* Validate the shape of redux store
*/
export function checkStore(store) {
const shape = {
dispatch: isFunction,
subscribe: isFunction,
getState: isFunction,
replaceReducer: isFunction,
asyncReducers: isObject,
}
invariant(
conformsTo(store, shape),
'(app/utils...) asyncInjectors: Expected a valid redux store'
)
}
/**
* Inject an asynchronously loaded reducer
*/
export function injectAsyncReducer(store, isValid) {
return function injectReducer(name, asyncReducer) {
if (!isValid) checkStore(store)
invariant(
isString(name) && !isEmpty(name) && isFunction(asyncReducer),
'(app/utils...) injectAsyncReducer: Expected `asyncReducer` to be a reducer function'
)
if (Reflect.has(store.asyncReducers, name)) return
store.asyncReducers[name] = asyncReducer // eslint-disable-line no-param-reassign
store.replaceReducer(createReducer(store.asyncReducers))
}
}
/**
* Setup to allow async loading of epics as per
* https://redux-observable.js.org/docs/recipes/AddingNewEpicsAsynchronously.html
*
* Used registerEpic (to avoid double loading) from
* http://stackoverflow.com/questions/40202074/is-it-an-efficient-practice-to-add-new-epics-lazily-inside-react-router-onenter
*/
export const epicRegistry = [] // Epic registry
export const epic$ = new BehaviorSubject(combineEpics(...epicRegistry))
/**
* Inject an asynchronously loaded epic
*/
export function injectAsyncEpics(store, isValid) {
return function injectEpics(epics) {
if (!isValid) checkStore(store)
invariant(
Array.isArray(epics) && epics.map(isFunction).reduce((p, n) => p && n, true),
'(app/utils...) injectAsyncEpics: Expected `epics` to be an array of epic functions'
)
warning(
!isEmpty(epics),
'(app/utils...) injectAsyncEpics: Received an empty `epics` array'
)
epics.forEach(epic => {
// don't add an epic that is already registered/running
if (epicRegistry.indexOf(epic) === -1) {
epicRegistry.push(epic)
epic$.next(epic)
}
})
}
}
/**
* Helper for creating injectors
*/
export function getAsyncInjectors(store) {
checkStore(store)
return {
injectReducer: injectAsyncReducer(store, true),
injectEpics: injectAsyncEpics(store, true),
}
}
|
export { Gesture } from './Gesture.js';
export { gestureManager } from './gestureManager.js';
export { tap } from './tap.js';
export { threeFingerSwipe } from './threeFingerSwipe.js';
export { itemListTouchSelect } from './itemListTouchSelect.js';
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.