text
stringlengths 2
6.14k
|
|---|
/**
* findRoutingRule - find applicable routing rule from bucket metadata
* @param {RoutingRule []} routingRules - array of routingRule objects
* @param {string} key - object key
* @param {number} [errCode] - error code to match if applicable
* @return {object | undefined} redirectInfo -- comprised of all of the
* keys/values from routingRule.getRedirect() plus
* a key of prefixFromRule and a value of routingRule.condition.keyPrefixEquals
*/
export function findRoutingRule(routingRules, key, errCode) {
if (!routingRules || routingRules.length === 0) {
return undefined;
}
// For AWS compat:
// 1) use first routing rules whose conditions are satisfied
// 2) for matching prefix no need to check closest match. first
// match wins
// 3) there can be a match for a key condition with and without
// error code condition but first one that matches will be the rule
// used. So, if prefix foo without error and first rule has error condition,
// will fall through to next foo rule. But if first foo rule has
// no error condition, will have match on first rule even if later
// there is more specific rule with error condition.
for (let i = 0; i < routingRules.length; i++) {
const prefixFromRule =
routingRules[i].getCondition().keyPrefixEquals;
const errorCodeFromRule =
routingRules[i].getCondition().httpErrorCodeReturnedEquals;
if (prefixFromRule !== undefined) {
if (!key.startsWith(prefixFromRule)) {
// no key match, move on
continue;
}
// add the prefixFromRule to the redirect info
// so we can replaceKeyPrefixWith if that is part of redirect
// rule
const redirectInfo = Object.assign({ prefixFromRule },
routingRules[i].getRedirect());
// have key match so check error code match
if (errorCodeFromRule !== undefined) {
if (errCode === errorCodeFromRule) {
return redirectInfo;
}
// if don't match on both conditions, this is not the rule
// for us
continue;
}
// if no error code condition at all, we have found our match
return redirectInfo;
}
// we have an error code condition but no key condition
if (errorCodeFromRule !== undefined) {
if (errCode === errorCodeFromRule) {
const redirectInfo = Object.assign({},
routingRules[i].getRedirect());
return redirectInfo;
}
continue;
}
return undefined;
}
return undefined;
}
/**
* extractRedirectInfo - convert location saved from x-amz-website header to
* same format as redirectInfo saved from a put bucket website configuration
* @param {string} location - location to redirect to
* @return {object} redirectInfo - select key/values stored in
* WebsiteConfiguration for a redirect -- protocol, replaceKeyWith and hostName
*/
export function extractRedirectInfo(location) {
const redirectInfo = { redirectLocationHeader: true };
if (location.startsWith('/')) {
// redirect to another object in bucket
redirectInfo.replaceKeyWith = location.slice(1);
// when redirect info is set by x-amz-website-redirect-location header
// to another key in the same bucket
// AWS only returns the path in the location response header
redirectInfo.justPath = true;
} else if (location.startsWith('https')) {
// otherwise, redirect to another website
redirectInfo.protocol = 'https';
redirectInfo.hostName = location.slice(8);
} else {
redirectInfo.protocol = 'http';
redirectInfo.hostName = location.slice(7);
}
return redirectInfo;
}
|
import React from 'react';
export default class TabsSkeleton extends React.Component {
render() {
const tab = (
<li className="wfp--tabs__nav-item">
<div className="wfp--tabs__nav-link"> </div>
</li>
);
return (
<nav className="wfp--tabs wfp--skeleton">
<div className="wfp--tabs-trigger">
<div className="wfp--tabs-trigger-text"> </div>
<svg width="10" height="5" viewBox="0 0 10 5" fill-rule="evenodd">
<path d="M10 0L5 5 0 0z" />
</svg>
</div>
<ul className="wfp--tabs__nav wfp--tabs__nav--hidden">
<li className="wfp--tabs__nav-item wfp--tabs__nav-item--selected">
<div className="wfp--tabs__nav-link"> </div>
</li>
{tab}
{tab}
{tab}
</ul>
</nav>
);
}
}
|
import { nearlyEqual as bigNearlyEqual } from '../../utils/bignumber/nearlyEqual.js'
import { nearlyEqual } from '../../utils/number.js'
import { factory } from '../../utils/factory.js'
import { createAlgorithm03 } from '../../type/matrix/utils/algorithm03.js'
import { createAlgorithm12 } from '../../type/matrix/utils/algorithm12.js'
import { createAlgorithm14 } from '../../type/matrix/utils/algorithm14.js'
import { createAlgorithm13 } from '../../type/matrix/utils/algorithm13.js'
import { createAlgorithm05 } from '../../type/matrix/utils/algorithm05.js'
const name = 'compare'
const dependencies = [
'typed',
'config',
'matrix',
'equalScalar',
'BigNumber',
'Fraction',
'DenseMatrix'
]
export const createCompare = /* #__PURE__ */ factory(name, dependencies, ({ typed, config, equalScalar, matrix, BigNumber, Fraction, DenseMatrix }) => {
const algorithm03 = createAlgorithm03({ typed })
const algorithm05 = createAlgorithm05({ typed, equalScalar })
const algorithm12 = createAlgorithm12({ typed, DenseMatrix })
const algorithm13 = createAlgorithm13({ typed })
const algorithm14 = createAlgorithm14({ typed })
/**
* Compare two values. Returns 1 when x > y, -1 when x < y, and 0 when x == y.
*
* x and y are considered equal when the relative difference between x and y
* is smaller than the configured epsilon. The function cannot be used to
* compare values smaller than approximately 2.22e-16.
*
* For matrices, the function is evaluated element wise.
* Strings are compared by their numerical value.
*
* Syntax:
*
* math.compare(x, y)
*
* Examples:
*
* math.compare(6, 1) // returns 1
* math.compare(2, 3) // returns -1
* math.compare(7, 7) // returns 0
* math.compare('10', '2') // returns 1
* math.compare('1000', '1e3') // returns 0
*
* const a = math.unit('5 cm')
* const b = math.unit('40 mm')
* math.compare(a, b) // returns 1
*
* math.compare(2, [1, 2, 3]) // returns [1, 0, -1]
*
* See also:
*
* equal, unequal, smaller, smallerEq, larger, largerEq, compareNatural, compareText
*
* @param {number | BigNumber | Fraction | Unit | string | Array | Matrix} x First value to compare
* @param {number | BigNumber | Fraction | Unit | string | Array | Matrix} y Second value to compare
* @return {number | BigNumber | Fraction | Array | Matrix} Returns the result of the comparison:
* 1 when x > y, -1 when x < y, and 0 when x == y.
*/
return typed(name, {
'boolean, boolean': function (x, y) {
return x === y ? 0 : (x > y ? 1 : -1)
},
'number, number': function (x, y) {
return nearlyEqual(x, y, config.epsilon)
? 0
: (x > y ? 1 : -1)
},
'BigNumber, BigNumber': function (x, y) {
return bigNearlyEqual(x, y, config.epsilon)
? new BigNumber(0)
: new BigNumber(x.cmp(y))
},
'Fraction, Fraction': function (x, y) {
return new Fraction(x.compare(y))
},
'Complex, Complex': function () {
throw new TypeError('No ordering relation is defined for complex numbers')
},
'Unit, Unit': function (x, y) {
if (!x.equalBase(y)) {
throw new Error('Cannot compare units with different base')
}
return this(x.value, y.value)
},
'SparseMatrix, SparseMatrix': function (x, y) {
return algorithm05(x, y, this)
},
'SparseMatrix, DenseMatrix': function (x, y) {
return algorithm03(y, x, this, true)
},
'DenseMatrix, SparseMatrix': function (x, y) {
return algorithm03(x, y, this, false)
},
'DenseMatrix, DenseMatrix': function (x, y) {
return algorithm13(x, y, this)
},
'Array, Array': function (x, y) {
// use matrix implementation
return this(matrix(x), matrix(y)).valueOf()
},
'Array, Matrix': function (x, y) {
// use matrix implementation
return this(matrix(x), y)
},
'Matrix, Array': function (x, y) {
// use matrix implementation
return this(x, matrix(y))
},
'SparseMatrix, any': function (x, y) {
return algorithm12(x, y, this, false)
},
'DenseMatrix, any': function (x, y) {
return algorithm14(x, y, this, false)
},
'any, SparseMatrix': function (x, y) {
return algorithm12(y, x, this, true)
},
'any, DenseMatrix': function (x, y) {
return algorithm14(y, x, this, true)
},
'Array, any': function (x, y) {
// use matrix implementation
return algorithm14(matrix(x), y, this, false).valueOf()
},
'any, Array': function (x, y) {
// use matrix implementation
return algorithm14(matrix(y), x, this, true).valueOf()
}
})
})
export const createCompareNumber = /* #__PURE__ */ factory(name, ['typed', 'config'], ({ typed, config }) => {
return typed(name, {
'number, number': function (x, y) {
return nearlyEqual(x, y, config.epsilon)
? 0
: (x > y ? 1 : -1)
}
})
})
|
function GetBehaviorSettings()
{
return {
"name": "Replacer",
"id": "Rex_Replacer",
"description": "Replace instancne by fade-out itself, and create the target instance then fade-in it.",
"author": "Rex.Rainbow",
"help url": "https://dl.dropbox.com/u/5779181/C2Repo/rex_replacer.html",
"category": "Rex - Movement - opacity",
"flags": bf_onlyone
};
};
//////////////////////////////////////////////////////////////
// Conditions
AddCondition(1, cf_trigger, "On fade-out started", "Fade out", "On {my} fade-out started",
"Triggered when fade-out started", "OnFadeOutStart");
AddCondition(2, cf_trigger, "On fade-out finished", "Fade out", "On {my} fade-out finished",
"Triggered when fade-out finished", "OnFadeOutFinish");
AddCondition(3, cf_trigger, "On fade-in started", "Fade in", "On {my} fade-in started",
"Triggered when fade-out started", "OnFadeInStart");
AddCondition(4, cf_trigger, "On fade-in finished", "Fade in", "On {my} fade-in finished",
"Triggered when fade-in finished", "OnFadeInFinish");
AddCondition(5, 0, "Is fade-out", "Fade out", "Is {my} fade-out",
"Return true if instance is in fade-out stage", "IsFadeOut");
AddCondition(6, 0, "Is fade-in", "Fade in", "Is {my} fade-in",
"Return true if instance is in fade-in stage", "IsFadeIn");
AddCondition(7, 0, "Is idle", "Idle", "Is {my} idle",
"Return true if instance is in idle stage", "IsIdle");
//////////////////////////////////////////////////////////////
// Actions
AddObjectParam("Target", "Target type of replacing instance.");
AddAction(1, 0, "Replace instance", "Replace",
"{my} Replace to {0}","Replace instance.", "ReplaceInst");
AddStringParam("Target", "Target type in nickname of replacing instance.", '""');
AddAction(2, 0, "Replace instance to nickname type", "Replace",
"Replace {my} to nickname: <i>{0}</i>","Replace instance to nickname type.", "ReplaceInst");
AddNumberParam("Duration", "Duration of fade-out or fade in, in seconds.");
AddAction(3, 0, "Set duration", "Configure", "Set {my} fade duration to <i>{0}</i>", "Set the object's fade duration.", "SetDuration");
//////////////////////////////////////////////////////////////
// Expressions
AddExpression(1, ef_return_number, "Get UID of replacing instance", "UID", "ReplacingInstUID",
"The UID of replacing instanc, return -1 if the replacing does not start.");
AddExpression(2, ef_return_number, "Get UID of replacing instance", "UID", "ReplacingInstUID",
"The UID of replacing instanc, return -1 if the replacing does not start.");
ACESDone();
// Property grid properties for this plugin
var property_list = [
new cr.Property(ept_float, "Fade duration", 1, "Duration of fade-out or fade-in, in seconds."),
];
// Called by IDE when a new behavior type is to be created
function CreateIDEBehaviorType()
{
return new IDEBehaviorType();
}
// Class representing a behavior type in the IDE
function IDEBehaviorType()
{
assert2(this instanceof arguments.callee, "Constructor called as a function");
}
// Called by IDE when a new behavior instance of this type is to be created
IDEBehaviorType.prototype.CreateInstance = function(instance)
{
return new IDEInstance(instance, this);
}
// Class representing an individual instance of an object in the IDE
function IDEInstance(instance, type)
{
assert2(this instanceof arguments.callee, "Constructor called as a function");
// Save the constructor parameters
this.instance = instance;
this.type = type;
// Set the default property values from the property table
this.properties = {};
for (var i = 0; i < property_list.length; i++)
this.properties[property_list[i].name] = property_list[i].initial_value;
}
// Called by the IDE after all initialization on this instance has been completed
IDEInstance.prototype.OnCreate = function()
{
}
// Called by the IDE after a property has been changed
IDEInstance.prototype.OnPropertyChanged = function(property_name)
{
// Clamp values
if (this.properties["Fade duration"] < 0)
this.properties["Fade duration"] = 0;
}
|
/**
* @license
* Copyright 2015 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.
*/
CLASS({
package: 'foam.u2.md',
name: 'CitationView',
extends: 'foam.u2.md.DetailView',
imports: [
'dynamic',
],
properties: [
{
name: 'data',
postSet: function(old, nu) {
if (old !== nu && nu)
this.model = nu.model_;
},
},
{
name: 'model',
postSet: function(old, nu) {
if (this.prop && old === nu) return;
this.prop = this.pickNameProperty();
},
},
{
name: 'prop',
documentation: 'The name of the selected property.',
},
],
methods: [
function pickNameProperty() {
var prop = this.model.getFeature('label') || this.model.getFeature('name');
if (!prop) {
var props = this.model.getRuntimeProperties();
var stringProps = [];
for (var i = 0; i < props.length; i++) {
var p = props[i];
if (! p.hidden && p.name !== 'id' && p.model_.id === 'Property' || p.model_.id === 'StringProperty') {
stringProps.push(p);
}
}
for (var i = 0; i < stringProps.length; i++) {
var p = stringProps[i];
var pname = p.name.toLowerCase();
if (pname.indexOf('name') > -1 || pname.indexOf('label') > -1) {
prop = p;
break;
}
}
if (!prop && stringProps.length) prop = stringProps[0];
}
return prop ? prop.name : 'id';
}
],
templates: [
function CSS() {/*
^ {
align-items: center;
border-bottom: 1px solid #eee;
display: flex;
min-height: 48px;
padding: 16px;
}
*/},
function initE() {/*#U2
<div class="^">
{{this.dynamic(function(data, prop) {
return data ? data.propertyValue(prop) : '';
}, this.data$, this.prop$)}}
</div>
*/},
]
});
|
import { factory } from '../../../utils/factory.js'
import { createSolveValidation } from './utils/solveValidation.js'
const name = 'lsolveAll'
const dependencies = [
'typed',
'matrix',
'divideScalar',
'multiplyScalar',
'subtract',
'equalScalar',
'DenseMatrix'
]
export const createLsolveAll = /* #__PURE__ */ factory(name, dependencies, ({ typed, matrix, divideScalar, multiplyScalar, subtract, equalScalar, DenseMatrix }) => {
const solveValidation = createSolveValidation({ DenseMatrix })
/**
* Finds all solutions of a linear equation system by forwards substitution. Matrix must be a lower triangular matrix.
*
* `L * x = b`
*
* Syntax:
*
* math.lsolveAll(L, b)
*
* Examples:
*
* const a = [[-2, 3], [2, 1]]
* const b = [11, 9]
* const x = lsolveAll(a, b) // [ [[-5.5], [20]] ]
*
* See also:
*
* lsolve, lup, slu, usolve, lusolve
*
* @param {Matrix, Array} L A N x N matrix or array (L)
* @param {Matrix, Array} b A column vector with the b values
*
* @return {DenseMatrix[] | Array[]} An array of affine-independent column vectors (x) that solve the linear system
*/
return typed(name, {
'SparseMatrix, Array | Matrix': function (m, b) {
return _sparseForwardSubstitution(m, b)
},
'DenseMatrix, Array | Matrix': function (m, b) {
return _denseForwardSubstitution(m, b)
},
'Array, Array | Matrix': function (a, b) {
const m = matrix(a)
const R = _denseForwardSubstitution(m, b)
return R.map(r => r.valueOf())
}
})
function _denseForwardSubstitution (m, b_) {
// the algorithm is derived from
// https://www.overleaf.com/read/csvgqdxggyjv
// array of right-hand sides
const B = [solveValidation(m, b_, true)._data.map(e => e[0])]
const M = m._data
const rows = m._size[0]
const columns = m._size[1]
// loop columns
for (let i = 0; i < columns; i++) {
let L = B.length
// loop right-hand sides
for (let k = 0; k < L; k++) {
const b = B[k]
if (!equalScalar(M[i][i], 0)) {
// non-singular row
b[i] = divideScalar(b[i], M[i][i])
for (let j = i + 1; j < columns; j++) {
// b[j] -= b[i] * M[j,i]
b[j] = subtract(b[j], multiplyScalar(b[i], M[j][i]))
}
} else if (!equalScalar(b[i], 0)) {
// singular row, nonzero RHS
if (k === 0) {
// There is no valid solution
return []
} else {
// This RHS is invalid but other solutions may still exist
B.splice(k, 1)
k -= 1
L -= 1
}
} else if (k === 0) {
// singular row, RHS is zero
const bNew = [...b]
bNew[i] = 1
for (let j = i + 1; j < columns; j++) {
bNew[j] = subtract(bNew[j], M[j][i])
}
B.push(bNew)
}
}
}
return B.map(x => new DenseMatrix({ data: x.map(e => [e]), size: [rows, 1] }))
}
function _sparseForwardSubstitution (m, b_) {
// array of right-hand sides
const B = [solveValidation(m, b_, true)._data.map(e => e[0])]
const rows = m._size[0]
const columns = m._size[1]
const values = m._values
const index = m._index
const ptr = m._ptr
// loop columns
for (let i = 0; i < columns; i++) {
let L = B.length
// loop right-hand sides
for (let k = 0; k < L; k++) {
const b = B[k]
// values & indices (column i)
const iValues = []
const iIndices = []
// first & last indeces in column
const firstIndex = ptr[i]
const lastIndex = ptr[i + 1]
// find the value at [i, i]
let Mii = 0
for (let j = firstIndex; j < lastIndex; j++) {
const J = index[j]
// check row
if (J === i) {
Mii = values[j]
} else if (J > i) {
// store lower triangular
iValues.push(values[j])
iIndices.push(J)
}
}
if (!equalScalar(Mii, 0)) {
// non-singular row
b[i] = divideScalar(b[i], Mii)
for (let j = 0, lastIndex = iIndices.length; j < lastIndex; j++) {
const J = iIndices[j]
b[J] = subtract(b[J], multiplyScalar(b[i], iValues[j]))
}
} else if (!equalScalar(b[i], 0)) {
// singular row, nonzero RHS
if (k === 0) {
// There is no valid solution
return []
} else {
// This RHS is invalid but other solutions may still exist
B.splice(k, 1)
k -= 1
L -= 1
}
} else if (k === 0) {
// singular row, RHS is zero
const bNew = [...b]
bNew[i] = 1
for (let j = 0, lastIndex = iIndices.length; j < lastIndex; j++) {
const J = iIndices[j]
bNew[J] = subtract(bNew[J], iValues[j])
}
B.push(bNew)
}
}
}
return B.map(x => new DenseMatrix({ data: x.map(e => [e]), size: [rows, 1] }))
}
})
|
var component
function help() {
return component = Qt.createComponent("NearbyDevices.qml");
}
|
/**
* @license
* Copyright 2018 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @fileoverview Zelos theme.
*/
'use strict';
/**
* Zelos theme.
* @namespace Blockly.Themes.Zelos
*/
goog.module('Blockly.Themes.Zelos');
const {Theme} = goog.require('Blockly.Theme');
const defaultBlockStyles = {
'colour_blocks': {
'colourPrimary': '#CF63CF',
'colourSecondary': '#C94FC9',
'colourTertiary': '#BD42BD',
},
'list_blocks': {
'colourPrimary': '#9966FF',
'colourSecondary': '#855CD6',
'colourTertiary': '#774DCB',
},
'logic_blocks': {
'colourPrimary': '#4C97FF',
'colourSecondary': '#4280D7',
'colourTertiary': '#3373CC',
},
'loop_blocks': {
'colourPrimary': '#0fBD8C',
'colourSecondary': '#0DA57A',
'colourTertiary': '#0B8E69',
},
'math_blocks': {
'colourPrimary': '#59C059',
'colourSecondary': '#46B946',
'colourTertiary': '#389438',
},
'procedure_blocks': {
'colourPrimary': '#FF6680',
'colourSecondary': '#FF4D6A',
'colourTertiary': '#FF3355',
},
'text_blocks': {
'colourPrimary': '#FFBF00',
'colourSecondary': '#E6AC00',
'colourTertiary': '#CC9900',
},
'variable_blocks': {
'colourPrimary': '#FF8C1A',
'colourSecondary': '#FF8000',
'colourTertiary': '#DB6E00',
},
'variable_dynamic_blocks': {
'colourPrimary': '#FF8C1A',
'colourSecondary': '#FF8000',
'colourTertiary': '#DB6E00',
},
'hat_blocks': {
'colourPrimary': '#4C97FF',
'colourSecondary': '#4280D7',
'colourTertiary': '#3373CC',
'hat': 'cap',
},
};
const categoryStyles = {
'colour_category': {'colour': '#CF63CF'},
'list_category': {'colour': '#9966FF'},
'logic_category': {'colour': '#4C97FF'},
'loop_category': {'colour': '#0fBD8C'},
'math_category': {'colour': '#59C059'},
'procedure_category': {'colour': '#FF6680'},
'text_category': {'colour': '#FFBF00'},
'variable_category': {'colour': '#FF8C1A'},
'variable_dynamic_category': {'colour': '#FF8C1A'},
};
/**
* Zelos theme.
* @type {Theme}
* @alias Blockly.Themes.Zelos
*/
const Zelos = new Theme('zelos', defaultBlockStyles, categoryStyles);
exports.Zelos = Zelos;
|
Controller = undefined;
|
/* */
"use strict";
var Subject_1 = require('../Subject');
var multicast_1 = require('./multicast');
function publish(selector) {
return selector ? multicast_1.multicast.call(this, function() {
return new Subject_1.Subject();
}, selector) : multicast_1.multicast.call(this, new Subject_1.Subject());
}
exports.publish = publish;
|
/*
* L.Marker is used to display clickable/draggable icons on the map.
*/
L.Marker = L.Class.extend({
includes: L.Mixin.Events,
options: {
icon: new L.Icon(),
title: '',
clickable: true,
draggable: false
},
initialize: function(latlng, options) {
L.Util.setOptions(this, options);
this._latlng = latlng;
},
onAdd: function(map) {
this._map = map;
this._initIcon();
map.on('viewreset', this._reset, this);
this._reset();
},
onRemove: function(map) {
this._removeIcon();
// TODO move to Marker.Popup.js
if (this.closePopup) {
this.closePopup();
}
map.off('viewreset', this._reset, this);
},
getLatLng: function() {
return this._latlng;
},
setLatLng: function(latlng) {
this._latlng = latlng;
if (this._icon) {
this._reset();
}
},
setIcon: function(icon) {
this._removeIcon();
this._icon = this._shadow = null;
this.options.icon = icon;
this._initIcon();
this._reset();
},
_initIcon: function() {
if (!this._icon) {
this._icon = this.options.icon.createIcon();
if (this.options.title) {
this._icon.title = this.options.title;
}
this._initInteraction();
}
if (!this._shadow) {
this._shadow = this.options.icon.createShadow();
}
this._map._panes.markerPane.appendChild(this._icon);
if (this._shadow) {
this._map._panes.shadowPane.appendChild(this._shadow);
}
},
_removeIcon: function() {
this._map._panes.markerPane.removeChild(this._icon);
if (this._shadow) {
this._map._panes.shadowPane.removeChild(this._shadow);
}
},
_reset: function() {
var pos = this._map.latLngToLayerPoint(this._latlng).round();
L.DomUtil.setPosition(this._icon, pos);
if (this._shadow) {
L.DomUtil.setPosition(this._shadow, pos);
}
this._icon.style.zIndex = pos.y;
},
_initInteraction: function() {
if (this.options.clickable) {
this._icon.className += ' leaflet-clickable';
L.DomEvent.addListener(this._icon, 'click', this._onMouseClick, this);
var events = ['dblclick', 'mousedown', 'mouseover', 'mouseout'];
for (var i = 0; i < events.length; i++) {
L.DomEvent.addListener(this._icon, events[i], this._fireMouseEvent, this);
}
}
if (L.Handler.MarkerDrag) {
this.dragging = new L.Handler.MarkerDrag(this);
if (this.options.draggable) {
this.dragging.enable();
}
}
},
_onMouseClick: function(e) {
L.DomEvent.stopPropagation(e);
if (this.dragging && this.dragging.moved()) { return; }
this.fire(e.type);
},
_fireMouseEvent: function(e) {
this.fire(e.type);
L.DomEvent.stopPropagation(e);
}
});
|
var stream = require('stream');
var util = require('util');
function combineTarget(){
stream.Writable.call(this);
this.file = '';
}
util.inherits(combineTarget,stream.Writable);
combineTarget.prototype._write = function(chunk,encoding,callback){
this.file += chunk.toString();
callback();
};
module.exports = combineTarget;
|
// Copyright (C) 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 23.1.3.6
description: >
Throws a TypeError if `this` is a WeakMap object.
info: |
Map.prototype.get ( key )
...
3. If M does not have a [[MapData]] internal slot, throw a TypeError
exception.
...
features: [WeakMap]
---*/
assert.throws(TypeError, function() {
Map.prototype.get.call(new WeakMap(), 1);
});
assert.throws(TypeError, function() {
var m = new Map();
m.get.call(new WeakMap(), 1);
});
|
goog.provide('ol.test.color');
goog.require('ol.color');
describe('ol.color', function() {
describe('ol.color.asArray()', function() {
it('returns the same for an array', function() {
var color = [1, 2, 3, 0.4];
var got = ol.color.asArray(color);
expect(got).to.be(color);
});
it('returns an array given an rgba string', function() {
var color = ol.color.asArray('rgba(1,2,3,0.4)');
expect(color).to.eql([1, 2, 3, 0.4]);
});
it('returns an array given an rgb string', function() {
var color = ol.color.asArray('rgb(1,2,3)');
expect(color).to.eql([1, 2, 3, 1]);
});
it('returns an array given a hex string', function() {
var color = ol.color.asArray('#00ccff');
expect(color).to.eql([0, 204, 255, 1]);
});
});
describe('ol.color.asString()', function() {
it('returns the same for a string', function() {
var color = 'rgba(0,1,2,0.3)';
var got = ol.color.asString(color);
expect(got).to.be(color);
});
it('returns a string given an rgba array', function() {
var color = ol.color.asString([1, 2, 3, 0.4]);
expect(color).to.eql('rgba(1,2,3,0.4)');
});
it('returns a string given an rgb array', function() {
var color = ol.color.asString([1, 2, 3]);
expect(color).to.eql('rgba(1,2,3,1)');
});
});
describe('ol.color.fromString', function() {
before(function() {
sinon.spy(ol.color, 'fromStringInternal_');
});
after(function() {
ol.color.fromStringInternal_.restore();
});
if (ol.ENABLE_NAMED_COLORS) {
it('can parse named colors', function() {
expect(ol.color.fromString('red')).to.eql([255, 0, 0, 1]);
});
}
it('can parse 3-digit hex colors', function() {
expect(ol.color.fromString('#087')).to.eql([0, 136, 119, 1]);
});
it('can parse 6-digit hex colors', function() {
expect(ol.color.fromString('#56789a')).to.eql([86, 120, 154, 1]);
});
it('can parse rgb colors', function() {
expect(ol.color.fromString('rgb(0, 0, 255)')).to.eql([0, 0, 255, 1]);
});
it('can parse rgba colors', function() {
expect(ol.color.fromString('rgba(255, 255, 0, 0.1)')).to.eql(
[255, 255, 0, 0.1]);
});
it('caches parsed values', function() {
var count = ol.color.fromStringInternal_.callCount;
ol.color.fromString('aquamarine');
expect(ol.color.fromStringInternal_.callCount).to.be(count + 1);
ol.color.fromString('aquamarine');
expect(ol.color.fromStringInternal_.callCount).to.be(count + 1);
});
it('throws an error on invalid colors', function() {
var invalidColors = ['tuesday', '#1234567', 'rgb(255.0,0,0)'];
var i, ii;
for (i = 0, ii < invalidColors.length; i < ii; ++i) {
expect(function() {
ol.color.fromString(invalidColors[i]);
}).to.throwException();
}
});
});
describe('ol.color.normalize', function() {
it('clamps out-of-range channels', function() {
expect(ol.color.normalize([-1, 256, 0, 2])).to.eql([0, 255, 0, 1]);
});
it('rounds color channels to integers', function() {
expect(ol.color.normalize([1.2, 2.5, 3.7, 1])).to.eql([1, 3, 4, 1]);
});
});
describe('ol.color.toString', function() {
it('converts valid colors', function() {
expect(ol.color.toString([1, 2, 3, 0.4])).to.be('rgba(1,2,3,0.4)');
});
it('rounds to integers if needed', function() {
expect(ol.color.toString([1.2, 2.5, 3.7, 0.4])).to.be('rgba(1,3,4,0.4)');
});
it('sets default alpha value if undefined', function() {
expect(ol.color.toString([0, 0, 0])).to.be('rgba(0,0,0,1)');
});
});
});
|
// Copyright 2008 Google Inc. All Rights Reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
var alias = eval;
function e(s) { return alias(s); }
assertEquals(42, e("42"));
assertEquals(Object, e("Object"));
assertEquals(e, e("e"));
var caught = false;
try {
e('s'); // should throw exception since aliased eval is global
} catch (e) {
caught = true;
assertTrue(e instanceof ReferenceError);
}
assertTrue(caught);
|
window.jQuery = window.$ = require('jquery');
require('bootstrap');
require('bootstrap/dist/js/bootstrap.js');
require('bootstrap/dist/css/bootstrap.css');
require('file?name=[name].[ext]!bootstrap/dist/css/bootstrap.css.map');
require('yii2-pjax');
require('yii');
require('yii.validation');
require('yii.activeForm');
require('yii.gridView');
require('yii.captcha');
|
/*
Language: Tagger Script
Author: Philipp Wolfer <ph.wolfer@gmail.com>
Description: Syntax Highlighting for the Tagger Script as used by MusicBrainz Picard.
Website: https://picard.musicbrainz.org
*/
function(hljs) {
var COMMENT = {
className: 'comment',
begin: /\$noop\(/,
end: /\)/,
contains: [{
begin: /\(/,
end: /\)/,
contains: ['self', {
begin: /\\./
}]
}],
relevance: 10
};
var FUNCTION = {
className: 'keyword',
begin: /\$(?!noop)[a-zA-Z][_a-zA-Z0-9]*/,
end: /\(/,
excludeEnd: true
};
var VARIABLE = {
className: 'variable',
begin: /%[_a-zA-Z0-9:]*/,
end: '%'
};
var ESCAPE_SEQUENCE = {
className: 'symbol',
begin: /\\./
};
return {
contains: [
COMMENT,
FUNCTION,
VARIABLE,
ESCAPE_SEQUENCE
]
};
}
|
#!/usr/bin/env node
//
var fs = require('fs'),
path = require('path'),
http = require('http'),
BufferStream = require('bufferstream'),
// http://www.ksu.ru/eng/departments/ktk/test/perl/lib/unicode/UCDFF301.html
keys = ['value', 'name', 'category', 'class',
'bidirectional_category', 'mapping', 'decimal_digit_value', 'digit_value',
'numeric_value', 'mirrored', 'unicode_name', 'comment', 'uppercase_mapping',
'lowercase_mapping', 'titlecase_mapping'],
systemfiles = [
"UnicodeData.txt"
],
refs = 0;
// based on https://github.com/mathiasbynens/jsesc
function escape(charValue) {
var hexadecimal = charValue.replace(/^0*/, ''); // is already in hexadecimal
var longhand = hexadecimal.length > 2;
return '\\' + (longhand ? 'u' : 'x') +
('0000' + hexadecimal).slice(longhand ? -4 : -2);
}
function stringify(key, value) {
return key + ":" + JSON.stringify(value).replace(/\\\\(u|x)/, "\\$1");
}
function newFile(name, callback) {
var filename = path.join(__dirname, "category", name + ".js"),
file = fs.createWriteStream(filename, {encoding:'utf8'});
file.once('close', function () {
if (!--refs) {
console.log("done.");
callback();
}
});
refs++;
return file;
}
function parser(callback) {
var data = {},
buffer = new BufferStream({encoding:'utf8', size:'flexible'}),
resume = buffer.resume.bind(buffer);
buffer.split('\n', function (line) {
var v, c, char = {},
values = line.toString().split(';');
for(var i = 0 ; i < 15 ; i++)
char[keys[i]] = values[i];
v = parseInt(char.value, 16);
char.symbol = escape(char.value);
c = char.category;
if (!data[c]) {
data[c] = newFile(c, callback)
.on('drain', resume)
.once('open', function () {
console.log("saving data as %s.js …", c);
if (this.write('module.exports={' + stringify(v, char)))
buffer.resume();
});
buffer.pause();
} else if (!data[c].write("," + stringify(v, char))) {
buffer.pause();
}
});
buffer.on('end', function () {
var cat, categories = Object.keys(data),
len = categories.length;
for(var i = 0 ; i < len ; i++) {
cat = categories[i];
data[cat].end("};");
}
});
buffer.on('error', function (err) {
if (typeof err === 'string')
err = new Error(err);
throw err;
});
return buffer;
}
function read_file(success_cb, error_cb) {
var systemfile, sysfiles = systemfiles.slice(),
try_reading = function (success, error) {
systemfile = sysfiles.shift();
if (!systemfile) return error_cb();
console.log("try to read file %s …", systemfile);
fs.exists(systemfile, function (exists) {
if (!exists) {
console.error("%s not found.", systemfile);
return try_reading(success_cb, error_cb);
}
console.log("parsing …");
fs.createReadStream(systemfile, {encoding:'utf8'}).pipe(parser(success_cb));
});
};
try_reading(success_cb, error_cb);
}
// run
if (!module.parent) { // not required
read_file(process.exit, process.exit);
} else {
module.exports = {
escape:escape,
stringify:stringify,
newFile:newFile,
parser:parser,
read_file:read_file
};
}
|
module.exports = function (grunt) {
var packageVersion = require('../../package.json').version;
/* -------------
RELEASE
------------- */
grunt.registerTask('notes', 'Run a ruby gem that will request from Github unreleased pull requests', ['prompt:generatelogsmanually']);
grunt.registerTask('updateRelease', '', function () {
packageVersion = require('../../package.json').version;
});
// Maintainers: Run prior to a release. Includes SauceLabs VM tests.
grunt.registerTask('release', 'Release a new version, push it and publish it', function () {
grunt.log.write('Welcome to the FUEL UX Release process.\n');
grunt.log.write('\n');
grunt.log.write('Please review and complete prerequisites in RELEASE.md.\n');
grunt.log.write('\n');
grunt.log.write('Please make sure you are not on VPN.\n');
grunt.log.write('\n');
// default variables for release task
var releaseDefaults = {
release: {
files: ['dist', 'README.md', 'CONTRIBUTING.md', 'bower.json', 'package.json', 'reference/dist'],
localBranch: 'release',
remoteBaseBranch: 'master',
remoteDestinationBranch: '3.x',
remoteRepository: 'upstream'
}
};
// add releaseDefaults
grunt.config.merge(releaseDefaults);
if (!grunt.file.exists('SAUCE_API_KEY.yml')) {
grunt.log.write('The file SAUCE_API_KEY.yml is needed in order to run tests in SauceLabs.'.red.bold +
' Please contact another maintainer to obtain this file.');
}
if (typeof grunt.config('cdnLoginFile') === 'undefined') {
grunt.log.write('The file FUEL_CDN.yml is needed in order to upload the release files to the CDN.'.red.bold +
' Please contact another maintainer to obtain this file.');
}
// update local variable to make sure build prompt is using temp branch's package version
grunt.task.run(
[
'prompt:logoffvpn',
'prompt:rannpminstall',
'prompt:rangrunttest',
'prompt:ransauce',
'prompt:createmilestone',
'prompt:bumpmilestones',
'prompt:closemilestone',
'prompt:startrelease',
'prompt:tempbranch',
'shell:checkoutRemoteReleaseBranch',
'updateRelease',
'prompt:build',
'dorelease'
]
);
});
grunt.registerTask('dorelease', '', function () {
grunt.log.writeln('');
if (!grunt.option('no-tests')) {
grunt.task.run(['releasetest']); // If phantom timeouts happening because of long-running qunit tests, look into setting `resourceTimeout` in phantom: http://phantomjs.org/api/webpage/property/settings.html
// Delete any screenshots that may have happened if it got this far. This isn't foolproof
// because it relies on the phantomjs server/page timeout, which can take longer than this
// grunt task depending on how long saucelabs takes to run...
grunt.task.run('clean:screenshots');
}
grunt.config('banner', '<%= bannerRelease %>');
// Run dist again to grab the latest version numbers. Yeah, we're running it twice... ¯\_(ツ)_/¯
grunt.task.run([
'bump-only:' + grunt.config('release.buildSemVerType'),
'replace:readme',
'replace:packageJs',
'dist',
'shell:addReleaseFiles',
'shell:copyToReference',
'prompt:commit',
'prompt:tag',
'prompt:pushLocalBranchToUpstream',
'prompt:pushTagToUpstream',
'prompt:uploadToCDN',
'prompt:pushLocalBranchToUpstreamMaster',
'shell:publishToNPM',
'prompt:generatelogs'
]);
});
};
|
/**
* openircd, a lightweight ircd written in javascript v8 with nodejs.
* http://www.openbrasil.org/ - rede do conhecimento livre.
*
* $Id$
*/
exports.listen = {
port: 6667,
host: '0.0.0.0'
};
exports.server = {
name: "experimental.openbrasil.org",
description: "servidor experimental openbrasil",
};
exports.network = {
name: "openbrasil"
};
exports.general = {
ping_timeout: 1
};
|
import { Handlers } from '@sentry/node';
import { sentry } from '../../../../config/secrets';
export default function sentryRequestHandler() {
return sentry.dns === 'dsn_from_sentry_dashboard'
? (req, res, next) => next()
: Handlers.requestHandler();
}
|
// These tests require the client to be built and served with additional
// redirect configuration. The Cypress action in .github/workflows/cypress.yml
// contains the necessary commands to do this.
describe('Legacy redirects', () => {
it('should redirect from front-end-libraries to front-end-development-libraries', () => {
cy.visit('learn/front-end-libraries');
cy.url().should('include', 'learn/front-end-development-libraries');
cy.visit('learn/front-end-libraries/bootstrap');
cy.location().should(loc => {
expect(loc.pathname).to.eq(
'/learn/front-end-development-libraries/bootstrap/'
);
});
cy.visit('learn/front-end-libraries/front-end-libraries-projects');
cy.location().should(loc => {
expect(loc.pathname).to.eq(
'/learn/front-end-development-libraries/front-end-development-libraries-projects/'
);
});
cy.visit(
'learn/front-end-libraries/front-end-libraries-projects/build-a-random-quote-machine'
);
cy.location().should(loc => {
expect(loc.pathname).to.eq(
'/learn/front-end-development-libraries/front-end-development-libraries-projects/build-a-random-quote-machine'
);
});
cy.visit('certification/certifieduser/front-end-libraries');
cy.location().should(loc => {
expect(loc.pathname).to.eq(
'/certification/certifieduser/front-end-development-libraries'
);
});
cy.visit(
'learn/front-end-libraries/bootstrap/use-responsive-design-with-bootstrap-fluid-containers'
);
cy.location().should(loc => {
expect(loc.pathname).to.eq(
'/learn/front-end-development-libraries/bootstrap/use-responsive-design-with-bootstrap-fluid-containers'
);
});
// Bit of hack: but we need to make sure the page is fully loaded before
// moving on.
cy.get('.react-monaco-editor-container').should('be.visible');
});
it('should redirect from /apis-and-microservices to /back-end-development-and-apis', () => {
cy.visit('learn/apis-and-microservices');
cy.location().should(loc => {
expect(loc.pathname).to.eq('/learn/back-end-development-and-apis/');
});
cy.visit('learn/apis-and-microservices/managing-packages-with-npm');
cy.location().should(loc => {
expect(loc.pathname).to.eq(
'/learn/back-end-development-and-apis/managing-packages-with-npm/'
);
});
cy.visit(
'learn/apis-and-microservices/managing-packages-with-npm/how-to-use-package-json-the-core-of-any-node-js-project-or-npm-package'
);
cy.location().should(loc => {
expect(loc.pathname).to.eq(
'/learn/back-end-development-and-apis/managing-packages-with-npm/how-to-use-package-json-the-core-of-any-node-js-project-or-npm-package'
);
});
cy.visit('learn/apis-and-microservices/apis-and-microservices-projects');
cy.location().should(loc => {
expect(loc.pathname).to.eq(
'/learn/back-end-development-and-apis/back-end-development-and-apis-projects/'
);
});
cy.visit(
'learn/apis-and-microservices/apis-and-microservices-projects/timestamp-microservice'
);
cy.location().should(loc => {
expect(loc.pathname).to.eq(
'/learn/back-end-development-and-apis/back-end-development-and-apis-projects/timestamp-microservice'
);
});
cy.visit('certification/certifieduser/apis-and-microservices');
cy.location().should(loc => {
expect(loc.pathname).to.eq(
'/certification/certifieduser/back-end-development-and-apis'
);
});
});
});
|
foo.bar()
|
var structarm__dct4__instance__q31 =
[
[ "N", "structarm__dct4__instance__q31.html#a46a9f136457350676e2bfd3768ff9d6d", null ],
[ "Nby2", "structarm__dct4__instance__q31.html#a32d3268ba4629908dba056599f0a904d", null ],
[ "normalize", "structarm__dct4__instance__q31.html#ac80ff7b28fca36aeef74dea12e8312dd", null ],
[ "pCfft", "structarm__dct4__instance__q31.html#ac96579cfb28d08bb11dd2fe4c6303833", null ],
[ "pCosFactor", "structarm__dct4__instance__q31.html#af97204d1838925621fc82021a0c2d6c1", null ],
[ "pRfft", "structarm__dct4__instance__q31.html#af1487dab5e7963b85dc0fdc6bf492542", null ],
[ "pTwiddle", "structarm__dct4__instance__q31.html#a7db236e22673146bb1d2c962f0713f08", null ]
];
|
var _ = require('underscore-cdb-v3');
var cdb = require('cartodb.js-v3');
var pluralizeString = require('../../../view_helpers/pluralize_string')
module.exports = cdb.core.View.extend({
initialize: function() {
_.each(['permission', 'isUsingVis'], function(name) {
if (_.isUndefined(this.options[name])) throw new Error(name + ' is required');
}, this);
},
render: function() {
this.$el.html(
this.getTemplate('common/dialogs/change_privacy/share/details')({
willRevokeAccess: this._willRevokeAccess(),
avatarUrl: this.model.get('avatar_url'),
title: this.model.get('display_name'),
desc: this._desc(),
roleLabel: false
})
);
return this;
},
_desc: function() {
var usersCount = this.model.users.length;
var xMembers = pluralizeString.prefixWithCount('member', 'members', usersCount);
if (this._willRevokeAccess()) {
return xMembers + '. ' + pluralizeString("Member's", "Members'", usersCount) + ' maps will be affected';
} else if (this.options.isUsingVis) {
return xMembers + '. ' + pluralizeString('Member is', 'Members are', usersCount) + ' using this dataset';
} else {
return xMembers;
}
},
_willRevokeAccess: function() {
return this.options.isUsingVis && !this.options.permission.hasReadAccess(this.model);
}
});
|
module.exports = {
selector: '.lift-status',
parse: {
name: '1/0',
status: {
child: 0,
attribute: 'class',
fn: s => s.split(' ').pop()
}
}
};
|
/*
* Copyright (c) 2019-2021 Renata Hodovan, Akos Kiss.
*
* Licensed under the BSD 3-Clause License
* <LICENSE.rst or https://opensource.org/licenses/BSD-3-Clause>.
* This file may not be copied, modified, or distributed except
* according to those terms.
*/
/* global fz */
$(document).ready(function () {
'use strict';
var jobAdded = function (data) {
var job = $(`#${data.type}-job-template`).prop('content').cloneNode(true);
$(job).find('.card').attr('id', `job-${data.job_id}`);
$(job).find('.card').addClass(data.status === 'active' ? 'bg-success' : 'bg-secondary');
$(job).find('.close').attr('onclick', `fz.api.cancelJob('${data.job_id}')`);
$(job).find('.job-id').text(data.job_id);
if ('fuzzer' in data) {
$(job).find('.job-fuzzer').text(data.fuzzer);
}
if ('sut' in data) {
$(job).find('.job-sut').text(data.sut);
}
if ('issue_id' in data) {
$(job).find('.job-issue').text(data.issue_id);
}
if ('issue_oid' in data) {
$(job).find('.job-issue').attr('href', `/issues/${data.issue_oid}`);
}
var maxValue = data.batch || data.size || 0;
var progress = $(job).find('.progress-bar');
progress.attr('data-maxvalue', maxValue);
if (maxValue == Infinity) {
$(job).find('.progress-text').text('0');
}
$('#jobs').append(document.importNode(job, true));
if ('progress' in data) {
jobProgressed(data);
}
};
fz.notifications.onmessage['job_added'] = jobAdded;
var jobProgressed = function (data) {
var jobCard = $(`#job-${data.job_id}`);
if (jobCard.length !== 0) {
var progress = jobCard.find('.progress-bar');
if ($(progress).data('maxvalue') < Infinity) {
var percent = Math.round(data.progress / $(progress).data('maxvalue') * 100);
progress.css('width', `${percent}%`);
progress.attr('aria-valuenow', percent);
jobCard.find('.progress-text').text(`${percent}%`);
} else {
jobCard.find('.progress-text').text(new Intl.NumberFormat({ notation: "scientific" }).format(data.progress));
if (!progress.hasClass('progress-bar-striped')) {
progress.attr('style', 'width: 100%');
progress.addClass('progress-bar-striped');
}
}
}
};
fz.notifications.onmessage['job_progressed'] = jobProgressed;
fz.notifications.onmessage['job_activated'] = function (data) {
var jobCard = $(`#job-${data.job_id}`);
if (jobCard.length !== 0 && jobCard.hasClass('bg-secondary')) {
jobCard.removeClass('bg-secondary').addClass('bg-success');
}
if ($(jobCard).data('job-type') == 'fuzz') {
var progress = $(jobCard).find('.progress-bar');
if ($(progress).data('maxvalue') == Infinity) {
progress.attr('style', 'width: 100%');
progress.addClass('progress-bar-striped');
}
}
};
fz.notifications.onmessage['job_removed'] = function (data) {
$(`#job-${data.job_id}`).remove();
};
fz.api.getJobs(function (data) {
for (var job of data) {
jobAdded(job);
}
});
});
|
var searchData=
[
['node',['node',['../structconnectivity.html#af0fc7c1443c916dce333bee34787cd20',1,'connectivity']]]
];
|
$(document).ready(function () {
//$('#pageListDt').DataTable();
/*
$("#publish").click(function () {
NccPageMask.ShowLoadingMask();
$.ajax({
type: "post",
url: form.action,
data: form.serialize(),
contentType: "application/x-www-form-urlencoded",
success: function (rsp, textStatus, jqXHR) {
NccPageMask.HideLoadingMask();
if (rsp.isSuccess) {
NccAlert.ShowSuccess(rsp.message);
ClearForm();
}
else {
NccAlert.ShowError("Error: " + rsp.message);
}
},
error: function (jqXHR, textStatus, errorThrown) {
NccPageMask.HideLoadingMask();
NccAlert.ShowError("Error. Please try again.");
}
})
});
*/
});
|
( function( exports ) {
/**
* @class
* @param params
* @constructor
*/
function BulkLoader( params ) {
this.params = params;
this._ids = [];
this.results = {};
this._objects = []; // GC対策
this.cache = {};
var self = this;
this._handler = function( e ) {
self._onLoadHandler( e );
};
for ( var id in this.params ) {
this._ids.push( id );
var param = this.params[id];
var object = null;
switch ( param.type ) {
case "image":
object = new Image();
object.src = param.url;
break;
case "audio":
case "music":
object = new Audio( param.url, Audio.MUSIC );
break;
case "se":
object = new Audio( param.url, Audio.SE );
break;
}
object.id = id;
object.onload = this._handler;
this._objects.push( object );
}
}
BulkLoader.prototype = {};
BulkLoader.prototype._onLoadHandler = function( e ) {
var id = e.target.id;
e.target.onload = null;
this.results[id] = e.target;
this._ids.splice( this._ids.indexOf( id ), 1 );
if ( this._ids.length > 0 ) {
return;
}
// complete
this._handler = null;
if ( this.onload !== null ) this.onload();
};
BulkLoader.prototype.getBitmapData = function( id ) {
if(typeof this.cache[id] === "undefined" &&
typeof this.results[id] !== "undefined") {
this.cache[id] = new BitmapData(this.results[id]);
this.results[id] = null;
}
return this.cache[id];
};
BulkLoader.prototype.get = function( id ) {
return this.results[id];
};
BulkLoader.prototype.onload = null;
exports.BulkLoader = BulkLoader;
} )( this );
( function( exports ) {
var Observer = function () {
this.listeners = {};
};
Observer.prototype = {
addEventListener: function( type, listener ) {
var listeners = this.listeners;
if (!listeners[type]) {
listeners[type] = [];
}
listeners[type].push(listener);
},
removeEventListener:function (type, listener) {
var listeners = this.listeners;
if (listeners[type]) {
var i;
var len = listeners[type].length;
for (i = len - 1; i >= 0; i--) {
var arr = listeners[type][i];
if (arr[0] === listener) {
listeners[type].splice(i, 1);
}
}
}
},
dispatchEvent: function(event) {
var listeners = this.listeners;
var newEvent = {};
newEvent.type = event.type;
newEvent.target = this;
if (listeners[newEvent.type]) {
var i;
var len = listeners[newEvent.type].length;
for (i = 0; i < len; i++) {
var listener = listeners[newEvent.type][i];
listener.call(this, newEvent);
}
}
}
};
exports.Observer = Observer;
} )( this );
|
module.exports = function(gatewayd) {
// ADD PLUGINS HERE, SUCH AS SETUP WIZARD
const WizardPlugin = require('gatewayd-setup-wizard-plugin');
var wizardPlugin = new WizardPlugin({
gatewayd: gatewayd
});
gatewayd.server.use('/', wizardPlugin.router);
}
|
/*global define*/
define({
"_widgetLabel": "グリッド オーバーレイ",
"description": "座標グリッド オーバーレイを表示するカスタム Web AppBuilder ウィジェットです。"
});
|
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory() :
typeof define === 'function' && define.amd ? define(factory) :
(factory());
}(this, (function () { 'use strict';
var foo = 42;
assert.equal( foo, 42 );
})));
|
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
'use strict';
/**
* The resource limits.
*
*/
class ResourceLimits {
/**
* Create a ResourceLimits.
* @member {number} [memoryInGB] The memory limit in GB of this container
* instance.
* @member {number} [cpu] The CPU limit of this container instance.
*/
constructor() {
}
/**
* Defines the metadata of ResourceLimits
*
* @returns {object} metadata of ResourceLimits
*
*/
mapper() {
return {
required: false,
serializedName: 'ResourceLimits',
type: {
name: 'Composite',
className: 'ResourceLimits',
modelProperties: {
memoryInGB: {
required: false,
serializedName: 'memoryInGB',
type: {
name: 'Number'
}
},
cpu: {
required: false,
serializedName: 'cpu',
type: {
name: 'Number'
}
}
}
}
};
}
}
module.exports = ResourceLimits;
|
#!/usr/bin/env node
/*!
* Module dependencies.
*/
var CLI = require('../lib/cli'),
argv = require('optimist').boolean('d')
.boolean('device')
.boolean('e')
.boolean('emulator')
.boolean('V')
.boolean('verbose')
.boolean('v')
.boolean('version')
.boolean('h')
.boolean('help')
.argv;
/*!
* Run the command-line client.
*/
var cli = new CLI().argv(argv);
|
/**
* @fileoverview client模式,serve时js文件处理
* @author liweitao
*/
'use strict';
module.exports = function ($, appConf, moduleConf, args) {
return function (mod, modulePath, appPath) {
return new Promise(function (resolve, reject) {
var vfs = require('vinyl-fs');
var path = require('path');
var athenaMate = require('../athena_mate');
var useBabel = moduleConf.support.useBabel || { enable: false };
var enableBabel = useBabel.enable;
var jsxPragma = useBabel.jsxPragma || 'Nerv.createElement'
athenaMate.concat({
cwd: appPath,
pageFiles: args.pageFiles,
module: moduleConf.module,
map: path.join('dist', 'map.json'),
dest: 'dist',
end: function () {
vfs.src(path.join(modulePath, 'dist', '_static', 'js', '**', '*.js'))
.pipe($.if(enableBabel, athenaMate.babel({
config: {
presets: [
require('babel-preset-es2015'),
require('babel-preset-stage-0')
],
plugins: [
require('babel-plugin-transform-es3-member-expression-literals'),
require('babel-plugin-transform-es3-property-literals'),
[require('babel-plugin-transform-react-jsx'), {
pragma: jsxPragma
}]
]
},
fileTest: useBabel.test || /\.js/,
exclude: useBabel.exclude || []
})))
.pipe(athenaMate.replace({
cwd: appPath,
module: moduleConf.module,
serve: true
}))
.pipe(vfs.dest(path.join(appPath, '.temp', appConf.app, moduleConf.module, 'js')))
.on('end', function () {
resolve();
})
.on('error', function (err) {
reject(err);
});
}
});
});
};
};
|
/*
* Routes handlers
*/
var exec = require('child_process').exec,
child_process = require('child_process'),
fs = require('fs'),
child_processes = [];
// Basic routing
module.exports = function(app) {
app.get("/", getHomePage);
app.post("/add", postAddScraper);
}
function getHomePage(req, res) {
var port = res.app.settings.config.server.port;
res.render('index', {
port: port
});
}
function postAddScraper(req, res) {
var url = req.body.url,
auth_user = req.body.auth_user,
auth_pass = req.body.auth_pass,
depth = parseInt(req.body.create_crawler_depth),
create_sitemap = req.body.create_crawler_sitemap == 1,
clean = req.body.clean_crawl == 1,
config = res.app.settings.config;
var child = child_process.fork("crawling-daemon.js");
// setup config
child.send({
action: "setConfig",
config: config
});
if (auth_user!="" && auth_pass!="") {
child.send({
action: "setAuth",
auth_user: auth_user,
auth_pass: auth_pass
});
}
child.send({
action: "start",
url: url,
clean: clean,
depth: depth
});
child.on("message", function(data) {
switch (data.message) {
case "auth-required":
data.row_id = data.host.replace(/\./g,"");
res.render("partials/scraper-stats-row", {data: data, layout: false}, function(err, html) {
if (err != null) {
return;
}
data.html = html;
io.sockets.emit('auth-required', data);
});
break;
case "general-stats":
data.row_id = data.host.replace(/\./g,"");
res.render("partials/scraper-stats-row", {data: data, layout: false}, function(err, html) {
if (err != null) {
return;
}
data.html = html;
io.sockets.emit('general-stats', data);
});
break;
case "done-crawling": case "stop-crawling":
if (create_sitemap) {
child.send({ action: "createSitemap" });
} else {
child.kill(); // Terminate crawling daemon
}
io.sockets.emit(data.message, data); // done-crawling | stop-crawling
break;
// @TODO: Implement
case "recrawl":
break;
case "sitemap-created":
var sitemap_path = "public/sitemaps/";
fs.exists(sitemap_path, function(exists) {
if (!exists) {
fs.mkdir(sitemap_path, writeSitemap);
} else {
writeSitemap();
}
// Terminate crawling daemon
child.kill();
});
function writeSitemap() {
sitemap_path += "sitemap_"+ data.host +".xml";
fs.writeFile(sitemap_path, data.content, function(err) {
if(err) {
console.log(err);
}
else {
io.sockets.emit('sitemap-ready', { host: data.host, path: sitemap_path.replace("public/", "") })
}
});
}
break;
default:
io.sockets.emit(data.message, data);
break;
}
})
res.redirect("/");
}
|
MSG.title = "Webduino Blockly 課程 1-3:控制兩顆 LED 燈";
MSG.subTitle = "課程 1-3:控制兩顆 LED 燈";
MSG.demoDescription = "點選下圖左右兩顆燈泡,分別控制兩顆 LED 的開或關";
|
/*global require*/
require({
baseUrl : '.',
paths : {
domReady : '../../ThirdParty/requirejs-2.1.20/domReady',
Cesium : '../../Source'
}
}, [
'CesiumViewer'
], function() {
});
|
import requestAnimationFrame from 'requestanimationframe'
import { DistributeHeight } from './DistributeHeight'
export class Resize {
constructor () {
this.ticking = false
// Create an instance of DistributeHeight for each element
$('[data-distribute-height]').each((index, element) => {
element.distributeHeight = new DistributeHeight($(element))
})
this.calculate = () => {
$('[data-distribute-height]').each((index, element) => {
element.distributeHeight.setHeights()
})
this.ticking = false
}
}
resize () {
$(window).on('load resize', () => {
this.tick()
})
}
tick () {
if (!this.ticking) {
requestAnimationFrame(this.calculate)
this.ticking = true
}
}
}
|
var EventEmitter = require('events').EventEmitter;
var fs = require('fs');
var content;
function readFileIfRequired(cb) {
if (!content) { //<co id="callout-globals-nexttick-3-1" />
fs.readFile(__filename, 'utf8', function(err, data) {
content = data;
console.log('readFileIfRequired: readFile');
cb(err, content);
});
} else {
process.nextTick(function() { //<co id="callout-globals-nexttick-3-2" />
console.log('readFileIfRequired: cached');
cb(null, content);
});
}
}
readFileIfRequired(function(err, data) { //<co id="callout-globals-nexttick-3-3" />
console.log('1. Length:', data.length);
readFileIfRequired(function(err, data2) {
console.log('2. Length:', data2.length);
});
console.log('Reading file again...');
});
console.log('Reading file...');
|
function* f1() {
a = (yield) ? 1 : 1;
a = yield 1 ? 1 : 1;
a = (yield 1) ? 1 : 1;
a = 1 ? yield : yield;
a = 1 ? yield 1 : yield 1;
}
function* f2() {
a = yield* 1 ? 1 : 1;
a = (yield* 1) ? 1 : 1;
a = 1 ? yield* 1 : yield* 1;
}
async function f3() {
a = await 1 ? 1 : 1;
a = (await 1) ? 1 : 1;
a = 1 ? await 1 : await 1;
}
|
import React from 'react';
import PropTypes from 'prop-types';
const Soon = () => (
<div>
<article className="glitch">
<span>ALWAYS Ɐ WIP</span>
</article>
</div>
);
export default Soon;
|
module.exports = {
rules: {
'max-nested-callbacks': 0
}
};
|
function setup() {
createCanvas(600, 400);
noLoop();
noStroke();
textSize(20);
loadJSON("data.json", drawData);
}
function draw() {
background(255, 0, 0);
console.log(int(random(0, 2)));
}
function drawData(data) {
background(120, 180, 200);
// person 1 bubble
fill(155, 30, 180, 180);
ellipse(250, 200, data.person1.age * 5, data.person1.age * 5); // person1.age = 30
fill(255);
text(data.person1.name, 210, 200); // person1.name = Morgan
// person 2 bubble
fill(180, 180, 34, 180);
ellipse(350, 200, data.person2.age * 5, data.person2.age * 5); // person2.age = 32
fill(255);
text(data.person2.name, 330, 200); // person2.name = Joss
}
|
version https://git-lfs.github.com/spec/v1
oid sha256:c2c3856c7f168c79af5e259afd0648e280f99384ba53df89f67814f2bafd5c74
size 18348
|
'use strict';
/**
* @ngdoc function
* @name ng.filter:limitTo
* @function
*
* @description
* Creates a new array or string containing only a specified number of elements. The elements
* are taken from either the beginning or the end of the source array or string, as specified by
* the value and sign (positive or negative) of `limit`.
*
* @param {Array|string} input Source array or string to be limited.
* @param {string|number} limit The length of the returned array or string. If the `limit` number
* is positive, `limit` number of items from the beginning of the source array/string are copied.
* If the number is negative, `limit` number of items from the end of the source array/string
* are copied. The `limit` will be trimmed if it exceeds `array.length`
* @returns {Array|string} A new sub-array or substring of length `limit` or less if input array
* had less than `limit` elements.
*
* @example
<doc:example>
<doc:source>
<script>
function Ctrl($scope) {
$scope.numbers = [1,2,3,4,5,6,7,8,9];
$scope.letters = "abcdefghi";
$scope.numLimit = 3;
$scope.letterLimit = 3;
}
</script>
<div ng-controller="Ctrl">
Limit {{numbers}} to: <input type="integer" ng-model="numLimit">
<p>Output numbers: {{ numbers | limitTo:numLimit }}</p>
Limit {{letters}} to: <input type="integer" ng-model="letterLimit">
<p>Output letters: {{ letters | limitTo:letterLimit }}</p>
</div>
</doc:source>
<doc:protractor>
var numLimitInput = element(by.model('numLimit'));
var letterLimitInput = element(by.model('letterLimit'));
var limitedNumbers = element(by.binding('numbers | limitTo:numLimit'));
var limitedLetters = element(by.binding('letters | limitTo:letterLimit'));
it('should limit the number array to first three items', function() {
expect(numLimitInput.getAttribute('value')).toBe('3');
expect(letterLimitInput.getAttribute('value')).toBe('3');
expect(limitedNumbers.getText()).toEqual('Output numbers: [1,2,3]');
expect(limitedLetters.getText()).toEqual('Output letters: abc');
});
it('should update the output when -3 is entered', function() {
numLimitInput.clear();
numLimitInput.sendKeys('-3');
letterLimitInput.clear();
letterLimitInput.sendKeys('-3');
expect(limitedNumbers.getText()).toEqual('Output numbers: [7,8,9]');
expect(limitedLetters.getText()).toEqual('Output letters: ghi');
});
it('should not exceed the maximum size of input array', function() {
numLimitInput.clear();
numLimitInput.sendKeys('100');
letterLimitInput.clear();
letterLimitInput.sendKeys('100');
expect(limitedNumbers.getText()).toEqual('Output numbers: [1,2,3,4,5,6,7,8,9]');
expect(limitedLetters.getText()).toEqual('Output letters: abcdefghi');
});
</doc:protractor>
</doc:example>
*/
function limitToFilter(){
return function(input, limit) {
if (!isArray(input) && !isString(input)) return input;
limit = int(limit);
if (isString(input)) {
//NaN check on limit
if (limit) {
return limit >= 0 ? input.slice(0, limit) : input.slice(limit, input.length);
} else {
return "";
}
}
var out = [],
i, n;
// if abs(limit) exceeds maximum length, trim it
if (limit > input.length)
limit = input.length;
else if (limit < -input.length)
limit = -input.length;
if (limit > 0) {
i = 0;
n = limit;
} else {
i = input.length + limit;
n = input.length;
}
for (; i<n; i++) {
out.push(input[i]);
}
return out;
};
}
|
"use strict";
var chokidar = require("chokidar"),
shell = require("shelljs"),
files = {
"./src/pages/schema-edit/parse-schema.js" : "./gen/parse-schema.js"
};
exports.watch = function() {
// Make sure files stay up to date in the /gen folder
chokidar.watch(Object.keys(files)).on("all", function(event, file) {
if(event !== "add" && event !== "change") {
return;
}
file = "./" + file;
shell.cp(file, files[file]);
});
};
exports.copy = function() {
Object.keys(files).forEach(function(file) {
shell.cp(file, files[file]);
});
};
|
// moment.js locale configuration
// locale : Marathi (mr)
// author : Harshad Kale : https://github.com/kalehv
(function (factory) {
if (typeof define === 'function' && define.amd) {
define(['moment'], factory); // AMD
} else if (typeof exports === 'object') {
module.exports = factory(require('../moment')); // Node
} else {
factory(window.moment); // Browser global
}
}(function (moment) {
var symbolMap = {
'1': '१',
'2': '२',
'3': '३',
'4': '४',
'5': '५',
'6': '६',
'7': '७',
'8': '८',
'9': '९',
'0': '०'
},
numberMap = {
'१': '1',
'२': '2',
'३': '3',
'४': '4',
'५': '5',
'६': '6',
'७': '7',
'८': '8',
'९': '9',
'०': '0'
};
return moment.defineLocale('mr', {
months : 'जानेवारी_फेब्रुवारी_मार्च_एप्रिल_मे_जून_जुलै_ऑगस्ट_सप्टेंबर_ऑक्टोबर_नोव्हेंबर_डिसेंबर'.split('_'),
monthsShort: 'जाने._फेब्रु._मार्च._एप्रि._मे._जून._जुलै._ऑग._सप्टें._ऑक्टो._नोव्हें._डिसें.'.split('_'),
weekdays : 'रविवार_सोमवार_मंगळवार_बुधवार_गुरूवार_शुक्रवार_शनिवार'.split('_'),
weekdaysShort : 'रवि_सोम_मंगळ_बुध_गुरू_शुक्र_शनि'.split('_'),
weekdaysMin : 'र_सो_मं_बु_गु_शु_श'.split('_'),
longDateFormat : {
LT : 'A h:mm वाजता',
L : 'DD/MM/YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY, LT',
LLLL : 'dddd, D MMMM YYYY, LT'
},
calendar : {
sameDay : '[आज] LT',
nextDay : '[उद्या] LT',
nextWeek : 'dddd, LT',
lastDay : '[काल] LT',
lastWeek: '[मागील] dddd, LT',
sameElse : 'L'
},
relativeTime : {
future : '%s नंतर',
past : '%s पूर्वी',
s : 'सेकंद',
m: 'एक मिनिट',
mm: '%d मिनिटे',
h : 'एक तास',
hh : '%d तास',
d : 'एक दिवस',
dd : '%d दिवस',
M : 'एक महिना',
MM : '%d महिने',
y : 'एक वर्ष',
yy : '%d वर्षे'
},
preparse: function (string) {
return string.replace(/[१२३४५६७८९०]/g, function (match) {
return numberMap[match];
});
},
postformat: function (string) {
return string.replace(/\d/g, function (match) {
return symbolMap[match];
});
},
meridiem: function (hour, minute, isLower)
{
if (hour < 4) {
return 'रात्री';
} else if (hour < 10) {
return 'सकाळी';
} else if (hour < 17) {
return 'दुपारी';
} else if (hour < 20) {
return 'सायंकाळी';
} else {
return 'रात्री';
}
},
week : {
dow : 0, // Sunday is the first day of the week.
doy : 6 // The week that contains Jan 1st is the first week of the year.
}
});
}));
|
"use strict";
var _foob, _foob$test;
var _toArray = function (arr) { return Array.isArray(arr) ? arr : Array.from(arr); };
(_foob = foob).add.apply(_foob, [foo, bar].concat(_toArray(numbers)));
(_foob$test = foob.test).add.apply(_foob$test, [foo, bar].concat(_toArray(numbers)));
|
import { useState } from 'react'
import { useRouter } from 'next/router'
import Link from 'next/link'
import { gql, useMutation } from '@apollo/client'
import { getErrorMessage } from '../lib/form'
import Field from '../components/field'
const SignUpMutation = gql`
mutation SignUpMutation($email: String!, $password: String!) {
signUp(input: { email: $email, password: $password }) {
user {
id
email
}
}
}
`
function SignUp() {
const [signUp] = useMutation(SignUpMutation)
const [errorMsg, setErrorMsg] = useState()
const router = useRouter()
async function handleSubmit(event) {
event.preventDefault()
const emailElement = event.currentTarget.elements.email
const passwordElement = event.currentTarget.elements.password
try {
await signUp({
variables: {
email: emailElement.value,
password: passwordElement.value,
},
})
router.push('/signin')
} catch (error) {
setErrorMsg(getErrorMessage(error))
}
}
return (
<>
<h1>Sign Up</h1>
<form onSubmit={handleSubmit}>
{errorMsg && <p>{errorMsg}</p>}
<Field
name="email"
type="email"
autoComplete="email"
required
label="Email"
/>
<Field
name="password"
type="password"
autoComplete="password"
required
label="Password"
/>
<button type="submit">Sign up</button> or{' '}
<Link href="/signin">
<a>Sign in</a>
</Link>
</form>
</>
)
}
export default SignUp
|
const nest = require('depnest')
const { h, Value } = require('mutant')
exports.needs = nest({
'app.sync.goTo': 'first',
'message.html.backlinks': 'first',
'message.html.author': 'first',
'message.html.meta': 'map',
'message.html.timestamp': 'first'
})
exports.gives = nest('message.html.layout')
exports.create = (api) => {
return nest('message.html.layout', miniLayout)
function miniLayout (msg, opts) {
if (opts.layout !== 'mini') return
var rawMessage = Value(null)
return h('Message -mini', {
attributes: {
tabindex: '0'
}
}, [
h('section.timestamp', {}, api.message.html.timestamp(msg)),
h('header.author', {}, api.message.html.author(msg, { size: 'mini' })),
h('section.meta', {}, api.message.html.meta(msg, { rawMessage })),
h('section.content', { 'ev-click': () => api.app.sync.goTo(msg) }, opts.content),
h('section.raw-content', rawMessage)
])
}
}
|
var gbxremote = require('gbxremote'),
async = require('async');
module.exports = require('./core').extend({
init: function() {
this._super();
this.options.port = 2350;
this.options.port_query = 5000;
this.gbxclient = false;
},
reset: function() {
this._super();
if(this.gbxclient) {
this.gbxclient.terminate();
this.gbxclient = false;
}
},
run: function(state) {
var self = this;
var cmds = [
['Connect'],
['Authenticate', this.options.login,this.options.password],
['GetStatus'],
['GetPlayerList',500,0],
['GetServerOptions'],
['GetCurrentChallengeInfo'],
['GetCurrentGameInfo']
];
var results = [];
async.eachSeries(cmds, function(cmdset,c) {
var cmd = cmdset[0];
var params = cmdset.slice(1);
if(cmd == 'Connect') {
var client = self.gbxclient = gbxremote.createClient(self.options.port_query,self.options.host, function(err) {
if(err) return self.fatal('GBX error '+JSON.stringify(err));
c();
});
client.on('error',function(){});
} else {
self.gbxclient.methodCall(cmd, params, function(err, value) {
if(err) return self.fatal('XMLRPC error '+JSON.stringify(err));
results.push(value);
c();
});
}
}, function() {
var gamemode = '';
var igm = results[5].GameMode;
if(igm == 0) gamemode="Rounds";
if(igm == 1) gamemode="Time Attack";
if(igm == 2) gamemode="Team";
if(igm == 3) gamemode="Laps";
if(igm == 4) gamemode="Stunts";
if(igm == 5) gamemode="Cup";
state.name = self.stripColors(results[3].Name);
state.password = (results[3].Password != 'No password');
state.maxplayers = results[3].CurrentMaxPlayers;
state.map = self.stripColors(results[4].Name);
state.raw.gametype = gamemode;
results[2].forEach(function(player) {
state.players.push({name:self.stripColors(player.Name)});
});
self.finish(state);
});
},
stripColors: function(str) {
return str.replace(/\$([0-9a-f][^\$]?[^\$]?|[^\$]?)/g,'');
}
});
|
'use strict';
var React = require('react');
var mui = require('material-ui');
var SvgIcon = mui.SvgIcon;
var ActionSettingsInputHdmi = React.createClass({
displayName: 'ActionSettingsInputHdmi',
render: function render() {
return React.createElement(
SvgIcon,
this.props,
React.createElement('path', { d: 'M18 7V4c0-1.1-.9-2-2-2H8c-1.1 0-2 .9-2 2v3H5v6l3 6v3h8v-3l3-6V7h-1zM8 4h8v3h-2V5h-1v2h-2V5h-1v2H8V4z' })
);
}
});
module.exports = ActionSettingsInputHdmi;
|
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @file Horizontal Page Break
*/
// Register a plugin named "pagebreak".
CKEDITOR.plugins.add( 'pagebreak',
{
init : function( editor )
{
// Register the command.
editor.addCommand( 'pagebreak', CKEDITOR.plugins.pagebreakCmd );
// Register the toolbar button.
editor.ui.addButton( 'PageBreak',
{
label : editor.lang.pagebreak,
command : 'pagebreak'
});
var cssStyles = [
'{' ,
'background: url(' + CKEDITOR.getUrl( this.path + 'images/pagebreak.gif' ) + ') no-repeat center center;' ,
'clear: both;' ,
'width:100%; _width:99.9%;' ,
'border-top: #999999 1px dotted;' ,
'border-bottom: #999999 1px dotted;' ,
'padding:0;' ,
'height: 5px;' ,
'cursor: default;' ,
'}'
].join( '' ).replace(/;/g, ' !important;' ); // Increase specificity to override other styles, e.g. block outline.
// Add the style that renders our placeholder.
editor.addCss( 'div.cke_pagebreak' + cssStyles );
// Opera needs help to select the page-break.
CKEDITOR.env.opera && editor.on( 'contentDom', function()
{
editor.document.on( 'click', function( evt )
{
var target = evt.data.getTarget();
if ( target.is( 'div' ) && target.hasClass( 'cke_pagebreak') )
editor.getSelection().selectElement( target );
});
});
},
afterInit : function( editor )
{
var label = editor.lang.pagebreakAlt;
// Register a filter to displaying placeholders after mode change.
var dataProcessor = editor.dataProcessor,
dataFilter = dataProcessor && dataProcessor.dataFilter,
htmlFilter = dataProcessor && dataProcessor.htmlFilter;
if ( htmlFilter )
{
htmlFilter.addRules(
{
attributes : {
'class' : function( value, element )
{
var className = value.replace( 'cke_pagebreak', '' );
if ( className != value )
{
var span = CKEDITOR.htmlParser.fragment.fromHtml( '<span style="display: none;"> </span>' );
element.children.length = 0;
element.add( span );
var attrs = element.attributes;
delete attrs[ 'aria-label' ];
delete attrs.contenteditable;
delete attrs.title;
}
return className;
}
}
}, 5 );
}
if ( dataFilter )
{
dataFilter.addRules(
{
elements :
{
div : function( element )
{
var attributes = element.attributes,
style = attributes && attributes.style,
child = style && element.children.length == 1 && element.children[ 0 ],
childStyle = child && ( child.name == 'span' ) && child.attributes.style;
if ( childStyle && ( /page-break-after\s*:\s*always/i ).test( style ) && ( /display\s*:\s*none/i ).test( childStyle ) )
{
attributes.contenteditable = "false";
attributes[ 'class' ] = "cke_pagebreak";
attributes[ 'data-cke-display-name' ] = "pagebreak";
attributes[ 'aria-label' ] = label;
attributes[ 'title' ] = label;
element.children.length = 0;
}
}
}
});
}
},
requires : [ 'fakeobjects' ]
});
CKEDITOR.plugins.pagebreakCmd =
{
exec : function( editor )
{
var label = editor.lang.pagebreakAlt;
// Create read-only element that represents a print break.
var pagebreak = CKEDITOR.dom.element.createFromHtml(
'<div style="' +
'page-break-after: always;"' +
'contenteditable="false" ' +
'title="'+ label + '" ' +
'aria-label="'+ label + '" ' +
'data-cke-display-name="pagebreak" ' +
'class="cke_pagebreak">' +
'</div>', editor.document );
var ranges = editor.getSelection().getRanges( true );
editor.fire( 'saveSnapshot' );
for ( var range, i = ranges.length - 1 ; i >= 0; i-- )
{
range = ranges[ i ];
if ( i < ranges.length -1 )
pagebreak = pagebreak.clone( true );
range.splitBlock( 'p' );
range.insertNode( pagebreak );
if ( i == ranges.length - 1 )
{
var next = pagebreak.getNext();
range.moveToPosition( pagebreak, CKEDITOR.POSITION_AFTER_END );
// If there's nothing or a non-editable block followed by, establish a new paragraph
// to make sure cursor is not trapped.
if ( !next || next.type == CKEDITOR.NODE_ELEMENT && !next.isEditable() )
range.fixBlock( true, editor.config.enterMode == CKEDITOR.ENTER_DIV ? 'div' : 'p' );
range.select();
}
}
editor.fire( 'saveSnapshot' );
}
};
|
import { sortSurveyElements } from '../index';
describe('sortSurveyElements', () => {
it('sorts survey elements by weight', () => {
const inputSurvey = {
title: 'Sample Survey',
sections: [
{ id: 1, title: 'Later Section', weight: 1 },
{
id: 2,
title: 'Earlier Section',
weight: 0,
questions: [
{ id: 4, description: 'Q3', weight: 2 },
{ id: 5, description: 'Q1', weight: 0 },
{
id: 1,
description: 'Q2',
weight: 1,
options: [
{ option: 'Choice 2', weight: 1 },
{ option: 'Choice 1', weight: 0 },
],
},
],
},
],
};
const outputSurvey = {
title: 'Sample Survey',
sections: [
{
id: 2,
title: 'Earlier Section',
weight: 0,
questions: [
{ id: 5, description: 'Q1', weight: 0 },
{
id: 1,
description: 'Q2',
weight: 1,
options: [
{ option: 'Choice 1', weight: 0 },
{ option: 'Choice 2', weight: 1 },
],
},
{ id: 4, description: 'Q3', weight: 2 },
],
},
{ id: 1, title: 'Later Section', weight: 1 },
],
};
expect(sortSurveyElements(inputSurvey)).toEqual(outputSurvey);
});
});
|
import {
findPort,
killApp,
nextBuild,
nextStart,
renderViaHTTP,
File,
waitFor,
} from 'next-test-utils'
import webdriver from 'next-webdriver'
import { join } from 'path'
const appDir = join(__dirname, '../')
let appPort
let app
let browser
let html
const indexPage = new File(join(appDir, 'pages/static-img.js'))
const runTests = () => {
it('Should allow an image with a static src to omit height and width', async () => {
expect(await browser.elementById('basic-static')).toBeTruthy()
expect(await browser.elementById('blur-png')).toBeTruthy()
expect(await browser.elementById('blur-webp')).toBeTruthy()
expect(await browser.elementById('blur-avif')).toBeTruthy()
expect(await browser.elementById('blur-jpg')).toBeTruthy()
expect(await browser.elementById('static-svg')).toBeTruthy()
expect(await browser.elementById('static-gif')).toBeTruthy()
expect(await browser.elementById('static-bmp')).toBeTruthy()
expect(await browser.elementById('static-ico')).toBeTruthy()
expect(await browser.elementById('static-unoptimized')).toBeTruthy()
})
it('Should use immutable cache-control header for static import', async () => {
await browser.eval(
`document.getElementById("basic-static").scrollIntoView()`
)
await waitFor(1000)
const url = await browser.eval(
`document.getElementById("basic-static").src`
)
const res = await fetch(url)
expect(res.headers.get('cache-control')).toBe(
'public, max-age=315360000, immutable'
)
})
it('Should use immutable cache-control header even when unoptimized', async () => {
await browser.eval(
`document.getElementById("static-unoptimized").scrollIntoView()`
)
await waitFor(1000)
const url = await browser.eval(
`document.getElementById("static-unoptimized").src`
)
const res = await fetch(url)
expect(res.headers.get('cache-control')).toBe(
'public, max-age=31536000, immutable'
)
})
it('Should automatically provide an image height and width', async () => {
expect(html).toContain('width:400px;height:300px')
})
it('Should allow provided width and height to override intrinsic', async () => {
expect(html).toContain('width:200px;height:200px')
expect(html).not.toContain('width:400px;height:400px')
})
it('Should add a blur placeholder to statically imported jpg', async () => {
expect(html).toContain(
`style="position:absolute;top:0;left:0;bottom:0;right:0;box-sizing:border-box;padding:0;border:none;margin:auto;display:block;width:0;height:0;min-width:100%;max-width:100%;min-height:100%;max-height:100%;filter:blur(20px);background-size:cover;background-image:url("data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAoKCgoKCgsMDAsPEA4QDxYUExMUFiIYGhgaGCIzICUgICUgMy03LCksNy1RQDg4QFFeT0pPXnFlZXGPiI+7u/sBCgoKCgoKCwwMCw8QDhAPFhQTExQWIhgaGBoYIjMgJSAgJSAzLTcsKSw3LVFAODhAUV5PSk9ecWVlcY+Ij7u7+//CABEIAAYACAMBIgACEQEDEQH/xAAnAAEBAAAAAAAAAAAAAAAAAAAABwEBAAAAAAAAAAAAAAAAAAAAAP/aAAwDAQACEAMQAAAAmgP/xAAcEAACAQUBAAAAAAAAAAAAAAASFBMAAQMFERX/2gAIAQEAAT8AZ1HjrKZX55JysIc4Ff/EABQRAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQIBAT8Af//EABQRAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQMBAT8Af//Z");background-position:0% 0%"`
)
})
it('Should add a blur placeholder to statically imported png', async () => {
expect(html).toContain(
`style="position:absolute;top:0;left:0;bottom:0;right:0;box-sizing:border-box;padding:0;border:none;margin:auto;display:block;width:0;height:0;min-width:100%;max-width:100%;min-height:100%;max-height:100%;filter:blur(20px);background-size:cover;background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAAAAADhZOFXAAAAOklEQVR42iWGsQkAIBDE0iuIdiLOJjiGIzjiL/Meb4okiNYIlLjK3hJMzCQG1/0qmXXOUkjAV+m9wAMe3QiV6Ne8VgAAAABJRU5ErkJggg==");background-position:0% 0%"`
)
})
}
describe('Build Error Tests', () => {
it('should throw build error when import statement is used with missing file', async () => {
await indexPage.replace(
'../public/foo/test-rect.jpg',
'../public/foo/test-rect-broken.jpg'
)
const { stderr } = await nextBuild(appDir, undefined, { stderr: true })
await indexPage.restore()
expect(stderr).toContain(
"Module not found: Can't resolve '../public/foo/test-rect-broken.jpg"
)
// should contain the importing module
expect(stderr).toContain('./pages/static-img.js')
// should contain a import trace
expect(stderr).not.toContain('Import trace for requested module')
})
})
describe('Static Image Component Tests', () => {
beforeAll(async () => {
await nextBuild(appDir)
appPort = await findPort()
app = await nextStart(appDir, appPort)
html = await renderViaHTTP(appPort, '/static-img')
browser = await webdriver(appPort, '/static-img')
})
afterAll(() => {
killApp(app)
})
runTests()
})
|
const DrawCard = require('../../drawcard.js');
class AeronDamphair extends DrawCard {
setupCardAbilities() {
this.reaction({
when: {
onCardSaved: event => event.card.getType() === 'character'
},
handler: context => {
let card = context.event.card;
if(card.kneeled) {
card.controller.standCard(card);
this.game.addMessage('{0} uses {1} to stand {2}', this.controller, this, card);
} else {
card.controller.kneelCard(card);
this.game.addMessage('{0} uses {1} to kneel {2}', this.controller, this, card);
}
}
});
}
}
AeronDamphair.code = '04071';
module.exports = AeronDamphair;
|
function foo() {
throw <Bar />;
}
function foo() {
throw <Bar>baz</Bar>;
}
function foo() {
throw <Bar baz={baz} />;
}
function foo() {
throw <Bar baz={baz}>foo</Bar>;
}
function foo() {
throw <></>;
}
function foo() {
throw <>foo</>;
}
|
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
// This is a very simple test, and could be made more robust.
// All we do is check for the presence of "http://" or "https://"
// at the start of the string.
var description = 'Relative src URLs can break (i.e. if recipients are outside the company network) and make your content unavailable to view.';
exports.default = function (props) {
if (props.hasOwnProperty('src')) {
if (!/^https?:\/\//.test(props['src'])) {
return new Error(description);
}
}
};
|
var assert = require('assert');
var R = require('..');
describe('join', function() {
it("concatenates a list's elements to a string, with an seperator string between elements", function() {
var list = [1, 2, 3, 4];
assert.strictEqual(R.join('~', list), '1~2~3~4');
});
});
|
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var prefix = 'fas';
var iconName = 'intersection';
var width = 384;
var height = 512;
var ligatures = [];
var unicode = 'f668';
var svgPathData = 'M166.74 33.62C69.96 46.04 0 133.11 0 230.68V464c0 8.84 7.16 16 16 16h64c8.84 0 16-7.16 16-16V224c0-59.2 53.85-106.04 115.13-94.14 45.58 8.85 76.87 51.5 76.87 97.93V464c0 8.84 7.16 16 16 16h64c8.84 0 16-7.16 16-16V224c0-114.18-100.17-205.4-217.26-190.38z';
exports.definition = {
prefix: prefix,
iconName: iconName,
icon: [
width,
height,
ligatures,
unicode,
svgPathData
]};
exports.faIntersection = exports.definition;
exports.prefix = prefix;
exports.iconName = iconName;
exports.width = width;
exports.height = height;
exports.ligatures = ligatures;
exports.unicode = unicode;
exports.svgPathData = svgPathData;
|
/*
* Moonshine - a Lua virtual machine.
*
* Email: moonshine@gamesys.co.uk
* http://moonshinejs.org
*
* Copyright (c) 2013-2015 Gamesys Limited. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* @fileOverview File class.
* @author <a href="mailto:paul.cuthbertson@gamesys.co.uk">Paul Cuthbertson</a>
*/
'use strict';
var shine = shine || {};
/**
* Represents a Luac data file.
* @constructor
* @extends shine.EventEmitter
* @param {String} url Url of the distilled JSON file.
*/
shine.File = function (url, data) {
this.url = url;
this.data = data;
};
/**
* Dump memory associated with file.
*/
shine.File.prototype.dispose = function () {
delete this.url;
delete this.data;
};
|
// ----------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// ----------------------------------------------------------------------------
var promises = require('../utilities/promises'),
log = require('../logger');
module.exports = function (tables) {
log.warn('The memory data provider is deprecated and will be removed from future versions. Use the sqlite provider instead.');
tables = tables || {};
return function (table) {
return {
read: function (query) {
// need to evaluate query against each item before returning
return promises.resolved(values(table));
},
update: function (item) {
items(table)[item.id] = item;
return promises.resolved(item);
},
insert: function (item) {
items(table)[item.id] = item;
return promises.resolved(item);
},
delete: function (id, version) {
delete items(table)[id];
return promises.resolved(id);
},
undelete: function (id) {
// unsupported
return promises.resolved({ id: id });
},
truncate: function () {
tables[table.name] = {};
return promises.resolved();
},
initialize: function () {
return promises.resolved();
}
}
function items(table) {
var name = table.name.toLowerCase();
if(!tables[name])
tables[name] = {};
return tables[name];
}
function values(table) {
var tableItems = items(table);
return Object.keys(tableItems).map(function (id) {
return tableItems[id];
});
}
};
};
|
parent.jQuery(window).load(function() {
parent.jQuery('div.container select', document).change(function () {
change();
});
parent.jQuery('div.container input', document).keyup(function () {
change();
});
});
function change() {
fsi=parseInt(parent.jQuery('#fontsize', document).val(),10);
lh=parseInt(parent.jQuery('#lineheight', document).val(),10);
if (lh==0) lh=Math.round(font_size[fsi][2] * 1.2);
parent.jQuery('div.preview_text', document).html('<p style="font-size:' + font_size[fsi][2] + 'px; line-height:' + lh + 'px; font-family:' + parent.jQuery('#fontfamily', document).val() + '">' + demo_text + '</p>');
parent.jQuery('div.preview_text_no_css', document).html('<font size="' + font_size[fsi][1] + '" face="' + parent.jQuery('#fontfamily', document).val() + '">' + demo_text + '</font>');
}
function select_font() {
ff = parent.jQuery('#fontfamily', document).val();
fsi=parseInt(parent.jQuery('#fontsize', document).val(),10);
fs=font_size[fsi][1];
ss=font_size[fsi][2];
lh=parseInt(parent.jQuery('#lineheight', document).val(),10);
parent.CallBackFont(ff, fs, ss, lh);
}
|
//>>built
define("dojox/wire/ml/RestHandler",["dijit","dojo","dojox","dojo/require!dojox/wire/_base,dojox/wire/ml/util"],function(_1,_2,_3){
_2.provide("dojox.wire.ml.RestHandler");
_2.require("dojox.wire._base");
_2.require("dojox.wire.ml.util");
_2.declare("dojox.wire.ml.RestHandler",null,{contentType:"text/plain",handleAs:"text",bind:function(_4,_5,_6,_7){
_4=_4.toUpperCase();
var _8=this;
var _9={url:this._getUrl(_4,_5,_7),contentType:this.contentType,handleAs:this.handleAs,headers:this.headers,preventCache:this.preventCache};
var d=null;
if(_4=="POST"){
_9.postData=this._getContent(_4,_5);
d=_2.rawXhrPost(_9);
}else{
if(_4=="PUT"){
_9.putData=this._getContent(_4,_5);
d=_2.rawXhrPut(_9);
}else{
if(_4=="DELETE"){
d=_2.xhrDelete(_9);
}else{
d=_2.xhrGet(_9);
}
}
}
d.addCallbacks(function(_a){
_6.callback(_8._getResult(_a));
},function(_b){
_6.errback(_b);
});
},_getUrl:function(_c,_d,_e){
var _f;
if(_c=="GET"||_c=="DELETE"){
if(_d.length>0){
_f=_d[0];
}
}else{
if(_d.length>1){
_f=_d[1];
}
}
if(_f){
var _10="";
for(var _11 in _f){
var _12=_f[_11];
if(_12){
_12=encodeURIComponent(_12);
var _13="{"+_11+"}";
var _14=_e.indexOf(_13);
if(_14>=0){
_e=_e.substring(0,_14)+_12+_e.substring(_14+_13.length);
}else{
if(_10){
_10+="&";
}
_10+=(_11+"="+_12);
}
}
}
if(_10){
_e+="?"+_10;
}
}
return _e;
},_getContent:function(_15,_16){
if(_15=="POST"||_15=="PUT"){
return (_16?_16[0]:null);
}else{
return null;
}
},_getResult:function(_17){
return _17;
}});
});
|
define( "dojox/calendar/nls/fr/buttons", {
previousButton: "◄",
nextButton: "►",
todayButton: "Aujourd'hui",
dayButton: "Jour",
weekButton: "Semaine",
fourDaysButton: "4 jours",
monthButton: "Mois"
}
);
|
function setupFilterForm() {
// make filter form expandable
$('#filter-panel .card-header').on('click', function() {
$('#filter-panel .card-body').toggle(200);
if($('#filter-panel').hasClass('filter-panel-bottom')) {
$('html,body').animate({
scrollTop: $(document).height()
});
}
});
$('#filter-panel .help_popover').on('click', function(event) {
event.stopPropagation();
});
$('#filter-form').on('submit', function(event) {
if($('#filter-form').serialize() !== window.location.search.substring(1)) {
// show progress indication
$('#filter-form').hide();
$('#filter-panel .card-body').append('<span id="filter-progress"><i class="fa fa-cog fa-spin fa-2x fa-fw"></i> <span>Applying filter…</span></span>');
}
});
}
function parseFilterArguments(paramHandler) {
var varPairs = window.location.search.substring(1).split('&');
var filterLabels = [];
for (var j = 0; j < varPairs.length; ++j) {
var pair = varPairs[j].split('=');
if(pair.length > 1) {
var key = decodeURIComponent(pair[0].replace(/\+/g, '%20'));
var val = decodeURIComponent(pair[1].replace(/\+/g, '%20'));
if(val.length < 1) {
continue;
}
var filterLabel = paramHandler(key, val);
if(filterLabel) {
filterLabels.push(filterLabel);
} else {
var input = $('<input/>');
input.attr('value', val);
input.attr('name', key);
input.attr('hidden', true);
$('#filter-form').append(input);
}
}
}
if(filterLabels.length > 0) {
$('#filter-panel .card-header').find('span').text('current: ' + filterLabels.join(', '));
}
return filterLabels;
}
|
/*jslint browser: true, white: true, undef: true, nomen: true, eqeqeq: true, plusplus: true, bitwise: true, newcap: true, immed: true, indent: 4, onevar: false */
/*global window, $, jQuery, _ */
STUDIP.register = {
re_username : null,
re_email: null,
re_name: null,
clearErrors: function (field) {
jQuery('input[name=' + field + ']').parent().find('div').remove();
},
addError: function (field, error) {
jQuery('input[name=' + field + ']').parent().append('<div class="error">' + error + '</div>');
jQuery('div[class=error]').show();
},
checkusername: function () {
STUDIP.register.clearErrors('username');
var checked = true;
if (jQuery('input[name=username]').val().length < 4) {
STUDIP.register.addError('username', "Der Benutzername ist zu kurz, er sollte mindestens 4 Zeichen lang sein.".toLocaleString());
document.login.username.focus();
checked = false;
}
if (STUDIP.register.re_username.test(jQuery('input[name=username]').val()) === false) {
STUDIP.register.addError('username', "Der Benutzername enthält unzulässige Zeichen, er darf keine Sonderzeichen oder Leerzeichen enthalten.".toLocaleString());
document.login.username.focus();
checked = false;
}
return checked;
},
checkpassword: function () {
STUDIP.register.clearErrors('password');
var checked = true;
if (jQuery('input[name=password]').val().length < 4) {
STUDIP.register.addError('password', "Das Passwort ist zu kurz, es sollte mindestens 4 Zeichen lang sein.".toLocaleString());
document.login.password.focus();
checked = false;
}
return checked;
},
checkpassword2: function () {
STUDIP.register.clearErrors('password2');
var checked = true;
if (jQuery('input[name=password]').val() !== jQuery('input[name=password2]').val()) {
STUDIP.register.addError('password2', "Das Passwort stimmt nicht mit dem Bestätigungspasswort überein!".toLocaleString());
document.login.password2.focus();
checked = false;
}
return checked;
},
checkVorname: function () {
STUDIP.register.clearErrors('Vorname');
var checked = true;
if (STUDIP.register.re_name.test(jQuery('input[name=Vorname]').val()) === false) {
STUDIP.register.addError('Vorname', "Bitte geben Sie Ihren tatsächlichen Vornamen an.".toLocaleString());
document.login.Vorname.focus();
checked = false;
}
return checked;
},
checkNachname: function () {
STUDIP.register.clearErrors('Nachname');
var checked = true;
if (STUDIP.register.re_name.test(jQuery('input[name=Nachname]').val()) === false) {
STUDIP.register.addError('Nachname', "Bitte geben Sie Ihren tatsächlichen Nachnamen an.".toLocaleString());
document.login.Nachname.focus();
checked = false;
}
return checked;
},
checkEmail: function () {
STUDIP.register.clearErrors('Email');
var Email = jQuery('input[name=Email]').val();
var checked = true;
if ((STUDIP.register.re_email.test(Email)) === false || Email.length === 0) {
STUDIP.register.addError('Email', "Die E-Mail-Adresse ist nicht korrekt!".toLocaleString());
document.login.Email.focus();
checked = false;
}
return checked;
},
checkdata: function () {
return this.checkusername() &&
this.checkpassword() &&
this.checkpassword2() &&
this.checkVorname() &&
this.checkNachname() &&
this.checkEmail();
}
};
|
/*global _, _s, Backbone*/
define(function(require) {
var Super = require('views/base'),
B = require('bluebird'),
THEAD = require('hbs!./table/thead.tpl'),
TBODY = require('hbs!./table/tbody.tpl'),
TD = require('hbs!./table/td.tpl'),
TR = require('hbs!./table/tr.tpl'),
Template = require('hbs!./table.tpl');
var View = Super.extend({});
View.Columns = Backbone.Collection.extend();
View.prototype.initialize = function(options) {
//super(options)
Super.prototype.initialize.call(this, options);
this.columns = this.getColumns();
};
View.prototype.render = function() {
var that = this;
return B.resolve()
.then(function() {
that.$el.html(Template({
id: that.id
}));
that.mapControls();
that.renderHead();
that.renderBody();
var events = {};
events['click th.sortable'] = 'sortableColumnClickHandler';
that.delegateEvents(events);
that.collection.on('sync add remove', that.renderBody.bind(that));
that.on('sort', that.sortHandler.bind(that));
});
};
View.prototype.sortableColumnClickHandler = function(event) {
var that = this;
var e = $(event.currentTarget);
var field = e.data('id');
var column = that.columns.get(field);
var direction = '';
that.columns.forEach(function(column) {
if (column.id !== field) {
column.set('direction', '');
}
});
switch (column.get('direction')) {
case 'asc':
direction = 'desc';
break;
case 'desc':
direction = '';
break;
default:
direction = 'asc';
}
column.set('direction', direction);
that.trigger('sort');
};
View.prototype.sortHandler = function(event) {
var that = this;
that.renderHead();
};
View.prototype.renderHead = function() {
var that = this;
// console.log('renderHead()', that.columns.toJSON());
that.controls.thead.html(THEAD({
id: that.id,
columns: that.columns.map(function(column, index) {
return that.tranformColumn(column, index);
})
}));
};
View.prototype.getColumns = function() {
return new View.Columns();
};
View.prototype.tranformColumn = function(column, index) {
return _.extend(column.toJSON(), {
sortIcon: (function() {
if (column.get('sortable')) {
if (column.get('direction') === 'asc') {
if (column.get('type') === 'number') {
return 'fa-sort-numeric-asc text-success';
}
else {
return 'fa-sort-alpha-asc text-success';
}
}
else if (column.get('direction') === 'desc') {
if (column.get('type') === 'number') {
return 'fa-sort-numeric-desc text-warning';
}
else {
return 'fa-sort-alpha-desc text-warning';
}
}
else {
return 'fa-sort';
}
}
else {
return '';
}
})()
});
};
View.prototype.renderBody = function() {
var that = this;
that.controls.tbody.html(TBODY({
id: that.id,
rows: that.collection.map(function(model, index) {
return that.tranformRow(model, index);
}),
columns: that.columns.toJSON()
}));
};
View.prototype.tranformRow = function(model, index) {
var that = this;
var DefaultRenderer = that.getDefaultRenderer();
var cells = that.columns.map(function(column, columnIndex) {
var value = ' ';
var renderer = column.get('renderer') || DefaultRenderer;
var td = column.get('td') || TD;
if (typeof renderer === 'function') {
try {
value = renderer(model, column, index, columnIndex);
}
catch (e) {
console.error(e);
}
}
if (typeof td === 'function') {
return td({
value: value,
field: column.id,
data: model.toJSON(),
column: column.toJSON(),
rowIndex: index,
columnIndex: columnIndex,
className: column.get('className')
});
}
});
return TR({
data: model.toJSON(),
cells: cells.join('')
});
};
View.prototype.getDefaultRenderer = function() {
return function(model, column, rowIndex, columnIndex) {
return model.get(column.id);
};
};
View.prototype.getSortedColumn = function() {
var that = this;
return that.columns.find(function(column) {
return column.get('direction') === 'asc' || column.get('direction') === 'desc';
});
};
return View;
});
|
//
// namespace : HG.Statistics
// info : -
//
HG.Statistics = HG.Statistics || {};
//
HG.Statistics.ServiceCall = function (fn, opt1, opt2, callback) {
$.ajax({
url: '/' + HG.WebApp.Data.ServiceKey + '/' + HG.WebApp.Data.ServiceDomain + '/Statistics/' + fn + '/' + opt1 + '/' + opt2,
type: 'GET',
dataType: 'text',
success: function (data) {
var value = eval(data);
if (typeof value == 'undefined') {
value = data;
}
else if (typeof value[0] != 'undefined' && typeof value[0].ResponseValue != 'undefined') {
value = value[0].ResponseValue;
}
callback(value);
}
});
};
//
// namespace : HG.Statistics.Global
// info : -
//
HG.Statistics.Global = HG.Statistics.Global || {};
HG.Statistics.Global.GetWattsCounter = function (callback) {
$.ajax({
url: '/' + HG.WebApp.Data.ServiceKey + '/' + HG.WebApp.Data.ServiceDomain + '/Statistics/Global.CounterTotal/Meter.Watts',
type: 'GET',
dataType: 'text',
success: function (data) {
var counter = eval(data)[0];
callback(counter.ResponseValue);
}
});
};
//
// namespace : HG.Statistics.Database
// info : -
//
HG.Statistics.Database = HG.Statistics.Database || {};
HG.Statistics.Database.Reset = function () {
$.get('/' + HG.WebApp.Data.ServiceKey + '/' + HG.WebApp.Data.ServiceDomain + '/Statistics/Database.Reset/' + (new Date().getTime()), function (data) {
});
};
|
export default function(visitable, deletable, creatable, clickable, attribute, collection, filter) {
return creatable({
visit: visitable('/:dc/acls'),
acls: collection(
'[data-test-tabular-row]',
deletable({
name: attribute('data-test-acl', '[data-test-acl]'),
acl: clickable('a'),
actions: clickable('label'),
use: clickable('[data-test-use]'),
confirmUse: clickable('[data-test-confirm-use]'),
})
),
filter: filter,
});
}
|
/*
* Disorder is a class for storing genetic disorder info and loading it from the
* the OMIM database. These disorders can be attributed to an individual in the Pedigree.
*
* @param disorderID the id number for the disorder, taken from the OMIM database
* @param name a string representing the name of the disorder e.g. "Down Syndrome"
*/
var Disorder = Class.create( {
initialize: function(disorderID, name, callWhenReady) {
// user-defined disorders
if (name == null && !isInt(disorderID)) {
name = disorderID;
}
this._disorderID = disorderID;
this._name = name ? name : "loading...";
if (!name && callWhenReady)
this.load(callWhenReady);
},
/*
* Returns the disorderID of the disorder
*/
getDisorderID: function() {
return this._disorderID;
},
/*
* Returns the name of the disorder
*/
getName: function() {
return this._name;
},
load: function(callWhenReady) {
var baseOMIMServiceURL = Disorder.getOMIMServiceURL();
var queryURL = baseOMIMServiceURL + "&q=id:" + this._disorderID;
//console.log("queryURL: " + queryURL);
new Ajax.Request(queryURL, {
method: "GET",
onSuccess: this.onDataReady.bind(this),
//onComplete: complete.bind(this)
onComplete: callWhenReady ? callWhenReady : {}
});
},
onDataReady : function(response) {
try {
var parsed = JSON.parse(response.responseText);
//console.log(stringifyObject(parsed));
console.log("LOADED DISORDER: disorder id = " + this._disorderID + ", name = " + parsed.rows[0].name);
this._name = parsed.rows[0].name;
} catch (err) {
console.log("[LOAD DISORDER] Error: " + err);
}
}
});
Disorder.getOMIMServiceURL = function() {
return new XWiki.Document('OmimService', 'PhenoTips').getURL("get", "outputSyntax=plain");
}
|
/**
* Copyright (c) 2014, Oracle and/or its affiliates.
* All rights reserved.
*/
"use strict";var l={"EU":["EU","Eurooppa"]};(this?this:window)['DvtBaseMapManager']['_UNPROCESSED_MAPS'][2].push(["europe","continent",l]);
|
enyo.depends(
"source/VirtualSlidingPane.js",
"source/CanonSlidingView.js",
"source/CanonSliding.js"
);
|
/// Copyright (c) 2009 Microsoft Corporation
///
/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
/// that the following conditions are met:
/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
/// the following disclaimer.
/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
/// the following disclaimer in the documentation and/or other materials provided with the distribution.
/// * Neither the name of Microsoft nor the names of its contributors may be used to
/// endorse or promote products derived from this software without specific prior written permission.
///
/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
ES5Harness.registerTest({
id: "15.2.3.5-4-83",
path: "TestCases/chapter15/15.2/15.2.3/15.2.3.5/15.2.3.5-4-83.js",
description: "Object.create - 'enumerable' property of one property in 'Properties' is a non-empty string (8.10.5 step 3.b)",
test: function testcase() {
var accessed = false;
var newObj = Object.create({}, {
prop: {
enumerable: "AB\n\\cd"
}
});
for (var property in newObj) {
if (property === "prop") {
accessed = true;
}
}
return accessed;
},
precondition: function prereq() {
return fnExists(Object.create);
}
});
|
/**
* Copyright 2015 The AMP HTML 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.
*/
// Requires polyfills in immediate side effect.
import '../polyfills';
import {user} from '../log';
import {fromClass} from '../service';
/**
* Helper with all things Timer.
*/
export class Timer {
/**
* @param {!Window} win
*/
constructor(win) {
/** @const {!Window} */
this.win = win;
/** @private @const {!Promise} */
this.resolved_ = Promise.resolve();
this.taskCount_ = 0;
this.canceled_ = {};
/** @const {number} */
this.startTime_ = Date.now();
}
/**
* Returns time since start in milliseconds.
* @return {number}
*/
timeSinceStart() {
return Date.now() - this.startTime_;
}
/**
* Runs the provided callback after the specified delay. This uses a micro
* task for 0 or no specified time. This means that the delay will actually
* be close to 0 and this will NOT yield to the event queue.
*
* Returns the timer ID that can be used to cancel the timer (cancel method).
* @param {!function()} callback
* @param {number=} opt_delay
* @return {number|string}
*/
delay(callback, opt_delay) {
if (!opt_delay) {
// For a delay of zero, schedule a promise based micro task since
// they are predictably fast.
const id = 'p' + this.taskCount_++;
this.resolved_.then(() => {
if (this.canceled_[id]) {
delete this.canceled_[id];
return;
}
callback();
});
return id;
}
return this.win.setTimeout(callback, opt_delay);
}
/**
* Cancels the previously scheduled callback.
* @param {number|string|null} timeoutId
*/
cancel(timeoutId) {
if (typeof timeoutId == 'string') {
this.canceled_[timeoutId] = true;
return;
}
this.win.clearTimeout(timeoutId);
}
/**
* Returns a promise that will resolve after the delay. Optionally, the
* resolved value can be provided as opt_result argument.
* @param {number=} opt_delay
* @param {RESULT=} opt_result
* @return {!Promise<RESULT>}
* @template RESULT
*/
promise(opt_delay, opt_result) {
let timerKey = null;
return new Promise((resolve, reject) => {
timerKey = this.delay(() => {
timerKey = -1;
resolve(opt_result);
}, opt_delay);
if (timerKey == -1) {
reject(new Error('Failed to schedule timer.'));
}
}).catch(error => {
// Clear the timer. The most likely reason is "cancel" signal.
if (timerKey != -1) {
this.cancel(timerKey);
}
throw error;
});
}
/**
* Returns a promise that will fail after the specified delay. Optionally,
* this method can take opt_racePromise parameter. In this case, the
* resulting promise will either fail when the specified delay expires or
* will resolve based on the opt_racePromise, whichever happens first.
* @param {number} delay
* @param {!Promise<RESULT>|undefined} opt_racePromise
* @param {string=} opt_message
* @return {!Promise<RESULT>}
* @template RESULT
*/
timeoutPromise(delay, opt_racePromise, opt_message) {
let timerKey = null;
const delayPromise = new Promise((_resolve, reject) => {
timerKey = this.delay(() => {
timerKey = -1;
reject(user().createError(opt_message || 'timeout'));
}, delay);
if (timerKey == -1) {
reject(new Error('Failed to schedule timer.'));
}
}).catch(error => {
// Clear the timer. The most likely reason is "cancel" signal.
if (timerKey != -1) {
this.cancel(timerKey);
}
throw error;
});
if (!opt_racePromise) {
return delayPromise;
}
return Promise.race([delayPromise, opt_racePromise]);
}
}
/**
* @param {!Window} window
* @return {!Timer}
*/
export function installTimerService(window) {
return fromClass(window, 'timer', Timer);
};
|
define(function(require, exports, module) {
var showMessage = function(type, message, duration) {
var $exist = $('.bootstrap-notify-bar');
if ($exist.length > 0) {
$exist.remove();
}
var html = '<div class="alert alert-' + type + ' bootstrap-notify-bar" style="display:none;">'
html += '<button type="button" class="close" data-dismiss="alert">×</button>';
html += message;
html += '</div>';
var $html = $(html);
$html.appendTo('body');
$html.slideDown(100, function(){
duration = $.type(duration) == 'undefined' ? 3 : duration;
if (duration > 0) {
setTimeout(function(){
$html.remove();
}, duration * 1000);
}
});
}
var Notify = {
primary: function(message, duration) {
showMessage('primary', message, duration);
},
success: function(message, duration) {
showMessage('success', message, duration);
},
warning: function(message, duration) {
showMessage('warning', message, duration);
},
danger: function(message, duration) {
showMessage('danger', message, duration);
},
info: function(message, duration) {
showMessage('info', message, duration);
}
};
module.exports = Notify;
});
|
// <![CDATA[
/**
* Creative Commons has made the contents of this file
* available under a CC-GNU-GPL license:
*
* http://creativecommons.org/licenses/GPL/2.0/
*
* A copy of the full license can be found as part of this
* distribution in the file COPYING.
*
* You may use this software in accordance with the
* terms of that license. You agree that you are solely
* responsible for your use of this software and you
* represent and warrant to Creative Commons that your use
* of this software will comply with the CC-GNU-GPL.
*
* $Id: $
*
* Copyright 2006, Creative Commons, www.creativecommons.org.
*
* This is code that is used to generate licenses.
*
*/
function cc_js_$F(id) {
if (cc_js_$(id)) {
return cc_js_$(id).value;
}
return null; // if we can't find the form element, pretend it has no contents
}
function cc_js_$(id) {
return document.getElementById("cc_js_" + id);
}
/* Inspired by Django. Thanks, guys.
* http://code.djangoproject.com/browser/django/trunk/django/views/i18n.py
* Our use of gettext is incomplete, so I'm just grabbing the one function.
* And I've modified it, anyway.
* Here is their license - it applies only to the following function:
Copyright (c) 2005, the Lawrence Journal-World
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of Django nor the names of its contributors may be used
to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
function cc_js_gettext_style_interpolate(fmt, obj) {
return fmt.replace(/\${\w+}/g, function(match){return String(obj[match.slice(2,-1)])});
}
|
var a = 10;
var b;
var c = 10, d, e;
var c2, d2 = 10;
//# sourceMappingURL=sourceMapValidationVariables.js.map
|
// Editor.js
(function() {
var STORAGE_KEY = slingUserId+'-browser-file';
var editor = ace.edit("editor");
var saveBtn = $('#saveBtn');
// parent file should set the aceMode variable
editor.getSession().setMode(aceMode);
editor.getSession().setUseWrapMode(false);
editor.getSession().on('change', function(e) {
saveBtn[0].disabled=false;
});
$('#aceThemeSelect').on('change',function () {
var theme = $(this).val();
editor.setTheme("ace/theme/"+theme);
setLocalStorage(STORAGE_KEY, {theme:theme});
})
saveBtn.on('click', function(e) {
this.disabled=true;
$('input#jcrData').val(editor.getValue());
$('#updateForm').submit();
});
$('#editor').css('opacity',1);
var storage = getJsonLocalStorage(STORAGE_KEY);
if (storage && storage.theme) {
$('#aceThemeSelect').val(storage.theme).trigger('change');
}
})()
|
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2017, OpenNebula Project, OpenNebula Systems */
/* */
/* 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(function(require) {
/*
DEPENDENCIES
*/
var InstantiateTemplateFormPanel = require('tabs/vrouter-templates-tab/form-panels/instantiate');
var Sunstone = require('sunstone');
var Locale = require('utils/locale');
var Tips = require('utils/tips');
var VRouterTemplatesTable = require('tabs/vrouter-templates-tab/datatable');
/*
TEMPLATES
*/
var TemplateAdvancedHTML = require('hbs!./create/advanced');
/*
CONSTANTS
*/
var FORM_PANEL_ID = require('./create/formPanelId');
var TAB_ID = require('../tabId');
/*
CONSTRUCTOR
*/
function FormPanel() {
InstantiateTemplateFormPanel.call(this);
this.formPanelId = FORM_PANEL_ID;
this.tabId = TAB_ID;
this.actions = {
'create': {
'title': Locale.tr("Create Virtual Router"),
'buttonText': Locale.tr("Create"),
'resetButton': true
}
};
this.templatesTable = new VRouterTemplatesTable(
'vr_create',
{ 'select': true });
}
FormPanel.FORM_PANEL_ID = FORM_PANEL_ID;
FormPanel.prototype = Object.create(InstantiateTemplateFormPanel.prototype);
FormPanel.prototype.constructor = FormPanel;
FormPanel.prototype.htmlAdvanced = _htmlAdvanced;
FormPanel.prototype.submitAdvanced = _submitAdvanced;
FormPanel.prototype.onShow = _onShow;
FormPanel.prototype.setup = _setup;
return FormPanel;
/*
FUNCTION DEFINITIONS
*/
function _htmlAdvanced() {
return TemplateAdvancedHTML({formPanelId: this.formPanelId});
}
function _setup(context) {
var that = this;
InstantiateTemplateFormPanel.prototype.setup.call(this, context);
$(".selectTemplateTable", context).html(this.templatesTable.dataTableHTML);
$(".table_wrapper", context).show();
$(".no_table_wrapper", context).hide();
this.templatesTable.initialize();
this.templatesTable.idInput().attr("required", "");
this.templatesTable.idInput().on("change", function(){
var template_id = $(this).val();
that.setTemplateId(context, template_id);
});
$(".vr_attributes #name", context).on("input", function(){
$('#vm_name', context).val("vr-"+$(this).val()+"-%i");
});
Tips.setup(context);
return false;
}
function _submitAdvanced(context) {
if (this.action == "create") {
var template = $('textarea#template', context).val();
var virtual_router_json = {virtual_router: {virtual_router_raw: template}};
Sunstone.runAction("VirtualRouter.create",virtual_router_json);
return false;
}
}
function _onShow(context) {
this.templatesTable.refreshResourceTableSelect();
InstantiateTemplateFormPanel.prototype.onShow.call(this, context);
}
});
|
define(function (require) {
'use strict';
var modules = require('modules');
var $ = require('jquery');
modules.get('a4c-common').factory('resizeServices', ['$timeout', function($timeout) {
// the default min width and height for the application
var minWidth = 640;
var minHeight = 200;
return {
registerContainer: function(callback, selector) {
var container = $(selector);
var instance = this;
window.onresize = function() {
if (container.size()) {
var offsets = container.offset();
if (offsets && offsets.top && offsets.left) {
callback(instance.getWidth(offsets.left), instance.getHeight(offsets.top));
}
}
};
this.initSize();
},
register: function(callback, widthOffset, heightOffset) {
var instance = this;
window.onresize = function() {
callback(instance.getWidth(widthOffset), instance.getHeight(heightOffset));
};
this.initSize();
},
initSize: function() {
$timeout(function() {
window.onresize();
});
},
getHeight : function(offset){
var height = $(window).height();
if(height < minHeight) {
height = minHeight;
}
return height - offset;
},
getWidth : function(offset) {
var width = $(window).width();
if(width < minWidth) {
width = minWidth;
}
return width - offset;
}
};
}]); // factory
}); // define
|
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: The length property of shift has the attribute DontEnum
es5id: 15.4.4.9_A5.1
description: Checking use propertyIsEnumerable, for-in
---*/
//CHECK#1
if (Array.prototype.shift.propertyIsEnumerable('length') !== false) {
$ERROR('#1: Array.prototype.shift.propertyIsEnumerable(\'length\') === false. Actual: ' + (Array.prototype.shift.propertyIsEnumerable('length')));
}
//CHECK#2
var result = true;
for (var p in Array.prototype.shift){
if (p === "length") {
result = false;
}
}
if (result !== true) {
$ERROR('#2: result = true; for (p in Array.prototype.shift) { if (p === "length") result = false; } result === true;');
}
|
//>>built
define(
"dojox/editor/plugins/nls/hr/CollapsibleToolbar", ({
"collapse": "Spusti traku s alatima editora",
"expand": "Proširi traku s alatima editora"
})
);
|
'use strict';
describe('Service: backend', function () {
// load the service's module
beforeEach(module('yeomanIonicAngularPhonegapSeedApp'));
// instantiate service
var backend;
beforeEach(inject(function(_backend_) {
backend = _backend_;
}));
it('should do something', function () {
expect(!!backend).toBe(true);
});
});
|
//>>built
define(
"dojox/editor/plugins/nls/cs/InsertAnchor", //begin v1.x content
({
insertAnchor: "Vložit kotvu",
title: "Vlastnosti kotvy",
anchor: "Název:",
text: "Popis:",
set: "Nastavit",
cancel: "Storno"
})
//end v1.x content
);
|
/*
Copyright 2017 Google Inc.
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.
*/
'use strict';
var xhr = new XMLHttpRequest();
xhr.open('GET', 'data.json');
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
var data = JSON.parse(xhr.responseText);
document.querySelector('#data').innerHTML = JSON.stringify(data);
}
};
/*
// can do this in Chrome, Firefox, etc.:
xhr.onload = function(event) {
var data = JSON.parse(this.response);
document.querySelector('#data').innerHTML = JSON.stringify(data);
}
*/
xhr.send();
|
var accordion = function() {
var e = new Foundation.Accordion($('.accordion'));
}
|
'use strict';
const { Readable } = require('stream');
const SILENCE_FRAME = Buffer.from([0xF8, 0xFF, 0xFE]);
class Silence extends Readable {
_read() {
this.push(SILENCE_FRAME);
}
}
module.exports = Silence;
|
goog.provide('ol.animation');
goog.require('ol');
goog.require('ol.PreRenderFunction');
goog.require('ol.ViewHint');
goog.require('ol.coordinate');
goog.require('ol.easing');
/**
* Generate an animated transition that will "bounce" the resolution as it
* approaches the final value.
* @param {olx.animation.BounceOptions} options Bounce options.
* @return {ol.PreRenderFunction} Pre-render function.
* @api
*/
ol.animation.bounce = function(options) {
var resolution = options.resolution;
var start = options.start ? options.start : Date.now();
var duration = options.duration !== undefined ? options.duration : 1000;
var easing = options.easing ?
options.easing : ol.easing.upAndDown;
return (
/**
* @param {ol.Map} map Map.
* @param {?olx.FrameState} frameState Frame state.
* @return {boolean} Run this function in the next frame.
*/
function(map, frameState) {
if (frameState.time < start) {
frameState.animate = true;
frameState.viewHints[ol.ViewHint.ANIMATING] += 1;
return true;
} else if (frameState.time < start + duration) {
var delta = easing((frameState.time - start) / duration);
var deltaResolution = resolution - frameState.viewState.resolution;
frameState.animate = true;
frameState.viewState.resolution += delta * deltaResolution;
frameState.viewHints[ol.ViewHint.ANIMATING] += 1;
return true;
} else {
return false;
}
});
};
/**
* Generate an animated transition while updating the view center.
* @param {olx.animation.PanOptions} options Pan options.
* @return {ol.PreRenderFunction} Pre-render function.
* @api
*/
ol.animation.pan = function(options) {
var source = options.source;
var start = options.start ? options.start : Date.now();
var sourceX = source[0];
var sourceY = source[1];
var duration = options.duration !== undefined ? options.duration : 1000;
var easing = options.easing ?
options.easing : ol.easing.inAndOut;
return (
/**
* @param {ol.Map} map Map.
* @param {?olx.FrameState} frameState Frame state.
* @return {boolean} Run this function in the next frame.
*/
function(map, frameState) {
if (frameState.time < start) {
frameState.animate = true;
frameState.viewHints[ol.ViewHint.ANIMATING] += 1;
return true;
} else if (frameState.time < start + duration) {
var delta = 1 - easing((frameState.time - start) / duration);
var deltaX = sourceX - frameState.viewState.center[0];
var deltaY = sourceY - frameState.viewState.center[1];
frameState.animate = true;
frameState.viewState.center[0] += delta * deltaX;
frameState.viewState.center[1] += delta * deltaY;
frameState.viewHints[ol.ViewHint.ANIMATING] += 1;
return true;
} else {
return false;
}
});
};
/**
* Generate an animated transition while updating the view rotation.
* @param {olx.animation.RotateOptions} options Rotate options.
* @return {ol.PreRenderFunction} Pre-render function.
* @api
*/
ol.animation.rotate = function(options) {
var sourceRotation = options.rotation ? options.rotation : 0;
var start = options.start ? options.start : Date.now();
var duration = options.duration !== undefined ? options.duration : 1000;
var easing = options.easing ?
options.easing : ol.easing.inAndOut;
var anchor = options.anchor ?
options.anchor : null;
return (
/**
* @param {ol.Map} map Map.
* @param {?olx.FrameState} frameState Frame state.
* @return {boolean} Run this function in the next frame.
*/
function(map, frameState) {
if (frameState.time < start) {
frameState.animate = true;
frameState.viewHints[ol.ViewHint.ANIMATING] += 1;
return true;
} else if (frameState.time < start + duration) {
var delta = 1 - easing((frameState.time - start) / duration);
var deltaRotation =
(sourceRotation - frameState.viewState.rotation) * delta;
frameState.animate = true;
frameState.viewState.rotation += deltaRotation;
if (anchor) {
var center = frameState.viewState.center;
ol.coordinate.sub(center, anchor);
ol.coordinate.rotate(center, deltaRotation);
ol.coordinate.add(center, anchor);
}
frameState.viewHints[ol.ViewHint.ANIMATING] += 1;
return true;
} else {
return false;
}
});
};
/**
* Generate an animated transition while updating the view resolution.
* @param {olx.animation.ZoomOptions} options Zoom options.
* @return {ol.PreRenderFunction} Pre-render function.
* @api
*/
ol.animation.zoom = function(options) {
var sourceResolution = options.resolution;
var start = options.start ? options.start : Date.now();
var duration = options.duration !== undefined ? options.duration : 1000;
var easing = options.easing ?
options.easing : ol.easing.inAndOut;
return (
/**
* @param {ol.Map} map Map.
* @param {?olx.FrameState} frameState Frame state.
* @return {boolean} Run this function in the next frame.
*/
function(map, frameState) {
if (frameState.time < start) {
frameState.animate = true;
frameState.viewHints[ol.ViewHint.ANIMATING] += 1;
return true;
} else if (frameState.time < start + duration) {
var delta = 1 - easing((frameState.time - start) / duration);
var deltaResolution =
sourceResolution - frameState.viewState.resolution;
frameState.animate = true;
frameState.viewState.resolution += delta * deltaResolution;
frameState.viewHints[ol.ViewHint.ANIMATING] += 1;
return true;
} else {
return false;
}
});
};
|
require('fis3-smarty')(fis);
fis.set('namespace', 'common');
|
'use strict';
var util = require('../node_modules/mapbox-gl/js/util/util');
try {
main();
} catch (err) {
log('red', err.toString());
throw err;
}
function main() {
var benchmarks = {
simple_select_small: require('./tests/simple_select_small'),
simple_select_large: require('./tests/simple_select_large'),
simple_select_large_two_maps: require('./tests/simple_select_large_two_maps'),
simple_select_large_zoomed: require('./tests/simple_select_large_zoomed'),
direct_select_small: require('./tests/direct_select_small'),
direct_select_small_zoomed: require('./tests/direct_select_small_zoomed'),
direct_select_large: require('./tests/direct_select_large'),
direct_select_large_zoomed: require('./tests/direct_select_large_zoomed'),
draw_line_string_small: require('./tests/draw_line_string_small'),
draw_line_string_large: require('./tests/draw_line_string_large'),
draw_line_string_large_zoomed: require('./tests/draw_line_string_large_zoomed'),
draw_polygon_small: require('./tests/draw_polygon_small'),
draw_polygon_large: require('./tests/draw_polygon_large'),
draw_polygon_large_zoomed: require('./tests/draw_polygon_large_zoomed'),
draw_land_polygon_small: require('./tests/draw_land_polygon_small'),
draw_land_polygon_large: require('./tests/draw_land_polygon_large'),
draw_urban_areas_polygon_small: require('./tests/draw_urban_areas_polygon_small'),
draw_urban_areas_polygon_large: require('./tests/draw_urban_areas_polygon_large'),
draw_point_small: require('./tests/draw_point_small'),
draw_point_large: require('./tests/draw_point_large'),
draw_point_large_zoomed: require('./tests/draw_point_large_zoomed'),
};
var pathnameArray = location.pathname.split('/');
var benchmarkName = pathnameArray[pathnameArray.length - 1] || pathnameArray[pathnameArray.length - 2];
var testDiv = document.getElementById('tests');
var tests = Object.keys(benchmarks);
var innerHTML = '';
tests.forEach(function(test) {
innerHTML += '<div class="test">';
innerHTML += '<a href="/bench/'+test+'">'+test+'</a>';
innerHTML += '</div>';
if (test === benchmarkName) {
innerHTML += '<div id="logs"></div>';
}
});
testDiv.innerHTML = innerHTML;
log('dark', 'please keep this window in the foreground and close the debugger');
var createBenchmark = benchmarks[benchmarkName];
if (!createBenchmark) {
log('dark', benchmarkName+' is not a valid test name');
return;
}
var benchmark = createBenchmark({
accessToken: getAccessToken(),
createMap: createMap
});
benchmark.on('log', function(event) {
log(event.color || 'blue', event.message);
});
benchmark.on('pass', function(event) {
log('green', '<strong class="prose-big">' + event.message + '</strong>');
});
benchmark.on('fail', function(event) {
log('red', '<strong class="prose-big">' + event.message + '</strong>');
});
}
function log(color, message) {
document.getElementById('logs').innerHTML += '<div class="log dark fill-' + color + '"><p>' + message + '</p></div>';
}
function getAccessToken() {
var accessToken = (
process.env.MapboxAccessToken ||
process.env.MAPBOX_ACCESS_TOKEN ||
getURLParameter('access_token') ||
localStorage.getItem('accessToken')
);
localStorage.setItem('accessToken', accessToken);
return accessToken;
}
function getURLParameter(name) {
var regexp = new RegExp('[?&]' + name + '=([^&#]*)', 'i');
var output = regexp.exec(window.location.href);
return output && output[1];
}
function createMap(options) {
var mapElement = document.getElementById('map');
options = util.extend({width: 512, height: 512}, options);
mapElement.style.display = 'block';
mapElement.style.width = options.width + 'px';
mapElement.style.height = options.height + 'px';
mapboxgl.accessToken = getAccessToken();
var map = new mapboxgl.Map(util.extend({
container: 'map',
style: 'mapbox://styles/mapbox/streets-v8'
}, options));
var draw = mapboxgl.Draw(options);
map.addControl(draw);
return {
draw: draw,
map: map
}
}
|
/* depends_on_multi_main 2.1.1 */
|
import {
moduleForModel,
test
} from 'ember-qunit';
moduleForModel('simple-model', 'SimpleModel', {
// Specify the other units that are required for this test.
needs: []
});
test('it exists', function() {
var model = this.subject();
// var store = this.store();
ok(!!model);
});
|
/**
* rcmuserAdminUsersApp.rcmuserAdminUsers
*/
angular.module('rcmuserAdminUsersApp').controller(
'rcmuserAdminUsers',
[
'$window',
'$scope',
'$log',
'$uibModal',
'RcmUserResult',
'RcmResults',
'rcmUserUserService',
function (
$window,
$scope,
$log,
$uibModal,
RcmUserResult,
RcmResults,
rcmUserUserService
) {
var self = this;
var userServiceEventManager = rcmUserUserService.getEventManager();
$scope.loading = true;
userServiceEventManager.on(
'RcmUserHttp.loading',
function (loading) {
$scope.loading = loading;
}
);
$scope.userQuery = '';
$scope.availableStates = [
'enabled',
'disabled'
];
// User
$scope.showMessages = false;
var onError = function (data) {
$window.alert('An error occurred');
console.error(data);
};
var onGetUsersSuccess = function (data) {
$scope.users = data.data;
$scope.messages = data.messages;
};
rcmUserUserService.getUsers(
onGetUsersSuccess,
onError
);
var onGetRolesSuccess = function (data) {
$scope.roles = data.data;
$scope.messages = data.messages;
};
// User Roles
rcmUserUserService.getRoles(
onGetRolesSuccess,
onError
);
var onValidUserStatesSuccess = function (data, status) {
$scope.availableStates = data.data;
};
// valid user states
rcmUserUserService.getValidUserStates(
onValidUserStatesSuccess
);
$scope.rolePropertyId = rcmUserUserService.getPropertyRoleId();
$scope.oneAtATime = false;
$scope.addUser = function () {
var user = {
username: '',
password: null,
state: 'disabled',
email: '',
name: '',
properties: {},
isNew: true
};
user.properties[$scope.rolePropertyId] = [];
$scope.users.unshift(user);
// clear filter
$scope.userQuery = '';
}
}
]
);
|
(function () {
'use strict';
function foo () {
return embiggen( 6, 7 );
}
/**
* Embiggens a number
* @param {number} num - the number to embiggen
* @param {number} factor - the factor to embiggen it by
* @returns {number}
*/
function embiggen ( num, factor ) {
return num * factor;
}
alert( foo() );
}());
|
require('./options-styles');
var CodeMirror = require('codemirror');
require('codemirror/addon/fold/foldcode');
require('codemirror/addon/fold/foldgutter');
require('codemirror/addon/fold/brace-fold');
require('codemirror/mode/javascript/javascript');
require('codemirror/addon/hint/show-hint');
require('codemirror/addon/hint/css-hint');
require('codemirror/mode/css/css');
var sweetAlert = require('sweetalert');
var Storage = require('./json-viewer/storage');
var renderThemeList = require('./json-viewer/options/render-theme-list');
var renderAddons = require('./json-viewer/options/render-addons');
var renderStructure = require('./json-viewer/options/render-structure');
var renderStyle = require('./json-viewer/options/render-style');
var bindSaveButton = require('./json-viewer/options/bind-save-button');
var bindResetButton = require('./json-viewer/options/bind-reset-button');
function isValidJSON(pseudoJSON) {
try {
JSON.parse(pseudoJSON);
return true;
} catch(e) {
return false;
}
}
function renderVersion() {
var version = process.env.VERSION;
var versionLink = document.getElementsByClassName('version')[0];
versionLink.innerHTML = version;
versionLink.href = "https://github.com/tulios/json-viewer/tree/" + version;
}
function onLoaded() {
var currentOptions = Storage.load();
renderVersion();
renderThemeList(CodeMirror, currentOptions.theme);
var addonsEditor = renderAddons(CodeMirror, currentOptions.addons);
var structureEditor = renderStructure(CodeMirror, currentOptions.structure);
var styleEditor = renderStyle(CodeMirror, currentOptions.style);
bindResetButton();
bindSaveButton([addonsEditor, structureEditor, styleEditor], function(options) {
if (!isValidJSON(options.addons)) {
sweetAlert("Ops!", "\"Add-ons\" isn't a valid JSON", "error");
} else if (!isValidJSON(options.structure)) {
sweetAlert("Ops!", "\"Structure\" isn't a valid JSON", "error");
} else {
Storage.save(options);
sweetAlert("Success", "Options saved!", "success");
}
});
}
document.addEventListener("DOMContentLoaded", onLoaded, false);
|
/**
* Theme: Simple Admin Template
* Author: Coderthemes
* VectorMap
*/
! function($) {
"use strict";
var VectorMap = function() {
};
VectorMap.prototype.init = function() {
//various examples
$('#world-map-markers').vectorMap({
map : 'world_mill_en',
scaleColors : ['#4bd396', '#4bd396'],
normalizeFunction : 'polynomial',
hoverOpacity : 0.7,
hoverColor : false,
regionStyle : {
initial : {
fill : '#ddd'
}
},
markerStyle: {
initial: {
r: 9,
'fill': '#4bd396',
'fill-opacity': 0.9,
'stroke': '#fff',
'stroke-width' : 7,
'stroke-opacity': 0.4
},
hover: {
'stroke': '#fff',
'fill-opacity': 1,
'stroke-width': 1.5
}
},
backgroundColor : 'transparent',
markers : [{
latLng : [41.90, 12.45],
name : 'Vatican City'
}, {
latLng : [43.73, 7.41],
name : 'Monaco'
}, {
latLng : [-0.52, 166.93],
name : 'Nauru'
}, {
latLng : [-8.51, 179.21],
name : 'Tuvalu'
}, {
latLng : [43.93, 12.46],
name : 'San Marino'
}, {
latLng : [47.14, 9.52],
name : 'Liechtenstein'
}, {
latLng : [7.11, 171.06],
name : 'Marshall Islands'
}, {
latLng : [17.3, -62.73],
name : 'Saint Kitts and Nevis'
}, {
latLng : [3.2, 73.22],
name : 'Maldives'
}, {
latLng : [35.88, 14.5],
name : 'Malta'
}, {
latLng : [12.05, -61.75],
name : 'Grenada'
}, {
latLng : [13.16, -61.23],
name : 'Saint Vincent and the Grenadines'
}, {
latLng : [13.16, -59.55],
name : 'Barbados'
}, {
latLng : [17.11, -61.85],
name : 'Antigua and Barbuda'
}, {
latLng : [-4.61, 55.45],
name : 'Seychelles'
}, {
latLng : [7.35, 134.46],
name : 'Palau'
}, {
latLng : [42.5, 1.51],
name : 'Andorra'
}, {
latLng : [14.01, -60.98],
name : 'Saint Lucia'
}, {
latLng : [6.91, 158.18],
name : 'Federated States of Micronesia'
}, {
latLng : [1.3, 103.8],
name : 'Singapore'
}, {
latLng : [1.46, 173.03],
name : 'Kiribati'
}, {
latLng : [-21.13, -175.2],
name : 'Tonga'
}, {
latLng : [15.3, -61.38],
name : 'Dominica'
}, {
latLng : [-20.2, 57.5],
name : 'Mauritius'
}, {
latLng : [26.02, 50.55],
name : 'Bahrain'
}, {
latLng : [0.33, 6.73],
name : 'São Tomé and Príncipe'
}]
});
$('#usa').vectorMap({
map : 'us_aea_en',
backgroundColor : 'transparent',
regionStyle : {
initial : {
fill : '#ddd'
}
}
});
$('#india').vectorMap({
map : 'in_mill',
backgroundColor : 'transparent',
regionStyle : {
initial : {
fill : '#ddd'
}
}
});
$('#uk').vectorMap({
map : 'uk_mill_en',
backgroundColor : 'transparent',
regionStyle : {
initial : {
fill : '#ddd'
}
}
});
$('#chicago').vectorMap({
map : 'us-il-chicago_mill_en',
backgroundColor : 'transparent',
regionStyle : {
initial : {
fill : '#ddd'
}
}
});
$('#australia').vectorMap({
map : 'au_mill',
backgroundColor : 'transparent',
regionStyle : {
initial : {
fill : '#ddd'
}
}
});
$('#canada').vectorMap({
map : 'ca_lcc',
backgroundColor : 'transparent',
regionStyle : {
initial : {
fill : '#ddd'
}
}
});
$('#germany').vectorMap({
map : 'de_mill',
backgroundColor : 'transparent',
regionStyle : {
initial : {
fill : '#ddd'
}
}
});
$('#asia').vectorMap({
map : 'asia_mill',
backgroundColor : 'transparent',
regionStyle : {
initial : {
fill : '#ddd'
}
}
});
},
//init
$.VectorMap = new VectorMap, $.VectorMap.Constructor =
VectorMap
}(window.jQuery),
//initializing
function($) {
"use strict";
$.VectorMap.init()
}(window.jQuery);
|
/*eslint-env node */
module.exports = function (grunt) {
grunt.initConfig({
"bolt-init": {
"plugin": {
config_dir: "config/bolt"
}
},
"bolt-build": {
"plugin": {
config_js: "config/bolt/prod.js",
output_dir: "scratch",
main: "tinymce.wordcount.Plugin",
filename: "plugin",
generate_inline: true,
minimise_module_names: true,
files: {
src: ["src/main/js/tinymce/wordcount/Plugin.js"]
}
}
},
copy: {
"plugin": {
files: [
{
src: "scratch/inline/plugin.raw.js",
dest: "plugin.js"
}
]
}
},
eslint: {
options: {
config: "../../../../.eslintrc"
},
src: [
"src"
]
},
uglify: {
options: {
beautify: {
ascii_only: true,
screw_ie8: false
},
compress: {
screw_ie8: false
}
},
"plugin": {
files: [
{
src: "scratch/inline/plugin.js",
dest: "plugin.min.js"
}
]
}
}
});
grunt.task.loadTasks("../../../../node_modules/@ephox/bolt/tasks");
grunt.task.loadTasks("../../../../node_modules/grunt-contrib-copy/tasks");
grunt.task.loadTasks("../../../../node_modules/grunt-contrib-uglify/tasks");
grunt.task.loadTasks("../../../../node_modules/grunt-eslint/tasks");
grunt.registerTask("default", ["bolt-init", "bolt-build", "copy", "eslint", "uglify"]);
};
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.