text
stringlengths 2
6.14k
|
|---|
goog.provide('ol.source.TileDebug');
goog.require('ol.Tile');
goog.require('ol.TileState');
goog.require('ol.dom');
goog.require('ol.size');
goog.require('ol.source.Tile');
/**
* @constructor
* @extends {ol.Tile}
* @param {ol.TileCoord} tileCoord Tile coordinate.
* @param {ol.Size} tileSize Tile size.
* @param {string} text Text.
* @private
*/
ol.DebugTile_ = function(tileCoord, tileSize, text) {
ol.Tile.call(this, tileCoord, ol.TileState.LOADED);
/**
* @private
* @type {ol.Size}
*/
this.tileSize_ = tileSize;
/**
* @private
* @type {string}
*/
this.text_ = text;
/**
* @private
* @type {Object.<number, HTMLCanvasElement>}
*/
this.canvasByContext_ = {};
};
ol.inherits(ol.DebugTile_, ol.Tile);
/**
* Get the image element for this tile.
* @param {Object=} opt_context Optional context. Only used by the DOM
* renderer.
* @return {HTMLCanvasElement} Image.
*/
ol.DebugTile_.prototype.getImage = function(opt_context) {
var key = opt_context !== undefined ? goog.getUid(opt_context) : -1;
if (key in this.canvasByContext_) {
return this.canvasByContext_[key];
} else {
var tileSize = this.tileSize_;
var context = ol.dom.createCanvasContext2D(tileSize[0], tileSize[1]);
context.strokeStyle = 'black';
context.strokeRect(0.5, 0.5, tileSize[0] + 0.5, tileSize[1] + 0.5);
context.fillStyle = 'black';
context.textAlign = 'center';
context.textBaseline = 'middle';
context.font = '24px sans-serif';
context.fillText(this.text_, tileSize[0] / 2, tileSize[1] / 2);
this.canvasByContext_[key] = context.canvas;
return context.canvas;
}
};
/**
* @classdesc
* A pseudo tile source, which does not fetch tiles from a server, but renders
* a grid outline for the tile grid/projection along with the coordinates for
* each tile. See examples/canvas-tiles for an example.
*
* Uses Canvas context2d, so requires Canvas support.
*
* @constructor
* @extends {ol.source.Tile}
* @param {olx.source.TileDebugOptions} options Debug tile options.
* @api
*/
ol.source.TileDebug = function(options) {
ol.source.Tile.call(this, {
opaque: false,
projection: options.projection,
tileGrid: options.tileGrid,
wrapX: options.wrapX !== undefined ? options.wrapX : true
});
};
ol.inherits(ol.source.TileDebug, ol.source.Tile);
/**
* @inheritDoc
*/
ol.source.TileDebug.prototype.getTile = function(z, x, y) {
var tileCoordKey = this.getKeyZXY(z, x, y);
if (this.tileCache.containsKey(tileCoordKey)) {
return /** @type {!ol.DebugTile_} */ (this.tileCache.get(tileCoordKey));
} else {
var tileSize = ol.size.toSize(this.tileGrid.getTileSize(z));
var tileCoord = [z, x, y];
var textTileCoord = this.getTileCoordForTileUrlFunction(tileCoord);
var text = !textTileCoord ? '' :
this.getTileCoordForTileUrlFunction(textTileCoord).toString();
var tile = new ol.DebugTile_(tileCoord, tileSize, text);
this.tileCache.set(tileCoordKey, tile);
return tile;
}
};
|
'use strict'
const inherits = require('util').inherits
const HookedWalletEthTxSubprovider = require('./hooked-wallet-ethtx.js')
module.exports = WalletSubprovider
inherits(WalletSubprovider, HookedWalletEthTxSubprovider)
function WalletSubprovider (wallet, opts) {
opts.getAccounts = function (cb) {
cb(null, [ wallet.getAddressString() ])
}
opts.getPrivateKey = function (address, cb) {
if (address !== wallet.getAddressString()) {
return cb('Account not found')
}
cb(null, wallet.getPrivateKey())
}
WalletSubprovider.super_.call(this, opts)
}
|
/*
Language: Less
Author: Max Mikhailov <seven.phases.max@gmail.com>
Category: css
*/
function(hljs) {
var IDENT_RE = '[\\w-]+'; // yes, Less identifiers may begin with a digit
var INTERP_IDENT_RE = '(' + IDENT_RE + '|@{' + IDENT_RE + '})';
/* Generic Modes */
var RULES = [], VALUE = []; // forward def. for recursive modes
var STRING_MODE = function(c) { return {
// Less strings are not multiline (also include '~' for more consistent coloring of "escaped" strings)
className: 'string', begin: '~?' + c + '.*?' + c
};};
var IDENT_MODE = function(name, begin, relevance) { return {
className: name, begin: begin, relevance: relevance
};};
var PARENS_MODE = {
// used only to properly balance nested parens inside mixin call, def. arg list
begin: '\\(', end: '\\)', contains: VALUE, relevance: 0
};
// generic Less highlighter (used almost everywhere except selectors):
VALUE.push(
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
STRING_MODE("'"),
STRING_MODE('"'),
hljs.CSS_NUMBER_MODE, // fixme: it does not include dot for numbers like .5em :(
{
begin: '(url|data-uri)\\(',
starts: {className: 'string', end: '[\\)\\n]', excludeEnd: true}
},
IDENT_MODE('number', '#[0-9A-Fa-f]+\\b'),
PARENS_MODE,
IDENT_MODE('variable', '@@?' + IDENT_RE, 10),
IDENT_MODE('variable', '@{' + IDENT_RE + '}'),
IDENT_MODE('built_in', '~?`[^`]*?`'), // inline javascript (or whatever host language) *multiline* string
{ // @media features (it’s here to not duplicate things in AT_RULE_MODE with extra PARENS_MODE overriding):
className: 'attribute', begin: IDENT_RE + '\\s*:', end: ':', returnBegin: true, excludeEnd: true
},
{
className: 'meta',
begin: '!important'
}
);
var VALUE_WITH_RULESETS = VALUE.concat({
begin: '{', end: '}', contains: RULES
});
var MIXIN_GUARD_MODE = {
beginKeywords: 'when', endsWithParent: true,
contains: [{beginKeywords: 'and not'}].concat(VALUE) // using this form to override VALUE’s 'function' match
};
/* Rule-Level Modes */
var RULE_MODE = {
className: 'attribute',
begin: INTERP_IDENT_RE, end: ':', excludeEnd: true,
contains: [hljs.C_LINE_COMMENT_MODE, hljs.C_BLOCK_COMMENT_MODE],
illegal: /\S/,
starts: {end: '[;}]', returnEnd: true, contains: VALUE, illegal: '[<=$]'}
};
var AT_RULE_MODE = {
className: 'keyword',
begin: '@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b',
starts: {end: '[;{}]', returnEnd: true, contains: VALUE, relevance: 0}
};
// variable definitions and calls
var VAR_RULE_MODE = {
className: 'variable',
variants: [
// using more strict pattern for higher relevance to increase chances of Less detection.
// this is *the only* Less specific statement used in most of the sources, so...
// (we’ll still often loose to the css-parser unless there's '//' comment,
// simply because 1 variable just can't beat 99 properties :)
{begin: '@' + IDENT_RE + '\\s*:', relevance: 15},
{begin: '@' + IDENT_RE}
],
starts: {end: '[;}]', returnEnd: true, contains: VALUE_WITH_RULESETS}
};
var SELECTOR_MODE = {
// first parse unambiguous selectors (i.e. those not starting with tag)
// then fall into the scary lookahead-discriminator variant.
// this mode also handles mixin definitions and calls
variants: [{
begin: '[\\.#:&\\[]', end: '[;{}]' // mixin calls end with ';'
}, {
begin: INTERP_IDENT_RE + '[^;]*{',
end: '{'
}],
returnBegin: true,
returnEnd: true,
illegal: '[<=\'$"]',
contains: [
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
MIXIN_GUARD_MODE,
IDENT_MODE('keyword', 'all\\b'),
IDENT_MODE('variable', '@{' + IDENT_RE + '}'), // otherwise it’s identified as tag
IDENT_MODE('selector-tag', INTERP_IDENT_RE + '%?', 0), // '%' for more consistent coloring of @keyframes "tags"
IDENT_MODE('selector-id', '#' + INTERP_IDENT_RE),
IDENT_MODE('selector-class', '\\.' + INTERP_IDENT_RE, 0),
IDENT_MODE('selector-tag', '&', 0),
{className: 'selector-attr', begin: '\\[', end: '\\]'},
{begin: '\\(', end: '\\)', contains: VALUE_WITH_RULESETS}, // argument list of parametric mixins
{begin: '!important'} // eat !important after mixin call or it will be colored as tag
]
};
RULES.push(
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
AT_RULE_MODE,
VAR_RULE_MODE,
SELECTOR_MODE,
RULE_MODE
);
return {
case_insensitive: true,
illegal: '[=>\'/<($"]',
contains: RULES
};
}
|
/**
* uri validator
*
* @link http://formvalidation.io/validators/uri/
* @author https://twitter.com/formvalidation
* @copyright (c) 2013 - 2015 Nguyen Huu Phuoc
* @license http://formvalidation.io/license/
*/
(function($) {
FormValidation.I18n = $.extend(true, FormValidation.I18n || {}, {
'en_US': {
uri: {
'default': 'Please enter a valid URI'
}
}
});
FormValidation.Validator.uri = {
html5Attributes: {
message: 'message',
allowlocal: 'allowLocal',
allowemptyprotocol: 'allowEmptyProtocol',
protocol: 'protocol'
},
enableByHtml5: function($field) {
return ('url' === $field.attr('type'));
},
/**
* Return true if the input value is a valid URL
*
* @param {FormValidation.Base} validator The validator plugin instance
* @param {jQuery} $field Field element
* @param {Object} options
* - message: The error message
* - allowLocal: Allow the private and local network IP. Default to false
* - allowEmptyProtocol: Allow the URI without protocol. Default to false
* - protocol: The protocols, separated by a comma. Default to "http, https, ftp"
* @returns {Boolean}
*/
validate: function(validator, $field, options, validatorName) {
var value = validator.getFieldValue($field, validatorName);
if (value === '') {
return true;
}
// Credit to https://gist.github.com/dperini/729294
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Updated: 2010/12/05
//
// the regular expression composed & commented
// could be easily tweaked for RFC compliance,
// it was expressly modified to fit & satisfy
// these test for an URL shortener:
//
// http://mathiasbynens.be/demo/url-regex
//
// Notes on possible differences from a standard/generic validation:
//
// - utf-8 char class take in consideration the full Unicode range
// - TLDs are mandatory unless `allowLocal` is true
// - protocols have been restricted to ftp, http and https only as requested
//
// Changes:
//
// - IP address dotted notation validation, range: 1.0.0.0 - 223.255.255.255
// first and last IP address of each class is considered invalid
// (since they are broadcast/network addresses)
//
// - Added exclusion of private, reserved and/or local networks ranges
// unless `allowLocal` is true
//
// - Added possibility of choosing a custom protocol
//
// - Add option to validate without protocol
//
var allowLocal = options.allowLocal === true || options.allowLocal === 'true',
allowEmptyProtocol = options.allowEmptyProtocol === true || options.allowEmptyProtocol === 'true',
protocol = (options.protocol || 'http, https, ftp').split(',').join('|').replace(/\s/g, ''),
urlExp = new RegExp(
"^" +
// protocol identifier
"(?:(?:" + protocol + ")://)" +
// allow empty protocol
(allowEmptyProtocol ? '?' : '') +
// user:pass authentication
"(?:\\S+(?::\\S*)?@)?" +
"(?:" +
// IP address exclusion
// private & local networks
(allowLocal
? ''
: ("(?!(?:10|127)(?:\\.\\d{1,3}){3})" +
"(?!(?:169\\.254|192\\.168)(?:\\.\\d{1,3}){2})" +
"(?!172\\.(?:1[6-9]|2\\d|3[0-1])(?:\\.\\d{1,3}){2})")) +
// IP address dotted notation octets
// excludes loopback network 0.0.0.0
// excludes reserved space >= 224.0.0.0
// excludes network & broadcast addresses
// (first & last IP address of each class)
"(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])" +
"(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}" +
"(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))" +
"|" +
// host name
"(?:(?:[a-z\\u00a1-\\uffff0-9]-?)*[a-z\\u00a1-\\uffff0-9]+)" +
// domain name
"(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-?)*[a-z\\u00a1-\\uffff0-9])*" +
// TLD identifier
"(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))" +
// Allow intranet sites (no TLD) if `allowLocal` is true
(allowLocal ? '?' : '') +
")" +
// port number
"(?::\\d{2,5})?" +
// resource path
"(?:/[^\\s]*)?" +
"$", "i"
);
return urlExp.test(value);
}
};
}(jQuery));
|
/*************************************************************
*
* MathJax/jax/output/HTML-CSS/fonts/TeX/SansSerif/Bold/Main.js
*
* Copyright (c) 2009-2016 The MathJax Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
MathJax.OutputJax['HTML-CSS'].FONTDATA.FONTS['MathJax_SansSerif-bold'] = {
directory: 'SansSerif/Bold',
family: 'MathJax_SansSerif',
weight: 'bold',
testString: "MathJax SansSerif ^ _",
Ranges: [
[0x0,0x7F,"BasicLatin"],
[0x80,0xFFFF,"Other"],
[0x300,0x36F,"CombDiacritMarks"]
]
};
MathJax.Callback.Queue(
["initFont",MathJax.OutputJax["HTML-CSS"],"MathJax_SansSerif-bold"],
["loadComplete",MathJax.Ajax,MathJax.OutputJax["HTML-CSS"].fontDir+"/SansSerif/Bold/Main.js"]
);
|
import config from './config/environment'
import Ember from 'ember'
import loadInitializers from 'ember-load-initializers'
import Resolver from './resolver'
const {Application} = Ember
let App
Ember.MODEL_FACTORY_INJECTIONS = true
App = Application.extend({
modulePrefix: config.modulePrefix,
podModulePrefix: config.podModulePrefix,
Resolver
})
loadInitializers(App, config.modulePrefix)
export default App
|
run_spec(__dirname, null, ["typescript"]);
run_spec(__dirname, { trailingComma: "all" }, ["typescript"]);
run_spec(__dirname, { trailingComma: "es5" }, ["typescript"]);
|
require("should");
var PurchaseRequest = require('../../data-util/purchasing/purchase-request-data-util');
var helper = require("../../helper");
var validate = require("dl-models").validator.purchasing.purchaseRequest;
var PurchaseRequestManager = require("../../../src/managers/purchasing/purchase-request-manager");
var purchaseRequestManager = null;
before('#00. connect db', function(done) {
helper.getDb()
.then(db => {
purchaseRequestManager = new PurchaseRequestManager(db, {
username: 'dev'
});
done();
})
.catch(e => {
done(e);
});
});
var purchaseRequest;
it('#01. should success when create new data', function(done) {
PurchaseRequest.getNewTestData()
.then(pr => {
purchaseRequest = pr;
validate(purchaseRequest);
done();
})
.catch(e => {
done(e);
});
});
it('#02. should success when post', function(done) {
purchaseRequestManager.post([purchaseRequest])
.then(purchaseRequests => {
var prId = purchaseRequests[0]._id;
purchaseRequestManager.getSingleById(prId)
.then(pr => {
purchaseRequest = pr;
validate(purchaseRequest);
purchaseRequest.isPosted.should.equal(true, "purchase-request.isPosted should be true after posted");
done();
})
.catch(e => {
done(e);
});
})
.catch(e => {
done(e);
});
});
|
/**
* Copyright 2012 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @fileoverview Definitions of all options for CanvasLayer.
* @author Brendan Kenny
*/
/**
* Options for a CanvasLayer.
*
* @interface
*/
function CanvasLayerOptions() {}
/**
* If true, updateHandler will be called repeatedly, once per frame. If false,
* updateHandler will only be called when a map property changes that could
* require the canvas content to be redrawn.
* @type {boolean}
*/
CanvasLayerOptions.prototype.animate;
/**
* Map on which to overlay the canvas.
* @type {google.maps.Map}
*/
CanvasLayerOptions.prototype.map;
/**
* The name of the MapPane in which this layer will be displayed. See
* {@code google.maps.MapPanes} for the panes available. Default is
* "overlayLayer".
* @type {string}
*/
CanvasLayerOptions.prototype.paneName;
/**
* A function that is called whenever the canvas has been resized to fit the
* map.
* @type {function}
*/
CanvasLayerOptions.prototype.resizeHandler;
/**
* A value for scaling the CanvasLayer resolution relative to the CanvasLayer
* display size. This can be used to save computation by scaling the backing
* buffer down, or to support high DPI devices by scaling it up (by e.g.
* window.devicePixelRatio).
* @type {number}
*/
CanvasLayerOptions.prototype.resolutionScale;
/**
* A function that is called when a repaint of the canvas is required.
* @type {function}
*/
CanvasLayerOptions.prototype.updateHandler;
|
tinyMCE.addI18n('ko.campsiteattachment',{
editor_button: "File Attachment",
select_to_link: "You need to select some text before creating a link to a file"
});
|
import { delegate } from 'rails-ujs';
function handleDeleteStatus(event) {
const [data] = event.detail;
const element = document.querySelector(`[data-id="${data.id}"]`);
if (element) {
element.parentNode.removeChild(element);
}
}
[].forEach.call(document.querySelectorAll('.trash-button'), (content) => {
content.addEventListener('ajax:success', handleDeleteStatus);
});
const batchCheckboxClassName = '.batch-checkbox input[type="checkbox"]';
delegate(document, '#batch_checkbox_all', 'change', ({ target }) => {
[].forEach.call(document.querySelectorAll(batchCheckboxClassName), (content) => {
content.checked = target.checked;
});
});
delegate(document, batchCheckboxClassName, 'change', () => {
const checkAllElement = document.querySelector('#batch_checkbox_all');
if (checkAllElement) {
checkAllElement.checked = [].every.call(document.querySelectorAll(batchCheckboxClassName), (content) => content.checked);
checkAllElement.indeterminate = !checkAllElement.checked && [].some.call(document.querySelectorAll(batchCheckboxClassName), (content) => content.checked);
}
});
delegate(document, '.media-spoiler-show-button', 'click', () => {
[].forEach.call(document.querySelectorAll('button.media-spoiler'), (element) => {
element.click();
});
});
delegate(document, '.media-spoiler-hide-button', 'click', () => {
[].forEach.call(document.querySelectorAll('.spoiler-button.spoiler-button--visible button'), (element) => {
element.click();
});
});
delegate(document, '#domain_block_severity', 'change', ({ target }) => {
const rejectMediaDiv = document.querySelector('.input.with_label.domain_block_reject_media');
if (rejectMediaDiv) {
rejectMediaDiv.style.display = (target.value === 'suspend') ? 'none' : 'block';
}
});
|
var filename = "#empty#";
var content = "#empty#";
for each (field in formdata.fields) {
if (field.name == "file" && field.isFile) {
filename = field.filename;
content = field.content;
}
}
model.filename = filename;
model.content = content;
|
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* The join function is intentionally generic.
* It does not require that its this value be an Array object
*
* @path ch15/15.4/15.4.4/15.4.4.5/S15.4.4.5_A2_T4.js
* @description Operator use ToNumber from length.
* If Type(value) is Object, evaluate ToPrimitive(value, Number)
*/
var obj = {};
obj.join = Array.prototype.join;
//CHECK#1
obj.length = {valueOf: function() {return 3}};
if (obj.join() !== ",,") {
$ERROR('#1: obj.length = {valueOf: function() {return 3}} obj.join() === ",,". Actual: ' + (obj.join()));
}
//CHECK#2
obj.length = {valueOf: function() {return 3}, toString: function() {return 2}};
if (obj.join() !== ",,") {
$ERROR('#2: obj.length = {valueOf: function() {return 3}, toString: function() {return 2}} obj.join() === ",,". Actual: ' + (obj.join()));
}
//CHECK#3
obj.length = {valueOf: function() {return 3}, toString: function() {return {}}};
if (obj.join() !== ",,") {
$ERROR('#3: obj.length = {valueOf: function() {return 3}, toString: function() {return {}}} obj.join() === ",,". Actual: ' + (obj.join()));
}
//CHECK#4
try {
obj.length = {valueOf: function() {return 3}, toString: function() {throw "error"}};
if (obj.join() !== ",,") {
$ERROR('#4.1: obj.length = {valueOf: function() {return 3}, toString: function() {throw "error"}}; obj.join() === ",". Actual: ' + (obj.join()));
}
}
catch (e) {
if (e === "error") {
$ERROR('#4.2: obj.length = {valueOf: function() {return 3}, toString: function() {throw "error"}}; obj.join() not throw "error"');
} else {
$ERROR('#4.3: obj.length = {valueOf: function() {return 3}, toString: function() {throw "error"}}; obj.join() not throw Error. Actual: ' + (e));
}
}
//CHECK#5
obj.length = {toString: function() {return 2}};
if (obj.join() !== ",") {
$ERROR('#5: obj.length = {toString: function() {return 2}} obj.join() === ",". Actual: ' + (obj.join()));
}
//CHECK#6
obj.length = {valueOf: function() {return {}}, toString: function() {return 2}}
if (obj.join() !== ",") {
$ERROR('#6: obj.length = {valueOf: function() {return {}}, toString: function() {return 2}} obj.join() === ",". Actual: ' + (obj.join()));
}
//CHECK#7
try {
obj.length = {valueOf: function() {throw "error"}, toString: function() {return 2}};
obj.join();
$ERROR('#7.1: obj.length = {valueOf: function() {throw "error"}, toString: function() {return 2}}; obj.join() throw "error". Actual: ' + (obj.join()));
}
catch (e) {
if (e !== "error") {
$ERROR('#7.2: obj.length = {valueOf: function() {throw "error"}, toString: function() {return 2}}; obj.join() throw "error". Actual: ' + (e));
}
}
//CHECK#8
try {
obj.length = {valueOf: function() {return {}}, toString: function() {return {}}};
obj.join();
$ERROR('#8.1: obj.length = {valueOf: function() {return {}}, toString: function() {return {}}} obj.join() throw TypeError. Actual: ' + (obj.join()));
}
catch (e) {
if ((e instanceof TypeError) !== true) {
$ERROR('#8,2: obj.length = {valueOf: function() {return {}}, toString: function() {return {}}} obj.join() throw TypeError. Actual: ' + (e));
}
}
|
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* parseInt may interpret only a leading portion of the string as
* a number value; it ignores any characters that cannot be interpreted as part
* of the notation of an decimal literal, and no indication is given that any such
* characters were ignored.
*
* @path ch15/15.1/15.1.2/15.1.2.2/S15.1.2.2_A8.js
* @description Complex test without eval
*/
//CHECK
var errorCount = 0;
var count = 0;
var indexP;
var indexO = 0;
for (var index = 0; index <= 65535; index++) {
if ((index < 0x0030) || (index > 0x0039) &&
(index < 0x0041) || (index > 0x005A) &&
(index < 0x0061) || (index > 0x007A)) {
var hex = decimalToHexString(index);
if (parseInt("1Z" + String.fromCharCode(index), 36) !== 71) {
if (indexO === 0) {
indexO = index;
} else {
if ((index - indexP) !== 1) {
if ((indexP - indexO) !== 0) {
var hexP = decimalToHexString(indexP);
var hexO = decimalToHexString(indexO);
$ERROR('#' + hexO + '-' + hexP + ' ');
}
else {
var hexP = decimalToHexString(indexP);
$ERROR('#' + hexP + ' ');
}
indexO = index;
}
}
indexP = index;
errorCount++;
}
count++;
}
}
if (errorCount > 0) {
if ((indexP - indexO) !== 0) {
var hexP = decimalToHexString(indexP);
var hexO = decimalToHexString(indexO);
$ERROR('#' + hexO + '-' + hexP + ' ');
} else {
var hexP = decimalToHexString(indexP);
$ERROR('#' + hexP + ' ');
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}
|
// This file was procedurally generated from the following sources:
// - src/async-generators/yield-promise-reject-next-for-await-of-sync-iterator.case
// - src/async-generators/default/async-expression.template
/*---
description: yield Promise.reject(value) in for-await-of is treated as throw value (Unnamed async generator expression)
esid: prod-AsyncGeneratorExpression
features: [async-iteration]
flags: [generated, async]
info: |
Async Generator Function Definitions
AsyncGeneratorExpression :
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
AsyncGeneratorBody }
---*/
let error = new Error();
let iterable = [
Promise.reject(error),
"unreachable"
];
var callCount = 0;
var gen = async function *() {
callCount += 1;
for await (let value of iterable) {
yield value;
}
};
var iter = gen();
iter.next().then(() => {
throw new Test262Error("Promise incorrectly resolved.");
}, rejectValue => {
// yield Promise.reject(error);
assert.sameValue(rejectValue, error);
iter.next().then(({done, value}) => {
// iter is closed now.
assert.sameValue(done, true, "The value of IteratorResult.done is `true`");
assert.sameValue(value, undefined, "The value of IteratorResult.value is `undefined`");
}).then($DONE, $DONE);
}).catch($DONE);
assert.sameValue(callCount, 1);
|
import { Observable } from 'rx';
// add rx methods to express
export default function() {
return function expressExtensions(req, res, next) {
// express flash will overwrite render with one that will
// dump flash messages to locals on every call to render
// Use this when that behavior is not wanted
res.renderWithoutFlash = res.render;
// render to observable stream using build in render
res.render$ = Observable.fromNodeCallback(res.render, res);
res.sendFlash = (type, message) => {
if (type && message) {
req.flash(type, message);
}
return res.json(req.flash());
};
next();
};
}
|
/**
* Backbone localStorage Adapter
* Version 1.1.0
*
* https://github.com/jeromegn/Backbone.localStorage
*/
(function (root, factory) {
if (typeof define === "function" && define.amd) {
// AMD. Register as an anonymous module.
define(["underscore","backbone"], function(_, Backbone) {
// Use global variables if the locals are undefined.
return factory(_ || root._, Backbone || root.Backbone);
});
} else {
// RequireJS isn't being used. Assume underscore and backbone are loaded in <script> tags
factory(_, Backbone);
}
}(this, function(_, Backbone) {
// A simple module to replace `Backbone.sync` with *localStorage*-based
// persistence. Models are given GUIDS, and saved into a JSON object. Simple
// as that.
// Hold reference to Underscore.js and Backbone.js in the closure in order
// to make things work even if they are removed from the global namespace
// Generate four random hex digits.
function S4() {
return (((1+Math.random())*0x10000)|0).toString(16).substring(1);
};
// Generate a pseudo-GUID by concatenating random hexadecimal.
function guid() {
return (S4()+S4()+"-"+S4()+"-"+S4()+"-"+S4()+"-"+S4()+S4()+S4());
};
// Our Store is represented by a single JS object in *localStorage*. Create it
// with a meaningful name, like the name you'd give a table.
// window.Store is deprectated, use Backbone.LocalStorage instead
Backbone.LocalStorage = window.Store = function(name) {
this.name = name;
var store = this.localStorage().getItem(this.name);
this.records = (store && store.split(",")) || [];
};
_.extend(Backbone.LocalStorage.prototype, {
// Save the current state of the **Store** to *localStorage*.
save: function() {
this.localStorage().setItem(this.name, this.records.join(","));
},
// Add a model, giving it a (hopefully)-unique GUID, if it doesn't already
// have an id of it's own.
create: function(model) {
if (!model.id) {
model.id = guid();
model.set(model.idAttribute, model.id);
}
this.localStorage().setItem(this.name+"-"+model.id, JSON.stringify(model));
this.records.push(model.id.toString());
this.save();
return this.find(model);
},
// Update a model by replacing its copy in `this.data`.
update: function(model) {
this.localStorage().setItem(this.name+"-"+model.id, JSON.stringify(model));
if (!_.include(this.records, model.id.toString()))
this.records.push(model.id.toString()); this.save();
return this.find(model);
},
// Retrieve a model from `this.data` by id.
find: function(model) {
return this.jsonData(this.localStorage().getItem(this.name+"-"+model.id));
},
// Return the array of all models currently in storage.
findAll: function() {
return _(this.records).chain()
.map(function(id){
return this.jsonData(this.localStorage().getItem(this.name+"-"+id));
}, this)
.compact()
.value();
},
// Delete a model from `this.data`, returning it.
destroy: function(model) {
if (model.isNew())
return false
this.localStorage().removeItem(this.name+"-"+model.id);
this.records = _.reject(this.records, function(id){
return id === model.id.toString();
});
this.save();
return model;
},
localStorage: function() {
return localStorage;
},
// fix for "illegal access" error on Android when JSON.parse is passed null
jsonData: function (data) {
return data && JSON.parse(data);
}
});
// localSync delegate to the model or collection's
// *localStorage* property, which should be an instance of `Store`.
// window.Store.sync and Backbone.localSync is deprectated, use Backbone.LocalStorage.sync instead
Backbone.LocalStorage.sync = window.Store.sync = Backbone.localSync = function(method, model, options) {
var store = model.localStorage || model.collection.localStorage;
var resp, errorMessage, syncDfd = $.Deferred && $.Deferred(); //If $ is having Deferred - use it.
try {
switch (method) {
case "read":
resp = model.id != undefined ? store.find(model) : store.findAll();
break;
case "create":
resp = store.create(model);
break;
case "update":
resp = store.update(model);
break;
case "delete":
resp = store.destroy(model);
break;
}
} catch(error) {
if (error.code === DOMException.QUOTA_EXCEEDED_ERR && window.localStorage.length === 0)
errorMessage = "Private browsing is unsupported";
else
errorMessage = error.message;
}
if (resp) {
model.trigger("sync", model, resp, options);
if (options && options.success)
options.success(resp);
if (syncDfd)
syncDfd.resolve(resp);
} else {
errorMessage = errorMessage ? errorMessage
: "Record Not Found";
if (options && options.error)
options.error(errorMessage);
if (syncDfd)
syncDfd.reject(errorMessage);
}
// add compatibility with $.ajax
// always execute callback for success and error
if (options && options.complete) options.complete(resp);
return syncDfd && syncDfd.promise();
};
Backbone.ajaxSync = Backbone.sync;
Backbone.getSyncMethod = function(model) {
if(model.localStorage || (model.collection && model.collection.localStorage)) {
return Backbone.localSync;
}
return Backbone.ajaxSync;
};
// Override 'Backbone.sync' to default to localSync,
// the original 'Backbone.sync' is still available in 'Backbone.ajaxSync'
Backbone.sync = function(method, model, options) {
return Backbone.getSyncMethod(model).apply(this, [method, model, options]);
};
return Backbone.LocalStorage;
}));
|
var nwmatcher = require("nwmatcher");
function addNwmatcher(document) {
if (!document._nwmatcher) {
document._nwmatcher = nwmatcher({ document: document });
}
return document._nwmatcher;
}
exports.applyQuerySelector = function(doc, dom) {
doc.querySelector = function(selector) {
return addNwmatcher(this).first(selector, this);
};
doc.querySelectorAll = function(selector) {
return new dom.NodeList(addNwmatcher(this).select(selector, this));
};
var _createElement = doc.createElement;
doc.createElement = function() {
var element = _createElement.apply(this, arguments);
element.querySelector = function(selector) {
return addNwmatcher(this.ownerDocument).first(selector, this);
};
element.querySelectorAll = function(selector) {
return new dom.NodeList(addNwmatcher(this.ownerDocument).select(selector, this));
};
element.matchesSelector = function(selector) {
return addNwmatcher(this.ownerDocument).match(this, selector);
};
return element;
};
};
|
(function ($) {
AjaxSolr.CalendarWidget = AjaxSolr.AbstractFacetWidget.extend({
afterRequest: function () {
var self = this;
$(this.target).datepicker('destroy').datepicker({
dateFormat: 'yy-mm-dd',
defaultDate: new Date(1987, 2, 1),
maxDate: $.datepicker.parseDate('yy-mm-dd', this.manager.store.get('facet.date.end').val().substr(0, 10)),
minDate: $.datepicker.parseDate('yy-mm-dd', this.manager.store.get('facet.date.start').val().substr(0, 10)),
nextText: '>',
prevText: '<',
beforeShowDay: function (date) {
var value = $.datepicker.formatDate('yy-mm-dd', date) + 'T00:00:00Z';
var count = self.manager.response.facet_counts.facet_dates[self.field][value];
return [ parseInt(count) > 0, '', count + ' documents found!' ];
},
onSelect: function (dateText, inst) {
if (self.add('[' + dateText + 'T00:00:00Z TO ' + dateText + 'T23:59:59Z]')) {
self.doRequest();
}
}
});
}
});
})(jQuery);
|
/*!
* migrate - Migration
* Copyright (c) 2010 TJ Holowaychuk <tj@vision-media.ca>
* MIT Licensed
*/
/**
* Expose `Migration`.
*/
module.exports = Migration;
function Migration(title, up, down) {
this.title = title;
this.up = up;
this.down = down;
}
|
var utils = require('../utils');
var prism = new (require('../prism'));
class CodeOutput {
constructor() {
this.container = utils.strToEl(
'<div class="code-output">' +
'<pre><code></code></pre>' +
'</div>' +
'');
this._codeEl = this.container.querySelector('code');
}
async setSvg(svgFile) {
this._codeEl.innerHTML = await prism.highlight(svgFile.text);
}
reset() {
this._codeEl.innerHTML = '';
}
}
module.exports = CodeOutput;
|
var five = require("../lib/johnny-five.js");
var board = new five.Board();
board.on("ready", function() {
var motors = new five.Motors([
{ controller: "EVS_EV3", pin: "BAM1" },
{ controller: "EVS_EV3", pin: "BBM1" },
]);
this.wait(2000, function() {
motors.rev();
this.wait(2000, function() {
motors.stop();
});
});
motors.fwd();
});
|
var Iconv = require("iconv").Iconv,
app = require("./app"),
Configurable = require("./configurable");
var iconv = new Iconv("UTF-8", "ASCII//TRANSLIT//IGNORE");
var wsReplacement = "-";
var overrides = {};
function getWhitespaceReplacement() {
// For future improvements
return "-";
}
var Namer = function () {
Configurable.call(this);
};
Namer.prototype = Object.create(Configurable.prototype);
Namer.prototype.wikify = function (str) {
var ret = str;
if (typeof ret != "string" || ret.trim() === "") {
return "";
}
wsReplacement = getWhitespaceReplacement();
var pc = this.getConfig().pages;
// Replace < and > with '' (Gollum replaces it with '-')
ret = ret.replace(/[<>]/g, '');
// Replace / with '+' (Gollum replaces it with '')
ret = ret.replace(/\//g, '+');
if (pc.title.asciiOnly) {
ret = iconv.convert(ret)
.toString()
.replace(/[^a-zA-Z0-9\- _]/g, "");
}
ret = ret.trim();
if (pc.title.lowercase) {
ret = ret.toLowerCase();
}
ret = ret.replace(/\s/g, wsReplacement);
return ret;
};
// Not symmetric by any chance, but still better than nothing
Namer.prototype.unwikify = function (str) {
var ret = str;
if (typeof ret != "string" || ret.trim() === "") {
return "";
}
var pc = this.getConfig().pages;
wsReplacement = getWhitespaceReplacement();
ret = ret.replace(new RegExp(wsReplacement, "g"), " ");
ret = ret.replace(/\+/g, "/");
if (pc.title.lowercase) {
// "something really hot" => "Something Really Hot"
ret = ret.split(/\b/).map(function (v) {
return v.slice(0,1).toUpperCase() + v.slice(1);
}).join("");
}
return ret;
};
module.exports = new Namer();
|
import { wrap as aesKw } from '../runtime/aeskw.js';
import * as ECDH from '../runtime/ecdhes.js';
import { encrypt as pbes2Kw } from '../runtime/pbes2kw.js';
import { encrypt as rsaEs } from '../runtime/rsaes.js';
import { encode as base64url } from '../runtime/base64url.js';
import generateCek, { bitLength as cekLength } from '../lib/cek.js';
import { JOSENotSupported } from '../util/errors.js';
import { exportJWK } from '../key/export.js';
import checkKeyType from './check_key_type.js';
import { wrap as aesGcmKw } from './aesgcmkw.js';
async function encryptKeyManagement(alg, enc, key, providedCek, providedParameters = {}) {
let encryptedKey;
let parameters;
let cek;
checkKeyType(alg, key, 'encrypt');
switch (alg) {
case 'dir': {
cek = key;
break;
}
case 'ECDH-ES':
case 'ECDH-ES+A128KW':
case 'ECDH-ES+A192KW':
case 'ECDH-ES+A256KW': {
if (!ECDH.ecdhAllowed(key)) {
throw new JOSENotSupported('ECDH-ES with the provided key is not allowed or not supported by your javascript runtime');
}
const { apu, apv } = providedParameters;
let { epk: ephemeralKey } = providedParameters;
ephemeralKey || (ephemeralKey = await ECDH.generateEpk(key));
const { x, y, crv, kty } = await exportJWK(ephemeralKey);
const sharedSecret = await ECDH.deriveKey(key, ephemeralKey, alg === 'ECDH-ES' ? enc : alg, parseInt(alg.substr(-5, 3), 10) || cekLength(enc), apu, apv);
parameters = { epk: { x, y, crv, kty } };
if (apu)
parameters.apu = base64url(apu);
if (apv)
parameters.apv = base64url(apv);
if (alg === 'ECDH-ES') {
cek = sharedSecret;
break;
}
cek = providedCek || generateCek(enc);
const kwAlg = alg.substr(-6);
encryptedKey = await aesKw(kwAlg, sharedSecret, cek);
break;
}
case 'RSA1_5':
case 'RSA-OAEP':
case 'RSA-OAEP-256':
case 'RSA-OAEP-384':
case 'RSA-OAEP-512': {
cek = providedCek || generateCek(enc);
encryptedKey = await rsaEs(alg, key, cek);
break;
}
case 'PBES2-HS256+A128KW':
case 'PBES2-HS384+A192KW':
case 'PBES2-HS512+A256KW': {
cek = providedCek || generateCek(enc);
const { p2c, p2s } = providedParameters;
({ encryptedKey, ...parameters } = await pbes2Kw(alg, key, cek, p2c, p2s));
break;
}
case 'A128KW':
case 'A192KW':
case 'A256KW': {
cek = providedCek || generateCek(enc);
encryptedKey = await aesKw(alg, key, cek);
break;
}
case 'A128GCMKW':
case 'A192GCMKW':
case 'A256GCMKW': {
cek = providedCek || generateCek(enc);
const { iv } = providedParameters;
({ encryptedKey, ...parameters } = await aesGcmKw(alg, key, cek, iv));
break;
}
default: {
throw new JOSENotSupported('Invalid or unsupported "alg" (JWE Algorithm) header value');
}
}
return { cek, encryptedKey, parameters };
}
export default encryptKeyManagement;
|
var assert = require("assert");
var {absolute, join} = require("fs");
var strings = require("ringo/utils/strings");
var {separator} = java.io.File;
exports.setup = function(exports, path, repo) {
exports.testGetResource = function() {
var res = repo.getResource("test.txt");
assert.strictEqual(res.name, "test.txt");
assert.isTrue(res.exists());
assert.strictEqual(res.baseName, "test");
// Regardless of OS, when resolving paths inside an archive file the separator is '/'.
var comparePath = /\.zip$|\.jar$/.test(path) ? absolute(path) + "/test.txt" : absolute(join(path, "test.txt"));
assert.strictEqual(res.path, comparePath);
assert.strictEqual(res.content, "hello world!");
};
exports.testGetNestedResource = function() {
var res = repo.getResource("nested/nested.txt");
assert.strictEqual(res.name, "nested.txt");
assert.isTrue(res.exists());
assert.strictEqual(res.baseName, "nested");
// Regardless of OS, when resolving paths inside an archive file the separator is '/'.
var comparePath = /\.zip$|\.jar$/.test(path)
? absolute(path) + "/nested/nested.txt"
: absolute(join(path, "nested", "nested.txt"));
assert.strictEqual(res.path, comparePath);
// Windows uses two bytes for EOL while other OS's use one byte.
var len = /^windows/.test(java.lang.System.getProperty("os.name", "generic").toLowerCase()) ? 2274 : 2240;
// Except when in an archive, then it depends on what OS the archive was created, ugh.
if (/\.zip$|\.jar$/.test(path)) len = 2240;
assert.strictEqual(res.length, len);
assert.strictEqual(res.content.length, len);
assert.isTrue(strings.startsWith(res.content, "Lorem ipsum dolor sit amet"));
assert.isTrue(strings.endsWith(res.content.trim(), "id est laborum."));
};
exports.testNonExistingResource = function() {
var res = repo.getResource("doesNotExist.txt");
assert.isNotNull(res);
assert.isFalse(res.exists());
assert.throws(function() {res.content});
};
exports.testNestedNonExistingResource = function() {
var res = repo.getResource("foo/bar/doesNotExist.txt");
assert.isNotNull(res);
assert.isFalse(res.exists());
assert.throws(function() {res.content});
};
exports.testGetRepositories = function() {
var repos = repo.getRepositories();
assert.strictEqual(repos.length, 1);
assert.strictEqual(repos[0].name, "nested");
}
exports.testGetResources = function() {
var res = repo.getResources();
assert.strictEqual(res.length, 1);
assert.strictEqual(res[0].name, "test.txt");
}
exports.testGetRecursiveResources = function() {
var res = repo.getResources(true);
assert.strictEqual(res.length, 2);
res = res.sort(function(a, b) a.length - b.length);
assert.strictEqual(res[0].name, "test.txt");
assert.strictEqual(res[0].relativePath, "test.txt");
// Regardless of OS, when resolving paths inside an archive file the separator is '/'.
var comparePath = /\.zip$|\.jar$/.test(path) ? absolute(path) + "/test.txt" : absolute(join(path, "test.txt"));
assert.strictEqual(res[0].path, comparePath);
assert.strictEqual(res[1].name, "nested.txt");
assert.strictEqual(res[1].relativePath, "nested/nested.txt");
// Regardless of OS, when resolving paths inside an archive file the separator is '/'.
var comparePath = /\.zip$|\.jar$/.test(path) ? absolute(path) + "/nested/nested.txt" : absolute(join(path, "nested/nested.txt"));
assert.strictEqual(res[1].path, comparePath);
}
exports.testGetNestedResources = function() {
var res = repo.getResources("nested", false);
assert.strictEqual(res.length, 1);
assert.strictEqual(res[0].name, "nested.txt");
assert.strictEqual(res[0].relativePath, "nested/nested.txt");
}
};
|
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/*
* Copyright (c) 2014, Joyent, Inc.
*/
var Backbone = require('backbone');
var View = Backbone.Marionette.ItemView.extend({
template: function() {}
});
module.exports = View;
|
var assert = require('chai').assert;
var traceurSystem = global.System;
var System = require('../third_party/es6-module-loader/index').System;
global.System = traceurSystem;
var Options = global.traceur.util.Options;
System.baseURL = __dirname + '/instantiate/';
var traceurOptions;
suite('instantiate', function() {
beforeEach(function() {
traceurOptions = null;
System.translate = function(load) {
load.metadata.traceurOptions = traceurOptions;
return load.source;
};
});
test('Inheritance', function(done) {
System.import('./inheritance.js').then(function(m) {
assert.instanceOf(m.test, m.Bar);
assert.instanceOf(m.test, m.Foo);
done();
}).catch(done);
});
test('Variable Hoisting', function(done) {
System.import('./hoisting.js').then(function(m) {
assert.equal(m.a, 1);
done();
}).catch(done);
});
test('Circular dependencies', function(done) {
System.import('./circular1.js').then(function(m1) {
System.import('./circular2.js').then(function(m2) {
assert.equal(m2.output, 'test circular 1');
assert.equal(m1.output, 'test circular 2');
done();
}).catch(done);
}).catch(done);
});
test('Circular annotations', function(done) {
traceurOptions = new Options();
traceurOptions.types = true;
traceurOptions.annotations = true;
traceurOptions.validate = true;
System.import('./circular_annotation1.js').then(function(m1) {
System.import('./circular_annotation2.js').then(function(m2) {
assert.instanceOf(m1.BarAnnotation.annotations[0], m2.FooAnnotation);
assert.instanceOf(m2.FooAnnotation.annotations[0], m1.BarAnnotation);
done();
}).catch(done);
}).catch(done);
});
test('Circular parameter annotations', function(done) {
System.import('./circular_annotation1.js').then(function(m1) {
System.import('./circular_annotation2.js').then(function(m2) {
assert.instanceOf(m1.BarAnnotation.parameters[0][0], m2.FooAnnotation);
assert.instanceOf(m2.FooAnnotation.parameters[0][0], m1.BarAnnotation);
done();
}).catch(done);
}).catch(done);
});
test('Circular type annotations', function(done) {
System.import('./circular_annotation1.js').then(function(m1) {
System.import('./circular_annotation2.js').then(function(m2) {
assert.equal(m1.BarAnnotation.parameters[1][0], m2.FooAnnotation);
assert.equal(m2.FooAnnotation.parameters[1][0], m1.BarAnnotation);
done();
}).catch(done);
}).catch(done);
});
test('Re-export', function(done) {
System.import('./reexport1.js').then(function(m) {
assert(m.p, 5);
done();
}).catch(done);
});
test('Re-export bindings', function(done) {
System.import('./reexport-binding.js').then(function(m) {
System.import('./rebinding.js').then(function(m) {
assert.equal(m.p, 4);
done();
}).catch(done);
}).catch(done);
});
test('Shorthand syntax with import', function(done) {
System.import('./shorthand.js').then(function(m) {
done();
}).catch(done);
});
test('Export Reassignments', function(done) {
System.import('./export-reassignment.js').then(function(m) {
assert.equal(m.a, -6);
assert.equal(m.b, 6);
assert.equal(m.c, 'number');
assert.equal(m.d, 4);
assert.equal(m.e, 6);
assert.equal(m.default, 5);
done();
}).catch(done);
});
test('Postfix Operator', function(done) {
System.import('./postfix-operator.js').then(function(m) {
assert.equal(m.a, 5);
assert.equal(m.b, 5);
assert.equal(m.c, 6);
assert.equal(m.d, 5);
done();
}).catch(done);
});
test('Module import', function(done) {
System.import('./module-import.js').then(function(m) {
assert.equal(m.default, -6);
done();
}).catch(done);
});
test('Export Star', function(done) {
System.import('./export-reassignment.js').then(function(ma) {
return System.import('./export-star.js').then(function(mb) {
assert.equal(mb.a, -6);
assert.equal(mb.b, 'localvalue');
ma.reassign(); // updates the a export variable to 10, which should push the change out
assert.equal(mb.a, 10);
assert.equal(mb.b, 'localvalue');
assert.equal(mb.default, undefined);
done();
});
}).catch(done);
});
test('Generator exports', function(done) {
System.import('./generator.js').then(function(m) {
done();
}).catch(done);
});
test('Export default function parsing', function(done) {
System.import('./export-default-fn.js').then(function(m) {
assert.equal(m.test, undefined);
done();
}).catch(done);
});
test('Export default class', function(done) {
System.import('./export-default-class.js').then(function(m) {
var f = new m.default();
assert.equal(f.foo(), 'foo');
done();
}).catch(done);
});
test('Export star as', function(done) {
System.import('./export-star-as.js').then(function(m) {
assert.equal(2, m.a.b);
done();
}).catch(done);
});
test('Export name from', function(done) {
traceurOptions = new Options();
traceurOptions.exportFromExtended = true;
traceurOptions.validate = true;
System.import('./export-forward-default.js').then(function(m) {
assert.equal(42, m.a);
done();
}).catch(done);
});
test('Export destructuring', function(done) {
System.import('./export-destructuring.js').then(function(m) {
assert.equal(1, m.x);
assert.equal(2, m.y);
m.f();
assert.equal(3, m.x);
done();
}).catch(done);
});
});
|
/*
Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'liststyle', 'si', {
armenian: 'Armenian numbering', // MISSING
bulletedTitle: 'Bulleted List Properties', // MISSING
circle: 'Circle', // MISSING
decimal: 'Decimal (1, 2, 3, etc.)', // MISSING
decimalLeadingZero: 'Decimal leading zero (01, 02, 03, etc.)', // MISSING
disc: 'Disc', // MISSING
georgian: 'Georgian numbering (an, ban, gan, etc.)', // MISSING
lowerAlpha: 'Lower Alpha (a, b, c, d, e, etc.)', // MISSING
lowerGreek: 'Lower Greek (alpha, beta, gamma, etc.)', // MISSING
lowerRoman: 'Lower Roman (i, ii, iii, iv, v, etc.)', // MISSING
none: 'කිසිවක්ම නොවේ',
notset: '<යොදා >',
numberedTitle: 'Numbered List Properties', // MISSING
square: 'Square', // MISSING
start: 'Start', // MISSING
type: 'වර්ගය',
upperAlpha: 'Upper Alpha (A, B, C, D, E, etc.)', // MISSING
upperRoman: 'Upper Roman (I, II, III, IV, V, etc.)', // MISSING
validateStartNumber: 'List start number must be a whole number.' // MISSING
} );
|
// tquery.js - https://github.com/jeromeetienne/tquery - MIT License
|
'use strict';
const gulp = require('gulp');
const path = require('path');
const tools = require('urbanjs-tools');
tools.tasks.nsp.register(gulp, 'nsp', {
packageFile: path.join(__dirname, 'package.json')
});
|
define("d3/test/xhr/json-test", ["dojo","dijit","dojox"], function(dojo,dijit,dojox){
var vows = require("vows"),
load = require("../load"),
assert = require("../assert");
var suite = vows.describe("d3.json");
suite.addBatch({
"json": {
topic: load("xhr/json").expression("d3.json").document(),
"on a sample file": {
topic: function(json) {
json("test/data/sample.json", this.callback);
},
"invokes the callback with the loaded JSON": function(json) {
assert.deepEqual(json, [{"Hello":42,"World":"\"fish\""}]);
},
"overrides the mime type to application/json": function(json) {
assert.equal(XMLHttpRequest._last._info.mimeType, "application/json");
}
},
"on a file that does not exist": {
topic: function(json) {
var callback = this.callback;
json("//does/not/exist.json", function(error, json) {
callback(null, {error: error, value: json});
});
},
"invokes the callback with undefined when an error occurs": function(result) {
assert.equal(result.error.status, 404);
assert.isUndefined(result.value);
}
},
"on a file with invalid JSON": {
topic: function(json) {
var callback = this.callback;
json("test/data/sample.tsv", function(error, json) {
callback(null, {error: error, value: json});
});
},
"invokes the callback with undefined when an error occurs": function(result) {
assert.equal(result.error.constructor.name, "SyntaxError");
assert.isUndefined(result.value);
}
}
}
});
suite.export(module);
});
|
function ctype_print(text) {
// discuss at: http://phpjs.org/functions/ctype_print/
// original by: Brett Zamir (http://brett-zamir.me)
// depends on: setlocale
// example 1: ctype_print('AbC!#12');
// returns 1: true
if (typeof text !== 'string') {
return false;
}
// BEGIN REDUNDANT
this.setlocale('LC_ALL', 0); // ensure setup of localization variables takes place
// END REDUNDANT
return text.search(this.php_js.locales[this.php_js.localeCategories.LC_CTYPE].LC_CTYPE.pr) !== -1;
}
|
var Vec3 = require('../math/Vec3');
module.exports = Spring;
/**
* A spring, connecting two bodies.
*
* @class Spring
* @constructor
* @param {Body} bodyA
* @param {Body} bodyB
* @param {Object} [options]
* @param {number} [options.restLength] A number > 0. Default: 1
* @param {number} [options.stiffness] A number >= 0. Default: 100
* @param {number} [options.damping] A number >= 0. Default: 1
* @param {Vec3} [options.worldAnchorA] Where to hook the spring to body A, in world coordinates.
* @param {Vec3} [options.worldAnchorB]
* @param {Vec3} [options.localAnchorA] Where to hook the spring to body A, in local body coordinates.
* @param {Vec3} [options.localAnchorB]
*/
function Spring(bodyA,bodyB,options){
options = options || {};
/**
* Rest length of the spring.
* @property restLength
* @type {number}
*/
this.restLength = typeof(options.restLength) === "number" ? options.restLength : 1;
/**
* Stiffness of the spring.
* @property stiffness
* @type {number}
*/
this.stiffness = options.stiffness || 100;
/**
* Damping of the spring.
* @property damping
* @type {number}
*/
this.damping = options.damping || 1;
/**
* First connected body.
* @property bodyA
* @type {Body}
*/
this.bodyA = bodyA;
/**
* Second connected body.
* @property bodyB
* @type {Body}
*/
this.bodyB = bodyB;
/**
* Anchor for bodyA in local bodyA coordinates.
* @property localAnchorA
* @type {Vec3}
*/
this.localAnchorA = new Vec3();
/**
* Anchor for bodyB in local bodyB coordinates.
* @property localAnchorB
* @type {Vec3}
*/
this.localAnchorB = new Vec3();
if(options.localAnchorA){
this.localAnchorA.copy(options.localAnchorA);
}
if(options.localAnchorB){
this.localAnchorB.copy(options.localAnchorB);
}
if(options.worldAnchorA){
this.setWorldAnchorA(options.worldAnchorA);
}
if(options.worldAnchorB){
this.setWorldAnchorB(options.worldAnchorB);
}
}
/**
* Set the anchor point on body A, using world coordinates.
* @method setWorldAnchorA
* @param {Vec3} worldAnchorA
*/
Spring.prototype.setWorldAnchorA = function(worldAnchorA){
this.bodyA.pointToLocalFrame(worldAnchorA,this.localAnchorA);
};
/**
* Set the anchor point on body B, using world coordinates.
* @method setWorldAnchorB
* @param {Vec3} worldAnchorB
*/
Spring.prototype.setWorldAnchorB = function(worldAnchorB){
this.bodyB.pointToLocalFrame(worldAnchorB,this.localAnchorB);
};
/**
* Get the anchor point on body A, in world coordinates.
* @method getWorldAnchorA
* @param {Vec3} result The vector to store the result in.
*/
Spring.prototype.getWorldAnchorA = function(result){
this.bodyA.pointToWorldFrame(this.localAnchorA,result);
};
/**
* Get the anchor point on body B, in world coordinates.
* @method getWorldAnchorB
* @param {Vec3} result The vector to store the result in.
*/
Spring.prototype.getWorldAnchorB = function(result){
this.bodyB.pointToWorldFrame(this.localAnchorB,result);
};
var applyForce_r = new Vec3(),
applyForce_r_unit = new Vec3(),
applyForce_u = new Vec3(),
applyForce_f = new Vec3(),
applyForce_worldAnchorA = new Vec3(),
applyForce_worldAnchorB = new Vec3(),
applyForce_ri = new Vec3(),
applyForce_rj = new Vec3(),
applyForce_ri_x_f = new Vec3(),
applyForce_rj_x_f = new Vec3(),
applyForce_tmp = new Vec3();
/**
* Apply the spring force to the connected bodies.
* @method applyForce
*/
Spring.prototype.applyForce = function(){
var k = this.stiffness,
d = this.damping,
l = this.restLength,
bodyA = this.bodyA,
bodyB = this.bodyB,
r = applyForce_r,
r_unit = applyForce_r_unit,
u = applyForce_u,
f = applyForce_f,
tmp = applyForce_tmp;
var worldAnchorA = applyForce_worldAnchorA,
worldAnchorB = applyForce_worldAnchorB,
ri = applyForce_ri,
rj = applyForce_rj,
ri_x_f = applyForce_ri_x_f,
rj_x_f = applyForce_rj_x_f;
// Get world anchors
this.getWorldAnchorA(worldAnchorA);
this.getWorldAnchorB(worldAnchorB);
// Get offset points
worldAnchorA.vsub(bodyA.position,ri);
worldAnchorB.vsub(bodyB.position,rj);
// Compute distance vector between world anchor points
worldAnchorB.vsub(worldAnchorA,r);
var rlen = r.norm();
r_unit.copy(r);
r_unit.normalize();
// Compute relative velocity of the anchor points, u
bodyB.velocity.vsub(bodyA.velocity,u);
// Add rotational velocity
bodyB.angularVelocity.cross(rj,tmp);
u.vadd(tmp,u);
bodyA.angularVelocity.cross(ri,tmp);
u.vsub(tmp,u);
// F = - k * ( x - L ) - D * ( u )
r_unit.mult(-k*(rlen-l) - d*u.dot(r_unit), f);
// Add forces to bodies
bodyA.force.vsub(f,bodyA.force);
bodyB.force.vadd(f,bodyB.force);
// Angular force
ri.cross(f,ri_x_f);
rj.cross(f,rj_x_f);
bodyA.torque.vsub(ri_x_f,bodyA.torque);
bodyB.torque.vadd(rj_x_f,bodyB.torque);
};
|
var parent = require('../../../stable/string/virtual/fontsize');
module.exports = parent;
|
'use strict';
const path = require('path');
const WIN_SLASH = '\\\\/';
const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
/**
* Posix glob regex
*/
const DOT_LITERAL = '\\.';
const PLUS_LITERAL = '\\+';
const QMARK_LITERAL = '\\?';
const SLASH_LITERAL = '\\/';
const ONE_CHAR = '(?=.)';
const QMARK = '[^/]';
const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
const START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
const NO_DOT = `(?!${DOT_LITERAL})`;
const NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
const NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
const NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
const QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
const STAR = `${QMARK}*?`;
const POSIX_CHARS = {
DOT_LITERAL,
PLUS_LITERAL,
QMARK_LITERAL,
SLASH_LITERAL,
ONE_CHAR,
QMARK,
END_ANCHOR,
DOTS_SLASH,
NO_DOT,
NO_DOTS,
NO_DOT_SLASH,
NO_DOTS_SLASH,
QMARK_NO_DOT,
STAR,
START_ANCHOR
};
/**
* Windows glob regex
*/
const WINDOWS_CHARS = {
...POSIX_CHARS,
SLASH_LITERAL: `[${WIN_SLASH}]`,
QMARK: WIN_NO_SLASH,
STAR: `${WIN_NO_SLASH}*?`,
DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
NO_DOT: `(?!${DOT_LITERAL})`,
NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
END_ANCHOR: `(?:[${WIN_SLASH}]|$)`
};
/**
* POSIX Bracket Regex
*/
const POSIX_REGEX_SOURCE = {
alnum: 'a-zA-Z0-9',
alpha: 'a-zA-Z',
ascii: '\\x00-\\x7F',
blank: ' \\t',
cntrl: '\\x00-\\x1F\\x7F',
digit: '0-9',
graph: '\\x21-\\x7E',
lower: 'a-z',
print: '\\x20-\\x7E ',
punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~',
space: ' \\t\\r\\n\\v\\f',
upper: 'A-Z',
word: 'A-Za-z0-9_',
xdigit: 'A-Fa-f0-9'
};
module.exports = {
MAX_LENGTH: 1024 * 64,
POSIX_REGEX_SOURCE,
// regular expressions
REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
REGEX_NON_SPECIAL_CHAR: /^[^@![\].,$*+?^{}()|\\/]+/,
REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
// Replace globs with equivalent patterns to reduce parsing time.
REPLACEMENTS: {
'***': '*',
'**/**': '**',
'**/**/**': '**'
},
// Digits
CHAR_0: 48, /* 0 */
CHAR_9: 57, /* 9 */
// Alphabet chars.
CHAR_UPPERCASE_A: 65, /* A */
CHAR_LOWERCASE_A: 97, /* a */
CHAR_UPPERCASE_Z: 90, /* Z */
CHAR_LOWERCASE_Z: 122, /* z */
CHAR_LEFT_PARENTHESES: 40, /* ( */
CHAR_RIGHT_PARENTHESES: 41, /* ) */
CHAR_ASTERISK: 42, /* * */
// Non-alphabetic chars.
CHAR_AMPERSAND: 38, /* & */
CHAR_AT: 64, /* @ */
CHAR_BACKWARD_SLASH: 92, /* \ */
CHAR_CARRIAGE_RETURN: 13, /* \r */
CHAR_CIRCUMFLEX_ACCENT: 94, /* ^ */
CHAR_COLON: 58, /* : */
CHAR_COMMA: 44, /* , */
CHAR_DOT: 46, /* . */
CHAR_DOUBLE_QUOTE: 34, /* " */
CHAR_EQUAL: 61, /* = */
CHAR_EXCLAMATION_MARK: 33, /* ! */
CHAR_FORM_FEED: 12, /* \f */
CHAR_FORWARD_SLASH: 47, /* / */
CHAR_GRAVE_ACCENT: 96, /* ` */
CHAR_HASH: 35, /* # */
CHAR_HYPHEN_MINUS: 45, /* - */
CHAR_LEFT_ANGLE_BRACKET: 60, /* < */
CHAR_LEFT_CURLY_BRACE: 123, /* { */
CHAR_LEFT_SQUARE_BRACKET: 91, /* [ */
CHAR_LINE_FEED: 10, /* \n */
CHAR_NO_BREAK_SPACE: 160, /* \u00A0 */
CHAR_PERCENT: 37, /* % */
CHAR_PLUS: 43, /* + */
CHAR_QUESTION_MARK: 63, /* ? */
CHAR_RIGHT_ANGLE_BRACKET: 62, /* > */
CHAR_RIGHT_CURLY_BRACE: 125, /* } */
CHAR_RIGHT_SQUARE_BRACKET: 93, /* ] */
CHAR_SEMICOLON: 59, /* ; */
CHAR_SINGLE_QUOTE: 39, /* ' */
CHAR_SPACE: 32, /* */
CHAR_TAB: 9, /* \t */
CHAR_UNDERSCORE: 95, /* _ */
CHAR_VERTICAL_LINE: 124, /* | */
CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, /* \uFEFF */
SEP: path.sep,
/**
* Create EXTGLOB_CHARS
*/
extglobChars(chars) {
return {
'!': { type: 'negate', open: '(?:(?!(?:', close: `))${chars.STAR})` },
'?': { type: 'qmark', open: '(?:', close: ')?' },
'+': { type: 'plus', open: '(?:', close: ')+' },
'*': { type: 'star', open: '(?:', close: ')*' },
'@': { type: 'at', open: '(?:', close: ')' }
};
},
/**
* Create GLOB_CHARS
*/
globChars(win32) {
return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
}
};
|
sap.ui.require([
'sap/ui/test/Opa5',
'sap/ui/test/matchers/AggregationLengthEquals',
'sap/ui/test/matchers/PropertyStrictEquals',
'sap/ui/demo/bulletinboard/test/integration/pages/Common',
'sap/ui/test/actions/Press'
],
function (Opa5,
AggregationLengthEquals,
PropertyStrictEquals,
Common,
Press) {
"use strict";
var sViewName = "Worklist",
sTableId = "table";
Opa5.createPageObjects({
onTheWorklistPage: {
baseClass: Common,
actions: {
iPressOnMoreData: function () {
// Press action hits the "more" trigger on a table
return this.waitFor({
id: sTableId,
viewName: sViewName,
actions: new Press(),
errorMessage: "The Table does not have a trigger"
});
}
},
assertions: {
theTableShouldHavePagination: function () {
return this.waitFor({
id: sTableId,
viewName: sViewName,
matchers: new AggregationLengthEquals({
name: "items",
length: 20
}),
success: function () {
Opa5.assert.ok(true, "The table has 20 items on the first page");
},
errorMessage: "Table does not have all entries."
});
},
theTableShouldHaveAllEntries: function () {
return this.waitFor({
id: sTableId,
viewName: sViewName,
matchers: new AggregationLengthEquals({
name: "items",
length: 23
}),
success: function () {
Opa5.assert.ok(true, "The table has 23 items");
},
errorMessage: "Table does not have all entries."
});
},
theTitleShouldDisplayTheTotalAmountOfItems: function () {
return this.waitFor({
id: "tableHeader",
viewName: sViewName,
matchers: function (oPage) {
var sExpectedText = oPage.getModel("i18n").getResourceBundle().getText("worklistTableTitleCount", [23]);
return new PropertyStrictEquals({
name: "text",
value: sExpectedText
}).isMatching(oPage);
},
success: function () {
Opa5.assert.ok(true, "The table header has 23 items");
},
errorMessage: "The Table's header does not container the number of items: 23"
});
}
}
}
});
});
|
//// [varianceRepeatedlyPropegatesWithUnreliableFlag.ts]
type A = { a: number };
type B = { b: number };
type X<T> = ({ [K in keyof T]: T[K] } & Record<string, void>)[keyof T];
type P1<T> = { data: X<T> };
type P2<T> = { data: X<T> };
interface I<T> {
fn<K extends keyof T>(p1: P1<Pick<T, K>>, p2: P2<Pick<T, K>>): void;
}
const i: I<A & B> = null as any;
const p2: P2<A> = null as any;
// Commenting out the below line will remove the error on the `const _i: I<A> = i;`
i.fn(null as any, p2);
const _i: I<A> = i;
//// [varianceRepeatedlyPropegatesWithUnreliableFlag.js]
var i = null;
var p2 = null;
// Commenting out the below line will remove the error on the `const _i: I<A> = i;`
i.fn(null, p2);
var _i = i;
|
/**
* SVG grunt task for CartoDB.js
*
*/
module.exports = {
task: function() {
return {
dist: {
files: [{
expand: true,
cwd: '<%= config.dist %>/<%= config.app %>',
src: '**/*.svg',
dest: '<%= config.dist %>/<%= config.app %>'
}]
}
}
}
}
|
version https://git-lfs.github.com/spec/v1
oid sha256:85c6e80fe290ea76de8396f8607df1301a71e2089a71a99fc90bfd9b7b159546
size 16638
|
/**
* https://github.com/mrdoob/eventdispatcher.js/
*/
THREE.EventDispatcher = function () {};
Object.assign( THREE.EventDispatcher.prototype, {
addEventListener: function ( type, listener ) {
if ( this._listeners === undefined ) this._listeners = {};
var listeners = this._listeners;
if ( listeners[ type ] === undefined ) {
listeners[ type ] = [];
}
if ( listeners[ type ].indexOf( listener ) === - 1 ) {
listeners[ type ].push( listener );
}
},
hasEventListener: function ( type, listener ) {
if ( this._listeners === undefined ) return false;
var listeners = this._listeners;
if ( listeners[ type ] !== undefined && listeners[ type ].indexOf( listener ) !== - 1 ) {
return true;
}
return false;
},
removeEventListener: function ( type, listener ) {
if ( this._listeners === undefined ) return;
var listeners = this._listeners;
var listenerArray = listeners[ type ];
if ( listenerArray !== undefined ) {
var index = listenerArray.indexOf( listener );
if ( index !== - 1 ) {
listenerArray.splice( index, 1 );
}
}
},
dispatchEvent: function ( event ) {
if ( this._listeners === undefined ) return;
var listeners = this._listeners;
var listenerArray = listeners[ event.type ];
if ( listenerArray !== undefined ) {
event.target = this;
var array = [], i = 0;
var length = listenerArray.length;
for ( i = 0; i < length; i ++ ) {
array[ i ] = listenerArray[ i ];
}
for ( i = 0; i < length; i ++ ) {
array[ i ].call( this, event );
}
}
}
} );
|
/*
Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'format', 'sl', {
label: 'Oblika',
panelTitle: 'Oblika',
tag_address: 'Napis',
tag_div: 'Navaden (DIV)',
tag_h1: 'Naslov 1',
tag_h2: 'Naslov 2',
tag_h3: 'Naslov 3',
tag_h4: 'Naslov 4',
tag_h5: 'Naslov 5',
tag_h6: 'Naslov 6',
tag_p: 'Navaden',
tag_pre: 'Oblikovan'
});
|
// Copyright 2010 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @fileoverview Event Types.
*
* @author arv@google.com (Erik Arvidsson)
* @author mirkov@google.com (Mirko Visontai)
*/
goog.provide('goog.events.EventType');
goog.require('goog.userAgent');
/**
* Constants for event names.
* @enum {string}
*/
goog.events.EventType = {
// Mouse events
CLICK: 'click',
DBLCLICK: 'dblclick',
MOUSEDOWN: 'mousedown',
MOUSEUP: 'mouseup',
MOUSEOVER: 'mouseover',
MOUSEOUT: 'mouseout',
MOUSEMOVE: 'mousemove',
SELECTSTART: 'selectstart', // IE, Safari, Chrome
// Key events
KEYPRESS: 'keypress',
KEYDOWN: 'keydown',
KEYUP: 'keyup',
// Focus
BLUR: 'blur',
FOCUS: 'focus',
DEACTIVATE: 'deactivate', // IE only
// NOTE: The following two events are not stable in cross-browser usage.
// WebKit and Opera implement DOMFocusIn/Out.
// IE implements focusin/out.
// Gecko implements neither see bug at
// https://bugzilla.mozilla.org/show_bug.cgi?id=396927.
// The DOM Events Level 3 Draft deprecates DOMFocusIn in favor of focusin:
// http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html
// You can use FOCUS in Capture phase until implementations converge.
FOCUSIN: goog.userAgent.IE ? 'focusin' : 'DOMFocusIn',
FOCUSOUT: goog.userAgent.IE ? 'focusout' : 'DOMFocusOut',
// Forms
CHANGE: 'change',
SELECT: 'select',
SUBMIT: 'submit',
INPUT: 'input',
PROPERTYCHANGE: 'propertychange', // IE only
// Drag and drop
DRAGSTART: 'dragstart',
DRAG: 'drag',
DRAGENTER: 'dragenter',
DRAGOVER: 'dragover',
DRAGLEAVE: 'dragleave',
DROP: 'drop',
DRAGEND: 'dragend',
// WebKit touch events.
TOUCHSTART: 'touchstart',
TOUCHMOVE: 'touchmove',
TOUCHEND: 'touchend',
TOUCHCANCEL: 'touchcancel',
// Misc
BEFOREUNLOAD: 'beforeunload',
CONTEXTMENU: 'contextmenu',
ERROR: 'error',
HELP: 'help',
LOAD: 'load',
LOSECAPTURE: 'losecapture',
READYSTATECHANGE: 'readystatechange',
RESIZE: 'resize',
SCROLL: 'scroll',
UNLOAD: 'unload',
// HTML 5 History events
// See http://www.w3.org/TR/html5/history.html#event-definitions
HASHCHANGE: 'hashchange',
PAGEHIDE: 'pagehide',
PAGESHOW: 'pageshow',
POPSTATE: 'popstate',
// Copy and Paste
// Support is limited. Make sure it works on your favorite browser
// before using.
// http://www.quirksmode.org/dom/events/cutcopypaste.html
COPY: 'copy',
PASTE: 'paste',
CUT: 'cut',
BEFORECOPY: 'beforecopy',
BEFORECUT: 'beforecut',
BEFOREPASTE: 'beforepaste',
// HTML5 online/offline events.
// http://www.w3.org/TR/offline-webapps/#related
ONLINE: 'online',
OFFLINE: 'offline',
// HTML 5 worker events
MESSAGE: 'message',
CONNECT: 'connect',
// CSS transition events. Based on the browser support described at:
// https://developer.mozilla.org/en/css/css_transitions#Browser_compatibility
TRANSITIONEND: goog.userAgent.WEBKIT ? 'webkitTransitionEnd' :
(goog.userAgent.OPERA ? 'oTransitionEnd' : 'transitionend'),
// IE specific events.
// See http://msdn.microsoft.com/en-us/library/ie/hh673557(v=vs.85).aspx
MSGESTURECHANGE: 'MSGestureChange',
MSGESTUREEND: 'MSGestureEnd',
MSGESTUREHOLD: 'MSGestureHold',
MSGESTURESTART: 'MSGestureStart',
MSGESTURETAP: 'MSGestureTap',
MSGOTPOINTERCAPTURE: 'MSGotPointerCapture',
MSINERTIASTART: 'MSInertiaStart',
MSLOSTPOINTERCAPTURE: 'MSLostPointerCapture',
MSPOINTERCANCEL: 'MSPointerCancel',
MSPOINTERDOWN: 'MSPointerDown',
MSPOINTERMOVE: 'MSPointerMove',
MSPOINTEROVER: 'MSPointerOver',
MSPOINTEROUT: 'MSPointerOut',
MSPOINTERUP: 'MSPointerUp'
};
|
var recast = require("../main");
var n = recast.types.namedTypes;
var b = recast.types.builders;
var fromString = require("../lib/lines").fromString;
var util = require("../lib/util");
var annotated = [
"function dup(/* string */ s,",
" /* int */ n) /* string */",
"{",
" // Use an array full of holes.",
" return Array(n + /*",
" * off-by-*/ 1).join(s);",
"}"
];
exports.testComments = function(t, assert) {
var code = annotated.join("\n");
var ast = recast.parse(code);
var dup = ast.program.body[0];
n.FunctionDeclaration.assert(dup);
assert.strictEqual(dup.id.name, "dup");
// More of a basic sanity test than a comment test.
assert.strictEqual(recast.print(ast).code, code);
assert.strictEqual(recast.print(ast.program).code, code);
assert.strictEqual(recast.print(dup).code, code);
assert.strictEqual(
recast.print(dup.params[0]).code,
"/* string */ s"
);
assert.strictEqual(
recast.print(dup.params[1]).code,
"/* int */ n"
);
assert.strictEqual(
recast.print(dup.body).code,
["/* string */"].concat(annotated.slice(2)).join("\n")
);
var retStmt = dup.body.body[0];
n.ReturnStatement.assert(retStmt);
var indented = annotated.slice(3, 6).join("\n");
var flush = fromString(indented).indent(-2);
assert.strictEqual(
recast.print(retStmt).code,
flush.toString()
);
var join = retStmt.argument;
n.CallExpression.assert(join);
var one = join.callee.object.arguments[0].right;
n.Literal.assert(one);
assert.strictEqual(one.value, 1);
assert.strictEqual(recast.print(one).code, [
"/*",
" * off-by-*/ 1"
].join("\n"));
t.finish();
};
var trailing = [
"Foo.prototype = {",
"// Copyright (c) 2013 Ben Newman <bn@cs.stanford.edu>",
"",
" /**",
" * Leading comment.",
" */",
" constructor: Foo, // Important for instanceof",
" // to work in all browsers.",
' bar: "baz", // Just in case we need it.',
" qux: { // Here is an object literal.",
" zxcv: 42",
" // Put more properties here when you think of them.",
" } // There was an object literal...",
" // ... and here I am continuing this comment.",
"",
"};"
];
var trailingExpected = [
"Foo.prototype = {",
" // Copyright (c) 2013 Ben Newman <bn@cs.stanford.edu>",
"",
" /**",
" * Leading comment.",
" */",
" // Important for instanceof",
" // to work in all browsers.",
" constructor: Foo,",
"",
" // Just in case we need it.",
' bar: "baz",',
"",
" // There was an object literal...",
" // ... and here I am continuing this comment.",
" qux: // Here is an object literal.",
" {",
" // Put more properties here when you think of them.",
" zxcv: 42,",
"",
" asdf: 43",
" },",
"",
' extra: "property"',
"};"
];
exports.testTrailingComments = function(t, assert) {
var code = trailing.join("\n");
var ast = recast.parse(code);
assert.strictEqual(recast.print(ast).code, code);
// Drop all original source information to force reprinting.
require("ast-types").traverse(ast, function(node) {
node.original = null;
});
var assign = ast.program.body[0].expression;
n.AssignmentExpression.assert(assign);
var props = assign.right.properties;
n.Property.arrayOf().assert(props);
props.push(b.property(
"init",
b.identifier("extra"),
b.literal("property")
));
var quxVal = props[2].value;
n.ObjectExpression.assert(quxVal);
quxVal.properties.push(b.property(
"init",
b.identifier("asdf"),
b.literal(43)
));
var actual = recast.print(ast, { tabWidth: 2 }).code;
var expected = trailingExpected.join("\n");
// Check semantic equivalence:
util.assertEquivalent(ast, recast.parse(actual));
assert.strictEqual(actual, expected);
t.finish();
};
var paramTrailing = [
"function foo(bar, baz /* = null */) {",
" assert.strictEqual(baz, null);",
"}"
];
var paramTrailingExpected = [
"function foo(zxcv, bar, baz /* = null */) {",
" assert.strictEqual(baz, null);",
"}"
];
exports.testParamTrailingComments = function(t, assert) {
var code = paramTrailing.join("\n");
var ast = recast.parse(code);
var func = ast.program.body[0];
n.FunctionDeclaration.assert(func);
func.params.unshift(b.identifier("zxcv"));
var actual = recast.print(ast, { tabWidth: 2 }).code;
var expected = paramTrailingExpected.join("\n");
assert.strictEqual(actual, expected);
t.finish();
};
var protoAssign = [
"A.prototype.foo = function() {",
" return this.bar();",
"}", // Lack of semicolon screws up location info.
"",
"// Comment about the bar method.",
"A.prototype.bar = function() {",
" return this.foo();",
"}"
];
exports.testProtoAssignComment = function(t, assert) {
var code = protoAssign.join("\n");
var ast = recast.parse(code);
var foo = ast.program.body[0];
var bar = ast.program.body[1];
n.ExpressionStatement.assert(foo);
n.ExpressionStatement.assert(bar);
assert.strictEqual(foo.expression.left.property.name, "foo");
assert.strictEqual(bar.expression.left.property.name, "bar");
assert.ok(!foo.comments);
assert.ok(bar.comments);
assert.strictEqual(bar.comments.length, 1);
assert.strictEqual(
bar.comments[0].value,
" Comment about the bar method."
);
t.finish();
};
|
var React = require('react');
var ProfileComponent = require('../components/ProfileComponent');
var RawJSONComponent = require('../components/RawJSONComponent');
var ConfigComponent = React.createClass({
displayName: "ConfigComponent",
render: function () {
// get all the profile names from the config
var profileNames = [];
for(var key in this.props.config.profiles) {
if (this.props.config.profiles.hasOwnProperty(key)) {
profileNames.push(key);
}
}
var html = [];
for( var ii=0; ii<profileNames.length; ii++) {
var name = profileNames[ii];
html.push( <ProfileComponent key={name} name={name} profile={this.props.config.profiles[name]} /> );
html.push( <hr key={'hr_'+name} />);
}
return(
<div>
{html}
<h3>Raw Json</h3>
<RawJSONComponent json={this.props.config} />
</div>
)}
});
module.exports = ConfigComponent;
|
/*
YUI 3.17.2 (build 9c3c78e)
Copyright 2014 Yahoo! Inc. All rights reserved.
Licensed under the BSD License.
http://yuilibrary.com/license/
*/
YUI.add("series-spline",function(e,t){e.SplineSeries=e.Base.create("splineSeries",e.LineSeries,[e.CurveUtil,e.Lines],{drawSeries:function(){this.drawSpline()}},{ATTRS:{type:{value:"spline"}}})},"3.17.2",{requires:["series-line","series-curve-util"]});
|
require('./harness').run();
var recvCount = 0;
var body = "hello world";
connection.addListener('ready', function () {
puts("connected to " + connection.serverProperties.product);
var q = connection.queue('node-default-exchange', function() {
q.bind("#"); // bind to queue
q.on('queueBindOk', function() { // wait until queue is bound
q.on('basicConsumeOk', function () { // wait until consumer is registered
puts("publishing 2 msg messages");
connection.publish('message.msg1', {two:2, one:1});
connection.publish('message.msg2', {foo:'bar', hello: 'world'});
setTimeout(function () {
// wait one second to receive the message, then quit
connection.end();
}, 1000);
});
q.subscribe({ routingKeyInPayload: true },
function (msg) { // register consumer
recvCount++;
switch (msg._routingKey) {
case 'message.msg1':
assert.equal(1, msg.one);
assert.equal(2, msg.two);
break;
case 'message.msg2':
assert.equal('world', msg.hello);
assert.equal('bar', msg.foo);
break;
default:
throw new Error('unexpected routing key: ' + msg._routingKey);
}
})
});
});
});
process.addListener('exit', function () {
assert.equal(2, recvCount);
});
|
// HTML5 entities map: { name -> utf16string }
//
'use strict';
/*eslint quotes:0*/
module.exports = require('entities/lib/maps/entities.json');
|
'use strict';
exports.__esModule = true;
var _plugin = require('../plugin');
var _plugin2 = _interopRequireDefault(_plugin);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var targets = ['ie 5.5', 'ie 6', 'ie 7'];
exports.default = (0, _plugin2.default)(targets, ['decl'], function (decl) {
var match = decl.value.match(/!\w/);
if (match) {
var text = decl.value.substr(match.index, decl.value.length - 1);
this.push(decl, {
identifier: '!important',
hack: text
});
}
});
module.exports = exports['default'];
|
ace.define("ace/snippets/scad",["require","exports","module"], function(require, exports, module) {
"use strict";
exports.snippetText =undefined;
exports.scope = "scad";
}); (function() {
ace.require(["ace/snippets/scad"], function(m) {
if (typeof module == "object" && typeof exports == "object" && module) {
module.exports = m;
}
});
})();
|
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'liststyle', 'sl', {
armenian: 'Armenian numbering',
bulletedTitle: 'Bulleted List Properties',
circle: 'Circle',
decimal: 'Decimal (1, 2, 3, etc.)',
decimalLeadingZero: 'Decimal leading zero (01, 02, 03, etc.)',
disc: 'Disc',
georgian: 'Georgian numbering (an, ban, gan, etc.)',
lowerAlpha: 'Lower Alpha (a, b, c, d, e, etc.)',
lowerGreek: 'Lower Greek (alpha, beta, gamma, etc.)',
lowerRoman: 'Lower Roman (i, ii, iii, iv, v, etc.)',
none: 'None',
notset: '<not set>',
numberedTitle: 'Numbered List Properties',
square: 'Square',
start: 'Start',
type: 'Type',
upperAlpha: 'Upper Alpha (A, B, C, D, E, etc.)',
upperRoman: 'Upper Roman (I, II, III, IV, V, etc.)',
validateStartNumber: 'List start number must be a whole number.'
} );
|
/* */
var defined = require('./$.defined'),
cof = require('./$.cof');
module.exports = function(that, searchString, NAME) {
if (cof(searchString) == 'RegExp')
throw TypeError('String#' + NAME + " doesn't accept regex!");
return String(defined(that));
};
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
var customDomainsTextbox;
var saveButton;
function init() {
customDomainsTextbox = document.getElementById("custom-domain");
saveButton = document.getElementById("save-button");
customDomainsTextbox.value = localStorage.customDomain || "";
markClean();
}
function save() {
localStorage.customDomain = customDomainsTextbox.value;
markClean();
chrome.extension.getBackgroundPage().init();
}
function markDirty() {
saveButton.disabled = false;
}
function markClean() {
saveButton.disabled = true;
}
document.addEventListener('DOMContentLoaded', function () {
init();
document.querySelector('#cancel-button').addEventListener('DOMContentLoaded',
init);
document.querySelector('#save-button').addEventListener('DOMContentLoaded',
save);
});
|
describe('dropdown:', function() {
beforeEach(function() {
this.addMatchers({
// Place dropdown-specific matchers here...
});
var origFunc = $.fn.foundation;
spyOn($.fn, 'foundation').andCallFake(function() {
var result = origFunc.apply(this, arguments);
jasmine.Clock.tick(1000); // Let things settle...
return result;
});
});
describe('basic clearing', function() {
beforeEach(function() {
document.body.innerHTML = __html__['spec/dropdown/basic.html'];
});
it('is hidden on initialization', function() {
$(document).foundation();
expect($('#drop1').hasClass('open')).toBe(false);
expect($('#drop2').hasClass('open')).toBe(false);
expect($('#drop3').hasClass('open')).toBe(false);
expect($('#drop4').hasClass('open')).toBe(false);
});
it('displays the dropdown on click', function() {
$(document).foundation();
$('#drop1link').click();
expect($('#drop1').hasClass('open')).toBe(true);
expect($('#drop2').hasClass('open')).toBe(false);
expect($('#drop3').hasClass('open')).toBe(false);
expect($('#drop4').hasClass('open')).toBe(false);
});
it('displays the content dropdown on click', function() {
$(document).foundation();
$('#drop2link').click();
expect($('#drop1').hasClass('open')).toBe(false);
expect($('#drop2').hasClass('open')).toBe(true);
expect($('#drop3').hasClass('open')).toBe(false);
expect($('#drop4').hasClass('open')).toBe(false);
});
it('closes an open dropdown when another is clicked', function() {
$(document).foundation();
$('#drop1link').click();
$('#drop2link').click();
expect($('#drop1').hasClass('open')).toBe(false);
expect($('#drop2').hasClass('open')).toBe(true);
expect($('#drop3').hasClass('open')).toBe(false);
expect($('#drop4').hasClass('open')).toBe(false);
});
it('closes an open dropdown when the document is clicked elsewhere', function() {
$(document).foundation();
$('#drop1link').click();
$('body').click();
expect($('#drop1').hasClass('open')).toBe(false);
expect($('#drop2').hasClass('open')).toBe(false);
expect($('#drop3').hasClass('open')).toBe(false);
expect($('#drop4').hasClass('open')).toBe(false);
});
it('displays a dropdown even if the dropdown button has deeply nested content', function() {
$(document).foundation();
$('#drop3span').click();
expect($('#drop1').hasClass('open')).toBe(false);
expect($('#drop2').hasClass('open')).toBe(false);
expect($('#drop3').hasClass('open')).toBe(true);
expect($('#drop4').hasClass('open')).toBe(false);
});
it('does not display a disabled dropdown', function() {
$(document).foundation();
$('#drop4link').click();
expect($('#drop1').hasClass('open')).toBe(false);
expect($('#drop2').hasClass('open')).toBe(false);
expect($('#drop3').hasClass('open')).toBe(false);
expect($('#drop4').hasClass('open')).toBe(false);
});
});
});
|
'use strict';
// See https://github.com/nodejs/node/issues/5927
const common = require('../common');
const assert = require('assert');
const spawn = require('child_process').spawn;
if (process.argv[2] === 'child') {
process.stdin.pipe(process.stdout);
return;
}
const child = spawn(process.execPath, [__filename, 'child'], { stdio: 'pipe' });
const expectedBytes = 1024 * 1024;
let readBytes = 0;
child.stdin.end(Buffer.alloc(expectedBytes));
child.stdout.on('data', (chunk) => readBytes += chunk.length);
child.stdout.on('end', common.mustCall(() => {
assert.strictEqual(readBytes, expectedBytes);
}));
|
(function () {
'use strict';
function usersHelperService(localizationService) {
var userStates = [
{ "name": "All", "key": "All"} ,
{ "value": 0, "name": "Active", "key": "Active", "color": "success" },
{ "value": 1, "name": "Disabled", "key": "Disabled", "color": "danger" },
{ "value": 2, "name": "Locked out", "key": "LockedOut", "color": "danger" },
{ "value": 3, "name": "Invited", "key": "Invited", "color": "warning" },
{ "value": 4, "name": "Inactive", "key": "Inactive", "color": "warning" }
];
localizationService.localizeMany(userStates.map(userState => "user_state" + userState.key))
.then(data => {
var reg = /^\[[\S\s]*]$/g;
data.forEach((value, index) => {
if (!reg.test(value)) {
// Only translate if key exists
userStates[index].name = value;
}
});
});
function getUserStateFromValue(value) {
return userStates.find(userState => userState.value === value);
}
function getUserStateByKey(key) {
return userStates.find(userState => userState.key === key);
}
function getUserStatesFilter(userStatesObject) {
var userStatesFilter = [];
for (var key in userStatesObject) {
if (hasOwnProperty.call(userStatesObject, key)) {
var userState = getUserStateByKey(key);
if(userState) {
userState.count = userStatesObject[key];
userStatesFilter.push(userState);
}
}
}
return userStatesFilter;
}
////////////
var service = {
getUserStateFromValue: getUserStateFromValue,
getUserStateByKey: getUserStateByKey,
getUserStatesFilter: getUserStatesFilter
};
return service;
}
angular.module('umbraco.services').factory('usersHelper', usersHelperService);
})();
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
var gTestfile = 'regress-349653.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 349653;
var summary = 'Do not assert: OBJ_GET_CLASS(cx, obj) == &js_ArrayClass';
var actual = 'No Crash';
var expect = 'No Crash';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
void ({y: true ? [1 for (x in [2])] : 3 })
reportCompare(expect, actual, summary);
let (a) true ? [2 for each (z in function(id) { return id })] : 3;
reportCompare(expect, actual, summary);
exitFunc ('test');
}
|
'use strict';
module.exports = function (t, a) {
a(t.call('a', 0), '', "Empty");
a(t.call('a', 1), 'a', "1");
a(t.call('\t', 5), '\t\t\t\t\t', "Whitespace");
a(t.call('raz', 3), 'razrazraz', "Many chars");
};
|
// Copyright 2016 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
function benchName(bench, setup) {
var name = bench.name;
if (setup) name += "/" + setup.name;
return name;
}
function slowBenchName(bench, setup) {
return benchName(bench, setup) + " (Slow)";
}
function slow(setupFunction) {
return () => {
setupFunction();
// Trigger RegExp slow paths.
const regExpExec = re.exec;
re.exec = (str) => regExpExec.call(re, str);
};
}
function createHaystack() {
let s = "abCdefgz";
for (let i = 0; i < 3; i++) s += s;
return s;
}
function createBenchmarkSuite(name) {
return new BenchmarkSuite(
name, [1000],
benchmarks.map(([bench, setup]) =>
new Benchmark(benchName(bench, setup), false, false, 100000, bench,
setup)));
}
function createSlowBenchmarkSuite(name) {
return new BenchmarkSuite(
"Slow" + name, [1000],
benchmarks.map(([bench, setup]) =>
new Benchmark(slowBenchName(bench, setup), false, false, 0, bench,
slow(setup))));
}
|
//>>built
define("dojox/mobile/EdgeToEdgeStoreList",["dojo/_base/declare","./EdgeToEdgeList","./_StoreListMixin"],function(a,b,c){return a("dojox.mobile.EdgeToEdgeStoreList",[b,c],{})});
|
/*
Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'contextmenu', 'si', {
options: 'අනතර්ග ලේඛණ විකල්ප'
} );
|
import { Matrix3 } from '../../math/Matrix3.js';
import { Plane } from '../../math/Plane.js';
function WebGLClipping( properties ) {
const scope = this;
let globalState = null,
numGlobalPlanes = 0,
localClippingEnabled = false,
renderingShadows = false;
const plane = new Plane(),
viewNormalMatrix = new Matrix3(),
uniform = { value: null, needsUpdate: false };
this.uniform = uniform;
this.numPlanes = 0;
this.numIntersection = 0;
this.init = function ( planes, enableLocalClipping, camera ) {
const enabled =
planes.length !== 0 ||
enableLocalClipping ||
// enable state of previous frame - the clipping code has to
// run another frame in order to reset the state:
numGlobalPlanes !== 0 ||
localClippingEnabled;
localClippingEnabled = enableLocalClipping;
globalState = projectPlanes( planes, camera, 0 );
numGlobalPlanes = planes.length;
return enabled;
};
this.beginShadows = function () {
renderingShadows = true;
projectPlanes( null );
};
this.endShadows = function () {
renderingShadows = false;
resetGlobalState();
};
this.setState = function ( material, camera, useCache ) {
const planes = material.clippingPlanes,
clipIntersection = material.clipIntersection,
clipShadows = material.clipShadows;
const materialProperties = properties.get( material );
if ( ! localClippingEnabled || planes === null || planes.length === 0 || renderingShadows && ! clipShadows ) {
// there's no local clipping
if ( renderingShadows ) {
// there's no global clipping
projectPlanes( null );
} else {
resetGlobalState();
}
} else {
const nGlobal = renderingShadows ? 0 : numGlobalPlanes,
lGlobal = nGlobal * 4;
let dstArray = materialProperties.clippingState || null;
uniform.value = dstArray; // ensure unique state
dstArray = projectPlanes( planes, camera, lGlobal, useCache );
for ( let i = 0; i !== lGlobal; ++ i ) {
dstArray[ i ] = globalState[ i ];
}
materialProperties.clippingState = dstArray;
this.numIntersection = clipIntersection ? this.numPlanes : 0;
this.numPlanes += nGlobal;
}
};
function resetGlobalState() {
if ( uniform.value !== globalState ) {
uniform.value = globalState;
uniform.needsUpdate = numGlobalPlanes > 0;
}
scope.numPlanes = numGlobalPlanes;
scope.numIntersection = 0;
}
function projectPlanes( planes, camera, dstOffset, skipTransform ) {
const nPlanes = planes !== null ? planes.length : 0;
let dstArray = null;
if ( nPlanes !== 0 ) {
dstArray = uniform.value;
if ( skipTransform !== true || dstArray === null ) {
const flatSize = dstOffset + nPlanes * 4,
viewMatrix = camera.matrixWorldInverse;
viewNormalMatrix.getNormalMatrix( viewMatrix );
if ( dstArray === null || dstArray.length < flatSize ) {
dstArray = new Float32Array( flatSize );
}
for ( let i = 0, i4 = dstOffset; i !== nPlanes; ++ i, i4 += 4 ) {
plane.copy( planes[ i ] ).applyMatrix4( viewMatrix, viewNormalMatrix );
plane.normal.toArray( dstArray, i4 );
dstArray[ i4 + 3 ] = plane.constant;
}
}
uniform.value = dstArray;
uniform.needsUpdate = true;
}
scope.numPlanes = nPlanes;
scope.numIntersection = 0;
return dstArray;
}
}
export { WebGLClipping };
|
var knwl = new Knwl();
var demo = {};
demo.resultBoxes = {};
demo.input = null;
demo.resultsDiv = null;
demo.setup = function() {
var resultsDiv = document.getElementById('results');
demo.resultsDiv = resultsDiv;
for (var el in demo.resultBoxes) {
if (demo.resultsDiv.contains(demo.resultBoxes[el])) {
demo.resultsDiv.removeChild(demo.resultBoxes[el]);
}
}
demo.resultBoxes = {};
demo.input = document.getElementById('input');
for (var key in knwl.plugins) {
var resultBox = document.createElement('div');
resultBox.setAttribute('class', 'resultBox');
resultBox.innerHTML += '<p class = "title">' + key + '</p>';
demo.resultBoxes[key] = resultBox;
resultsDiv.appendChild(resultBox);
}
};
demo.startParse = function() {
demo.parse();
};
demo.parse = function() {
demo.setup();
knwl.init(demo.input.value);
for (var parser in knwl.plugins) {
var data = knwl.get(parser);
for (var ii = 0; ii < data.length; ii++) {
var resultDiv = document.createElement('div');
resultDiv.setAttribute('class', 'result');
for (var key in data[ii]) {
if (key !== 'found') {
var p = document.createElement('p');
if (key !== 'preview') {
p.innerHTML = key + ': <span class = "val">' + data[ii][key] + '</span>';
} else {
p.innerHTML = data[ii][key];
p.setAttribute('class', 'preview');
}
resultDiv.appendChild(p);
}
}
demo.resultBoxes[parser].appendChild(resultDiv);
}
if (data.length === 0) {
demo.resultsDiv.removeChild(demo.resultBoxes[parser]);
}
}
};
window.onload = function() {
demo.setup();
if (localStorage.getItem('knwlDemoText') !== '')
demo.input.value = localStorage.getItem('knwlDemoText');
demo.input.onkeydown = function() {
setTimeout(function() {
localStorage.setItem('knwlDemoText', demo.input.value);
},10);
};
};
console.info('This is a demo of knwl.js using a few of the plugins available by default. Website: http://loadfive.com/os/knwl');
console.info('Feel free to use this demo to test your own Knwl.js parser plugins. Just add them to the header of index.html, and the demo will recognize them automatically.');
|
/*
* Copyright 2012 Mark Cavage. All rights reserved.
*
* Help nodeunit API feel like node-tap's.
*
* Usage:
* if (require.cache[__dirname + '/tap4nodeunit.js'])
* delete require.cache[__dirname + '/tap4nodeunit.js'];
* var tap4nodeunit = require('./tap4nodeunit.js');
* var after = tap4nodeunit.after;
* var before = tap4nodeunit.before;
* var test = tap4nodeunit.test;
*/
//---- Exports
module.exports = {
after: function after(teardown) {
module.parent.exports.tearDown = function _teardown(callback) {
try {
teardown.call(this, callback);
} catch (e) {
console.error('after:\n' + e.stack);
process.exit(1);
}
};
},
before: function before(setup) {
module.parent.exports.setUp = function _setup(callback) {
try {
setup.call(this, callback);
} catch (e) {
console.error('before:\n' + e.stack);
process.exit(1);
}
};
},
test: function test(name, tester) {
module.parent.exports[name] = function _(t) {
var _done = false;
t.end = function end() {
if (!_done) {
_done = true;
t.done();
}
};
t.notOk = function notOk(ok, message) {
return (t.ok(!ok, message));
};
tester.call(this, t);
};
}
};
|
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
module.exports = angular.module('trafficPortal.private.servers.deliveryServices', [])
.config(function($stateProvider, $urlRouterProvider) {
$stateProvider
.state('trafficPortal.private.servers.deliveryServices', {
url: '/{serverId}/delivery-services',
views: {
serversContent: {
templateUrl: 'common/modules/table/serverDeliveryServices/table.serverDeliveryServices.tpl.html',
controller: 'TableServerDeliveryServicesController',
resolve: {
server: function($stateParams, serverService) {
return serverService.getServer($stateParams.serverId);
},
serverDeliveryServices: function($stateParams, deliveryServiceService) {
return deliveryServiceService.getServerDeliveryServices($stateParams.serverId);
}
}
}
}
})
;
$urlRouterProvider.otherwise('/');
});
|
module.exports = function(old, cfg) {
var data = cfg;
if (data.clock) {
data.clock.showTenths = data.pref.clockTenths;
data.clock.showBar = data.pref.clockBar;
}
if (data.correspondence)
data.correspondence.showBar = data.pref.clockBar;
if (data.game.variant.key === 'horde')
data.pref.showCaptured = false;
return data;
};
|
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
(function() {
var mode = CodeMirror.getMode({indentUnit: 2}, "soy");
function MT(name) {test.mode(name, mode, Array.prototype.slice.call(arguments, 1));}
// Test of small keywords and words containing them.
MT('keywords-test',
'[keyword {] [keyword as] worrying [keyword and] notorious [keyword as]',
' the Fandor-alias assassin, [keyword or]',
' Corcand cannot fit [keyword in] [keyword }]');
MT('let-test',
'[keyword {template] [def .name][keyword }]',
' [keyword {let] [def $name]: [string "world"][keyword /}]',
' [tag&bracket <][tag h1][tag&bracket >]',
' Hello, [keyword {][variable-2 $name][keyword }]',
' [tag&bracket </][tag h1][tag&bracket >]',
'[keyword {/template}]',
'');
MT('param-type-test',
'[keyword {@param] [def a]: ' +
'[variable-3 list]<[[[variable-3 a]: [variable-3 int], ' +
'[variable-3 b]: [variable-3 map]<[variable-3 string], ' +
'[variable-3 bool]>]]>][keyword }]');
MT('undefined-var',
'[keyword {][variable-2&error $var]');
MT('param-scope-test',
'[keyword {template] [def .a][keyword }]',
' [keyword {@param] [def x]: [variable-3 string][keyword }]',
' [keyword {][variable-2 $x][keyword }]',
'[keyword {/template}]',
'',
'[keyword {template] [def .b][keyword }]',
' [keyword {][variable-2&error $x][keyword }]',
'[keyword {/template}]',
'');
MT('if-variable-test',
'[keyword {if] [variable-2&error $showThing][keyword }]',
' Yo!',
'[keyword {/if}]',
'');
MT('defined-if-variable-test',
'[keyword {template] [def .foo][keyword }]',
' [keyword {@param?] [def showThing]: [variable-3 bool][keyword }]',
' [keyword {if] [variable-2 $showThing][keyword }]',
' Yo!',
' [keyword {/if}]',
'[keyword {/template}]',
'');
MT('template-calls-test',
'[keyword {template] [def .foo][keyword }]',
' Yo!',
'[keyword {/template}]',
'[keyword {call] [variable-2 .foo][keyword /}]',
'[keyword {call] [variable foo][keyword /}]',
'[keyword {call] [variable .bar][keyword /}]',
'[keyword {call] [variable bar][keyword /}]',
'');
MT('foreach-scope-test',
'[keyword {@param] [def bar]: [variable-3 string][keyword }]',
'[keyword {foreach] [def $foo] [keyword in] [variable-2&error $foos][keyword }]',
' [keyword {][variable-2 $foo][keyword }]',
'[keyword {/foreach}]',
'[keyword {][variable-2&error $foo][keyword }]',
'[keyword {][variable-2 $bar][keyword }]');
MT('foreach-ifempty-indent-test',
'[keyword {foreach] [def $foo] [keyword in] [variable-2&error $foos][keyword }]',
' something',
'[keyword {ifempty}]',
' nothing',
'[keyword {/foreach}]',
'');
MT('nested-kind-test',
'[keyword {template] [def .foo] [attribute kind]=[string "html"][keyword }]',
' [tag&bracket <][tag div][tag&bracket >]',
' [keyword {call] [variable .bar][keyword }]',
' [keyword {param] [attribute kind]=[string "js"][keyword }]',
' [keyword var] [def bar] [operator =] [number 5];',
' [keyword {/param}]',
' [keyword {/call}]',
' [tag&bracket </][tag div][tag&bracket >]',
'[keyword {/template}]',
'');
MT('allow-missing-colon-in-@param',
'[keyword {template] [def .foo][keyword }]',
' [keyword {@param] [def showThing] [variable-3 bool][keyword }]',
' [keyword {if] [variable-2 $showThing][keyword }]',
' Yo!',
' [keyword {/if}]',
'[keyword {/template}]',
'');
})();
|
'use strict';
var defaults = require('./../defaults');
var utils = require('./../utils');
var InterceptorManager = require('./InterceptorManager');
var dispatchRequest = require('./dispatchRequest');
/**
* Create a new instance of Axios
*
* @param {Object} instanceConfig The default config for the instance
*/
function Axios(instanceConfig) {
this.defaults = instanceConfig;
this.interceptors = {
request: new InterceptorManager(),
response: new InterceptorManager()
};
}
/**
* Dispatch a request
*
* @param {Object} config The config specific for this request (merged with this.defaults)
*/
Axios.prototype.request = function request(config) {
/*eslint no-param-reassign:0*/
// Allow for axios('example/url'[, config]) a la fetch API
if (typeof config === 'string') {
config = utils.merge({
url: arguments[0]
}, arguments[1]);
}
config = utils.merge(defaults, {method: 'get'}, this.defaults, config);
config.method = config.method.toLowerCase();
// Hook up interceptors middleware
var chain = [dispatchRequest, undefined];
var promise = Promise.resolve(config);
this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
chain.unshift(interceptor.fulfilled, interceptor.rejected);
});
this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
chain.push(interceptor.fulfilled, interceptor.rejected);
});
while (chain.length) {
promise = promise.then(chain.shift(), chain.shift());
}
return promise;
};
// Provide aliases for supported request methods
utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
/*eslint func-names:0*/
Axios.prototype[method] = function(url, config) {
return this.request(utils.merge(config || {}, {
method: method,
url: url
}));
};
});
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
/*eslint func-names:0*/
Axios.prototype[method] = function(url, data, config) {
return this.request(utils.merge(config || {}, {
method: method,
url: url,
data: data
}));
};
});
module.exports = Axios;
|
/**
* Copyright (c) 2006-2015, JGraph Ltd
* Copyright (c) 2006-2015, Gaudenz Alder
*/
/**
* Class: mxRhombus
*
* Extends <mxShape> to implement a rhombus (aka diamond) shape.
* This shape is registered under <mxConstants.SHAPE_RHOMBUS>
* in <mxCellRenderer>.
*
* Constructor: mxRhombus
*
* Constructs a new rhombus shape.
*
* Parameters:
*
* bounds - <mxRectangle> that defines the bounds. This is stored in
* <mxShape.bounds>.
* fill - String that defines the fill color. This is stored in <fill>.
* stroke - String that defines the stroke color. This is stored in <stroke>.
* strokewidth - Optional integer that defines the stroke width. Default is
* 1. This is stored in <strokewidth>.
*/
function mxRhombus(bounds, fill, stroke, strokewidth)
{
mxShape.call(this);
this.bounds = bounds;
this.fill = fill;
this.stroke = stroke;
this.strokewidth = (strokewidth != null) ? strokewidth : 1;
};
/**
* Extends mxShape.
*/
mxUtils.extend(mxRhombus, mxShape);
/**
* Function: paintVertexShape
*
* Generic painting implementation.
*/
mxRhombus.prototype.paintVertexShape = function(c, x, y, w, h)
{
var hw = w / 2;
var hh = h / 2;
var arcSize = mxUtils.getValue(this.style, mxConstants.STYLE_ARCSIZE, mxConstants.LINE_ARCSIZE) / 2;
c.begin();
this.addPoints(c, [new mxPoint(x + hw, y), new mxPoint(x + w, y + hh), new mxPoint(x + hw, y + h),
new mxPoint(x, y + hh)], this.isRounded, arcSize, true);
c.fillAndStroke();
};
|
// Based on http://bl.ocks.org/900762 by John Firebaugh
d3.json("../data/faithful.json", function(faithful) {
data = faithful;
var w = 800,
h = 400,
x = d3.scale.linear().domain([30, 110]).range([0, w]);
bins = d3.layout.histogram().frequency(false).bins(x.ticks(60))(data),
max = d3.max(bins, function(d) { return d.y; }),
y = d3.scale.linear().domain([0, .1]).range([0, h]),
kde = science.stats.kde().sample(data);
var vis = d3.select("body")
.append("svg")
.attr("width", w)
.attr("height", h);
var bars = vis.selectAll("g.bar")
.data(bins)
.enter().append("g")
.attr("class", "bar")
.attr("transform", function(d, i) {
return "translate(" + x(d.x) + "," + (h - y(d.y)) + ")";
});
bars.append("rect")
.attr("fill", "steelblue")
.attr("width", function(d) { return x(d.dx + 30) - 1; })
.attr("height", function(d) { return y(d.y); });
var line = d3.svg.line()
.x(function(d) { return x(d[0]); })
.y(function(d) { return h - y(d[1]); });
vis.selectAll("path")
.data(d3.values(science.stats.bandwidth))
.enter().append("path")
.attr("d", function(h) {
return line(kde.bandwidth(h)(d3.range(30, 110, .1)));
});
});
|
'use strict';
var StripeResource = require('../StripeResource');
var stripeMethod = StripeResource.method;
module.exports = StripeResource.extend({
path: '3d_secure',
includeBasic: [
'create',
'retrieve',
],
});
|
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/
gadgets.i18n = gadgets.i18n || {};
gadgets.i18n.NumberFormatConstants = {
DECIMAL_SEP: '.',
GROUP_SEP: ',',
PERCENT: '%',
ZERO_DIGIT: '0',
PLUS_SIGN: '+',
MINUS_SIGN: '-',
EXP_SYMBOL: 'E',
PERMILL: '\u2030',
INFINITY: '\u221E',
NAN: 'NaN',
DECIMAL_PATTERN: '#,##0.###',
SCIENTIFIC_PATTERN: '#E0',
PERCENT_PATTERN: '#,##0%',
CURRENCY_PATTERN: '\u00A4#,##0.00',
DEF_CURRENCY_CODE: 'MTL'
};
gadgets.i18n.NumberFormatConstants.MONETARY_SEP = gadgets.i18n.NumberFormatConstants.DECIMAL_SEP;
gadgets.i18n.NumberFormatConstants.MONETARY_GROUP_SEP = gadgets.i18n.NumberFormatConstants.GROUP_SEP;
|
var inst = require("../index").getInstance();
module.exports = inst.use("cssgrids-context-deprecated");
|
odoo.define("web.DomainSelectorDialog", function (require) {
"use strict";
var core = require("web.core");
var Dialog = require("web.Dialog");
var DomainSelector = require("web.DomainSelector");
var _t = core._t;
/**
* @class DomainSelectorDialog
*/
return Dialog.extend({
init: function (parent, model, domain, options) {
this.model = model;
this.options = _.extend({
readonly: true,
debugMode: false,
}, options || {});
var buttons;
if (this.options.readonly) {
buttons = [
{text: _t("Close"), close: true},
];
} else {
buttons = [
{text: _t("Save"), classes: "btn-primary", close: true, click: function () {
this.trigger_up("domain_selected", {domain: this.domainSelector.getDomain()});
}},
{text: _t("Discard"), close: true},
];
}
this._super(parent, _.extend({}, {
title: _t("Domain"),
buttons: buttons,
}, options || {}));
this.domainSelector = new DomainSelector(this, model, domain, options);
},
start: function () {
var self = this;
this.opened().then(function () {
// this restores default modal height (bootstrap) and allows field selector to overflow
self.$el.css('overflow', 'visible').closest('.modal-dialog').css('height', 'auto');
});
return Promise.all([
this._super.apply(this, arguments),
this.domainSelector.appendTo(this.$el)
]);
},
});
});
|
//// [parameterPropertyReferencingOtherParameter.ts]
class Foo {
constructor(public x: number, public y: number = x) { }
}
//// [parameterPropertyReferencingOtherParameter.js]
var Foo = /** @class */ (function () {
function Foo(x, y) {
if (y === void 0) { y = x; }
this.x = x;
this.y = y;
}
return Foo;
}());
|
/*
Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
if(!dojo._hasResource["dojox.mdnd.dropMode.OverDropMode"]){
dojo._hasResource["dojox.mdnd.dropMode.OverDropMode"]=true;
dojo.provide("dojox.mdnd.dropMode.OverDropMode");
dojo.require("dojox.mdnd.AreaManager");
dojo.declare("dojox.mdnd.dropMode.OverDropMode",null,{_oldXPoint:null,_oldYPoint:null,_oldBehaviour:"up",constructor:function(){
this._dragHandler=[dojo.connect(dojox.mdnd.areaManager(),"onDragEnter",function(_1,_2){
var m=dojox.mdnd.areaManager();
if(m._oldIndexArea==-1){
m._oldIndexArea=m._lastValidIndexArea;
}
})];
},addArea:function(_3,_4){
var _5=_3.length,_6=dojo.position(_4.node,true);
_4.coords={"x":_6.x,"y":_6.y};
if(_5==0){
_3.push(_4);
}else{
var x=_4.coords.x;
for(var i=0;i<_5;i++){
if(x<_3[i].coords.x){
for(var j=_5-1;j>=i;j--){
_3[j+1]=_3[j];
}
_3[i]=_4;
break;
}
}
if(i==_5){
_3.push(_4);
}
}
return _3;
},updateAreas:function(_7){
var _8=_7.length;
for(var i=0;i<_8;i++){
this._updateArea(_7[i]);
}
},_updateArea:function(_9){
var _a=dojo.position(_9.node,true);
_9.coords.x=_a.x;
_9.coords.x2=_a.x+_a.w;
_9.coords.y=_a.y;
},initItems:function(_b){
dojo.forEach(_b.items,function(_c){
var _d=_c.item.node;
var _e=dojo.position(_d,true);
var y=_e.y+_e.h/2;
_c.y=y;
});
_b.initItems=true;
},refreshItems:function(_f,_10,_11,_12){
if(_10==-1){
return;
}else{
if(_f&&_11&&_11.h){
var _13=_11.h;
if(_f.margin){
_13+=_f.margin.t;
}
var _14=_f.items.length;
for(var i=_10;i<_14;i++){
var _15=_f.items[i];
if(_12){
_15.y+=_13;
}else{
_15.y-=_13;
}
}
}
}
},getDragPoint:function(_16,_17,_18){
return {"x":_18.x,"y":_18.y};
},getTargetArea:function(_19,_1a,_1b){
var _1c=0;
var x=_1a.x;
var y=_1a.y;
var end=_19.length;
var _1d=0,_1e="right",_1f=false;
if(_1b==-1||arguments.length<3){
_1f=true;
}else{
if(this._checkInterval(_19,_1b,x,y)){
_1c=_1b;
}else{
if(this._oldXPoint<x){
_1d=_1b+1;
}else{
_1d=_1b-1;
end=0;
_1e="left";
}
_1f=true;
}
}
if(_1f){
if(_1e==="right"){
for(var i=_1d;i<end;i++){
if(this._checkInterval(_19,i,x,y)){
_1c=i;
break;
}
}
if(i==end){
_1c=-1;
}
}else{
for(var i=_1d;i>=end;i--){
if(this._checkInterval(_19,i,x,y)){
_1c=i;
break;
}
}
if(i==end-1){
_1c=-1;
}
}
}
this._oldXPoint=x;
return _1c;
},_checkInterval:function(_20,_21,x,y){
var _22=_20[_21];
var _23=_22.node;
var _24=_22.coords;
var _25=_24.x;
var _26=_24.x2;
var _27=_24.y;
var _28=_27+_23.offsetHeight;
if(_25<=x&&x<=_26&&_27<=y&&y<=_28){
return true;
}
return false;
},getDropIndex:function(_29,_2a){
var _2b=_29.items.length;
var _2c=_29.coords;
var y=_2a.y;
if(_2b>0){
for(var i=0;i<_2b;i++){
if(y<_29.items[i].y){
return i;
}else{
if(i==_2b-1){
return -1;
}
}
}
}
return -1;
},destroy:function(){
dojo.forEach(this._dragHandler,dojo.disconnect);
}});
(function(){
dojox.mdnd.areaManager()._dropMode=new dojox.mdnd.dropMode.OverDropMode();
}());
}
|
// DATA_TEMPLATE: empty_table
oTest.fnStart( "aoColumns.bSortable" );
$(document).ready( function () {
/* Check the default */
var oTable = $('#example').dataTable( {
"bServerSide": true,
"sAjaxSource": "../../../examples/server_side/scripts/server_processing.php"
} );
var oSettings = oTable.fnSettings();
oTest.fnWaitTest(
"All columns are sortable by default",
function () { $('#example thead th:eq(1)').click(); },
function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == "All others"; }
);
oTest.fnWaitTest(
"Can disable sorting from one column",
function () {
oSession.fnRestore();
$('#example').dataTable( {
"bServerSide": true,
"sAjaxSource": "../../../examples/server_side/scripts/server_processing.php",
"aoColumns": [
null,
{ "bSortable": false },
null,
null,
null
]
} );
$('#example thead th:eq(1)').click();
},
function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == "Firefox 1.0"; }
);
oTest.fnWaitTest(
"Disabled column has no sorting class",
null,
function () { return $('#example thead th:eq(1)').hasClass("sorting_asc") == false; }
);
oTest.fnWaitTest(
"Other columns can still sort",
function () {
$('#example thead th:eq(4)').click();
$('#example thead th:eq(4)').click();
},
function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == "Internet Explorer 4.0"; }
);
oTest.fnWaitTest(
"Disable sorting on multiple columns - no sorting classes",
function () {
oSession.fnRestore();
$('#example').dataTable( {
"bServerSide": true,
"sAjaxSource": "../../../examples/server_side/scripts/server_processing.php",
"aoColumns": [
null,
{ "bSortable": false },
null,
{ "bSortable": false },
null
]
} );
},
function () {
var bReturn =
$('#example thead th:eq(1)').hasClass("sorting") ||
$('#example thead th:eq(3)').hasClass("sorting")
return bReturn == false;
}
);
oTest.fnWaitTest(
"Sorting on disabled column 1 has no effect",
function () {
$('#example thead th:eq(1)').click();
},
function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == "Firefox 1.0"; }
);
oTest.fnWaitTest(
"Sorting on disabled column 2 has no effect",
function () {
$('#example thead th:eq(3)').click();
},
function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == "Firefox 1.0"; }
);
oTest.fnWaitTest(
"Second sort on disabled column 2 has no effect",
function () {
$('#example thead th:eq(3)').click();
},
function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == "Firefox 1.0"; }
);
oTest.fnWaitTest(
"Even with multiple disabled sorting columns other columns can still sort",
function () {
$('#example thead th:eq(4)').click();
$('#example thead th:eq(4)').click();
},
function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == "Internet Explorer 4.0"; }
);
oTest.fnComplete();
} );
|
//>>built
define("dojox/form/nls/nl/CheckedMultiSelect",({invalidMessage:"Er moet ten minste één item geselecteerd worden.",multiSelectLabelText:"{num} item(s) geselecteerd"}));
|
/*
* Copyright (c) 2012-2015 S-Core Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
define(['plugin-manager', // pm
'dojo/parser', // parser
'dijit/registry', // reg
'dijit/layout/TabContainer', // TabContainer
'dijit/layout/ContentPane', // ContentPane
'dojo/store/Memory',
'dojo/domReady!'
], function (pm, parser, reg, TabContainer, ContentPane, Memory) {
'use strict';
//var container = null;
//var cbWorkbench = null;
function showSelectPaas(combo, container) {
var name = combo.get('value');
var store = combo.get('store');
var paas = store.get('paas-store' + name);
container.selectChild(paas.paas);
var logo = paas.logo;
document.getElementById('paas-logo-image').style.backgroundImage = 'url("' + logo + '")';
//FIXME : logo set
}
function cbGetTab(tab) {
var container = reg.byId('paas-stack-container');
if (!container) {
return;
}
container.addChild(tab);
var combo = reg.byId('paas-selet-combo');
var store = combo.get('store');
var title = tab.get('title');
var logo = tab.get('logo');
if (!store) {
dojo.connect(combo, 'onChange', function () {
showSelectPaas(combo, container);
console.log('change');
});
store = new Memory({
data: [
{name: title, paas: tab, id: 'paas-store' + title, logo: logo}
]
});
combo.set('store', store);
combo.set('value', title);
} else if (store.data.length === 0) {
dojo.connect(combo, 'onChange', function () {
showSelectPaas(combo, container);
console.log('change');
});
store.put({name: title, paas: tab, id: 'paas-store' + title, logo: logo});
combo.set('value', title);
} else {
store.put({name: title, paas: tab, id: 'paas-store' + title, logo: logo});
}
}
var paas = {
initPaaSTab: function () {
var exts = pm.getExtensions('webida.deploy.paas:tab');
exts.forEach(function (ext) {
require([ext.module], function (module) {
module[ext.getTab](cbGetTab);
});
});
},
// for webida.deploy.workbench:views extension point
onStart: function () {
this.initPaaSTab();
//tab.init();
//cb(container);
//return container;
}
// for webida.deploy.workbench:views extension point
//onViewAppended: function () {},
};
return paas;
});
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Custom binding for the fileBrowserPrivate API.
// Bindings
var binding = require('binding').Binding.create('fileBrowserPrivate');
var eventBindings = require('event_bindings');
// Natives
var fileBrowserPrivateNatives = requireNative('file_browser_private');
var fileBrowserHandlerNatives = requireNative('file_browser_handler');
// Internals
var fileBrowserPrivateInternal =
require('binding').Binding.create('fileBrowserPrivateInternal').generate();
// Shorthands
var GetFileSystem = fileBrowserPrivateNatives.GetFileSystem;
var GetExternalFileEntry = fileBrowserHandlerNatives.GetExternalFileEntry;
binding.registerCustomHook(function(bindingsAPI) {
var apiFunctions = bindingsAPI.apiFunctions;
apiFunctions.setCustomCallback('requestFileSystem',
function(name, request, response) {
var fs = null;
if (response && !response.error)
fs = GetFileSystem(response.name, response.root_url);
if (request.callback)
request.callback(fs);
request.callback = null;
});
apiFunctions.setCustomCallback('searchDrive',
function(name, request, response) {
if (response && !response.error && response.entries) {
response.entries = response.entries.map(function(entry) {
return GetExternalFileEntry(entry);
});
}
// So |request.callback| doesn't break if response is not defined.
if (!response)
response = {};
if (request.callback)
request.callback(response.entries, response.nextFeed);
request.callback = null;
});
apiFunctions.setCustomCallback('searchDriveMetadata',
function(name, request, response) {
if (response && !response.error) {
for (var i = 0; i < response.length; i++) {
response[i].entry =
GetExternalFileEntry(response[i].entry);
}
}
// So |request.callback| doesn't break if response is not defined.
if (!response)
response = {};
if (request.callback)
request.callback(response);
request.callback = null;
});
apiFunctions.setHandleRequest('resolveIsolatedEntries',
function(entries, callback) {
var urls = entries.map(function(entry) {
return fileBrowserHandlerNatives.GetEntryURL(entry);
});
fileBrowserPrivateInternal.resolveIsolatedEntries(urls, function(
entryDescriptions) {
callback(entryDescriptions.map(function(description) {
return GetExternalFileEntry(description);
}));
});
});
});
eventBindings.registerArgumentMassager(
'fileBrowserPrivate.onDirectoryChanged', function(args, dispatch) {
// Convert the entry arguments into a real Entry object.
args[0].entry = GetExternalFileEntry(args[0].entry);
dispatch(args);
});
exports.binding = binding.generate();
|
var join = require('path').join,
assert = require('assert'),
mkdirp = require('mkdirp'),
lwip = require('../../'),
imgs = require('../imgs');
var tmpDir = join(__dirname, '../results'),
basename = 'contain',
current;
describe('lwip.contain', function() {
var image;
before(function(done) {
mkdirp(tmpDir, done);
});
beforeEach(function(done) {
lwip.open(imgs.png.rgb, function(err, img) {
image = img;
done(err);
});
});
afterEach(function(done) {
image.writeFile(join(tmpDir, current.join('_') + '.gif'), 'gif', {
colors: 256,
interlaced: true
}, done);
});
beforeEach(function(){
current = [ basename ];
});
describe('800X100, no color, unspecified interpolation', function() {
it('image should have the correct size', function(done) {
current.push('800X100','no_color','unspecified_inter');
image.contain(800, 100, function(err, im) {
if (err) return done(err);
assert(im.width() === 800);
assert(im.height() === 100);
done();
});
});
});
describe('100X800, no color, lanczos interpolation', function() {
it('image should have the correct size', function(done) {
current.push('100X800','no_color','lanczos');
image.contain(100, 800, 'lanczos', function(err, im) {
if (err) return done(err);
assert(im.width() === 100);
assert(im.height() === 800);
done();
});
});
});
describe('100X400, gray, unspecified interpolation', function() {
it('image should have the correct size', function(done) {
current.push('100X400','gray','unspecified_inter');
image.contain(100, 400, 'gray', function(err, im) {
if (err) return done(err);
assert(im.width() === 100);
assert(im.height() === 400);
done();
});
});
});
describe('400X100, gray, lanczos interpolation', function() {
it('image should have the correct size', function(done) {
current.push('400X100','gray','lanczos');
image.contain(400, 100, 'gray', 'lanczos', function(err, im) {
if (err) return done(err);
assert(im.width() === 400);
assert(im.height() === 100);
done();
});
});
});
});
|
//! moment.js locale configuration
;(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined'
&& typeof require === 'function' ? factory(require('../moment')) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var sw = moment.defineLocale('sw', {
months : 'Januari_Februari_Machi_Aprili_Mei_Juni_Julai_Agosti_Septemba_Oktoba_Novemba_Desemba'.split('_'),
monthsShort : 'Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ago_Sep_Okt_Nov_Des'.split('_'),
weekdays : 'Jumapili_Jumatatu_Jumanne_Jumatano_Alhamisi_Ijumaa_Jumamosi'.split('_'),
weekdaysShort : 'Jpl_Jtat_Jnne_Jtan_Alh_Ijm_Jmos'.split('_'),
weekdaysMin : 'J2_J3_J4_J5_Al_Ij_J1'.split('_'),
weekdaysParseExact : true,
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'DD.MM.YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY HH:mm',
LLLL : 'dddd, D MMMM YYYY HH:mm'
},
calendar : {
sameDay : '[leo saa] LT',
nextDay : '[kesho saa] LT',
nextWeek : '[wiki ijayo] dddd [saat] LT',
lastDay : '[jana] LT',
lastWeek : '[wiki iliyopita] dddd [saat] LT',
sameElse : 'L'
},
relativeTime : {
future : '%s baadaye',
past : 'tokea %s',
s : 'hivi punde',
ss : 'sekunde %d',
m : 'dakika moja',
mm : 'dakika %d',
h : 'saa limoja',
hh : 'masaa %d',
d : 'siku moja',
dd : 'masiku %d',
M : 'mwezi mmoja',
MM : 'miezi %d',
y : 'mwaka mmoja',
yy : 'miaka %d'
},
week : {
dow : 1, // Monday is the first day of the week.
doy : 7 // The week that contains Jan 1st is the first week of the year.
}
});
return sw;
})));
|
/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/*************************************************************
*
* MathJax/jax/output/HTML-CSS/autoload/ms.js
*
* Implements the HTML-CSS output for <ms> elements.
*
* ---------------------------------------------------------------------
*
* Copyright (c) 2010-2016 The MathJax Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
var VERSION = "2.7.0";
var MML = MathJax.ElementJax.mml,
HTMLCSS = MathJax.OutputJax["HTML-CSS"];
MML.ms.Augment({
toHTML: function (span) {
span = this.HTMLhandleSize(this.HTMLcreateSpan(span));
var values = this.getValues("lquote","rquote","mathvariant");
if (!this.hasValue("lquote") || values.lquote === '"') values.lquote = "\u201C";
if (!this.hasValue("rquote") || values.rquote === '"') values.rquote = "\u201D";
if (values.lquote === "\u201C" && values.mathvariant === "monospace") values.lquote = '"';
if (values.rquote === "\u201D" && values.mathvariant === "monospace") values.rquote = '"';
var text = values.lquote+this.data.join("")+values.rquote; // FIXME: handle mglyph?
this.HTMLhandleVariant(span,this.HTMLgetVariant(),text);
this.HTMLhandleSpace(span);
this.HTMLhandleColor(span);
this.HTMLhandleDir(span);
return span;
}
});
MathJax.Hub.Startup.signal.Post("HTML-CSS ms Ready");
MathJax.Ajax.loadComplete(HTMLCSS.autoloadDir+"/ms.js");
});
|
'use strict'
const winston = require('winston')
module.exports = {
trailpack: {
disabled: [
'repl'
]
},
log: {
logger: new winston.Logger({
level: 'info',
exitOnError: false,
transports: [
new winston.transports.Console({
timestamp: true
}),
new winston.transports.File({
name: 'info-file',
level: 'info',
filename: 'trails-info.log',
timestamp: true
}),
new winston.transports.File({
name: 'error-file',
level: 'error',
filename: 'trails-error.log',
timestamp: true
})
]
})
}
}
|
/**
* Module dependencies.
*/
var express = require('../..');
var logger = require('morgan');
var vhost = require('vhost');
/*
edit /etc/hosts:
127.0.0.1 foo.example.com
127.0.0.1 bar.example.com
127.0.0.1 example.com
*/
// Main server app
var main = express();
main.use(logger('dev'));
main.get('/', function(req, res){
res.send('Hello from main app!');
});
main.get('/:sub', function(req, res){
res.send('requested ' + req.params.sub);
});
// Redirect app
var redirect = express();
redirect.all('*', function(req, res){
console.log(req.subdomains);
res.redirect('http://example.com:3000/' + req.subdomains[0]);
});
// Vhost app
var app = express();
app.use(vhost('*.example.com', redirect)); // Serves all subdomains via Redirect app
app.use(vhost('example.com', main)); // Serves top level domain via Main server app
app.listen(3000);
console.log('Express app started on port 3000');
|
/**
* @version $Id: tabs.js 20196 2011-01-09 02:40:25Z ian $
* @copyright Copyright (C) 2005 - 2011 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
/**
* Tabs behavior
*
* @package Joomla!
* @subpackage JavaScript
* @since 1.5
*/
var JTabs = new Class({
Implements: [Options, Events],
options : {
display: 0,
onActive: function(title, description) {
description.setStyle('display', 'block');
title.addClass('open').removeClass('closed');
},
onBackground: function(title, description){
description.setStyle('display', 'none');
title.addClass('closed').removeClass('open');
},
titleSelector: 'dt',
descriptionSelector: 'dd'
},
initialize: function(dlist, options){
this.setOptions(options);
this.dlist = document.id(dlist);
this.titles = this.dlist.getChildren(this.options.titleSelector);
this.descriptions = this.dlist.getChildren(this.options.descriptionSelector);
this.content = new Element('div').inject(this.dlist, 'after').addClass('current');
this.options.display = this.options.display.toInt().limit(0, this.titles.length-1);
for (var i = 0, l = this.titles.length; i < l; i++){
var title = this.titles[i];
var description = this.descriptions[i];
title.setStyle('cursor', 'pointer');
title.addEvent('click', this.display.bind(this, i));
description.inject(this.content);
}
this.display(this.options.display);
if (this.options.initialize) this.options.initialize.call(this);
},
hideAllBut: function(but) {
for (var i = 0, l = this.titles.length; i < l; i++){
if (i != but) this.fireEvent('onBackground', [this.titles[i], this.descriptions[i]]);
}
},
display: function(i) {
this.hideAllBut(i);
this.fireEvent('onActive', [this.titles[i], this.descriptions[i]]);
Cookie.write('jpanetabs_' + this.dlist.id, i);
}
});
|
/*
* Should
* Copyright(c) 2010-2015 TJ Holowaychuk <tj@vision-media.ca>
* MIT Licensed
*/
var util = require('../util')
, assert = require('./_assert')
, AssertionError = require('../assertion-error');
module.exports = function(should) {
var i = should.format;
/*
* Expose assert to should
*
* This allows you to do things like below
* without require()ing the assert module.
*
* should.equal(foo.bar, undefined);
*
*/
util.merge(should, assert);
/**
* Assert _obj_ exists, with optional message.
*
* @static
* @memberOf should
* @category assertion assert
* @alias should.exists
* @param {*} obj
* @param {String} [msg]
* @example
*
* should.exist(1);
* should.exist(new Date());
*/
should.exist = should.exists = function(obj, msg) {
if(null == obj) {
throw new AssertionError({
message: msg || ('expected ' + i(obj) + ' to exist'), stackStartFunction: should.exist
});
}
};
should.not = {};
/**
* Asserts _obj_ does not exist, with optional message.
*
* @name not.exist
* @static
* @memberOf should
* @category assertion assert
* @alias should.not.exists
* @param {*} obj
* @param {String} [msg]
* @example
*
* should.not.exist(null);
* should.not.exist(void 0);
*/
should.not.exist = should.not.exists = function(obj, msg) {
if(null != obj) {
throw new AssertionError({
message: msg || ('expected ' + i(obj) + ' to not exist'), stackStartFunction: should.not.exist
});
}
};
};
|
/// Copyright (c) 2012 Ecma International. All rights reserved.
/**
* @path ch15/15.2/15.2.3/15.2.3.6/15.2.3.6-4-372.js
* @description ES5 Attributes - success to update [[Enumerable]] attribute of data property ([[Writable]] is false, [[Enumerable]] is false, [[Configurable]] is true) to different value
*/
function testcase() {
var obj = {};
Object.defineProperty(obj, "prop", {
value: 2010,
writable: false,
enumerable: false,
configurable: true
});
var propertyDefineCorrect = obj.hasOwnProperty("prop");
var desc1 = Object.getOwnPropertyDescriptor(obj, "prop");
Object.defineProperty(obj, "prop", {
enumerable: true
});
var desc2 = Object.getOwnPropertyDescriptor(obj, "prop");
return propertyDefineCorrect && desc1.enumerable === false && obj.prop === 2010 && desc2.enumerable === true;
}
runTestCase(testcase);
|
import _ from 'underscore';
import path from 'path';
import Promise from 'bluebird';
import fs from 'fs';
import util from './Util';
import resources from './ResourcesUtil';
var DockerMachine = {
command: function () {
return resources.dockerMachine();
},
name: function () {
return 'default';
},
isoversion: function (machineName = this.name()) {
try {
var data = fs.readFileSync(path.join(util.home(), '.docker', 'machine', 'machines', machineName, 'boot2docker.iso'), 'utf8');
var match = data.match(/Boot2Docker-v(\d+\.\d+\.\d+)/);
if (match) {
return match[1];
} else {
return null;
}
} catch (err) {
return null;
}
},
info: function (machineName = this.name()) {
return util.exec([this.command(), 'ls']).then(stdout => {
var lines = stdout.trim().split('\n').filter(line => line.indexOf('time=') === -1);
var machines = {};
lines.slice(1, lines.length).forEach(line => {
var tokens = line.trim().split(/[\s]+/).filter(token => token !== '*');
var machine = {
name: tokens[0],
driver: tokens[1],
state: tokens[2],
url: tokens[3] || ''
};
machines[machine.name] = machine;
});
if (machines[machineName]) {
return Promise.resolve(machines[machineName]);
} else {
return Promise.reject(new Error('Machine does not exist.'));
}
});
},
exists: function (machineName = this.name()) {
return this.info(machineName).then(() => {
return true;
}).catch(() => {
return false;
});
},
create: function (machineName = this.name()) {
return util.exec([this.command(), '-D', 'create', '-d', 'virtualbox', '--virtualbox-memory', '2048', machineName]);
},
start: function (machineName = this.name()) {
return util.exec([this.command(), '-D', 'start', machineName]);
},
stop: function (machineName = this.name()) {
return util.exec([this.command(), 'stop', machineName]);
},
upgrade: function (machineName = this.name()) {
return util.exec([this.command(), 'upgrade', machineName]);
},
rm: function (machineName = this.name()) {
return util.exec([this.command(), 'rm', '-f', machineName]);
},
ip: function (machineName = this.name()) {
return util.exec([this.command(), 'ip', machineName]).then(stdout => {
return Promise.resolve(stdout.trim().replace('\n', ''));
});
},
regenerateCerts: function (machineName = this.name()) {
return util.exec([this.command(), 'tls-regenerate-certs', '-f', machineName]);
},
state: function (machineName = this.name()) {
return this.info(machineName).then(info => {
return info ? info.state : null;
});
},
disk: function (machineName = this.name()) {
return util.exec([this.command(), 'ssh', machineName, 'df']).then(stdout => {
try {
var lines = stdout.split('\n');
var dataline = _.find(lines, function (line) {
return line.indexOf('/dev/sda1') !== -1;
});
var tokens = dataline.split(' ');
tokens = tokens.filter(function (token) {
return token !== '';
});
var usedGb = parseInt(tokens[2], 10) / 1000000;
var totalGb = parseInt(tokens[3], 10) / 1000000;
var percent = parseInt(tokens[4].replace('%', ''), 10);
return {
used_gb: usedGb.toFixed(2),
total_gb: totalGb.toFixed(2),
percent: percent
};
} catch (err) {
return Promise.reject(err);
}
});
},
memory: function (machineName = this.name()) {
return util.exec([this.command(), 'ssh', machineName, 'free -m']).then(stdout => {
try {
var lines = stdout.split('\n');
var dataline = _.find(lines, function (line) {
return line.indexOf('-/+ buffers') !== -1;
});
var tokens = dataline.split(' ');
tokens = tokens.filter(function(token) {
return token !== '';
});
var usedGb = parseInt(tokens[2], 10) / 1000;
var freeGb = parseInt(tokens[3], 10) / 1000;
var totalGb = usedGb + freeGb;
var percent = Math.round(usedGb / totalGb * 100);
return {
used_gb: usedGb.toFixed(2),
total_gb: totalGb.toFixed(2),
free_gb: freeGb.toFixed(2),
percent: percent
};
} catch (err) {
return Promise.reject(err);
}
});
},
stats: function (machineName = this.name()) {
this.state(machineName).then(state => {
if (state === 'Stopped') {
return Promise.resolve({state: state});
}
var memory = this.memory();
var disk = this.disk();
return Promise.all([memory, disk]).spread((memory, disk) => {
return Promise.resolve({
memory: memory,
disk: disk
});
});
});
},
dockerTerminal: function (cmd, machineName = this.name()) {
if(util.isWindows()) {
cmd = cmd || '';
this.info(machineName).then(machine => {
util.exec('start powershell.exe ' + cmd,
{env: {
'DOCKER_HOST' : machine.url,
'DOCKER_CERT_PATH' : path.join(util.home(), '.docker/machine/machines/' + machine.name),
'DOCKER_TLS_VERIFY': 1
}
});
});
} else {
cmd = cmd || process.env.SHELL;
this.info(machineName).then(machine => {
util.exec([resources.terminal(), `DOCKER_HOST=${machine.url} DOCKER_CERT_PATH=${path.join(util.home(), '.docker/machine/machines/' + machine.name)} DOCKER_TLS_VERIFY=1 ${cmd}`]).then(() => {});
});
}
},
};
module.exports = DockerMachine;
|
/// <reference path="jquery-1.8.2.js" />
/// <reference name="MicrosoftAjax.js" />
/// <reference path="~/_layouts/15/init.js" />
/// <reference path="~/_layouts/15/SP.Core.js" />
/// <reference path="~/_layouts/15/SP.Runtime.js" />
/// <reference path="~/_layouts/15/SP.UI.Dialog.js" />
/// <reference path="~/_layouts/15/SP.js" />
|
/*
* EJS Embedded JavaScript templates
* Copyright 2112 Matthew Eernisse (mde@fleegix.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
/**
* Private utility functions
* @module utils
* @private
*/
'use strict';
var regExpChars = /[|\\{}()[\]^$+*?.]/g;
/**
* Escape characters reserved in regular expressions.
*
* If `string` is `undefined` or `null`, the empty string is returned.
*
* @param {String} string Input string
* @return {String} Escaped string
* @static
* @private
*/
exports.escapeRegExpChars = function (string) {
// istanbul ignore if
if (!string) {
return '';
}
return String(string).replace(regExpChars, '\\$&');
};
var _ENCODE_HTML_RULES = {
'&': '&',
'<': '<',
'>': '>',
'"': '"',
"'": '''
};
var _MATCH_HTML = /[&<>'"]/g;
function encode_char(c) {
return _ENCODE_HTML_RULES[c] || c;
}
/**
* Stringified version of constants used by {@link module:utils.escapeXML}.
*
* It is used in the process of generating {@link ClientFunction}s.
*
* @readonly
* @type {String}
*/
var escapeFuncStr =
'var _ENCODE_HTML_RULES = {\n'
+ ' "&": "&"\n'
+ ' , "<": "<"\n'
+ ' , ">": ">"\n'
+ ' , \'"\': """\n'
+ ' , "\'": "'"\n'
+ ' }\n'
+ ' , _MATCH_HTML = /[&<>\'"]/g;\n'
+ 'function encode_char(c) {\n'
+ ' return _ENCODE_HTML_RULES[c] || c;\n'
+ '};\n';
/**
* Escape characters reserved in XML.
*
* If `markup` is `undefined` or `null`, the empty string is returned.
*
* @implements {EscapeCallback}
* @param {String} markup Input string
* @return {String} Escaped string
* @static
* @private
*/
exports.escapeXML = function (markup) {
return markup == undefined
? ''
: String(markup)
.replace(_MATCH_HTML, encode_char);
};
exports.escapeXML.toString = function () {
return Function.prototype.toString.call(this) + ';\n' + escapeFuncStr;
};
/**
* Naive copy of properties from one object to another.
* Does not recurse into non-scalar properties
* Does not check to see if the property has a value before copying
*
* @param {Object} to Destination object
* @param {Object} from Source object
* @return {Object} Destination object
* @static
* @private
*/
exports.shallowCopy = function (to, from) {
from = from || {};
for (var p in from) {
to[p] = from[p];
}
return to;
};
/**
* Naive copy of a list of key names, from one object to another.
* Only copies property if it is actually defined
* Does not recurse into non-scalar properties
*
* @param {Object} to Destination object
* @param {Object} from Source object
* @param {Array} list List of properties to copy
* @return {Object} Destination object
* @static
* @private
*/
exports.shallowCopyFromList = function (to, from, list) {
for (var i = 0; i < list.length; i++) {
var p = list[i];
if (typeof from[p] != 'undefined') {
to[p] = from[p];
}
}
return to;
};
/**
* Simple in-process cache implementation. Does not implement limits of any
* sort.
*
* @implements Cache
* @static
* @private
*/
exports.cache = {
_data: {},
set: function (key, val) {
this._data[key] = val;
},
get: function (key) {
return this._data[key];
},
reset: function () {
this._data = {};
}
};
|
/*jshint node:true*/
var ModelBlueprint = require('../model');
var testInfo = require('../../lib/utilities/test-info');
module.exports = {
description: 'Generates a model unit test.',
locals: function(options) {
var result = ModelBlueprint.locals.apply(this, arguments);
result.friendlyDescription = testInfo.description(options.entity.name, "Unit", "Model");
return result;
}
};
|
var assert = require('assert');
var R = require('..');
describe('divide', function() {
it('divides two numbers', function() {
assert.strictEqual(R.divide(28, 7), 4);
});
it('is curried', function() {
var into28 = R.divide(28);
assert.strictEqual(into28(7), 4);
});
it('behaves right curried when passed `R.__` for its first argument', function() {
var half = R.divide(R.__, 2);
assert.strictEqual(half(40), 20);
});
});
|
define({
"de":true,
"en":true
});
|
'use strict';
var AddonNodeConfig = require('js/addonNodeConfig').AddonNodeConfig;
var url = window.contextVars.node.urls.api + 'box/config/';
new AddonNodeConfig('Box', '#boxScope', url, '#boxGrid', {
onPickFolder: function(evt, item) {
evt.preventDefault();
var name = item.data.path === 'All Files' ? '/ (Full Box)' : item.data.path.replace('All Files', '');
this.selected({
name: name,
path: item.data.path,
id: item.data.id
});
return false; // Prevent event propagation
}
});
|
/*
Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'toolbar', 'sv', {
toolbarCollapse: 'Dölj verktygsfält',
toolbarExpand: 'Visa verktygsfält',
toolbarGroups: {
document: 'Dokument',
clipboard: 'Urklipp/ångra',
editing: 'Redigering',
forms: 'Formulär',
basicstyles: 'Basstilar',
paragraph: 'Paragraf',
links: 'Länkar',
insert: 'Infoga',
styles: 'Stilar',
colors: 'Färger',
tools: 'Verktyg'
},
toolbars: 'Redigera verktygsfält'
} );
|
import path from 'path';
// Filters out non .js files. Prevents
// accidental inclusion of possible hidden files
export default function(name) {
return /(\.(js)$)/i.test(path.extname(name));
};
|
import eq from './eq.js';
/**
* This function is like `assignValue` except that it doesn't assign
* `undefined` values.
*
* @private
* @param {Object} object The object to modify.
* @param {string} key The key of the property to assign.
* @param {*} value The value to assign.
*/
function assignMergeValue(object, key, value) {
if ((value !== undefined && !eq(object[key], value)) ||
(typeof key == 'number' && value === undefined && !(key in object))) {
object[key] = value;
}
}
export default assignMergeValue;
|
/*
Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/
CKEDITOR.plugins.setLang("devtools","cs",{title:"Informace o prvku",dialogName:"Název dialogového okna",tabName:"Název karty",elementId:"ID prvku",elementType:"Typ prvku"});
|
var _ = require("underscore");
var request = require("request");
var qs = require("querystring");
var uuid = require("node-uuid");
var should = require("should");
var sinon = require("sinon");
var url = require("url");
var ua = require("../lib/index.js");
var utils = require("../lib/utils.js")
var config = require("../lib/config.js")
describe("ua", function () {
describe("#_enqueue", function () {
var send;
beforeEach(function () {
send = sinon.stub(ua.Visitor.prototype, "send").callsArg(0);
});
afterEach(function () {
send.restore()
});
it("should accept arguments (type)", function () {
var tid = "UA-XXXXX-XX";
var cid = uuid.v4();
var type = Math.random().toString()
var visitor = ua(tid, cid)._enqueue(type);
send.called.should.equal(false, "#send should not have been called without a callback");
visitor._queue.length.should.equal(1, "1 tracking call should have been enqueued");
visitor._queue[0].should.have.keys(["v", "tid", "cid", "t"]);
visitor._queue[0].tid.should.equal(tid)
visitor._queue[0].cid.should.equal(cid)
visitor._queue[0].t.should.equal(type)
});
it("should accept arguments (type, fn)", function () {
var tid = "UA-XXXXX-XX";
var cid = uuid.v4();
var type = Math.random().toString()
var fn = sinon.spy()
var visitor = ua(tid, cid)._enqueue(type, fn);
send.calledOnce.should.equal(true, "#send should have been called once");
visitor._queue.length.should.equal(1, "1 tracking call should have been enqueued");
visitor._queue[0].should.have.keys(["v", "tid", "cid", "t"]);
visitor._queue[0].tid.should.equal(tid)
visitor._queue[0].cid.should.equal(cid)
visitor._queue[0].t.should.equal(type)
fn.calledOnce.should.equal(true, "callback should have been called once")
});
it("should accept arguments (type, params)", function () {
var tid = "UA-XXXXX-XX";
var cid = uuid.v4();
var type = Math.random().toString()
var params = {foo: Math.random().toString()}
var visitor = ua(tid, cid)._enqueue(type, params);
send.called.should.equal(false, "#send should not have been called without a callback");
visitor._queue.length.should.equal(1, "1 tracking call should have been enqueued");
visitor._queue[0].should.have.keys(["v", "tid", "cid", "t", "foo"]);
visitor._queue[0].tid.should.equal(tid)
visitor._queue[0].cid.should.equal(cid)
visitor._queue[0].foo.should.equal(params.foo);
});
it("should accept arguments (type, params, fn)", function () {
var tid = "UA-XXXXX-XX";
var cid = uuid.v4();
var type = Math.random().toString()
var params = {foo: Math.random().toString()}
var fn = sinon.spy()
var visitor = ua(tid, cid)._enqueue(type, params, fn);
send.calledOnce.should.equal(true, "#send should have been called once");
visitor._queue.length.should.equal(1, "1 tracking call should have been enqueued");
visitor._queue[0].should.have.keys(["v", "tid", "cid", "t", "foo"]);
visitor._queue[0].tid.should.equal(tid)
visitor._queue[0].cid.should.equal(cid)
visitor._queue[0].foo.should.equal(params.foo);
fn.calledOnce.should.equal(true, "callback should have been called once")
});
it("should continue adding to the queue", function () {
var tid = "UA-XXXXX-XX";
var cid = uuid.v4();
var type = Math.random().toString()
var visitor = ua(tid, cid)
visitor._enqueue(type);
visitor._enqueue(type);
visitor._enqueue(type);
visitor._enqueue(type);
visitor._queue.length.should.equal(4, "4 tracking calls should have been enqueued");
})
});
});
|
module.exports = function method(matchMethod) {
if (typeof matchMethod === 'string') {
matchMethod = [ matchMethod ]
}
if (!matchMethod) {
matchMethod = [ 'GET' ]
}
return function method(req, res, next) {
var notMatches = !~matchMethod.indexOf(req.method)
next(null, notMatches)
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.