text
stringlengths
2
6.14k
'use strict'; const path = require('path'); // This is a custom Jest transformer turning file imports into filenames. // https://facebook.github.io/jest/docs/en/webpack.html module.exports = { process(src, filename) { const assetFilename = JSON.stringify(path.basename(filename)); if (filename.match(/\.svg$/)) { return `const React = require('react'); module.exports = { __esModule: true, default: ${assetFilename}, ReactComponent: React.forwardRef((props, ref) => ({ $$typeof: Symbol.for('react.element'), type: 'svg', ref: ref, key: null, props: Object.assign({}, props, { children: ${assetFilename} }) })), };`; } return `module.exports = ${assetFilename};`; }, };
var colors = require('colors'); colors.enabled = true; exports.config = { seleniumAddress: 'http://localhost:4444/wd/hub', specs: ['../nodejs/jasmine-custom-message.spec.js', './test-jasmine-custom-message.js'] };
import { Increment, Decrement } from '../actions' export default (state = 0, action) => { switch (action.constructor) { case Increment: return state + 1 case Decrement: return state - 1 default: return state } }
import { RECEIVE_ALL_JOBS, RECEIVE_JOB, REQUEST_ALL_JOBS, REQUEST_JOB, RECEIVE_FILTERED_JOBS, REQUEST_FILTERED_JOBS, CREATE_JOBS, PAGINATE_JOBS, UPDATE_JOB, DELETE_JOB } from './constants' const initialState = { fetchingSelected: false, selected: null, fetchingAll: false, all: null, filteredJobs: null, filtered: false, filter: null, // we persist user's search parameters between navigations to/from home and job detail pages offset: 0, pageNum: 1 } const jobsReducer = (state = initialState, action) => { switch (action.type) { case REQUEST_ALL_JOBS: return { fetchingSelected: false, selected: null, fetchingAll: true, all: null, filteredJobs: state.filteredJobs ? [...state.filteredJobs] : null, filtered: false, filter: null, offset: 0, pageNum: 1 } case RECEIVE_ALL_JOBS: return { fetchingSelected: false, selected: null, fetchingAll: false, all: action.jobs, filteredJobs: null, filtered: false, filter: null, offset: 0, pageNum: 1 } case REQUEST_FILTERED_JOBS: return { fetchingSelected: false, selected: null, fetchingAll: true, all: state.all ? [...state.all] : null, filteredJobs: null, filtered: state.filteredJobs !== null, filter: action.filter, offset: 0, pageNum: 1 } case RECEIVE_FILTERED_JOBS: return { fetchingSelected: false, selected: null, fetchingAll: false, all: state.all ? [...state.all] : null, filteredJobs: action.jobs, filtered: true, filter: {...state.filter}, offset: 0, pageNum: 1 } case PAGINATE_JOBS: return { fetchingSelected: false, selected: null, fetchingAll: false, all: state.all ? [...state.all] : null, filteredJobs: state.filteredJobs ? [...state.filteredJobs] : null, filtered: state.filteredJobs !== null, filter: state.filter ? {...state.filter} : null, offset: action.offset, pageNum: action.pageNum } case REQUEST_JOB: return { fetchingSelected: true, selected: null, fetchingAll: false, all: state.all ? [...state.all] : null, filteredJobs: state.filteredJobs ? [...state.filteredJobs] : null, filtered: state.filteredJobs !== null, filter: state.filter ? {...state.filter} : null, offset: state.offset, pageNum: state.pageNum } case RECEIVE_JOB: return { fetchingSelected: false, selected: action.job, fetchingAll: false, all: state.all ? [...state.all] : null, filteredJobs: state.filteredJobs ? [...state.filteredJobs] : null, filtered: state.filteredJobs !== null, filter: state.filter ? {...state.filter} : null, offset: state.offset, pageNum: state.pageNum } case CREATE_JOBS: return { fetchingSelected: false, selected: state.selected ? {...state.selected} : null, fetchingAll: true, all: state.all ? [...state.all] : null, filteredJobs: state.filteredJobs ? [...state.filteredJobs] : null, filtered: false, filter: null, offset: 0, pageNum: 1 } case UPDATE_JOB: return { fetchingSelected: true, selected: state.selected ? {...state.selected} : null, fetchingAll: false, all: state.all ? [...state.all] : null, filteredJobs: state.filteredJobs ? [...state.filteredJobs] : null, filtered: false, filter: null, offset: 0, pageNum: 1 } case DELETE_JOB: return { fetchingSelected: true, selected: state.selected ? {...state.selected} : null, fetchingAll: false, all: state.all ? [...state.all] : null, filteredJobs: state.filteredJobs ? [...state.filteredJobs] : null, filtered: false, filter: null, offset: 0, pageNum: 1 } default: return state } } export default jobsReducer
module.exports = { createUser: require('./create-user') };
'use strict'; module.exports = function (t, a) { t(document.createElement('p')); };
import React from 'react'; import createSvgIcon from './utils/createSvgIcon'; export default createSvgIcon( <React.Fragment><path d="M11 17h10v-2H11v2zm-8-5l4 4V8l-4 4zm0 9h18v-2H3v2zM3 3v2h18V3H3zm8 6h10V7H11v2zm0 4h10v-2H11v2z" /></React.Fragment> , 'FormatIndentDecreaseSharp');
import { Button } from './button'; export { Button }; export default null;
/** * @author Richard Davey <rich@photonstorm.com> * @copyright 2019 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ var imageHeight = 0; /** * @function addFrame * @private * @since 3.0.0 */ var addFrame = function (texture, sourceIndex, name, frame) { // The frame values are the exact coordinates to cut the frame out of the atlas from var y = imageHeight - frame.y - frame.height; texture.add(name, sourceIndex, frame.x, y, frame.width, frame.height); // These are the original (non-trimmed) sprite values /* if (src.trimmed) { newFrame.setTrim( src.sourceSize.w, src.sourceSize.h, src.spriteSourceSize.x, src.spriteSourceSize.y, src.spriteSourceSize.w, src.spriteSourceSize.h ); } */ }; /** * Parses a Unity YAML File and creates Frames in the Texture. * For more details about Sprite Meta Data see https://docs.unity3d.com/ScriptReference/SpriteMetaData.html * * @function Phaser.Textures.Parsers.UnityYAML * @memberof Phaser.Textures.Parsers * @private * @since 3.0.0 * * @param {Phaser.Textures.Texture} texture - The Texture to add the Frames to. * @param {integer} sourceIndex - The index of the TextureSource. * @param {object} yaml - The YAML data. * * @return {Phaser.Textures.Texture} The Texture modified by this parser. */ var UnityYAML = function (texture, sourceIndex, yaml) { // Add in a __BASE entry (for the entire atlas) var source = texture.source[sourceIndex]; texture.add('__BASE', sourceIndex, 0, 0, source.width, source.height); imageHeight = source.height; var data = yaml.split('\n'); var lineRegExp = /^[ ]*(- )*(\w+)+[: ]+(.*)/; var prevSprite = ''; var currentSprite = ''; var rect = { x: 0, y: 0, width: 0, height: 0 }; // var pivot = { x: 0, y: 0 }; // var border = { x: 0, y: 0, z: 0, w: 0 }; for (var i = 0; i < data.length; i++) { var results = data[i].match(lineRegExp); if (!results) { continue; } var isList = (results[1] === '- '); var key = results[2]; var value = results[3]; if (isList) { if (currentSprite !== prevSprite) { addFrame(texture, sourceIndex, currentSprite, rect); prevSprite = currentSprite; } rect = { x: 0, y: 0, width: 0, height: 0 }; } if (key === 'name') { // Start new list currentSprite = value; continue; } switch (key) { case 'x': case 'y': case 'width': case 'height': rect[key] = parseInt(value, 10); break; // case 'pivot': // pivot = eval('var obj = ' + value); // break; // case 'border': // border = eval('var obj = ' + value); // break; } } if (currentSprite !== prevSprite) { addFrame(texture, sourceIndex, currentSprite, rect); } return texture; }; module.exports = UnityYAML; /* Example data: TextureImporter: spritePivot: {x: .5, y: .5} spriteBorder: {x: 0, y: 0, z: 0, w: 0} spritePixelsToUnits: 100 spriteSheet: sprites: - name: asteroids_0 rect: serializedVersion: 2 x: 5 y: 328 width: 65 height: 82 alignment: 0 pivot: {x: 0, y: 0} border: {x: 0, y: 0, z: 0, w: 0} - name: asteroids_1 rect: serializedVersion: 2 x: 80 y: 322 width: 53 height: 88 alignment: 0 pivot: {x: 0, y: 0} border: {x: 0, y: 0, z: 0, w: 0} spritePackingTag: Asteroids */
import React from 'react'; import createSvgIcon from './utils/createSvgIcon'; export default createSvgIcon( <React.Fragment><path fill="none" d="M0 0h24v24H0V0z" /><g><path d="M12 5.9c1.16 0 2.1.94 2.1 2.1s-.94 2.1-2.1 2.1S9.9 9.16 9.9 8s.94-2.1 2.1-2.1m0 9c2.97 0 6.1 1.46 6.1 2.1v1.1H5.9V17c0-.64 3.13-2.1 6.1-2.1M12 4C9.79 4 8 5.79 8 8s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4zm0 9c-2.67 0-8 1.34-8 4v2c0 .55.45 1 1 1h14c.55 0 1-.45 1-1v-2c0-2.66-5.33-4-8-4z" /></g></React.Fragment> , 'PersonOutlineRounded');
'use strict'; var element = require('../element'); module.exports = function(node) { var el = element('phpdbg'); el.innerHTML = node.nodeValue; return el; };
$(function () { // Prepare demo data var data = [ { "hc-key": "dm-lu", "value": 0 }, { "hc-key": "dm-ma", "value": 1 }, { "hc-key": "dm-pk", "value": 2 }, { "hc-key": "dm-da", "value": 3 }, { "hc-key": "dm-pl", "value": 4 }, { "hc-key": "dm-pr", "value": 5 }, { "hc-key": "dm-an", "value": 6 }, { "hc-key": "dm-go", "value": 7 }, { "hc-key": "dm-jn", "value": 8 }, { "hc-key": "dm-jh", "value": 9 } ]; // Initiate the chart $('#container').highcharts('Map', { title : { text : 'Highmaps basic demo' }, subtitle : { text : 'Source map: <a href="http://code.highcharts.com/mapdata/countries/dm/dm-all.js">Dominica</a>' }, mapNavigation: { enabled: true, buttonOptions: { verticalAlign: 'bottom' } }, colorAxis: { min: 0 }, series : [{ data : data, mapData: Highcharts.maps['countries/dm/dm-all'], joinBy: 'hc-key', name: 'Random data', states: { hover: { color: '#BADA55' } }, dataLabels: { enabled: true, format: '{point.name}' } }] }); });
/*global require: false, module: false, process: false */ "use strict"; var mod = function( _, Promise, Options, Logger ) { var Log = Logger.create("AppContainer"); var WebAppContainer = function() { this.initialize.apply(this, arguments); }; _.extend(WebAppContainer.prototype, { initialize: function(opts) { opts = Options.fromObject(opts) this._app = opts.getOrError("app"); }, start: Promise.method(function() { return Promise .bind(this) .then(function() { return this._app.start(); }); }), stop: Promise.method(function(reason) { return this._app.stop().then(function() { if (reason) { Log.error("Stopping due to reason:", reason); } }); }) }); return WebAppContainer; }; module.exports = mod( require("underscore"), require("bluebird"), require("../core/options"), require("../core/logging/logger") );
"use strict"; const Base = require('yeoman-generator'); const generatorArguments = require('./arguments'); const generatorOptions = require('./options'); const generatorSteps = require('./steps'); module.exports = class ResponseGenerator extends Base { constructor(args, options) { super(args, options); Object.keys(generatorArguments).forEach(key => this.argument(key, generatorArguments[key])); Object.keys(generatorOptions).forEach(key => this.option(key, generatorOptions[key])); this.description = 'Scaffold a new response'; } get configuring() { return generatorSteps.configuring; } get conflicts() { return generatorSteps.conflicts; } get default() { return generatorSteps.default; } get end() { return generatorSteps.end; } get initializing() { return generatorSteps.initializing } get install() { return generatorSteps.install; } get prompting() { return generatorSteps.prompting } get writing() { return generatorSteps.writing; } };
var _extend = function(obj, source) { for (var prop in source) { obj[prop] = source[prop]; } return obj; }; var STATUS = { blank: 'blank', booked: 'booked', overflowing: 'overflowing' }; var ACTION = { initialBook: 'initialBook', book: 'book' }; /** * SequenceObject */ var SequenceObject, so; SequenceObject = so = function(o){ this.registry = o.registry; this.config = o.config; this.store = this.registry.store; this.logger = this.registry.logger; this.state = {}; this.state.key = this.config.key; this.state.segment = this.config.segment; this.state.prebook = this.config.prebook; this.state.initialCursor = this.config.initialCursor; this.state.cursor = null; this.state.valve = null; this.state.prebookValve = null; this.state.nextValve = null; this.state.status = STATUS.blank; this.state.ready = false; this.state.actioning = false; }; so.STATUS = STATUS; so.ACTION = ACTION; so.build = function(o){ var config = _extend({}, so.defaults); o.config = _extend(config, o.config); return new so(o); }; so.prototype.init = function(cb){ var seq = this; this.store.book(this.state, function(action){ seq.update(action); cb(action.successful); }); }; so.prototype.book = function(){ var seq = this; this.store.book(this.state, function(action){ seq.update(action); }); }; so.prototype.update = function(action){ if(action.successful){ if(action.name==ACTION.initialBook){ this.state.cursor = this.config.initialCursor; this.state.valve = action.valve; this.state.prebookValve = this.state.cursor + this.config.prebook; this.state.nextValve = null; } else{ if(this.state.status==STATUS.blank || this.state.status==STATUS.overflowing ){ this.state.cursor = action.valve - this.config.segment; this.state.valve = action.valve; this.state.prebookValve = this.state.cursor + this.config.prebook; this.state.nextValve = null; } else{ this.state.nextValve = action.valve; } } this.state.ready = true; this.state.status = STATUS.booked; this.logger.info('Process ' + process.pid + ': The sequence [' + this.state.key + '] successfully booked a new valve ' + action.valve); } else{ if(action.name==ACTION.initialBook){ this.state.ready = false; } else{ //leave state as it was } this.logger.warn('Process ' + process.pid + ': The sequence [' + this.state.key + '] failed to book a new valve. ' + 'And currently, its valve is ' + this.state.valve + ', and its cursor is ' + this.state.cursor); } this.state.actioning = false; }; so.prototype.check = function(){ if(this.state.status==STATUS.booked){ if(!this.state.nextValve){ if(this.state.cursor < this.state.prebookValve){ //Do nothing } else if(this.state.cursor < this.state.valve){ this.book(); } else{ this.onOverflow(); this.book(); } } else{ if(this.state.cursor < this.state.valve){ //Do nothing } else if(this.state.cursor == this.state.valve){ this.onStep(); } else{ this.logger.warn('Process ' + process.pid + ': The sequence [' + this.state.key + '] is in a illegal status ' + this.state.status); this.onOverflow(); this.book(); } } } else if(this.state.status==STATUS.overflowing){ if(!this.state.nextValve){ this.book(); } else{ this.onStep(); } } else{ this.logger.error('unknown status: ' + this.state.status); this.book(); } }; so.prototype.onStep = function(){ this.logger.info('Process ' + process.pid + ': The sequence [' + this.state.key + '] stepped in status ' + this.state.status); this.state.cursor = this.state.nextValve - this.config.segment; this.state.valve = this.state.nextValve; this.state.prebookValve = this.state.cursor + this.config.prebook; this.state.nextValve = null; }; so.prototype.onOverflow = function(){ this.logger.info('Process ' + process.pid + ': The sequence [' + this.state.key + '] is ' + STATUS.overflowing); this.state.status = STATUS.overflowing; var base = (new Date().getTime())*1000; this.state.cursor = base; this.state.valve = base + this.config.segment; this.state.nextValve = null; this.logger.warn('Process ' + process.pid + ': overflow value ' + this.state.cursor); }; so.prototype.next = function(){ if(this.state.ready){ this.val = this.state.cursor++; ////debug //if(this.val>10000000){ // console.error('Process ' + process.pid + ': overflowed value: ' + this.val); //} this.check(); return this; } else{ throw new Error('Process ' + process.pid + ': The sequence [' + this.state.key + '] is not ready for generating value'); } }; module.exports = so;
'use strict'; const _ = require('lodash'); const moment = require('moment-timezone'); module.exports = BaseTypes => { BaseTypes.ABSTRACT.prototype.dialectTypes = 'https://mariadb.com/kb/en/library/resultset/#field-types'; /** * types: [buffer_type, ...] * @see documentation : https://mariadb.com/kb/en/library/resultset/#field-types * @see connector implementation : https://github.com/MariaDB/mariadb-connector-nodejs/blob/master/lib/const/field-type.js */ BaseTypes.DATE.types.mariadb = ['DATETIME']; BaseTypes.STRING.types.mariadb = ['VAR_STRING']; BaseTypes.CHAR.types.mariadb = ['STRING']; BaseTypes.TEXT.types.mariadb = ['BLOB']; BaseTypes.TINYINT.types.mariadb = ['TINY']; BaseTypes.SMALLINT.types.mariadb = ['SHORT']; BaseTypes.MEDIUMINT.types.mariadb = ['INT24']; BaseTypes.INTEGER.types.mariadb = ['LONG']; BaseTypes.BIGINT.types.mariadb = ['LONGLONG']; BaseTypes.FLOAT.types.mariadb = ['FLOAT']; BaseTypes.TIME.types.mariadb = ['TIME']; BaseTypes.DATEONLY.types.mariadb = ['DATE']; BaseTypes.BOOLEAN.types.mariadb = ['TINY']; BaseTypes.BLOB.types.mariadb = ['TINYBLOB', 'BLOB', 'LONGBLOB']; BaseTypes.DECIMAL.types.mariadb = ['NEWDECIMAL']; BaseTypes.UUID.types.mariadb = false; BaseTypes.ENUM.types.mariadb = false; BaseTypes.REAL.types.mariadb = ['DOUBLE']; BaseTypes.DOUBLE.types.mariadb = ['DOUBLE']; BaseTypes.GEOMETRY.types.mariadb = ['GEOMETRY']; BaseTypes.JSON.types.mariadb = ['JSON']; class DECIMAL extends BaseTypes.DECIMAL { toSql() { let definition = super.toSql(); if (this._unsigned) { definition += ' UNSIGNED'; } if (this._zerofill) { definition += ' ZEROFILL'; } return definition; } } class DATE extends BaseTypes.DATE { toSql() { return `DATETIME${this._length ? `(${this._length})` : ''}`; } _stringify(date, options) { date = this._applyTimezone(date, options); return date.format('YYYY-MM-DD HH:mm:ss.SSS'); } static parse(value, options) { value = value.string(); if (value === null) { return value; } if (moment.tz.zone(options.timezone)) { value = moment.tz(value, options.timezone).toDate(); } else { value = new Date(`${value} ${options.timezone}`); } return value; } } class DATEONLY extends BaseTypes.DATEONLY { static parse(value) { return value.string(); } } class UUID extends BaseTypes.UUID { toSql() { return 'CHAR(36) BINARY'; } } class GEOMETRY extends BaseTypes.GEOMETRY { constructor(type, srid) { super(type, srid); if (_.isEmpty(this.type)) { this.sqlType = this.key; } else { this.sqlType = this.type; } } toSql() { return this.sqlType; } } class ENUM extends BaseTypes.ENUM { toSql(options) { return `ENUM(${this.values.map(value => options.escape(value)).join(', ')})`; } } class JSONTYPE extends BaseTypes.JSON { _stringify(value, options) { return options.operation === 'where' && typeof value === 'string' ? value : JSON.stringify(value); } } return { ENUM, DATE, DATEONLY, UUID, GEOMETRY, DECIMAL, JSON: JSONTYPE }; };
module.exports = function () { var faker = require('faker'); var _ = require('lodash'); var getUserInfo = require('./mocks/getUserInfo.js'); var productName = function () { return faker.commerce.productAdjective() + ' ' + faker.commerce.productMaterial() + ' Widget'; }; var productImage = function () { return faker.image.imageUrl(); }; // This is your json structurn each named object below can match a remote call return { getUserInfo: getUserInfo, getSidebar: _.times(3, function (id) { return { id: id + 1, name: 'Home', icon: 'home', iconBackground: faker.internet.color(), sequence: id + 1 }; }), products: _.times(9, function (id) { var title = productName(); return { id: id + 1, title: title, image: productImage(), price: faker.commerce.price(), description: faker.lorem.paragraph(), summary: faker.lorem.paragraph() }; }), products6: _.times(6, function (id) { var title = productName(); return { id: id + 1, title: title, image: productImage(), price: faker.commerce.price(), description: faker.lorem.paragraph(), summary: faker.lorem.paragraph() }; }) }; };
/*jshint esversion: 6 */ import Service from '@ember/service'; export default Service.extend({ createCustomBlock(name, options, callback_to_change_block) { options.colour = options.colour || '#4453ff'; if (Blockly.Blocks[name]) { //console.warn(`Redefiniendo el bloque ${name}`); } Blockly.Blocks[name] = { init: function () { this.jsonInit(options); if (callback_to_change_block) { callback_to_change_block.call(this); } } }; Blockly.Blocks[name].isCustomBlock = true; if (!Blockly.MyLanguage) { Blockly.MyLanguage = Blockly.JavaScript; } if (options.code) { Blockly.MyLanguage[name] = function (block) { let variables = options.code.match(/\$(\w+)/g); let code = options.code; if (variables) { variables.forEach((v) => { let regex = new RegExp('\\' + v, "g"); let variable_name = v.slice(1); var variable_object = null; if (variable_name === "DO") { variable_object = Blockly.JavaScript.statementToCode(block, variable_name); } else { variable_object = Blockly.MyLanguage.valueToCode(block, variable_name) || block.getFieldValue(variable_name) || null; } code = code.replace(regex, variable_object); }); } return code; }; } return Blockly.Blocks[name]; }, createBlockWithAsyncDropdown(name, options) { function callback_to_change_block() { this. appendDummyInput(). appendField(options.label || ""). appendField(new Blockly.FieldDropdown(options.callbackDropdown), 'DROPDOWN_VALUE'); } return this.createCustomBlock(name, options, callback_to_change_block); }, createCustomBlockWithHelper(name, options) { let block_def = { message0: options.descripcion, colour: options.colour || '#4a6cd4', previousStatement: true, nextStatement: true, args0: [], code: options.code || `hacer(actor_id, "${options.comportamiento}", ${options.argumentos});`, }; if (options.icono) { block_def.message0 = `%1 ${options.descripcion}`; block_def.args0.push({ "type": "field_image", "src": `iconos/${options.icono}`, "width": 16, "height": 16, "alt": "*" }); } return this.createCustomBlock(name, block_def); }, createBlockValue(name, options) { let block = this.createCustomBlock(name, { message0: `%1 ${options.descripcion}`, colour: options.colour || '#4a6cd4', output: 'String', args0: [ { "type": "field_image", "src": `iconos/${options.icono}`, "width": 16, "height": 16, "alt": "*" } ], }); Blockly.MyLanguage[name] = function () { return [`'${options.valor}'`, Blockly.JavaScript.ORDER_ATOMIC]; }; return block; }, getBlocksList() { return Object.keys(Blockly.Blocks); }, getCustomBlocksList() { return Object.keys(Blockly.Blocks).filter((e) => { return Blockly.Blocks[e].isCustomBlock; } ); }, createAlias(new_name, original_block_name) { let original_block = Blockly.Blocks[original_block_name]; Blockly.Blocks[new_name] = Object.assign({}, original_block); let new_block = Blockly.Blocks[new_name]; new_block.isCustomBlock = true; new_block.aliases = [original_block_name]; if (!original_block.aliases) original_block.aliases = []; original_block.aliases.push(new_name); if (!Blockly.MyLanguage) { Blockly.MyLanguage = Blockly.JavaScript; } Blockly.MyLanguage[new_name] = Blockly.JavaScript[original_block_name]; return Blockly.Blocks[new_name]; }, setStartHat(state) { Blockly.BlockSvg.START_HAT = state; } });
mf.include("chat_commands.js"); mf.include("assert.js"); mf.include("arrays.js"); /** * Example: * var id; * var count = 0; * task_manager.doLater(new task_manager.Task(function start() { * id = mf.setInterval(function() { * mf.debug("hello"); * if (++count === 10) { * task_manager.done(); * } * }, 1000); * }, function stop() { * mf.clearInterval(id); * }, "saying hello 10 times"); */ var task_manager = {}; (function() { /** * Constructor. * @param start_func() called when the job starts or resumes * @param stop_func() called when the job should pause or abort * @param string either a toString function or a string used to display the task in a list */ task_manager.Task = function(start_func, stop_func, string, resume_func) { assert.isFunction(start_func); this.start = start_func; assert.isFunction(stop_func); this.stop = stop_func; if (typeof string === "string") { var old_string = string; string = function() { return old_string; }; } assert.isFunction(string); this.toString = string; if (resume_func !== undefined) { assert.isFunction(resume_func); this.resume = resume_func; } this.started = false; }; var tasks = []; function runNextCommand() { if (tasks.length === 0) { return; } if (tasks[0].started && tasks[0].resume !== undefined) { tasks[0].resume(); } else { tasks[0].started = true; tasks[0].begin_time = new Date().getTime(); tasks[0].start(); } }; task_manager.doLater = function(task) { tasks.push(task); task.started = false; if (tasks.length === 1) { runNextCommand(); } }; task_manager.doNow = function(task) { if (tasks.length !== 0) { tasks[0].stop(); } tasks.remove(task); tasks.unshift(task); runNextCommand(); }; task_manager.done = function() { assert.isTrue(tasks.length !== 0); var length = tasks.length; tasks[0].started = false; tasks.shift(); assert.isTrue(length !== tasks.length); runNextCommand(); }; task_manager.postpone = function(min_timeout) { var task = tasks[0]; tasks.remove(task); if (min_timeout > 0) { task.postponed = mf.setTimeout(function resume() { task.postponed = undefined; tasks.push(task); if (tasks.length === 1) { runNextCommand(); } }, min_timeout); } else { tasks.push(task); } runNextCommand(); }; task_manager.remove = function(task) { if (task === tasks[0]) { task.stop(); tasks.remove(task); runNextCommand(); } else { tasks.remove(task); if (task.postponed !== undefined) { mf.clearTimeout(task.postponed); task.postponed = undefined; task.stop(); } } } chat_commands.registerCommand("stop", function() { if (tasks.length === 0) { return; } tasks[0].stop(); tasks = []; }); chat_commands.registerCommand("tasks",function(speaker,args,responder_fun) { responder_fun("Tasks: " + tasks.join(", ")); }); chat_commands.registerCommand("reboot", function(speaker, args, responder_fun) { if (tasks.length === 0) { responder_fun("no tasks"); return; } tasks[0].stop(); tasks[0].start(); }), })();
/** * Adds a new plugin to plugin.json, based on user prompts */ (function(){ var fs = require("fs"), inquirer = require("inquirer"), chalk = require("chalk"), plugins = require("../plugins.json"), banner = require("./banner.js"), tags = require("./tags.js")(), tagChoices = tags.getTags().map(function(tag){ return { name: tag }; }), questions = [ { type: "input", name: "name", message: "What is the name of your postcss plugin?", validate: function( providedName ){ if( providedName.length < 1 ){ return "Please provide an actual name for your plugin." } var exists = plugins.filter(function( plugin ){ return plugin.name === providedName; }).length; if( exists ) { return "This plugin has already been added to the list."; } if( providedName.indexOf("postcss-") === -1 ){ console.log( chalk.red("\nFYI: Plugin names usually start with 'postcss-' so they can easily be found on NPM.") ); } return true; } },{ type: "input", name: "description", message: "Describe your plugin by finishing this sentence:\nPostCSS plugin...", default: "eg: \"...that transforms your CSS.\"" },{ type: "input", name: "url", message: "What is the GitHub URL for your plugin?", validate: function( providedName ){ if( providedName.indexOf("https://github.com/") > -1 ) return true; else return "Please provide a valid GitHub URL"; } },{ type: "checkbox", name: "tags", message: "Choose at least one tag that describes your plugin.\nFor descriptions of the tags, please see the list in full:\nhttps://github.com/himynameisdave/postcss-plugins/blob/master/docs/tags.md", choices: tagChoices, validate: function( answer ) { if ( answer.length < 1 ) { return "You must choose at least one tag."; } return true; } } ]; // START DA SCRIPT // 1. Hello console.log( banner ); // 2. Da Questions inquirer.prompt( questions, function(answers){ console.log( chalk.yellow("Adding a postcss plugin with the following properties:") ); console.log( chalk.cyan("name:\n ")+chalk.green(answers.name) ); console.log( chalk.cyan("description:\n ")+chalk.green(answers.description) ); console.log( chalk.cyan("url:\n ")+chalk.green(answers.url) ); console.log( chalk.cyan("tags:") ); answers.tags.forEach(function( tag ){ console.log( chalk.green(" - "+tag) ); }); // sets the author here var newPlug = answers; newPlug.author = newPlug.url.split("/")[3]; // push the new plugin right on there because it's formatted 👌👌👌 plugins.push( newPlug ) // write the plugins.json fs.writeFile( "plugins.json", JSON.stringify( plugins, null, 2 ), function(err){ if(err) throw err; console.log("Added the new plugin to plugins.json!"); require("./versionBump.js")(answers); }); }); })();
$(function() { /* We're going to use these elements a lot, so let's save references to them * here. All of these elements are already created by the HTML code produced * by the items page. */ var $orderPanel = $('#order-panel'); var $orderPanelCloseButton = $('#order-panel-close-button'); var $itemName = $('#item-name'); var $itemDescription = $('#item-description'); var $itemQuantity = $('#item-quantity-input'); var $itemId = $('#item-id-input'); /* Show or hide the side panel. We do this by animating its `left` CSS * property, causing it to slide off screen with a negative value when * we want to hide it. */ var togglePanel = function(show) { $orderPanel.animate({ right: show ? 0 : -$orderPanel.outerWidth()}); }; /* A function to show an alert box at the top of the page. */ var showAlert = function(message, type) { /* This stuctured mess of code creates a Bootstrap-style alert box. * Note the use of chainable jQuery methods. */ var $alert = ( $('<div>') // create a <div> element .text(message) // set its text .addClass('alert') // add some CSS classes and attributes .addClass('alert-' + type) .addClass('alert-dismissible') .attr('role', 'alert') .prepend( // prepend a close button to the inner HTML $('<button>') // create a <button> element .attr('type', 'button') // and so on... .addClass('close') .attr('data-dismiss', 'alert') .html('&times;') // &times; is code for the x-symbol ) .hide() // initially hide the alert so it will slide into view ); /* Add the alert to the alert container. */ $('#alerts').append($alert); /* Slide the alert into view with an animation. */ $alert.slideDown(); }; /* Close the panel when the close button is clicked. */ $('#order-panel-close-button').click(function() { togglePanel(false); }); /* Whenever an element with class `item-link` is clicked, copy over the item * information to the side panel, then show the side panel. */ $('.item-link').click(function(event) { // Prevent default link navigation event.preventDefault(); var $this = $(this); $itemName.text($this.find('.item-name').text()); $itemDescription.text($this.find('.item-description').text()); $itemId.val($this.attr('data-id')); togglePanel(true); }); /* A boring detail but an important one. When the size of the window changes, * update the `left` property of the side menu so that it remains fully * hidden. */ $(window).resize(function() { if($orderPanel.offset().right < 0) { $orderPanel.offset({ right: -$orderPanel.outerWidth() }); } }); /* When the form is submitted (button is pressed or enter key is pressed), * make the Ajax call to add the item to the current order. */ $('#item-add-form').submit(function(event) { // Prevent default form submission event.preventDefault(); /* No input validation... yet. */ var quantity = $itemQuantity.val(); //get orderid var orderID; $.ajax({ type: 'PUT', url: '/orders/', contentType: 'application/json', data:JSON.stringify({ userID: 1 }), async: false, dataType: 'json' }).done(function(data) { orderID = data.orderID //showAlert('Order created successfully', 'success'); }).fail(function() { showAlert('Fail to get orderID', 'danger'); }); /* Send the data to `PUT /orders/:orderid/items/:itemid`. */ $.ajax({ /* The HTTP method. */ type: 'PUT', /* The URL. Use a dummy order ID for now. */ url: '/orders/'+orderID+'/items/' + $itemId.val(), /* The `Content-Type` header. This tells the server what format the body * of our request is in. This sets the header as * `Content-Type: application/json`. */ contentType: 'application/json', /* The request body. `JSON.stringify` formats it as JSON. */ data: JSON.stringify({ quantity: quantity }), /* The `Accept` header. This tells the server that we want to receive * JSON. This sets the header as something like * `Accept: application/json`. */ dataType: 'json' }).done(function() { /* This is called if and when the server responds with a 2XX (success) * status code. */ /* Show a success message. */ showAlert('Posted the order with id ' + orderID, 'success'); /* Close the side panel while we're at it. */ togglePanel(false); }).fail(function() { showAlert('Something went wrong.', 'danger'); }); }); });
// @flow /* eslint-disable react/no-danger */ // $FlowMeteor import { find, propEq } from "ramda"; import { Link } from "react-router"; import Split, { Left, Right, } from "../../../components/@primitives/layout/split"; import Meta from "../../../components/shared/meta"; import AddToCart from "../../../components/giving/add-to-cart"; type ILayout = { account: Object, }; const Layout = ({ account }: ILayout) => ( <div> <Split nav classes={["background--light-primary"]}> <Meta title={account.name} description={account.summary} image={ account.images ? find(propEq("fileLabel", "2:1"), account.images).cloudfront : account.image } meta={[{ property: "og:type", content: "article" }]} /> <Right background={ account.images ? find(propEq("fileLabel", "2:1"), account.images).cloudfront : account.image } mobile /> <Right background={ account.images ? find(propEq("fileLabel", "2:1"), account.images).cloudfront : account.image } mobile={false} /> </Split> <Left scroll classes={["background--light-primary"]}> <Link to="/give/now" className={ "locked-top locked-left soft-double@lap-and-up soft " + "h7 text-dark-secondary plain visuallyhidden@handheld" } > <i className="icon-arrow-back soft-half-right display-inline-block" style={{ verticalAlign: "middle" }} /> <span className="display-inline-block" style={{ verticalAlign: "middle", marginTop: "5px" }} > Back </span> </Link> <div className="soft@lap-and-up soft-double-top@lap-and-up"> <div className="soft soft-double-bottom soft-double-top@lap-and-up"> <h2>{account.name}</h2> <div dangerouslySetInnerHTML={{ __html: account.description }} /> </div> </div> <div className="background--light-secondary"> <div className="constrain-copy soft-double@lap-and-up"> <div className="soft soft-double-bottom soft-double-top@lap-and-up"> <AddToCart accounts={[account]} donate /> </div> </div> </div> </Left> </div> ); export default Layout;
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _createSvgIcon = _interopRequireDefault(require("./utils/createSvgIcon")); var _jsxRuntime = require("react/jsx-runtime"); var _default = (0, _createSvgIcon.default)( /*#__PURE__*/(0, _jsxRuntime.jsx)("path", { d: "M22 5.18 10.59 16.6l-4.24-4.24 1.41-1.41 2.83 2.83 10-10L22 5.18zm-2.21 5.04c.13.57.21 1.17.21 1.78 0 4.42-3.58 8-8 8s-8-3.58-8-8 3.58-8 8-8c1.58 0 3.04.46 4.28 1.25l1.44-1.44C16.1 2.67 14.13 2 12 2 6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10c0-1.19-.22-2.33-.6-3.39l-1.61 1.61z" }), 'TaskAltSharp'); exports.default = _default;
var API_PHP ="http://devtucompass.tk/pici/BackEnd/Clases/chatAdmin.php"; var API_REST = "http://devtucompass.tk/pici/API/"; $.support.cors = true; $.mobile.allowCrossDomainPages = true; function enviarInfo(){ $("#enviarInfo").click(function(){ $.ajax({ type: "POST", url: API_PHP, data: $("#info").serialize(), // serializes the form's elements. error: function(jqXHR, textStatus, errorThrown){ console.log("hi"); console.log(jqXHR); console.log(textStatus); console.log(errorThrown); //do stuff }, cache:false }).done( function (data){ localStorage.cedula= $("#cedula").val(); $("#cedulaH").attr('value',localStorage.cedula); localStorage.useradmin = -1; $.mobile.navigate( "#chat"); sendMessage(); }); }); } function sendMessage(){ $("#send").click(function(){ $.ajax({ type: "POST", url: API_PHP, data: $("#messagechat").serialize(), // serializes the form's elements. error: function(jqXHR, textStatus, errorThrown){ alert("hi"); alert(jqXHR); alert(textStatus); alert(errorThrown); //do stuff }, cache:false }).done( function (data){ console.log("la informacion es: "+data); }); }); $("#message").val(""); } function getLogMessages() { var cedula= localStorage.cedula ; //alert("la Cedula es: "+cedula); var content = ""; $.ajax({ type: "GET", url: API_REST+"lastLogChat?cedula="+cedula, error: function(jqXHR, textStatus, errorThrown){ console.log("hi"); console.log(jqXHR); console.log(textStatus); console.log(errorThrown); //do stuff }, cache:false, format:"jsonp", crossDomain: true, async: true }).done( function (data){ $.each( data, function ( i, item ){ //alert(item.id); if(item.por ==='si'){ content+='<li data-theme="c">'+ '<a href="#">'+ '<h2>Consulta Sena PICI Dice: </h2>'+ '<p>'+item.mensaje+'</p>'+ '<p class="ui-li-aside"></p>'+ '</a>'+ '</li>'; }else{ content+='<li data-theme="e">'+ '<a href="#">'+ '<h2>Tu Dices: </h2>'+ '<p>'+item.mensaje+'</p>'+ '<p class="ui-li-aside"></p>'+ '</a>'+ '</li>'; } }); $("#logMensajes").html(content); $( "#logMensajes" ).listview( "refresh" ); }); }
(function(jiglib) { var MaterialProperties = jiglib.MaterialProperties; var CachedImpulse = jiglib.CachedImpulse; var PhysicsState = jiglib.PhysicsState; var RigidBody = jiglib.RigidBody; var HingeJoint = jiglib.HingeJoint; var BodyPair = jiglib.BodyPair; var PhysicsSystem = jiglib.PhysicsSystem; var PhysicsController = function() { this._controllerEnabled = null; // Boolean this._controllerEnabled = false; } PhysicsController.prototype.updateController = function(dt) { } PhysicsController.prototype.enableController = function() { } PhysicsController.prototype.disableController = function() { } PhysicsController.prototype.get_controllerEnabled = function() { return this._controllerEnabled; } jiglib.PhysicsController = PhysicsController; })(jiglib);
/* * SameValue() (E5 Section 9.12). * * SameValue() is difficult to test indirectly. It appears in E5 Section * 8.12.9, [[DefineOwnProperty]] several times. * * One relatively simple approach is to create a non-configurable, non-writable * property, and attempt to use Object.defineProperty() to set a new value for * the property. If SameValue(oldValue,newValue), no exception is thrown. * Otherwise, reject (TypeError); see E5 Section 8.12.9, step 10.a.ii.1. */ function sameValue(x,y) { var obj = {}; try { Object.defineProperty(obj, 'test', { writable: false, enumerable: false, configurable: false, value: x }); Object.defineProperty(obj, 'test', { value: y }); } catch (e) { if (e.name === 'TypeError') { return false; } else { throw e; } } return true; } function test(x,y) { print(sameValue(x,y)); } /*=== test: different types, first undefined false false false false false false ===*/ /* Different types, first is undefined */ print('test: different types, first undefined') test(undefined, null); test(undefined, true); test(undefined, false); test(undefined, 123.0); test(undefined, 'foo'); test(undefined, {}); /*=== test: different types, first null false false false false false false ===*/ /* Different types, first is null */ print('test: different types, first null') test(null, undefined); test(null, true); test(null, false); test(null, 123.0); test(null, 'foo'); test(null, {}); /*=== test: different types, first boolean false false false false false false false false false false ===*/ /* Different types, first is boolean */ print('test: different types, first boolean') test(true, undefined); test(true, null); test(true, 123.0); test(true, 'foo'); test(true, {}); test(false, undefined); test(false, null); test(false, 123.0); test(false, 'foo'); test(false, {}); /*=== test: different types, first number false false false false false false ===*/ /* Different types, first is number */ print('test: different types, first number') test(123.0, undefined); test(123.0, null); test(123.0, true); test(123.0, false); test(123.0, 'foo'); test(123.0, {}); /*=== test: different types, first string false false false false false false ===*/ /* Different types, first is string */ print('test: different types, first string') test('foo', undefined); test('foo', null); test('foo', true); test('foo', false); test('foo', 123.0); test('foo', {}); /*=== test: different types, first object false false false false false false ===*/ /* Different types, first is object */ print('test: different types, first object') test({}, undefined); test({}, null); test({}, true); test({}, false); test({}, 123.0); test({}, 'foo'); /*=== test: same types, undefined true ===*/ /* Same types: undefined */ print('test: same types, undefined') test(undefined, undefined); /*=== test: same types, null true ===*/ /* Same types: null */ print('test: same types, null') test(null, null); /*=== test: same types, boolean true false false true ===*/ /* Same types: boolean */ print('test: same types, boolean') test(true, true); test(true, false); test(false, true); test(false, false); /*=== test: same types, number true true false false true true false false true true true ===*/ /* Same types: number */ print('test: same types, number') test(NaN, NaN); test(-0, -0); test(-0, +0); test(+0, -0); test(+0, +0); test(Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY); test(Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY); test(Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY); test(Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY); test(-123.0, -123.0); test(123.0, 123.0); /*=== test: same types, string true false false true ===*/ /* Same types: string */ print('test: same types, string') test('', ''); test('foo', '') test('', 'foo'); test('foo', 'foo'); /*=== test: same types, object true false false true ===*/ /* Same types: object */ var obj1 = {}; var obj2 = {}; print('test: same types, object') test(obj1, obj1); test(obj1, obj2); test(obj2, obj1); test(obj2, obj2);
/* * @name शेक बॉल बाउंस * @description एक बॉल क्लास बनाएं, कई ऑब्जेक्ट्स को इंस्टेंट करें, इसे स्क्रीन के चारों ओर घुमाएं, और कैनवास के किनारे को छूने पर बाउंस करें। * त्वरणX और त्वरण में कुल परिवर्तन के आधार पर शेक घटना का पता लगाएं और पता लगाने के आधार पर वस्तुओं को गति दें या धीमा करें। */ let balls = []; let threshold = 30; let accChangeX = 0; let accChangeY = 0; let accChangeT = 0; function setup() { createCanvas(displayWidth, displayHeight); for (let i = 0; i < 20; i++) { balls.push(new Ball()); } } function draw() { background(0); for (let i = 0; i < balls.length; i++) { balls[i].move(); balls[i].display(); } checkForShake(); } function checkForShake() { // Calculate total change in accelerationX and accelerationY accChangeX = abs(accelerationX - pAccelerationX); accChangeY = abs(accelerationY - pAccelerationY); accChangeT = accChangeX + accChangeY; // If shake if (accChangeT >= threshold) { for (let i = 0; i < balls.length; i++) { balls[i].shake(); balls[i].turn(); } } // If not shake else { for (let i = 0; i < balls.length; i++) { balls[i].stopShake(); balls[i].turn(); balls[i].move(); } } } // Ball class class Ball { constructor() { this.x = random(width); this.y = random(height); this.diameter = random(10, 30); this.xspeed = random(-2, 2); this.yspeed = random(-2, 2); this.oxspeed = this.xspeed; this.oyspeed = this.yspeed; this.direction = 0.7; } move() { this.x += this.xspeed * this.direction; this.y += this.yspeed * this.direction; } // Bounce when touch the edge of the canvas turn() { if (this.x < 0) { this.x = 0; this.direction = -this.direction; } else if (this.y < 0) { this.y = 0; this.direction = -this.direction; } else if (this.x > width - 20) { this.x = width - 20; this.direction = -this.direction; } else if (this.y > height - 20) { this.y = height - 20; this.direction = -this.direction; } } // Add to xspeed and yspeed based on // the change in accelerationX value shake() { this.xspeed += random(5, accChangeX / 3); this.yspeed += random(5, accChangeX / 3); } // Gradually slows down stopShake() { if (this.xspeed > this.oxspeed) { this.xspeed -= 0.6; } else { this.xspeed = this.oxspeed; } if (this.yspeed > this.oyspeed) { this.yspeed -= 0.6; } else { this.yspeed = this.oyspeed; } } display() { ellipse(this.x, this.y, this.diameter, this.diameter); } }
import { removeFromArray } from '../../../utils/array'; import fireEvent from '../../../events/fireEvent'; import Fragment from '../../Fragment'; import createFunction from '../../../shared/createFunction'; import { unbind } from '../../../shared/methodCallers'; import noop from '../../../utils/noop'; import resolveReference from '../../resolvers/resolveReference'; const eventPattern = /^event(?:\.(.+))?$/; const argumentsPattern = /^arguments\.(\d*)$/; const dollarArgsPattern = /^\$(\d*)$/; export default class EventDirective { constructor ( owner, event, template ) { this.owner = owner; this.event = event; this.template = template; this.ractive = owner.parentFragment.ractive; this.parentFragment = owner.parentFragment; this.context = null; this.passthru = false; // method calls this.method = null; this.resolvers = null; this.models = null; this.argsFn = null; // handler directive this.action = null; this.args = null; } bind () { this.context = this.parentFragment.findContext(); const template = this.template; if ( template.m ) { this.method = template.m; if ( this.passthru = template.g ) { // on-click="foo(...arguments)" // no models or args, just pass thru values } else { this.resolvers = []; this.models = template.a.r.map( ( ref, i ) => { if ( eventPattern.test( ref ) ) { // on-click="foo(event.node)" return { event: true, keys: ref.length > 5 ? ref.slice( 6 ).split( '.' ) : [], unbind: noop }; } const argMatch = argumentsPattern.exec( ref ); if ( argMatch ) { // on-click="foo(arguments[0])" return { argument: true, index: argMatch[1] }; } const dollarMatch = dollarArgsPattern.exec( ref ); if ( dollarMatch ) { // on-click="foo($1)" return { argument: true, index: dollarMatch[1] - 1 }; } let resolver; const model = resolveReference( this.parentFragment, ref ); if ( !model ) { resolver = this.parentFragment.resolve( ref, model => { this.models[i] = model; removeFromArray( this.resolvers, resolver ); }); this.resolvers.push( resolver ); } return model; }); this.argsFn = createFunction( template.a.s, template.a.r.length ); } } else { // TODO deprecate this style of directive this.action = typeof template === 'string' ? // on-click='foo' template : typeof template.n === 'string' ? // on-click='{{dynamic}}' template.n : new Fragment({ owner: this, template: template.n }); this.args = template.a ? // static arguments ( typeof template.a === 'string' ? [ template.a ] : template.a ) : template.d ? // dynamic arguments new Fragment({ owner: this, template: template.d }) : []; // no arguments } if ( this.template.n && typeof this.template.n !== 'string' ) this.action.bind(); if ( this.template.d ) this.args.bind(); } bubble () { if ( !this.dirty ) { this.dirty = true; this.owner.bubble(); } } fire ( event, passedArgs ) { // augment event object if ( event ) { event.keypath = this.context.getKeypath(); event.context = this.context.get(); event.index = this.parentFragment.indexRefs; if ( passedArgs ) passedArgs.unshift( event ); } if ( this.method ) { if ( typeof this.ractive[ this.method ] !== 'function' ) { throw new Error( `Attempted to call a non-existent method ("${this.method}")` ); } let args; if ( this.passthru ) { args = passedArgs; } else { const values = this.models.map( model => { if ( !model ) return undefined; if ( model.event ) { let obj = event; let keys = model.keys.slice(); while ( keys.length ) obj = obj[ keys.shift() ]; return obj; } if ( model.argument ) { return passedArgs ? passedArgs[ model.index ] : void 0; } if ( model.wrapper ) { return model.wrapper.value; } return model.get(); }); args = this.argsFn.apply( null, values ); } // make event available as `this.event` const ractive = this.ractive; const oldEvent = ractive.event; ractive.event = event; ractive[ this.method ].apply( ractive, args ); ractive.event = oldEvent; } else { const action = this.action.toString(); let args = this.template.d ? this.args.getArgsList() : this.args; if ( event ) event.name = action; fireEvent( this.ractive, action, { event, args }); } } rebind () { throw new Error( 'EventDirective$rebind not yet implemented!' ); // TODO add tests } render () { this.event.listen( this ); } unbind () { const template = this.template; if ( template.m ) { this.resolvers.forEach( unbind ); this.resolvers = []; this.models.forEach( model => { if ( model ) model.unbind(); }); } else { // TODO this is brittle and non-explicit, fix it if ( this.action.unbind ) this.action.unbind(); if ( this.args.unbind ) this.args.unbind(); } } unrender () { this.event.unlisten(); } update () { if ( this.method ) return; // nothing to do // ugh legacy if ( this.action.update ) this.action.update(); if ( this.template.d ) this.args.update(); this.dirty = false; } }
/*! * Copyright 2010 - 2015 Pentaho Corporation. 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. */ define([ "cdf/lib/CCC/def", "./AbstractBarChart", "../util" ], function(def, AbstractBarChart, util) { return AbstractBarChart.extend({ methods: { _rolesToCccDimensionsMap: { 'measuresLine': 'value' // maps to same dim group as 'measures' role }, _noRoleInTooltipMeasureRoles: {'measures': true, 'measuresLine': true}, _options: { plot2: true, secondAxisIndependentScale: false, // prevent default of -1 (which means last series) // TODO: is this needed?? secondAxisSeriesIndexes: null }, _setNullInterpolationMode: function(options, value) { options.plot2NullInterpolationMode = value; }, _initAxes: function() { this.base(); this._measureDiscrimGem || def.assert("Must exist to distinguish measures."); var measureDiscrimCccDimName = this._measureDiscrimGem.cccDimName, meaAxis = this.axes.measure, barGems = meaAxis.gemsByRole[meaAxis.defaultRole], barGemsById = def.query(barGems) // bar: measures, line: measuresLine .uniqueIndex(function(gem) { return gem.id; }); // Create the dataPart dimension calculation this.options.calculations.push({ names: 'dataPart', calculation: function(datum, atoms) { var meaGemId = datum.atoms[measureDiscrimCccDimName].value; // Data part codes // 0 -> bars // 1 -> lines atoms.dataPart = def.hasOwn(barGemsById, meaGemId) ? '0' : '1'; } }); }, _readUserOptions: function(options, drawSpec) { this.base(options, drawSpec); var shape = drawSpec.shape; if(shape && shape === 'none') { options.pointDotsVisible = false; } else { options.pointDotsVisible = true; options.extensionPoints.pointDot_shape = shape; } }, _configure: function() { this.base(); this._configureAxisRange(/*isPrimary*/false, 'ortho2'); this._configureAxisTitle('ortho2',""); this.options.plot2OrthoAxis = 2; // Plot2 uses same color scale // options.plot2ColorAxis = 2; // options.color2AxisTransform = null; }, _configureLabels: function(options, drawSpec) { this.base.apply(this, arguments); // Plot2 var lineLabelsAnchor = drawSpec.lineLabelsOption; if(lineLabelsAnchor && lineLabelsAnchor !== 'none') { options.plot2ValuesVisible = true; options.plot2ValuesAnchor = lineLabelsAnchor; options.plot2ValuesFont = util.defaultFont(util.readFont(drawSpec, 'label')); options.extensionPoints.plot2Label_textStyle = drawSpec.labelColor; } }, _configureDisplayUnits: function() { this.base(); this._configureAxisDisplayUnits(/*isPrimary*/false, 'ortho2'); } } }); });
/* Copyright (c) 2004-2005 The Dojo Foundation, Licensed under the Academic Free License version 2.1 or above */dojo.provide("dojo.reflect"); /***************************************************************** reflect.js v.1.5.0 (c) 2003-2004 Thomas R. Trenka, Ph.D. Derived from the reflection functions of f(m). http://dojotoolkit.org http://fm.dept-z.com There is a dependency on the variable dJ_global, which should always refer to the global object. ******************************************************************/ if(!dj_global){ var dj_global = this; } dojo.reflect = {} ; dojo.reflect.$unknownType = function(){ } ; dojo.reflect.ParameterInfo = function(name, type){ this.name = name ; this.type = (type) ? type : dojo.reflect.$unknownType ; } ; dojo.reflect.PropertyInfo = function(name, type) { this.name = name ; this.type = (type) ? type : dojo.reflect.$unknownType ; } ; dojo.reflect.MethodInfo = function(name, fn){ var parse = function(f) { var o = {} ; var s = f.toString() ; var param = ((s.substring(s.indexOf('(')+1, s.indexOf(')'))).replace(/\s+/g, "")).split(",") ; o.parameters = [] ; for (var i = 0; i < param.length; i++) { o.parameters.push(new dojo.reflect.ParameterInfo(param[i])) ; } o.body = (s.substring(s.indexOf('{')+1, s.lastIndexOf('}'))).replace(/(^\s*)|(\s*$)/g, "") ; return o ; } ; var tmp = parse(fn) ; var p = tmp.parameters ; var body = tmp.body ; this.name = (name) ? name : "anonymous" ; this.getParameters = function(){ return p ; } ; this.getNullArgumentsObject = function() { var a = [] ; for (var i = 0; i < p.length; i++){ a.push(null); } return a ; } ; this.getBody = function() { return body ; } ; this.type = Function ; this.invoke = function(src, args){ return fn.apply(src, args) ; } ; } ; // Static object that can activate instances of the passed type. dojo.reflect.Activator = new (function(){ this.createInstance = function(type, args) { switch (typeof(type)) { case "function" : { var o = {} ; type.apply(o, args) ; return o ; } ; case "string" : { var o = {} ; (dojo.reflect.Reflector.getTypeFromString(type)).apply(o, args) ; return o ; } ; } throw new Error("dojo.reflect.Activator.createInstance(): no such type exists."); } })() ; dojo.reflect.Reflector = new (function(){ this.getTypeFromString = function(s) { var parts = s.split("."), i = 0, obj = dj_global ; do { obj = obj[parts[i++]] ; } while (i < parts.length && obj) ; return (obj != dj_global) ? obj : null ; }; this.typeExists = function(s) { var parts = s.split("."), i = 0, obj = dj_global ; do { obj = obj[parts[i++]] ; } while (i < parts.length && obj) ; return (obj && obj != dj_global) ; }; this.getFieldsFromType = function(s) { var type = s ; if (typeof(s) == "string") { type = this.getTypeFromString(s) ; } var nullArgs = (new dojo.reflect.MethodInfo(type)).getNullArgumentsObject() ; return this.getFields(dojo.reflect.Activator.createInstance(s, nullArgs)) ; }; this.getPropertiesFromType = function(s) { var type = s ; if (typeof(s) == "string") { type = this.getTypeFromString(s); } var nullArgs = (new dojo.reflect.MethodInfo(type)).getNullArgumentsObject() ; return this.getProperties(dojo.reflect.Activator.createInstance(s, nullArgs)) ; }; this.getMethodsFromType = function(s) { var type = s ; if (typeof(s) == "string") { type = this.getTypeFromString(s) ; } var nullArgs = (new dojo.reflect.MethodInfo(type)).getNullArgumentsObject() ; return this.getMethods(dojo.reflect.Activator.createInstance(s, nullArgs)) ; }; this.getType = function(o) { return o.constructor ; } ; this.getFields = function(obj) { var arr = [] ; for (var p in obj) { if(this.getType(obj[p]) != Function){ arr.push(new dojo.reflect.PropertyInfo(p, this.getType(obj[p]))) ; }else{ arr.push(new dojo.reflect.MethodInfo(p, obj[p])); } } return arr ; }; this.getProperties = function(obj) { var arr = [] ; var fi = this.getFields(obj) ; for (var i = 0; i < fi.length; i++){ if (this.isInstanceOf(fi[i], dojo.reflect.PropertyInfo)){ arr.push(fi[i]) ; } } return arr ; }; this.getMethods = function(obj) { var arr = [] ; var fi = this.getFields(obj) ; for (var i = 0; i < fi.length; i++){ if (this.isInstanceOf(fi[i], dojo.reflect.MethodInfo)){ arr.push(fi[i]) ; } } return arr ; }; /* this.implements = function(o, type) { if (this.isSubTypeOf(o, type)) return false ; var f = this.getFieldsFromType(type) ; for (var i = 0; i < f.length; i++) { if (typeof(o[(f[i].name)]) == "undefined"){ return false; } } return true ; }; */ this.getBaseClass = function(o) { if (o.getType().prototype.prototype.constructor){ return (o.getType()).prototype.prototype.constructor ; } return Object ; } ; this.isInstanceOf = function(o, type) { return (this.getType(o) == type) ; }; this.isSubTypeOf = function(o, type) { return (o instanceof type) ; }; this.isBaseTypeOf = function(o, type) { return (type instanceof o); }; })(); // back-compat dojo.provide("dojo.reflect.reflection");
$(window).load(function(){FusionCharts.ready(function () { var revenueChart = new FusionCharts({ type: 'column2d', renderAt: 'chart-container', width: '500', height: '300', dataFormat: 'json', dataSource: { "chart": { "caption": "Monthly Revenue", "subCaption": "Last year", "xAxisName": "Month", "yAxisName": "Amount (In USD)", "numberPrefix": "$", "theme": "fint", //Configure x-axis labels to display in staggered mode "labelDisplay": "stagger", "staggerLines": "3" }, "data": [{ "label": "January", "value": "420000" }, { "label": "February", "value": "810000" }, { "label": "March", "value": "720000" }, { "label": "April", "value": "550000" }, { "label": "May", "value": "910000" }, { "label": "June", "value": "510000" }, { "label": "July", "value": "680000" }, { "label": "August", "value": "620000" }, { "label": "September", "value": "610000" }, { "label": "October", "value": "490000" }, { "label": "November", "value": "900000" }, { "label": "December", "value": "730000" }] } }).render(); });});
/* * Simplified Chinese translation * By DavidHu * 09 April 2007 */ Ext.UpdateManager.defaults.indicatorText = '<div class="loading-indicator">加载中...</div>'; if(Ext.View){ Ext.View.prototype.emptyText = ""; } if(Ext.grid.Grid){ Ext.grid.Grid.prototype.ddText = "{0} 选择行"; } if(Ext.TabPanelItem){ Ext.TabPanelItem.prototype.closeText = "关闭"; } if(Ext.form.Field){ Ext.form.Field.prototype.invalidText = "输入值非法"; } Date.monthNames = [ "一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月" ]; Date.dayNames = [ "日", "一", "二", "三", "四", "五", "六" ]; if(Ext.MessageBox){ Ext.MessageBox.buttonText = { ok : "确定", cancel : "取消", yes : "是", no : "否" }; } if(Ext.util.Format){ Ext.util.Format.date = function(v, format){ if(!v) return ""; if(!(v instanceof Date)) v = new Date(Date.parse(v)); return v.dateFormat(format || "y年m月d日"); }; } if(Ext.DatePicker){ Ext.apply(Ext.DatePicker.prototype, { todayText : "今天", minText : "日期在最小日期之前", maxText : "日期在最大日期之后", disabledDaysText : "", disabledDatesText : "", monthNames : Date.monthNames, dayNames : Date.dayNames, nextText : '下月 (Control+Right)', prevText : '上月 (Control+Left)', monthYearText : '选择一个月 (Control+Up/Down 来改变年)', todayTip : "{0} (空格键选择)", format : "y年m月d日" }); } if(Ext.PagingToolbar){ Ext.apply(Ext.PagingToolbar.prototype, { beforePageText : "第", afterPageText : "页,共 {0} 页", firstText : "第一页", prevText : "前一页", nextText : "下一页", lastText : "最后页", refreshText : "刷新", displayMsg : "显示 {0} - {1},共 {2} 条", emptyMsg : '没有数据需要显示' }); } if(Ext.form.TextField){ Ext.apply(Ext.form.TextField.prototype, { minLengthText : "该输入项的最小长度是 {0}", maxLengthText : "该输入项的最大长度是 {0}", blankText : "该输入项为必输项", regexText : "", emptyText : null }); } if(Ext.form.NumberField){ Ext.apply(Ext.form.NumberField.prototype, { minText : "该输入项的最小值是 {0}", maxText : "该输入项的最大值是 {0}", nanText : "{0} 不是有效数值" }); } if(Ext.form.DateField){ Ext.apply(Ext.form.DateField.prototype, { disabledDaysText : "禁用", disabledDatesText : "禁用", minText : "该输入项的日期必须在 {0} 之后", maxText : "该输入项的日期必须在 {0} 之前", invalidText : "{0} 是无效的日期 - 必须符合格式: {1}", format : "y年m月d日" }); } if(Ext.form.ComboBox){ Ext.apply(Ext.form.ComboBox.prototype, { loadingText : "加载...", valueNotFoundText : undefined }); } if(Ext.form.VTypes){ Ext.apply(Ext.form.VTypes, { emailText : '该输入项必须是电子邮件地址,格式如: "user@domain.com"', urlText : '该输入项必须是URL地址,格式如: "http:/'+'/www.domain.com"', alphaText : '该输入项只能包含字符和_', alphanumText : '该输入项只能包含字符,数字和_' }); } if(Ext.grid.GridView){ Ext.apply(Ext.grid.GridView.prototype, { sortAscText : "正序", sortDescText : "逆序", lockText : "锁列", unlockText : "解锁列", columnsText : "列" }); } if(Ext.grid.PropertyColumnModel){ Ext.apply(Ext.grid.PropertyColumnModel.prototype, { nameText : "名称", valueText : "值", dateFormat : "y年m月d日" }); } if(Ext.layout.BorderLayout.SplitRegion){ Ext.apply(Ext.layout.BorderLayout.SplitRegion.prototype, { splitTip : "拖动来改变尺寸.", collapsibleSplitTip : "拖动来改变尺寸. 双击隐藏." }); }
/* Copyright (c) 2004-2008, The Dojo Foundation All Rights Reserved. Licensed under the Academic Free License version 2.1 or above OR the modified BSD license. For more information on Dojo licensing, see: http://dojotoolkit.org/book/dojo-book-0-9/introduction/licensing */ if(!dojo._hasResource["dijit.form.TimeTextBox"]){ dojo._hasResource["dijit.form.TimeTextBox"]=true; dojo.provide("dijit.form.TimeTextBox"); dojo.require("dijit._TimePicker"); dojo.require("dijit.form._DateTimeTextBox"); dojo.declare("dijit.form.TimeTextBox",dijit.form._DateTimeTextBox,{popupClass:"dijit._TimePicker",_selector:"time"}); }
var searchData= [ ['queuefree',['queueFree',['../struct_ticker_state.html#a942a4c5388669138ad9518b3e14c3cb4',1,'TickerState']]], ['queueused',['queueUsed',['../struct_ticker_state.html#a99d84731b9512a573efd4d40d1ce6b07',1,'TickerState']]] ];
// JavaScript Document jQuery(document).ready(function(){ var ap_methods = { load_sub_items: function(type){ jQuery.post(ajaxurl, {action: 'ap_tax_types',"type":type}, function(response) { response = jQuery.parseJSON(response); if(response.msg){ var data = response.data; var selected = response.selected; var items = ''; jQuery.each(data, function(i, v){ var is_selected = ''; jQuery.each(selected, function(is, vs){ if(vs==i) is_selected = 'selected="selected"'; }); items+='<option value="'+i+'" '+is_selected+'>'+v+'</option>'; }); jQuery('#tax_types_selector').html(items); jQuery('div.ap_tax_types').show(); } }); } } jQuery('#tax_selector').live('change',function(){ var type = jQuery(this).val(); if(type.length>0) ap_methods.load_sub_items(type); }); });
/**** MarketPress Checkout JS *********/ jQuery(document).ready(function($) { //coupon codes $('#coupon-link').click(function() { $('#coupon-link').hide(); $('#coupon-code').show(); $('#coupon_code').focus(); return false; }); //payment method choice $('input.mp_choose_gateway').change(function() { var gid = $('input.mp_choose_gateway:checked').val(); $('div.mp_gateway_form').hide(); $('div#' + gid).show(); }); //province field choice $('#mp_country').change(function() { $("#mp_province_field").html('<img src="'+MP_Ajax.imgUrl+'" alt="Loading..." />'); var country = $(this).val(); $.post(MP_Ajax.ajaxUrl, {action: 'mp-province-field', country: country}, function(data) { $("#mp_province_field").html(data); //remap listener $('#mp_state').change(function() { if ($('#mp_city').val() && $('#mp_state').val() && $('#mp_zip').val()) mp_refresh_shipping(); }); }); }); //shipping field choice $('#mp-shipping-select').change(function() {mp_refresh_shipping();}); //refresh on blur if necessary 3 fields are set $('#mp_shipping_form .mp_shipping_field').change(function() { if ($('#mp_city').val() && $('#mp_state').val() && $('#mp_zip').val()) mp_refresh_shipping(); }); function mp_refresh_shipping() { $("#mp-shipping-select-holder").html('<img src="'+MP_Ajax.imgUrl+'" alt="Loading..." />'); var serializedForm = $('form#mp_shipping_form').serialize(); $.post(MP_Ajax.ajaxUrl, serializedForm, function(data) { $("#mp-shipping-select-holder").html(data); }); } });
/* * Copyright © 2020 Luciano Iam <oss@lucianoiam.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ import { ChildComponent } from '../base/component.js'; import { StateNode } from '../base/protocol.js'; import Strip from './strip.js'; export default class Mixer extends ChildComponent { constructor (parent) { super(parent); this._strips = {}; this._ready = false; } get ready () { return this._ready; } get strips () { return Object.values(this._strips); } getStripByName (name) { name = name.trim().toLowerCase(); return this.strips.find(strip => strip.name.trim().toLowerCase() == name); } handle (node, addr, val) { if (node.startsWith('strip')) { if (node == StateNode.STRIP_DESCRIPTION) { this._strips[addr] = new Strip(this, addr, val); this.notifyPropertyChanged('strips'); return true; } else { const stripAddr = [addr[0]]; if (stripAddr in this._strips) { return this._strips[stripAddr].handle(node, addr, val); } } } else { // all initial strip description messages have been received at this point if (!this._ready) { this.updateLocal('ready', true); // passthrough by allowing to return false } } return false; } }
diamondApp.service('scrollSvc', function () { this.scrollTo = function (eID) { // This scrolling function // is from http://www.itnewb.com/tutorial/Creating-the-Smooth-Scroll-Effect-with-JavaScript var startY = currentYPosition(); var stopY = elmYPosition(eID); var distance = stopY > startY ? stopY - startY : startY - stopY; if (distance < 100) { scrollTo(0, stopY); return; } var speed = Math.round(distance / 10); if (speed >= 20) speed = 20; var step = Math.round(distance / 25); var leapY = stopY > startY ? startY + step : startY - step; var timer = 0; if (stopY > startY) { for (var i = startY; i < stopY; i += step) { setTimeout("window.scrollTo(0, " + leapY + ")", timer * speed); leapY += step; if (leapY > stopY) leapY = stopY; timer++; } return; } for (var i = startY; i > stopY; i -= step) { setTimeout("window.scrollTo(0, " + leapY + ")", timer * speed); leapY -= step; if (leapY < stopY) leapY = stopY; timer++; } function currentYPosition() { // Firefox, Chrome, Opera, Safari if (self.pageYOffset) return self.pageYOffset; // Internet Explorer 6 - standards mode if (document.documentElement && document.documentElement.scrollTop) return document.documentElement.scrollTop; // Internet Explorer 6, 7 and 8 if (document.body.scrollTop) return document.body.scrollTop; return 0; } function elmYPosition(eID) { var elm = document.getElementById(eID); var y = elm.offsetTop; var node = elm; while (node.offsetParent && node.offsetParent != document.body) { node = node.offsetParent; y += node.offsetTop; } return y; } }; });
/** * @class Ext.sparkline.Shape * @private */ Ext.define('Ext.sparkline.Shape', { constructor: function (target, id, type, args) { this.target = target; this.id = id; this.type = type; this.args = args; }, append: function () { this.target.appendShape(this); return this; } });
/** * @package omeka * @subpackage neatline * @copyright 2014 Rector and Board of Visitors, University of Virginia * @license http://www.apache.org/licenses/LICENSE-2.0.html */ Neatline.module('Editor.Exhibit.Records', function(Records) { Records.Controller = Neatline.Shared.Controller.extend({ slug: 'EDITOR:EXHIBIT:RECORDS', commands: [ 'display', 'load', 'ingest', 'navToList' ], requests: [ 'getModel' ], /** * Create the router, collection, and view. */ init: function() { this.router = new Records.Router(); this.view = new Records.View({ slug: this.slug }); }, /** * Append the list to the editor container. * * @param {Object} container: The container element. */ display: function(container) { this.view.showIn(container); }, /** * Query for new records. * * @param {Object} params: The query parameters. */ load: function(params) { this.view.load(params); }, /** * Render a records collection in the list. * * @param {Object} records: The collection of records. */ ingest: function(records) { this.view.ingest(records); }, /** * Navigate to the record list. */ navToList: function() { this.router.navigate('records', true); }, /** * Get a record model from the collection. * * @param {Number} id: The record id. * @param {Function} cb: A callback, called with the model. */ getModel: function(id, cb) { this.view.records.getOrFetch(id, cb); } }); });
/** * OpenEyes * * (C) Moorfields Eye Hospital NHS Foundation Trust, 2008-2011 * (C) OpenEyes Foundation, 2011-2013 * This file is part of OpenEyes. * OpenEyes is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * OpenEyes is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * You should have received a copy of the GNU General Public License along with OpenEyes in a file titled COPYING. If not, see <http://www.gnu.org/licenses/>. * * @package OpenEyes * @link http://www.openeyes.org.uk * @author OpenEyes <info@openeyes.org.uk> * @copyright Copyright (c) 2008-2011, Moorfields Eye Hospital NHS Foundation Trust * @copyright Copyright (c) 2011-2013, OpenEyes Foundation * @license http://www.gnu.org/licenses/gpl-3.0.html The GNU General Public License V3.0 */ /** * Cutter Peripheral iridectomy * * @class CutterPI * @property {String} className Name of doodle subclass * @param {Drawing} _drawing * @param {Object} _parameterJSON */ ED.CutterPI = function(_drawing, _parameterJSON) { // Set classname this.className = "CutterPI"; // Saved parameters this.savedParameterArray = ['rotation']; // Call superclass constructor ED.Doodle.call(this, _drawing, _parameterJSON); } /** * Sets superclass and constructor */ ED.CutterPI.prototype = new ED.Doodle; ED.CutterPI.prototype.constructor = ED.CutterPI; ED.CutterPI.superclass = ED.Doodle.prototype; /** * Sets default properties */ ED.CutterPI.prototype.setPropertyDefaults = function() { this.isScaleable = false; this.isMoveable = false; } /** * Sets default parameters */ ED.CutterPI.prototype.setParameterDefaults = function() { this.setRotationWithDisplacements(160, 40); } /** * Draws doodle or performs a hit test if a Point parameter is passed * * @param {Point} _point Optional point in canvas plane, passed if performing hit test */ ED.CutterPI.prototype.draw = function(_point) { // Get context var ctx = this.drawing.context; // Call draw method in superclass ED.CutterPI.superclass.draw.call(this, _point); // Boundary path ctx.beginPath(); // Draw base ctx.arc(0, -324, 40, 0, 2 * Math.PI, true); // Colour of fill ctx.fillStyle = "rgba(255,255,255,1)"; // Set line attributes ctx.lineWidth = 4; // Colour of outer line is dark gray ctx.strokeStyle = "rgba(120,120,120,0.75)";; // Draw boundary path (also hit testing) this.drawBoundary(_point); // Return value indicating successful hittest return this.isClicked; } /** * Returns a string containing a text description of the doodle * * @returns {String} Description of doodle */ ED.CutterPI.prototype.groupDescription = function() { return "Cutter iridectomy/s"; }
function loadText() { var txtLang = document.getElementsByName("txtLang"); txtLang[0].innerHTML = "K\u00E4lla"; txtLang[1].innerHTML = "Alternativ text"; txtLang[2].innerHTML = "Mellanrum"; txtLang[3].innerHTML = "Placering"; txtLang[4].innerHTML = "\u00D6verst"; txtLang[5].innerHTML = "Bildram"; txtLang[6].innerHTML = "Nederst"; txtLang[7].innerHTML = "Bredd"; txtLang[8].innerHTML = "V\u00E4nster"; txtLang[9].innerHTML = "H\u00F6jd"; txtLang[10].innerHTML = "H\u00F6ger"; var optLang = document.getElementsByName("optLang"); optLang[0].text = "Abs. nederst"; optLang[1].text = "Abs. mitten"; optLang[2].text = "Baslinje"; optLang[3].text = "Nederst"; optLang[4].text = "V\u00E4nster"; optLang[5].text = "Mitten"; optLang[6].text = "H\u00F6ger"; optLang[7].text = "Text-topp"; optLang[8].text = "\u00D6verst"; document.getElementById("btnBorder").value = " Kantlinje "; document.getElementById("btnReset").value = "\u00C5terst\u00E4ll"; document.getElementById("btnCancel").value = "Avbryt"; document.getElementById("btnInsert").value = "Infoga"; document.getElementById("btnApply").value = "Verkst\u00E4ll"; document.getElementById("btnOk").value = " OK "; } function writeTitle() { document.write("<title>Bild</title>") }
import React, { Component, PropTypes } from 'react'; import { View, Image, Text, StyleSheet } from 'react-native'; import LinearGradient from 'react-native-linear-gradient'; const glassPrimary = '#d5d2da'; const glassSecondary = '#bb2130'; class ProfilePicture extends Component { render() { const profileImage = this.props.image; return ( <View style={Styles.container}> <Image source={profileImage} resizeMode='contain' style={Styles.profilePic}> </Image> <LinearGradient colors={[glassPrimary, glassSecondary, glassPrimary]} start={{x: 0.0, y: 0.1}} end={{x: 0.5, y: 1.0}} style={Styles.frame}> </LinearGradient> </View> ) } } const Styles = StyleSheet.create({ container: { height: 120, width: 70, shadowColor: '#000', shadowOffset: { width: 2, height: 2 }, shadowOpacity: 0.7, shadowRadius: 2, elevation: 3, backgroundColor: 'transparent' }, profilePic: { height: 120, width: 70, shadowRadius: 2, shadowOpacity: 0.7, shadowColor: '#000000', borderColor: '#320f1c', borderWidth: 1, }, frame: { position: 'absolute', top: 0, height: 120, width: 70, opacity: 0.25, } }); export default ProfilePicture;
function helloWorld() { return 'Hello World'; }
/* Copyright 2010, 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 GdataExtension = {}; GdataExtension.isAuthorized = function() { return $.cookie('authsub_token') !== null; }; GdataExtension.showAuthorizationDialog = function(onAuthorized, onNotAuthorized) { if (window.name) { var windowName = window.name; } else { var windowName = "openrefine" + new Date().getTime(); window.name = windowName; } var callbackName = "cb" + new Date().getTime(); var callback = function(evt) { delete window[callbackName]; if (GdataExtension.isAuthorized()) { onAuthorized(); } else if (onNotAuthorized) { onNotAuthorized(); } window.setTimeout(function() { win.close(); }, 100); }; window[callbackName] = callback; var url = ModuleWirings['gdata'] + "authorize?winname=" + escape(windowName) + "&callback=" + escape(callbackName); var win = window.open(url, "openrefinegdataauth", "resizable=1,width=800,height=600"); };
module.exports = { 'code': 1100, 'type': 'UserExtTokenAlreadyRegistered', 'message': 'The provided external authentification is already used', 'http': 400 };
/************************************************************************ * This file is part of EspoCRM. * * EspoCRM - Open Source CRM application. * Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko * Website: http://www.espocrm.com * * EspoCRM is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * EspoCRM is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with EspoCRM. If not, see http://www.gnu.org/licenses/. ************************************************************************/ Espo.define('Views.Email.Record.DetailQuick', 'Views.Email.Record.Detail', function (Dep, Detail) { return Dep.extend({ isWide: true, sideView: false, init: function () { Dep.prototype.init.call(this); this.columnCount = 2; }, setup: function () { Dep.prototype.setup.call(this); }, }); });
/*global module */ module.exports = function(grunt) { 'use strict'; grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), concat: { options: { //define the string to go between each file in the concat'd output separator: ';' }, dist: { //files to concatenate src: ['src/**/*.js'], //destination js file dest: 'build/js/<%= pkg.name %>.js' } }, uglify: { options: { // the banner to stamp at top of output banner: '/* <%= pkg.name %> <%= grunt.template.today("dd-mm-yy") %> /* \n' }, dist: { files: { 'build/js/<%= pkg.name %>.min.js': ['<%= concat.dist.dest %>'] } } }, jshint: { //files to lint files: ['Gruntfile.js', 'src/**/*.js'], options: { globals: { jQuery: true, console: true, module: true } } }, compass: { dist: { options: { sassDir: 'src/sass', cssDir: 'build/css' } } }, watch: { css: { files: 'src/sass/*.scss', tasks: ['compass'] }, js: { files: ['src/js/*.js'], tasks: ['jshint', 'uglify', 'concat'] } } }); grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-contrib-concat'); grunt.loadNpmTasks('grunt-contrib-compass'); grunt.registerTask('default', ['jshint', 'concat', 'uglify', 'compass']); }; //exports
define( [ 'views/AlertMessageView', 'lib/Mediator' ], function (AlertMessageView, Mediator) { describe('AlertMessageView', function () { var resultsCollection, view, mediator; beforeEach(function () { resultsCollection = new Backbone.Collection(); mediator = new Mediator(); }); it('should initially be hidden', function () { view = new AlertMessageView().render(); expect(view.$el.find('.alert')).toHaveClass('hidden'); }); it('should become visible when a new message arrives', function () { view = new AlertMessageView(); view.setMediator(mediator); mediator.trigger('app:alert', {title: 'x', content: 'y'}); expect(view.$el.find('.alert')).not.toHaveClass('hidden'); }); it('should close it when a user clicks the X', function () { view = new AlertMessageView().render(); view.setMediator(mediator); view.removeAlertMessage(); expect(view.$el.find('.alert')).toHaveClass('hidden'); }); }); });
(function (angular) { 'use strict'; describe('adminStoreApi', function () { var $firebaseObjectMock; var firebaseObjectResult; var firebaseRef; var adminStoreApi; beforeEach(module('movieClub')); beforeEach(function () { firebaseObjectResult = {'$loaded': angular.noop}; $firebaseObjectMock = jasmine.createSpy('$firebaseObject'); $firebaseObjectMock.and.returnValue(firebaseObjectResult); module(function ($provide) { $provide.value('$firebaseObject', $firebaseObjectMock); }); }); beforeEach(inject(function (_firebaseRef_, _adminStoreApi_) { firebaseRef = _firebaseRef_; adminStoreApi = _adminStoreApi_; })); describe('get', function () { it('should get a firebase adminStore object', function () { spyOn(firebaseRef, 'child'); adminStoreApi.get(); expect(firebaseRef.child).toHaveBeenCalledWith('adminStore'); }); }); }); }(window.angular));
//= require ./map
const log = require('app/lib/core/log') module.exports = config => props => { const [ pluginName, pluginPath, pluginExports ] = props log.trace(`Initialzing includer: ${log.ul(pluginPath)}.`) const exports = {} exports.name = pluginExports.name || pluginName exports.options = pluginExports.options exports.setOptions = newOpts => { log.trace(`Setting options for modifier: ${log.ul(pluginPath)} ${log.hl(pluginName)}.`) exports.options = newOpts } exports.configure = conf => new Promise(resolve => { log.trace(`Configuring includer ${log.hl(pluginName)}.`) config = conf exports.htmlCommentIncluder = pluginExports.plugin(pluginExports, config) if (!exports.htmlCommentIncluder) { const msg = `Could not configure includer: ${pluginName}.` log.error(msg) // return reject(msg) resolve(exports) } resolve(exports) }) return exports }
/** * @author lnaef */ dojo.provide("cs.util.tests.controller.testModelController"); dojo.require("cs.controller.ModelController"); dojo.require("cs.util.tests.controller.testLibraryController"); doh.register("cs.util.tests.controller.testModelController", [ function constructorModelController(){ new cs.controller.ModelController(); }, function addComponent(){ var controller = new cs.controller.ModelController(); controller.addComponent("cs.module.string.concat",{x:200,y:100}); var module = controller._rootStatement.getBlock(0).getComponentContainer().get(0); doh.is("cs.module.string.concat",module.getMetaData().getName()); }, function moveComponentToBlock(){ //init var controller = new cs.controller.ModelController(); var fromBlock = new cs.model.program.Block(); var toBlock = new cs.model.program.Block(); //prepare var module = cs.library.getNewModule("cs.module.string.concat"); fromBlock.addComponent(module); doh.t(fromBlock.hasComponent(module)); //move module from FROMBlock to TOBlock controller.moveComponentToBlock(module,toBlock); doh.f(fromBlock.hasComponent(module)); doh.t(toBlock.hasComponent(module)); }, function connectSockets(){ var controller = new cs.controller.ModelController(); var module1 = cs.library.getNewModule("cs.module.string.concat"); var module2 = cs.library.getNewModule("cs.module.string.concat"); var s1 = module1.getOutputSockets().get(0); var s2 = module2.getInputSockets().get(0); var wire = controller.connectSockets(s1,s2); doh.t(wire.getFROM(),s1); doh.t(wire.getTO(),s2); doh.t(s1.hasWire(wire)); doh.t(s2.hasWire(wire)); }, function deleteComponent(){ var controller = new cs.controller.ModelController(); var module1 = cs.library.getNewModule("cs.module.string.concat"); var module2 = cs.library.getNewModule("cs.module.string.concat"); var block = new cs.model.program.Block(); // add both modules to the block block.addComponent(module1); block.addComponent(module2); doh.t(block.hasComponent(module1)); doh.t(block.hasComponent(module2)); // connect the two modules through a wire var s1 = module1.getOutputSockets().get(0); var s2 = module2.getInputSockets().get(0); var wire = controller.connectSockets(s1,s2); doh.t(wire.getFROM(),s1); doh.t(wire.getTO(),s2); // delete module1 and all its connected wires controller.deleteComponent(module1); doh.f(block.hasComponent(module1)); doh.t(block.hasComponent(module2)); doh.f(wire.getFROM(),s1); doh.f(wire.getTO(),s2); }, function updatePosition(){ var controller = new cs.controller.ModelController(); var module = cs.library.getNewModule("cs.module.string.concat"); doh.is(0,module.getPositionProg().x); doh.is(0,module.getPositionExec().x); controller.updatePositionProg(module,100,200); controller.updatePositionExec(module,300,400); doh.is(100,module.getPositionProg().x); doh.is(200,module.getPositionProg().y); doh.is(300,module.getPositionExec().x); doh.is(400,module.getPositionExec().y); } ]);
import { Map, Set, OrderedSet, List } from 'immutable' import * as constants from '../constants/files.js' import { ls, searchFiles, rangeSelect } from '../sagas/helpers.js' const initialState = Map({ files: List(), workingDirectoryFiles: null, searchResults: List(), uploading: List(), downloading: List(), selected: OrderedSet(), path: '', searchText: '', uploadSource: '', showAllowanceDialog: false, showUploadDialog: false, showSearchField: false, showFileTransfers: false, showDeleteDialog: false, showRenameDialog: false, settingAllowance: false, dragging: false, contractCount: 0, allowance: '0', spending: '0', showDownloadsSince: Date.now(), unreadUploads: Set(), unreadDownloads: Set(), }) export default function filesReducer(state = initialState, action) { switch (action.type) { case constants.SET_ALLOWANCE_COMPLETED: return state.set('settingAllowance', false) case constants.RECEIVE_ALLOWANCE: return state.set('allowance', action.allowance) case constants.RECEIVE_SPENDING: return state.set('spending', action.spending) case constants.DOWNLOAD_FILE: return state.set('unreadDownloads', state.get('unreadDownloads').add(action.file.siapath)) case constants.UPLOAD_FILE: return state.set('unreadUploads', state.get('unreadUploads').add(action.siapath)) case constants.RECEIVE_FILES: { const workingDirectoryFiles = ls(action.files, state.get('path')) const workingDirectorySiapaths = workingDirectoryFiles.map((file) => file.siapath) // filter out selected files that are no longer in the working directory const selected = state.get('selected').filter((file) => workingDirectorySiapaths.includes(file.siapath)) return state.set('files', action.files) .set('workingDirectoryFiles', workingDirectoryFiles) .set('selected', selected) } case constants.SET_ALLOWANCE: return state.set('allowance', action.funds) .set('settingAllowance', true) case constants.CLEAR_DOWNLOADS: return state.set('showDownloadsSince', Date.now()) case constants.SET_SEARCH_TEXT: { const results = searchFiles(state.get('workingDirectoryFiles'), action.text, state.get('path')) return state.set('searchResults', results) .set('searchText', action.text) } case constants.SET_PATH: return state.set('path', action.path) .set('selected', OrderedSet()) .set('workingDirectoryFiles', ls(state.get('files'), action.path)) .set('searchResults', searchFiles(state.get('workingDirectoryFiles'), state.get('searchText', state.get('path')))) case constants.DESELECT_FILE: return state.set('selected', state.get('selected').filter((file) => file.siapath !== action.file.siapath)) case constants.SELECT_FILE: return state.set('selected', state.get('selected').add(action.file)) case constants.DESELECT_ALL: return state.set('selected', OrderedSet()) case constants.SELECT_UP_TO: return state.set('selected', rangeSelect(action.file, state.get('workingDirectoryFiles'), state.get('selected'))) case constants.SHOW_ALLOWANCE_DIALOG: return state.set('showAllowanceDialog', true) case constants.CLOSE_ALLOWANCE_DIALOG: return state.set('showAllowanceDialog', false) case constants.TOGGLE_SEARCH_FIELD: return state.set('showSearchField', !state.get('showSearchField')) case constants.SET_DRAGGING: return state.set('dragging', true) case constants.SET_NOT_DRAGGING: return state.set('dragging', false) case constants.SHOW_DELETE_DIALOG: return state.set('showDeleteDialog', true) case constants.HIDE_DELETE_DIALOG: return state.set('showDeleteDialog', false) case constants.SHOW_UPLOAD_DIALOG: return state.set('showUploadDialog', true) .set('uploadSource', action.source) case constants.HIDE_UPLOAD_DIALOG: return state.set('showUploadDialog', false) case constants.RECEIVE_UPLOADS: return state.set('uploading', action.uploads) case constants.RECEIVE_DOWNLOADS: return state.set('downloading', action.downloads.filter((download) => Date.parse(download.starttime) > state.get('showDownloadsSince'))) case constants.SHOW_FILE_TRANSFERS: return state.set('showFileTransfers', true) case constants.HIDE_FILE_TRANSFERS: return state.set('showFileTransfers', false) case constants.TOGGLE_FILE_TRANSFERS: return state.set('showFileTransfers', !state.get('showFileTransfers')) .set('unreadDownloads', Set()) .set('unreadUploads', Set()) case constants.SET_CONTRACT_COUNT: return state.set('contractCount', action.count) case constants.SHOW_RENAME_DIALOG: return state.set('showRenameDialog', true) case constants.HIDE_RENAME_DIALOG: return state.set('showRenameDialog', false) default: return state } }
'use strict'; /** @namespace chas2.test * Тесты */ chas2.test = { /** @namespace chas2.test._ * Функционал, используемый только внутри модуля chas2.test * @private */ _ : {}, /** @function chas2.test.testTemplates * Проверить шаблоны в текущем наборе * @param {Number} triesCount кол-во прогонов каждого шаблона * @param {Function} infoFunc функция вывода информационной строки * @param {Function} warnFunc функция вывода предупреждающей строки * @param {Function} errFunc функция вывода строки об ошибке */ testTemplates : function(p) { var infoFunc = p.infoFunc || chas2.Linfo; var warnFunc = p.warnFunc || chas2.Lwarn; var errFunc = p.errFunc || chas2.Lerr; infoFunc('Проверка шаблонов в наборе "' + nabor.adres + '"'); var errCount = 0; for (var category in nabor.upak) { infoFunc('\tПроверка категории ' + category); var errCountPerCat = 0; for (var templ in nabor.upak[category]) { if (templ != 'main') { infoFunc('\t\tПроверка шаблона B1/' + templ); for (var i = p.triesCount || 10; i; i--) { try { nabor.upak[category][templ](); var checkResult = dvig.validateVopr(); if (checkResult != '') { warnFunc('\t\t\t' + checkResult); } } catch (e) { errFunc('\t\t\tОшибка :' + e); errCountPerCat++; } } } } infoFunc('\tПроверка категории ' + category + ' закончена c ' + errCountPerCat + ' ошибками'); } infoFunc('Проверка шаблонов в наборе "' + nabor.adres + '" закончена с ' + errCount + ' ошибками'); } };
window.nomer=sl(1,4); window.comment='Элементарные бытовые задачи.';
'use strict'; // Gulp & plugins var gulp = require('gulp'); var autoprefixer = require('gulp-autoprefixer'); var sass = require('gulp-sass'); // BrowerSync var browserSync = require('browser-sync'); // Utilities var handleErrors = require('../util/handleErrors'); // Configs var config = require('../config').sass; gulp.task('sass', function () { return gulp.src(config.src) .pipe(sass(config.settings)) .on('error', handleErrors) .pipe(autoprefixer({browsers: ['last 2 version']})) .pipe(gulp.dest(config.dest)) .pipe(browserSync.reload({stream: true})); });
'use strict'; // Users service used for communicating with the users REST endpoint angular.module('users').factory('Users', [ '$resource', function ($resource) { return $resource('users', {}, { update: { method: 'PUT' } }); } ]);
"use strict"; tutao.provide('tutao.entity.sys.ChangePasswordData'); /** * @constructor * @param {Object=} data The json data to store in this entity. */ tutao.entity.sys.ChangePasswordData = function(data) { if (data) { this.updateData(data); } else { this.__format = "0"; this._code = null; this._pwEncUserGroupKey = null; this._salt = null; this._verifier = null; } this._entityHelper = new tutao.entity.EntityHelper(this); this.prototype = tutao.entity.sys.ChangePasswordData.prototype; }; /** * Updates the data of this entity. * @param {Object=} data The json data to store in this entity. */ tutao.entity.sys.ChangePasswordData.prototype.updateData = function(data) { this.__format = data._format; this._code = data.code; this._pwEncUserGroupKey = data.pwEncUserGroupKey; this._salt = data.salt; this._verifier = data.verifier; }; /** * The version of the model this type belongs to. * @const */ tutao.entity.sys.ChangePasswordData.MODEL_VERSION = '10'; /** * The url path to the resource. * @const */ tutao.entity.sys.ChangePasswordData.PATH = '/rest/sys/changepasswordservice'; /** * The encrypted flag. * @const */ tutao.entity.sys.ChangePasswordData.prototype.ENCRYPTED = false; /** * Provides the data of this instances as an object that can be converted to json. * @return {Object} The json object. */ tutao.entity.sys.ChangePasswordData.prototype.toJsonData = function() { return { _format: this.__format, code: this._code, pwEncUserGroupKey: this._pwEncUserGroupKey, salt: this._salt, verifier: this._verifier }; }; /** * The id of the ChangePasswordData type. */ tutao.entity.sys.ChangePasswordData.prototype.TYPE_ID = 534; /** * The id of the code attribute. */ tutao.entity.sys.ChangePasswordData.prototype.CODE_ATTRIBUTE_ID = 539; /** * The id of the pwEncUserGroupKey attribute. */ tutao.entity.sys.ChangePasswordData.prototype.PWENCUSERGROUPKEY_ATTRIBUTE_ID = 538; /** * The id of the salt attribute. */ tutao.entity.sys.ChangePasswordData.prototype.SALT_ATTRIBUTE_ID = 537; /** * The id of the verifier attribute. */ tutao.entity.sys.ChangePasswordData.prototype.VERIFIER_ATTRIBUTE_ID = 536; /** * Sets the format of this ChangePasswordData. * @param {string} format The format of this ChangePasswordData. */ tutao.entity.sys.ChangePasswordData.prototype.setFormat = function(format) { this.__format = format; return this; }; /** * Provides the format of this ChangePasswordData. * @return {string} The format of this ChangePasswordData. */ tutao.entity.sys.ChangePasswordData.prototype.getFormat = function() { return this.__format; }; /** * Sets the code of this ChangePasswordData. * @param {string} code The code of this ChangePasswordData. */ tutao.entity.sys.ChangePasswordData.prototype.setCode = function(code) { this._code = code; return this; }; /** * Provides the code of this ChangePasswordData. * @return {string} The code of this ChangePasswordData. */ tutao.entity.sys.ChangePasswordData.prototype.getCode = function() { return this._code; }; /** * Sets the pwEncUserGroupKey of this ChangePasswordData. * @param {string} pwEncUserGroupKey The pwEncUserGroupKey of this ChangePasswordData. */ tutao.entity.sys.ChangePasswordData.prototype.setPwEncUserGroupKey = function(pwEncUserGroupKey) { this._pwEncUserGroupKey = pwEncUserGroupKey; return this; }; /** * Provides the pwEncUserGroupKey of this ChangePasswordData. * @return {string} The pwEncUserGroupKey of this ChangePasswordData. */ tutao.entity.sys.ChangePasswordData.prototype.getPwEncUserGroupKey = function() { return this._pwEncUserGroupKey; }; /** * Sets the salt of this ChangePasswordData. * @param {string} salt The salt of this ChangePasswordData. */ tutao.entity.sys.ChangePasswordData.prototype.setSalt = function(salt) { this._salt = salt; return this; }; /** * Provides the salt of this ChangePasswordData. * @return {string} The salt of this ChangePasswordData. */ tutao.entity.sys.ChangePasswordData.prototype.getSalt = function() { return this._salt; }; /** * Sets the verifier of this ChangePasswordData. * @param {string} verifier The verifier of this ChangePasswordData. */ tutao.entity.sys.ChangePasswordData.prototype.setVerifier = function(verifier) { this._verifier = verifier; return this; }; /** * Provides the verifier of this ChangePasswordData. * @return {string} The verifier of this ChangePasswordData. */ tutao.entity.sys.ChangePasswordData.prototype.getVerifier = function() { return this._verifier; }; /** * Posts to a service. * @param {Object.<string, string>} parameters The parameters to send to the service. * @param {?Object.<string, string>} headers The headers to send to the service. If null, the default authentication data is used. * @return {Promise.<null=>} Resolves to the string result of the server or rejects with an exception if the post failed. */ tutao.entity.sys.ChangePasswordData.prototype.setup = function(parameters, headers) { if (!headers) { headers = tutao.entity.EntityHelper.createAuthHeaders(); } parameters["v"] = 10; this._entityHelper.notifyObservers(false); return tutao.locator.entityRestClient.postService(tutao.entity.sys.ChangePasswordData.PATH, this, parameters, headers, null); }; /** * Provides the entity helper of this entity. * @return {tutao.entity.EntityHelper} The entity helper. */ tutao.entity.sys.ChangePasswordData.prototype.getEntityHelper = function() { return this._entityHelper; };
import emotion from 'preact-emotion'; import remcalc from 'remcalc'; import { Category } from './service'; export const Place = emotion(Category)` margin-bottom: ${remcalc(10)}; `; export const Region = emotion('h6')` margin: ${remcalc(6)} 0; font-size: ${remcalc(13)}; line-height: ${remcalc(18)}; font-weight: ${props => props.theme.font.weight.normal}; color: #494949; `; export { Name as default } from './service';
/* * Copyright (C) 2017 - present Instructure, Inc. * * This file is part of Canvas. * * Canvas is free software: you can redistribute it and/or modify it under * the terms of the GNU Affero General Public License as published by the Free * Software Foundation, version 3 of the License. * * Canvas is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR * A PARTICULAR PURPOSE. See the GNU Affero General Public License for more * details. * * You should have received a copy of the GNU Affero General Public License along * with this program. If not, see <http://www.gnu.org/licenses/>. */ import React from 'react' import {bool, func, number, shape, string} from 'prop-types' import {FormFieldGroup} from '@instructure/ui-form-field' import SubmissionTrayRadioInput from './SubmissionTrayRadioInput' import {statusesTitleMap} from '../constants/statuses' import I18n from 'i18n!gradebook' function checkedValue(submission) { if (submission.excused) { return 'excused' } else if (submission.missing) { return 'missing' } else if (submission.late) { return 'late' } return 'none' } export default class SubmissionTrayRadioInputGroup extends React.Component { state = {pendingUpdateData: null} componentWillReceiveProps(nextProps) { if ( this.props.submissionUpdating && !nextProps.submissionUpdating && this.state.pendingUpdateData ) { this.props.updateSubmission(this.state.pendingUpdateData) this.setState({pendingUpdateData: null}) } } handleRadioInputChanged = ({target: {value}}) => { const alreadyChecked = checkedValue(this.props.submission) === value if (alreadyChecked && !this.props.submissionUpdating) { return } const data = value === 'excused' ? {excuse: true} : {latePolicyStatus: value} if (value === 'late') { data.secondsLateOverride = this.props.submission.secondsLate } if (this.props.submissionUpdating) { this.setState({pendingUpdateData: data}) } else { this.props.updateSubmission(data) } } render() { const radioOptions = ['none', 'late', 'missing', 'excused'].map(status => ( <SubmissionTrayRadioInput key={status} checked={checkedValue(this.props.submission) === status} color={this.props.colors[status]} disabled={this.props.disabled} latePolicy={this.props.latePolicy} locale={this.props.locale} onChange={this.handleRadioInputChanged} updateSubmission={this.props.updateSubmission} submission={this.props.submission} text={statusesTitleMap[status] || I18n.t('None')} value={status} /> )) return ( <FormFieldGroup description={I18n.t('Status')} disabled={this.props.disabled} layout="stacked" rowSpacing="none" > {radioOptions} </FormFieldGroup> ) } } SubmissionTrayRadioInputGroup.propTypes = { colors: shape({ late: string.isRequired, missing: string.isRequired, excused: string.isRequired }).isRequired, disabled: bool.isRequired, latePolicy: shape({ lateSubmissionInterval: string.isRequired }).isRequired, locale: string.isRequired, submission: shape({ excused: bool.isRequired, late: bool.isRequired, missing: bool.isRequired, secondsLate: number.isRequired }).isRequired, submissionUpdating: bool.isRequired, updateSubmission: func.isRequired }
function initializeDataTable(formId, tableId, storageKey, pageNumber, itemsPerPage, ajaxUrl, columnDefs, extra){ let domTable = $('#' + tableId); let options = { 'createdRow': function (row, data, dataIndex) { let url = ""; if (data['osis_url']) { url = data['osis_url']; } else { url = data['url']; } $(row).attr('data-id', url); $(row).attr('data-value', data['acronym']); }, columnDefs: columnDefs, "stateSave": true, "paging" : false, "ordering" : true, "orderMulti": false, "order": [[1, 'asc']], "serverSide": true, "ajax" : { "url": ajaxUrl, "accepts": { json: 'application/json' }, "type": "GET", "dataSrc": "object_list", "data": function (d){ let querystring = getDataAjaxTable(formId, domTable, d, pageNumber); querystring["paginator_size"] = itemsPerPage; return querystring; }, "traditional": true }, "info" : false, "searching" : false, 'processing': false, "language": { "oAria": { "sSortAscending": gettext("activate to sort column ascending"), "sSortDescending": gettext("activate to sort column descending") } } }; return domTable.DataTable($.extend(true, {}, options, extra)); } function outputAnchorOuterHtml(urlPath, textContent){ const anchor = document.createElement("a"); anchor.setAttribute("href", urlPath); anchor.textContent = textContent; return anchor.outerHTML; }
// // Copyright (C) 2017 - present Instructure, Inc. // // This file is part of Canvas. // // Canvas is free software: you can redistribute it and/or modify it under // the terms of the GNU Affero General Public License as published by the Free // Software Foundation, version 3 of the License. // // Canvas is distributed in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR // A PARTICULAR PURPOSE. See the GNU Affero General Public License for more // details. // // You should have received a copy of the GNU Affero General Public License along // with this program. If not, see <http://www.gnu.org/licenses/>. import $ from 'jquery' import I18n from 'i18n!broken_images' export function attachErrorHandler(imgElement) { $(imgElement).on('error', e => { if (e.currentTarget.src) { $.get(e.currentTarget.src).fail(response => { if (response.status === 403) { // Replace the image with a lock image $(e.currentTarget).attr({ src: '/images/svg-icons/icon_lock.svg', alt: I18n.t('Locked image'), width: 100, height: 100 }) } else { // Add the broken-image class $(e.currentTarget).addClass('broken-image') } }) } else { // Add the broken-image class (if there is no source) $(e.currentTarget).addClass('broken-image') } }) } export function getImagesAndAttach() { Array.from(document.querySelectorAll('img:not([src=""])')).forEach(attachErrorHandler) } // this behavior will set up all broken images on the page with an error handler that // can apply the broken-image class if there is an error loading the image. $(document).ready(() => getImagesAndAttach())
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors // License: GNU General Public License v3. See license.txt frappe.ui.form.on("Supplier", { before_load: function(frm) { frappe.setup_language_field(frm); }, refresh: function(frm) { if(frappe.defaults.get_default("supp_master_name")!="Naming Series") { frm.toggle_display("naming_series", false); } else { erpnext.toggle_naming_series(); } if(frm.doc.__islocal){ hide_field(['address_html','contact_html']); erpnext.utils.clear_address_and_contact(frm); } else { unhide_field(['address_html','contact_html']); erpnext.utils.render_address_and_contact(frm); } }, }); cur_frm.fields_dict['default_price_list'].get_query = function(doc, cdt, cdn) { return{ filters:{'buying': 1} } } cur_frm.fields_dict['accounts'].grid.get_field('account').get_query = function(doc, cdt, cdn) { var d = locals[cdt][cdn]; return { filters: { 'account_type': 'Payable', 'company': d.company, "is_group": 0 } } }
var searchData= [ ['takeoff',['takeOff',['../class_flight_controller.html#a514f2619b98216e9fca0ad876d000966',1,'FlightController']]] ];
"use strict"; var Activity = require("./activity"); var util = require("util"); function Falsy() { Activity.call(this); this.value = false; this.is = true; this.isNot = false; } util.inherits(Falsy, Activity); Falsy.prototype.run = function (callContext, args) { callContext.schedule(this.value, "_valueGot"); }; Falsy.prototype._valueGot = function (callContext, reason, result) { if (reason !== Activity.states.complete) { callContext.end(reason, result); return; } if (result) { callContext.schedule(this.isNot, "_done"); } else { callContext.schedule(this.is, "_done"); } }; Falsy.prototype._done = function (callContext, reason, result) { callContext.end(reason, result); }; module.exports = Falsy; //# sourceMappingURL=falsy.js.map
var dir_68267d1309a1af8e8297ef4c3efbcdba = [ [ "BeagleGoo.cpp", "_beagle_goo_8cpp.html", [ [ "BeagleGoo", "struct_beagle_goo.html", "struct_beagle_goo" ] ] ], [ "BeagleGooP.cpp", "_beagle_goo_p_8cpp.html", "_beagle_goo_p_8cpp" ], [ "GPIOoo.cpp", "_g_p_i_ooo_8cpp.html", null ], [ "gpiotest.c", "gpiotest_8c.html", "gpiotest_8c" ], [ "HD44780.cpp", "_h_d44780_8cpp.html", null ], [ "HD44780gpioPhy.cpp", "_h_d44780gpio_phy_8cpp.html", "_h_d44780gpio_phy_8cpp" ], [ "SPI.cpp", "_s_p_i_8cpp.html", "_s_p_i_8cpp" ], [ "TLC5946chain.cpp", "_t_l_c5946chain_8cpp.html", null ], [ "TLC5946phy.cpp", "_t_l_c5946phy_8cpp.html", null ], [ "TLC5946PRUSSphy.cpp", "_t_l_c5946_p_r_u_s_sphy_8cpp.html", null ] ];
/** * @license Copyright 2017 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. */ 'use strict'; /** * Manages drag and drop file input for the page. */ class DragAndDrop { /** * @param {function(!File)} fileHandlerCallback Invoked when the user chooses a new file. */ constructor(fileHandlerCallback) { this._dropZone = document.querySelector('.drop_zone'); this._fileHandlerCallback = fileHandlerCallback; this._dragging = false; this._addListeners(); } _addListeners() { // The mouseleave event is more reliable than dragleave when the user drops // the file outside the window. document.addEventListener('mouseleave', _ => { if (!this._dragging) { return; } this._resetDraggingUI(); }); document.addEventListener('dragover', e => { e.stopPropagation(); e.preventDefault(); e.dataTransfer.dropEffect = 'copy'; // Explicitly show as copy action. }); document.addEventListener('dragenter', _ => { this._dropZone.classList.add('dropping'); this._dragging = true; }); document.addEventListener('drop', e => { e.stopPropagation(); e.preventDefault(); this._resetDraggingUI(); // Note, this ignores multiple files in the drop, only taking the first. this._fileHandlerCallback(e.dataTransfer.files[0]); }); } _resetDraggingUI() { this._dropZone.classList.remove('dropping'); this._dragging = false; } } if (typeof module !== 'undefined' && module.exports) { module.exports = DragAndDrop; }
import React from 'react'; import {Link} from 'react-router'; import '../../styles/about-page.css'; // Since this component is simple and static, there's no parent container for it. const AboutPage = () => { return ( <div> <h2 className="alt-header">About</h2> <p> This example app is part of the <a href="https://github.com/coryhouse/react-slingshot">React-Slingshot starter kit</a>. </p> <p> <Link to="/badlink">Click this bad link</Link> to see the 404 page. </p> </div> ); }; export default AboutPage;
(function() { function config($stateProvider, $locationProvider) { $locationProvider .html5Mode({ enabled: true, requireBase: false }); $stateProvider .state('landing', { url: '/', controller: 'LandingCtrl as landing', templateUrl: '/templates/landing.html' }) .state('newroom', { url: '/', controller: 'NewRoomCtrl as newroom', templateUrl: '/templates/newroom.html' }) .state('login', { url: '/', controller: 'LoginCtrl as login', templateUrl: '/templates/login.html' }); } function BlocChatCookies($cookies,$uibModal) { if (!$cookies.blocChatCurrentUser || $cookies.blocChatCurrentUser === '') { this.animationsEnabled = true; $uibModal.open({ animation: this.animationsEnabled, backdrop: 'static', templateUrl: '/templates/login.html', size: "sm", controller: "LoginCtrl", controllerAs: "login", }); } } angular .module('blocChat',['ui.router','ui.bootstrap','firebase','ngCookies']) .config(config) .run(['$cookies','$uibModal', BlocChatCookies]); })();
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DNSCache = exports.DNS_DEFAULT_EXPIRE = void 0; var _dns = _interopRequireDefault(require("dns")); var _net = _interopRequireDefault(require("net")); var _logger = require("./logger"); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } async function lookup(hostname) { return new Promise((resolve, reject) => { _dns.default.lookup(hostname, function (err, address) { if (err) { reject(err); } else { resolve(address); } }); }); } function now() { return Date.now(); } const DNS_DEFAULT_EXPIRE = 3600000; exports.DNS_DEFAULT_EXPIRE = DNS_DEFAULT_EXPIRE; class DNSCache { static init(expire) { if (typeof expire === 'number' && expire >= 0) { DNSCache.expire = expire; } DNSCache.pool = {}; } static async get(hostname) { if (_net.default.isIP(hostname)) { return hostname; } let address = null; if (!DNSCache.pool[hostname]) { address = await lookup(hostname); DNSCache._put(hostname, address); } else { const [addr, expire] = DNSCache.pool[hostname]; const _now = now(); if (_now >= expire) { delete DNSCache.pool[hostname]; } _logger.logger.verbose(`[dns-cache] hit: hostname=${hostname} resolved=${addr} ttl=${expire - _now}ms`); address = addr; } return address; } static clear() { DNSCache.pool = {}; } static _put(hostname, address) { if (DNSCache.expire > 0) { const expire = now() + DNSCache.expire; DNSCache.pool[hostname] = [address, expire]; } } } exports.DNSCache = DNSCache; _defineProperty(DNSCache, "pool", {}); _defineProperty(DNSCache, "expire", DNS_DEFAULT_EXPIRE);
'use strict'; var chai = require('chai'); require('chai-as-promised'); var should = chai.should(); var PouchDB = require('pouchdb-browser'); PouchDB.adapter('worker', require('../../client')); describe('custom api test suite', function () { this.timeout(180000); var db; before(function () { var worker = new Worker('/test/custom-api/worker-bundle.js'); db = new PouchDB('testdb', { adapter: 'worker', worker: function () { return worker; } }); }); after(function () { return db.destroy(); }); it('should exist', function () { should.exist(db); }); it('should be valid', function () { db.adapter.should.equal('worker'); }); it('should put() and get data', function () { return db.put({ _id: 'foo' }).then(function () { return db.get('foo'); }).then(function (doc) { doc._id.should.equal('foo'); return db.info(); }).then(function (info) { info.doc_count.should.equal(1); }); }); });
/* eslint-env jest */ import { actionReducer } from './utils' describe('actionReducer', () => { const counter = actionReducer(0, { INCREMENT (state, action) { return state + 1 }, DECREMENT (state, action) { return state - 1 }, SET_VALUE (state, action) { return action.value }, }) it('returns initial state on no action', () => { expect(counter(undefined, {})).toEqual(0) }) it('utilizes initial state for known action', () => { expect(counter(undefined, { type: 'INCREMENT' })).toEqual(1) }) it('utilizes current state for known action', () => { expect(counter(1, { type: 'INCREMENT' })).toEqual(2) expect(counter(4, { type: 'DECREMENT' })).toEqual(3) }) it('preserves state on unknown actions', () => { expect(counter(42, { type: 'UNKNOWN' })).toEqual(42) }) it('enables action handlers to consume action parameters', () => { expect(counter(5, { type: 'SET_VALUE', value: 7 })).toEqual(7) }) })
/** * @license * Copyright 2014 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({ name: 'TooltipDemo', package: 'foam.ui.polymer.demo', extends: 'foam.ui.View', requires: [ 'foam.ui.polymer.demo.ElementWithTooltip', 'foam.ui.polymer.Tooltip' ], properties: [ { type: 'String', name: 'right', view: 'foam.ui.polymer.demo.ElementWithTooltip', defaultValue: 'Right' }, { type: 'String', name: 'top', view: 'foam.ui.polymer.demo.ElementWithTooltip', defaultValue: 'Top' }, { type: 'String', name: 'left', view: 'foam.ui.polymer.demo.ElementWithTooltip', defaultValue: 'Left' }, { type: 'String', name: 'bottom', view: 'foam.ui.polymer.demo.ElementWithTooltip', defaultValue: 'Bottom' }, { type: 'String', name: 'noArrow', view: 'foam.ui.polymer.demo.ElementWithTooltip', defaultValue: 'NoArrow' }, { type: 'String', name: 'richText', view: 'foam.ui.polymer.demo.ElementWithTooltip', defaultValue: 'RichText' }, { type: 'String', name: 'show', view: 'foam.ui.polymer.demo.ElementWithTooltip', defaultValue: 'Show' } ], templates: [ function toHTML() {/* <div class="centeredDiv"> $$top{ tooltipConfig: { text: 'Tooltip on the top', position: 'top' } } </div><div class="centeredDiv"> $$left{ tooltipConfig: { text: 'Tooltip on the left', position: 'left' } } </div><div class="centeredDiv"> $$right{ tooltipConfig: { text: 'Tooltip on the right', position: 'right' } } </div><div class="centeredDiv"> $$bottom{ tooltipConfig: { text: 'Tooltip on the bottom', position: 'bottom' } } </div><div class="centeredDiv"> $$noArrow{ tooltipConfig: { text: 'Tooltip without arrow', noarrow: true } } </div><div class="centeredDiv"> $$richText{ tooltipConfig: { html: 'Tooltip with <b>rich</b> <i>text</i>' } } </div><div class="centeredDiv"> $$show{ tooltipConfig: { text: 'Tooltip always shown', show: true } } </div> */}, function CSS() {/* .centeredDiv { cursor: pointer; width: 0; margin: 0 auto; } */} ] });
// Backbone.Syphon.KeySplitter // --------------------------- // This function is used to split DOM element keys in to an array // of parts, which are then used to create a nested result structure. // returning `["foo", "bar"]` results in `{foo: { bar: "value" }}`. // // Override this method to use a custom key splitter, such as: // `<input name="foo.bar.baz">`, `return key.split(".")` Backbone.Syphon.KeySplitter = function(key){ var matches = key.match(/[^\[\]]+/g); if (key.indexOf("[]") === key.length - 2){ lastKey = matches.pop(); matches.push([lastKey]); } return matches; }
/** * Copyright IBM Corp. 2016, 2018 * * This source code is licensed under the Apache-2.0 license found in the * LICENSE file in the root directory of this source tree. */ import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { settings } from 'carbon-components'; import ListBulleted16 from '@carbon/icons-react/lib/list--bulleted/16'; import Grid16 from '@carbon/icons-react/lib/grid/16'; const { prefix } = settings; /** * The layout button for `<Search>`. */ class SearchLayoutButton extends Component { state = { format: 'list' }; static propTypes = { /** * The layout. */ format: PropTypes.oneOf(['list', 'grid']), /** * The a11y label text. */ labelText: PropTypes.string, /** * The description for the "list" icon. */ iconDescriptionList: PropTypes.string, /** * The description for the "grid" icon. */ iconDescriptionGrid: PropTypes.string, /** * The callback called when layout switches. */ onChangeFormat: PropTypes.func, }; static defaultProps = { labelText: 'Filter', iconDescriptionList: 'list', iconDescriptionGrid: 'grid', }; static getDerivedStateFromProps({ format }, state) { const { prevFormat } = state; return prevFormat === format ? null : { format: format || 'list', prevFormat: format, }; } /** * Toggles the button state upon user-initiated event. */ toggleLayout = () => { const format = this.state.format === 'list' ? 'grid' : 'list'; this.setState({ format }, () => { const { onChangeFormat } = this.props; if (typeof onChangeFormat === 'function') { onChangeFormat({ format }); } }); }; render() { const { labelText, iconDescriptionList, iconDescriptionGrid } = this.props; const SearchLayoutButtonIcon = () => { if (this.state.format === 'list') { return ( <ListBulleted16 className={`${prefix}--search-view`} aria-label={iconDescriptionList} /> ); } return ( <Grid16 className={`${prefix}--search-view`} aria-label={iconDescriptionGrid} /> ); }; return ( <button className={`${prefix}--search-button`} type="button" onClick={this.toggleLayout} aria-label={labelText} title={labelText}> <div className={`${prefix}--search__toggle-layout__container`}> <SearchLayoutButtonIcon /> </div> </button> ); } } export default SearchLayoutButton;
alert("XSS from JS file");
sap.ui.define([ 'jquery.sap.global', 'sap/ui/core/Fragment', 'sap/ui/core/mvc/Controller', 'sap/ui/model/Filter', 'sap/ui/model/json/JSONModel' ], function(jQuery, Fragment, Controller, Filter, JSONModel) { "use strict"; var CController = Controller.extend("sap.m.sample.InputAssistedTwoValues.C", { inputId: '', onInit: function () { // set explored app's demo model on this sample var oModel = new JSONModel(jQuery.sap.getModulePath("sap.ui.demo.mock", "/products.json")); this.getView().setModel(oModel); }, handleValueHelp : function (oController) { this.inputId = oController.oSource.sId; // create value help dialog if (!this._valueHelpDialog) { this._valueHelpDialog = sap.ui.xmlfragment( "sap.m.sample.InputAssistedTwoValues.Dialog", this ); this.getView().addDependent(this._valueHelpDialog); } // open value help dialog this._valueHelpDialog.open(); }, _handleValueHelpSearch : function (evt) { var sValue = evt.getParameter("value"); var oFilter = new Filter( "Name", sap.ui.model.FilterOperator.Contains, sValue ); evt.getSource().getBinding("items").filter([oFilter]); }, _handleValueHelpClose : function (evt) { var oSelectedItem = evt.getParameter("selectedItem"); if (oSelectedItem) { var productInput = this.byId(this.inputId); productInput.setValue(oSelectedItem.getTitle()); } evt.getSource().getBinding("items").filter([]); } }); return CController; });
"use strict"; const {strict: assert} = require("assert"); const {zrequire} = require("../zjsunit/namespace"); const {run_test} = require("../zjsunit/test"); const user_groups = zrequire("user_groups"); const user_group_pill = zrequire("user_group_pill"); const admins = { name: "Admins", description: "foo", id: 101, members: [10, 20], }; const testers = { name: "Testers", description: "bar", id: 102, members: [20, 50, 30, 40], }; const admins_pill = { id: admins.id, group_name: admins.name, type: "user_group", display_value: admins.name + ": " + admins.members.length + " users", }; const testers_pill = { id: testers.id, group_name: testers.name, type: "user_group", display_value: testers.name + ": " + testers.members.length + " users", }; const groups = [admins, testers]; for (const group of groups) { user_groups.add(group); } run_test("create_item", () => { function test_create_item(group_name, current_items, expected_item) { const item = user_group_pill.create_item_from_group_name(group_name, current_items); assert.deepEqual(item, expected_item); } test_create_item(" admins ", [], admins_pill); test_create_item("admins", [testers_pill], admins_pill); test_create_item("admins", [admins_pill], undefined); test_create_item("unknown", [], undefined); }); run_test("get_stream_id", () => { assert.equal(user_group_pill.get_group_name_from_item(admins_pill), admins.name); }); run_test("get_user_ids", () => { const items = [admins_pill, testers_pill]; const widget = {items: () => items}; const user_ids = user_group_pill.get_user_ids(widget); assert.deepEqual(user_ids, [10, 20, 30, 40, 50]); }); run_test("get_group_ids", () => { const items = [admins_pill, testers_pill]; const widget = {items: () => items}; const group_ids = user_group_pill.get_group_ids(widget); assert.deepEqual(group_ids, [101, 102]); });
/** * Passport configuration * * This is the configuration for your Passport.js setup and where you * define the authentication strategies you want your application to employ. * * I have tested the service with all of the providers listed below - if you * come across a provider that for some reason doesn't work, feel free to open * an issue on GitHub. * * Also, authentication scopes can be set through the `scope` property. * * For more information on the available providers, check out: * http://passportjs.org/guide/providers/ */ module.exports.passport = { local: { strategy: require('passport-local').Strategy }, bearer: { strategy: require('passport-http-bearer').Strategy } /*twitter: { name: 'Twitter', protocol: 'oauth', strategy: require('passport-twitter').Strategy, options: { consumerKey: 'your-consumer-key', consumerSecret: 'your-consumer-secret' } }, github: { name: 'GitHub', protocol: 'oauth2', strategy: require('passport-github').Strategy, options: { clientID: 'your-client-id', clientSecret: 'your-client-secret' } }, facebook: { name: 'Facebook', protocol: 'oauth2', strategy: require('passport-facebook').Strategy, options: { clientID: 'your-client-id', clientSecret: 'your-client-secret', scope: ['email'] } }, google: { name: 'Google', protocol: 'oauth2', strategy: require('passport-google-oauth').OAuth2Strategy, options: { clientID: 'your-client-id', clientSecret: 'your-client-secret' } }, cas: { name: 'CAS', protocol: 'cas', strategy: require('passport-cas').Strategy, options: { ssoBaseURL: 'http://your-cas-url', serverBaseURL: 'http://localhost:1337', serviceURL: 'http://localhost:1337/auth/cas/callback' } }*/ };
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. */ function friendsWrapper() { /* * Loads the owner, the viewer, the owner's friends, and the viewer's * friends and mutual friends between owner and viewer. Response data is put into the variables owner, viewer, * ownerFriends, and viewerFriends, mutualFriends respectively. * * */ this.loadFriends = function(){ var req = opensocial.newDataRequest(); req.add(req.newFetchPersonRequest(opensocial.IdSpec.PersonId.VIEWER), 'viewer'); req.add(req.newFetchPersonRequest(opensocial.IdSpec.PersonId.OWNER), 'owner'); var viewerFriends = opensocial.newIdSpec({ "userId" : "VIEWER", "groupId" : "FRIENDS" }); var ownerFriends = opensocial.newIdSpec({ "userId" : "OWNER", "groupId" : "FRIENDS" }); var opt_params = {}; opt_params[opensocial.DataRequest.PeopleRequestFields.MAX] = 100; req.add(req.newFetchPeopleRequest(viewerFriends, opt_params), 'viewerFriends'); req.add(req.newFetchPeopleRequest(ownerFriends, opt_params), 'ownerFriends'); var params = {}; params[opensocial.DataRequest.PeopleRequestFields.MAX] = 100; // Usage of isFriendsWith filter to get mutual friends. filterValue should be set to the friend with whom mutual friends is to be found. params[opensocial.DataRequest.PeopleRequestFields.FILTER] = opensocial.DataRequest.FilterType.IS_FRIENDS_WITH; params["filterValue"] = opensocial.IdSpec.PersonId.VIEWER; req.add(req.newFetchPeopleRequest(ownerFriends, params), 'mutualFriends'); var app_params = {}; app_params[opensocial.DataRequest.PeopleRequestFields.MAX] = 100; // Usage of hasApp filter to get list of friends who use this app. app_params[opensocial.DataRequest.PeopleRequestFields.FILTER] = opensocial.DataRequest.FilterType.HAS_APP; req.add(req.newFetchPeopleRequest(ownerFriends, app_params), 'friendsUsingApp'); req.send(displayFriends); }; function displayFriends(data) { var viewer = data.get('viewer').getData(); var viewerFriends = data.get('viewerFriends').getData(); var owner = data.get('owner').getData(); var ownerFriends = data.get('ownerFriends').getData(); html = new Array(); html.push(owner.getDisplayName() + '\'s Friends(',ownerFriends.size(),') <br>'); html.push('<ul>'); ownerFriends.each(function(person) { if (person.getId()) { html.push('<li>', person.getDisplayName(), '</li>'); } }); html.push('</ul>'); if(owner.getDisplayName()!=viewer.getDisplayName()) { var mutualFriends = data.get('mutualFriends').getData(); html.push('Mutual Friends with ',viewer.getDisplayName(),'(',mutualFriends.size(),') <br>'); html.push('<ul>'); mutualFriends.each(function(person) { if (person.getId()) { html.push('<li>', person.getDisplayName(), '</li>'); } }); html.push('</ul>'); } var friendsUsingApp = data.get('friendsUsingApp').getData(); html.push('Friends using this Widget (',friendsUsingApp.size(),') <br>'); html.push('<ul>'); friendsUsingApp.each(function(person) { if (person.getId()) { html.push('<li>', person.getDisplayName(), '</li>'); } }); html.push('</ul>'); document.getElementById('friends').innerHTML = html.join(''); gadgets.window.adjustHeight(); } }
import { FunctionNode } from './FunctionNode.js'; function ExpressionNode( src, type, keywords, extensions, includes ) { FunctionNode.call( this, src, includes, extensions, keywords, type ); } ExpressionNode.prototype = Object.create( FunctionNode.prototype ); ExpressionNode.prototype.constructor = ExpressionNode; ExpressionNode.prototype.nodeType = "Expression"; export { ExpressionNode };
var Event = { addListener: function (obj, event, listener, scope) { if (obj) { if (typeof obj.__listeners == "undefined") { obj.__listeners = new Object(); } if (typeof obj.__listeners[event] == "undefined") { obj.__listeners[event] = new Array(); obj.__listeners[event].__listenerCount = 0; } if (typeof scope == "undefined") obj.__listeners[event].push(listener); else obj.__listeners[event].push({ "listener": listener, "scope": scope }); obj.__listeners[event].__listenerCount++; obj["on" + event] = function () { Event.fire(obj, event, arguments); }; return obj.__listeners[event].length - 1; } }, removeListener: function (obj, event, listener, scope) { if (obj && obj.__listeners && obj.__listeners[event]) { for (var i = 0; i < obj.__listeners[event].length; i++) { if (obj.__listeners[event][i] === listener) { obj.__listeners[event][i] = null; delete obj.__listeners[event][i]; obj.__listeners[event].__listenerCount--; } else { var l = obj.__listeners[event][i]; if (l && l.listener === listener && l.scope === scope) { obj.__listeners[event][i] = null; delete obj.__listeners[event][i]; obj.__listeners[event].__listenerCount--; } } } Event.defragListeners(obj, event); } }, removeListenerById: function (obj, event, listenerId) { if (obj && obj.__listeners && obj.__listeners[event] && obj.__listeners[event][listenerId]) { obj.__listeners[event][listenerId] = null; delete obj.__listeners[event][listenerId]; obj.__listeners[event].__listenerCount--; } Event.defragListeners(obj, event); }, removeAllListeners: function(obj, event) { if(obj && obj.__listeners) { if(typeof event == "undefined") { obj.__listeners = new Object(); } else if(typeof obj.__listeners[event] != "undefined") { obj.__listeners[event] = new Array(); obj.__listeners[event].__listenerCount = 0; } } }, defragListener: function(obj, event) { // do nothing right now }, fire: function (obj, event, args) { if(!args) args = new Array(); for (var i = 0; obj && obj.__listeners && obj.__listeners[event] && i < obj.__listeners[event].length; i++) { var f = obj.__listeners[event][i]; if (typeof f == "function") { // TODO: should the scope be the obj, the listener, or should it be passed in? f.apply(obj, args); } else if (f && typeof f.listener == "function") { f.listener.apply(f.scope, args); } } } };
var utils = require('./utils'), Signals = require('./Signals'); /** * Support for the W3C Page Visibility API - http://www.w3.org/TR/page-visibility * * {@link module:enyo/pageVisibility.hidden} and {@link module:enyo/pageVisibility.visibilityState} * contain the same information as `document.hidden` and * `document.visibilityState` in supported browsers. The `visibilitychange` * event is channelled through the [Signals]{@link module:enyo/Signals~Signals} mechanism. * * Partly based on {@linkplain http://stackoverflow.com/a/1060034}. * * Example: * * ```javascript * var * kind = require('enyo/kind'), * Signals = require('enyo/Signals'); * * module.exports = kind({ * name: 'App', * components: [ * {kind: Signals, onvisibilitychange: 'visibilitychanged'} * ], * visibilitychanged: function() { * if(enyo.hidden){ * // page hidden * } else { * // page visible * } * } * }); * ``` * * @module enyo/pageVisibility * @private */ var doc = global.document, hidden = 'hidden', visibilityState = 'visibilityState', hiddenMap = {}; var pageVisibility = module.exports = { // set inital values for enyo.hidden and enyo.visibilityState it's probably save to assume // that the current document is visible when loading the page /** * `true` if the document is hidden; otherwise, `false`. * * @readonly * @type {Boolean} * @default false * @public */ hidden: typeof doc[hidden] !== 'undefined' ? doc[hidden] : false, /** * String indicating the document's visibility state. * * @readonly * @type {String} * @default 'visible' * @public */ visibilityState: typeof doc[visibilityState] !== 'undefined' ? doc[visibilityState] : 'visible' }; // map compatibility events to document.hidden state hiddenMap.blur = hiddenMap.focusout = hiddenMap.pagehide = true; hiddenMap.focus = hiddenMap.focusin = hiddenMap.pageshow = false; function onchange (event) { event = event || global.event; pageVisibility.hidden = (event.type in hiddenMap) ? hiddenMap[event.type] : doc[hidden]; pageVisibility.visibilityState = (event.type in hiddenMap) ? (hiddenMap[event.type] ? 'hidden' : 'visible' ) : doc[visibilityState]; Signals.send('onvisibilitychange', utils.mixin(event, {hidden: pageVisibility.hidden})); } // Standards: if (hidden in doc) { doc.addEventListener('visibilitychange', onchange); } else if ((hidden = 'mozHidden') in doc) { doc.addEventListener('mozvisibilitychange', onchange); visibilityState = 'mozVisibilityState'; } else if ((hidden = 'webkitHidden') in doc) { doc.addEventListener('webkitvisibilitychange', onchange); visibilityState = 'webkitVisibilityState'; } else if ((hidden = 'msHidden') in doc) { doc.addEventListener('msvisibilitychange', onchange); visibilityState = 'msVisibilityState'; } else if ('onfocusin' in doc) { // IE 9 and lower: doc.onfocusin = doc.onfocusout = onchange; } else { // All others: global.onpageshow = global.onpagehide = global.onfocus = global.onblur = onchange; }
/* * 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'; const models = require('./index'); /** * Base class for backup ProtectionIntent. * * @extends models['Resource'] */ class ProtectionIntentResource extends models['Resource'] { /** * Create a ProtectionIntentResource. * @member {object} [properties] ProtectionIntentResource properties * @member {string} [properties.backupManagementType] Type of backup * managemenent for the backed up item. Possible values include: 'Invalid', * 'AzureIaasVM', 'MAB', 'DPM', 'AzureBackupServer', 'AzureSql', * 'AzureStorage', 'AzureWorkload', 'DefaultBackup' * @member {string} [properties.sourceResourceId] ARM ID of the resource to * be backed up. * @member {string} [properties.itemId] ID of the item which is getting * protected, In case of Azure Vm , it is ProtectedItemId * @member {string} [properties.policyId] ID of the backup policy with which * this item is backed up. * @member {string} [properties.protectionState] Backup state of this backup * item. Possible values include: 'Invalid', 'NotProtected', 'Protecting', * 'Protected', 'ProtectionFailed' * @member {string} [properties.protectionIntentItemType] Polymorphic * Discriminator */ constructor() { super(); } /** * Defines the metadata of ProtectionIntentResource * * @returns {object} metadata of ProtectionIntentResource * */ mapper() { return { required: false, serializedName: 'ProtectionIntentResource', type: { name: 'Composite', className: 'ProtectionIntentResource', modelProperties: { id: { required: false, readOnly: true, serializedName: 'id', type: { name: 'String' } }, name: { required: false, readOnly: true, serializedName: 'name', type: { name: 'String' } }, type: { required: false, readOnly: true, serializedName: 'type', type: { name: 'String' } }, location: { required: false, serializedName: 'location', type: { name: 'String' } }, tags: { required: false, serializedName: 'tags', type: { name: 'Dictionary', value: { required: false, serializedName: 'StringElementType', type: { name: 'String' } } } }, eTag: { required: false, serializedName: 'eTag', type: { name: 'String' } }, properties: { required: false, serializedName: 'properties', type: { name: 'Composite', polymorphicDiscriminator: { serializedName: 'protectionIntentItemType', clientName: 'protectionIntentItemType' }, uberParent: 'ProtectionIntent', className: 'ProtectionIntent' } } } } }; } } module.exports = ProtectionIntentResource;
/* * 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'; const models = require('./index'); /** * Class representing a ProductionOrStagingEndpointInfo. * @extends models['EndpointInfo'] */ class ProductionOrStagingEndpointInfo extends models['EndpointInfo'] { /** * Create a ProductionOrStagingEndpointInfo. */ constructor() { super(); } /** * Defines the metadata of ProductionOrStagingEndpointInfo * * @returns {object} metadata of ProductionOrStagingEndpointInfo * */ mapper() { return { required: false, serializedName: 'ProductionOrStagingEndpointInfo', type: { name: 'Composite', className: 'ProductionOrStagingEndpointInfo', modelProperties: { versionId: { required: false, serializedName: 'versionId', type: { name: 'String' } }, isStaging: { required: false, serializedName: 'isStaging', type: { name: 'Boolean' } }, endpointUrl: { required: false, serializedName: 'endpointUrl', type: { name: 'String' } }, region: { required: false, serializedName: 'region', type: { name: 'String' } }, assignedEndpointKey: { required: false, serializedName: 'assignedEndpointKey', type: { name: 'String' } }, endpointRegion: { required: false, serializedName: 'endpointRegion', type: { name: 'String' } }, failedRegions: { required: false, serializedName: 'failedRegions', type: { name: 'String' } }, publishedDateTime: { required: false, serializedName: 'publishedDateTime', type: { name: 'String' } } } } }; } } module.exports = ProductionOrStagingEndpointInfo;
(function() { function AlbumCtrl(Fixtures, SongPlayer) { this.albumData = []; this.albumData.push(Fixtures.getAlbum()); this.songPlayer = SongPlayer; } angular .module('blocJams') .controller('AlbumCtrl', ['Fixtures','SongPlayer', AlbumCtrl]); })();
// UserController for AngularJS ecollabroApp.controller('userController', ['$scope', 'securityService', function ($scope, securityService) { $scope.user = {}; $scope.activeRoles = []; $scope.userId = 0; //Method initialize $scope.initialize = function (userId) { $scope.userId = userId; includeChangePassword($scope, securityService, 'admin'); $scope.loadUser(); }; //Method loadUser $scope.loadUser = function () { if ($scope.userId == 0) { $scope.user.IsActive = true; $scope.loadActiveRoles(); return; } securityService.getUser($scope.userId).then(function (resp) { if (resp.businessException == null) { $scope.user = resp.result; $scope.loadActiveRoles(); } else { showMessage("divSummaryMessageUser", resp.businessException.ExceptionMessage, "danger"); } }); }; //Method saveUser $scope.saveUser = function () { if (!$("#frmUser").valid()) { return; } else { if ($scope.user.UserRoles == null || $scope.user.UserRoles.length == 0) { showMessage("divSummaryMessageUser", "Select at-least one role for user!", "danger"); return; } } securityService.saveUser($scope.user).then(function (resp) { if (resp.businessException == null) { $scope.user.UserId = resp.result.Id; var divUsers = document.getElementById("divUsers"); if (divUsers) { showUsers(resp.result.Message); // calling parent's method } else { showMessage("divSummaryMessageUser", resp.result.Message, "success"); } } else { showMessage("divSummaryMessageUser", resp.businessException.ExceptionMessage, "danger"); } }); }; //Method restPassword $scope.resetPassword = function () { bootbox.confirm("This will reset User's password and will send email with new credential? Are you sure to reset the password for selected User?", function (result) { if (result) { securityService.resetUserPassword($scope.user.UserId).then(function (resp) { if (resp.businessException == null) { showMessage("divSummaryMessageUser", resp.result, "success"); } else { showMessage("divSummaryMessageUser", resp.businessException.ExceptionMessage, "danger"); } }); } }); }; //Method confirmUser $scope.confirmUser = function () { securityService.confirmUser($scope.user.UserId).then(function (resp) { if (resp.businessException == null) { showMessage("divSummaryMessageUser", resp.result, "success"); $scope.user.IsConfirmed = true; } else { showMessage("divSummaryMessageUser", resp.businessException.ExceptionMessage, "danger"); } }); }; //Method unlockUser $scope.unlockUser = function () { securityService.unlockUser($scope.user.UserId).then(function (resp) { if (resp.businessException == null) { showMessage("divSummaryMessageUser", resp.result, "success"); $scope.user.IsLocked = false; } else { showMessage("divSummaryMessageUser", resp.businessException.ExceptionMessage, "danger"); } }); }; //Method approveUser $scope.approveUser = function () { securityService.approveUser($scope.user.UserId).then(function (resp) { if (resp.businessException == null) { showMessage("divSummaryMessageUser", resp.result, "success"); $scope.user.IsApproved = true; } else { showMessage("divSummaryMessageUser", resp.businessException.ExceptionMessage, "danger"); } }); }; //Method getActiveRole $scope.getActiveRole = function (roleId) { var activeRole = null; for (var ctr = 0; ctr < $scope.activeRoles.length; ctr++) { if ($scope.activeRoles[ctr].RoleId == roleId) { activeRole = $scope.activeRoles[ctr]; break; } } return activeRole; } // Method loadAactiveRoles $scope.loadActiveRoles = function () { securityService.getActiveRoles($scope.user).then(function (resp) { if (resp.businessException == null) { $scope.activeRoles = resp.result.data; if ($scope.user.UserRoles != null && $scope.user.UserRoles.length > 0) { var existingRoles = $scope.user.UserRoles; $scope.user.UserRoles = []; for (var ctr = 0; ctr < existingRoles.length; ctr++) { var activeRole = $scope.getActiveRole(existingRoles[ctr].RoleId); if (activeRole != null) $scope.user.UserRoles.push(activeRole); } } } else { showMessage("divSummaryMessageUser", resp.businessException.ExceptionMessage, "danger"); } }); }; //method openUsers $scope.openUsers = function () { location.href = "/security/users"; }; }]);
$(document).ready(function() { $('#btn-create-version').on('click', function(e) { e.preventDefault(); var newVersion = $('#new-version').val(); if (newVersion) { var assetId = $('#asset-id').val(); var assetType = $('#asset-type').val(); var path = caramel.url('/apis/asset/' + assetId + '/create-version?type=' + assetType); var assetPath = caramel.url('/assets/' + assetType + '/details/'); $('#btn-create-version').addClass('disabled'); $('#new-version-loading').removeClass('hide'); var alertMessage = $("#alertSection"); $.ajax({ url: path, data: JSON.stringify({ "attributes": { "overview_version": newVersion } }), type: 'POST', success: function(response) { messages.alertSuccess('Asset version created successfully!,You will be redirected to new asset details page in few seconds.....'); setTimeout(function() { var path = caramel.url('assets/' + assetType + '/details/' + response.data); window.location = path; }, 3000); }, error: function(error) { var errorText = JSON.parse(error.responseText).error; messages.alertError(errorText); $('#btn-create-version').removeClass('disabled'); $('#new-version-loading').addClass('hide'); } }); } }); $('#btn-cancel-version').on('click', function(e) { var assetId = $('#asset-id').val(); var assetType = $('#asset-type').val(); var path = caramel.url('/assets/' + assetType + '/details/' + assetId); $.ajax({ success: function(response) { window.location = path; } }); }); });
export { Clock } from './Clock';
/** * 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. */ const path = require('path'); const webpack = require('webpack'); module.exports = { devtool: 'source-map', module: { rules: [ { test: /\.tsx?$/, exclude: /node_modules/, use: 'ts-loader' }, { test: /\.[tj]sx?$/, use: 'source-map-loader', enforce: 'pre' }, { test: /\.tsx?$/, use: { loader: 'istanbul-instrumenter-loader', options: { esModules: true } }, enforce: 'post', include: path.resolve(process.cwd(), 'src') } ] }, resolve: { modules: ['node_modules', path.resolve(__dirname, '../../node_modules')], extensions: ['.js', '.ts'] } };
/* Copyright (c) 2002 JSON.org 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 shall be used for Good, not Evil. 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. json.js 2006-10-05 This file adds these methods to JavaScript: object.toJSONString() This method produces a JSON text from an object. The object must not contain any cyclical references. array.toJSONString() This method produces a JSON text from an array. The array must not contain any cyclical references. string.parseJSON() This method parses a JSON text to produce an object or array. It will return false if there is an error. It is expected that these methods will formally become part of the JavaScript Programming Language in the Fourth Edition of the ECMAScript standard. */ (function () { var m = { '\b': '\\b', '\t': '\\t', '\n': '\\n', '\f': '\\f', '\r': '\\r', '"' : '\\"', '\\': '\\\\' }, s = { array: function (x) { var a = ['['], b, f, i, l = x.length, v; for (i = 0; i < l; i += 1) { v = x[i]; f = s[typeof v]; if (f) { v = f(v); if (typeof v == 'string') { if (b) { a[a.length] = ','; } a[a.length] = v; b = true; } } } a[a.length] = ']'; return a.join(''); }, 'boolean': function (x) { return String(x); }, 'null': function (x) { return "null"; }, number: function (x) { return isFinite(x) ? String(x) : 'null'; }, object: function (x) { if (x) { if (x instanceof Array) { return s.array(x); } var a = ['{'], b, f, i, v; for (i in x) { v = x[i]; f = s[typeof v]; if (f) { v = f(v); if (typeof v == 'string') { if (b) { a[a.length] = ','; } a.push(s.string(i), ':', v); b = true; } } } a[a.length] = '}'; return a.join(''); } return 'null'; }, string: function (x) { if (/["\\\x00-\x1f]/.test(x)) { x = x.replace(/([\x00-\x1f\\"])/g, function(a, b) { var c = m[b]; if (c) { return c; } c = b.charCodeAt(); return '\\u00' + Math.floor(c / 16).toString(16) + (c % 16).toString(16); }); } return '"' + x + '"'; } }; Object.prototype.toJSONString = function () { return s.object(this); }; Array.prototype.toJSONString = function () { return s.array(this); }; })(); String.prototype.parseJSON = function () { try { return (/^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/.test(this)) && eval('(' + this + ')'); } catch (e) { return false; } };
/** * Created by hooxin on 14-10-10. */ /** * 字典维护标志 */ Ext.define('Techsupport.store.DictMaintFlag', { extend: 'Ext.data.Store', fields: ['text', 'value'], data: [ {text: '维护', value: 0}, {text: '停止维护', value: 1} ] })
//// [declFileWithExtendsClauseThatHasItsContainerNameConflict.ts] declare module A.B.C { class B { } } module A.B { export class EventManager { id: number; } } module A.B.C { export class ContextMenu extends EventManager { name: string; } } //// [declFileWithExtendsClauseThatHasItsContainerNameConflict.js] var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } __.prototype = b.prototype; d.prototype = new __(); }; var A; (function (A) { var B; (function (B) { var EventManager = (function () { function EventManager() { } return EventManager; })(); B.EventManager = EventManager; })(B = A.B || (A.B = {})); })(A || (A = {})); var A; (function (A) { var B; (function (B) { var C; (function (C) { var ContextMenu = (function (_super) { __extends(ContextMenu, _super); function ContextMenu() { _super.apply(this, arguments); } return ContextMenu; })(B.EventManager); C.ContextMenu = ContextMenu; })(C = B.C || (B.C = {})); })(B = A.B || (A.B = {})); })(A || (A = {})); //// [declFileWithExtendsClauseThatHasItsContainerNameConflict.d.ts] declare module A.B.C { class B { } } declare module A.B { class EventManager { id: number; } } declare module A.B.C { class ContextMenu extends EventManager { name: string; } }
'use strict'; angular.module("ngLocale", [], ["$provide", function($provide) { var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"}; function getDecimals(n) { n = n + ''; var i = n.indexOf('.'); return (i == -1) ? 0 : n.length - i - 1; } function getVF(n, opt_precision) { var v = opt_precision; if (undefined === v) { v = Math.min(getDecimals(n), 3); } var base = Math.pow(10, v); var f = ((n * base) | 0) % base; return {v: v, f: f}; } $provide.value("$locale", { "DATETIME_FORMATS": { "AMPMS": [ "\u0434\u043f", "\u043f\u043f" ], "DAY": [ "\u043d\u0435\u0434\u0456\u043b\u044f", "\u043f\u043e\u043d\u0435\u0434\u0456\u043b\u043e\u043a", "\u0432\u0456\u0432\u0442\u043e\u0440\u043e\u043a", "\u0441\u0435\u0440\u0435\u0434\u0430", "\u0447\u0435\u0442\u0432\u0435\u0440", "\u043f\u02bc\u044f\u0442\u043d\u0438\u0446\u044f", "\u0441\u0443\u0431\u043e\u0442\u0430" ], "ERANAMES": [ "\u0434\u043e \u043d\u0430\u0448\u043e\u0457 \u0435\u0440\u0438", "\u043d\u0430\u0448\u043e\u0457 \u0435\u0440\u0438" ], "ERAS": [ "\u0434\u043e \u043d. \u0435.", "\u043d. \u0435." ], "FIRSTDAYOFWEEK": 0, "MONTH": [ "\u0441\u0456\u0447\u043d\u044f", "\u043b\u044e\u0442\u043e\u0433\u043e", "\u0431\u0435\u0440\u0435\u0437\u043d\u044f", "\u043a\u0432\u0456\u0442\u043d\u044f", "\u0442\u0440\u0430\u0432\u043d\u044f", "\u0447\u0435\u0440\u0432\u043d\u044f", "\u043b\u0438\u043f\u043d\u044f", "\u0441\u0435\u0440\u043f\u043d\u044f", "\u0432\u0435\u0440\u0435\u0441\u043d\u044f", "\u0436\u043e\u0432\u0442\u043d\u044f", "\u043b\u0438\u0441\u0442\u043e\u043f\u0430\u0434\u0430", "\u0433\u0440\u0443\u0434\u043d\u044f" ], "SHORTDAY": [ "\u041d\u0434", "\u041f\u043d", "\u0412\u0442", "\u0421\u0440", "\u0427\u0442", "\u041f\u0442", "\u0421\u0431" ], "SHORTMONTH": [ "\u0441\u0456\u0447.", "\u043b\u044e\u0442.", "\u0431\u0435\u0440.", "\u043a\u0432\u0456\u0442.", "\u0442\u0440\u0430\u0432.", "\u0447\u0435\u0440\u0432.", "\u043b\u0438\u043f.", "\u0441\u0435\u0440\u043f.", "\u0432\u0435\u0440.", "\u0436\u043e\u0432\u0442.", "\u043b\u0438\u0441\u0442.", "\u0433\u0440\u0443\u0434." ], "STANDALONEMONTH": [ "\u0441\u0456\u0447\u0435\u043d\u044c", "\u043b\u044e\u0442\u0438\u0439", "\u0431\u0435\u0440\u0435\u0437\u0435\u043d\u044c", "\u043a\u0432\u0456\u0442\u0435\u043d\u044c", "\u0442\u0440\u0430\u0432\u0435\u043d\u044c", "\u0447\u0435\u0440\u0432\u0435\u043d\u044c", "\u043b\u0438\u043f\u0435\u043d\u044c", "\u0441\u0435\u0440\u043f\u0435\u043d\u044c", "\u0432\u0435\u0440\u0435\u0441\u0435\u043d\u044c", "\u0436\u043e\u0432\u0442\u0435\u043d\u044c", "\u043b\u0438\u0441\u0442\u043e\u043f\u0430\u0434", "\u0433\u0440\u0443\u0434\u0435\u043d\u044c" ], "WEEKENDRANGE": [ 5, 6 ], "fullDate": "EEEE, d MMMM y '\u0440'.", "longDate": "d MMMM y '\u0440'.", "medium": "d MMM y '\u0440'. HH:mm:ss", "mediumDate": "d MMM y '\u0440'.", "mediumTime": "HH:mm:ss", "short": "dd.MM.yy HH:mm", "shortDate": "dd.MM.yy", "shortTime": "HH:mm" }, "NUMBER_FORMATS": { "CURRENCY_SYM": "\u0433\u0440\u043d.", "DECIMAL_SEP": ",", "GROUP_SEP": "\u00a0", "PATTERNS": [ { "gSize": 3, "lgSize": 3, "maxFrac": 3, "minFrac": 0, "minInt": 1, "negPre": "-", "negSuf": "", "posPre": "", "posSuf": "" }, { "gSize": 3, "lgSize": 3, "maxFrac": 2, "minFrac": 2, "minInt": 1, "negPre": "-", "negSuf": "\u00a0\u00a4", "posPre": "", "posSuf": "\u00a0\u00a4" } ] }, "id": "uk-ua", "localeID": "uk_UA", "pluralCat": function(n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (vf.v == 0 && i % 10 == 1 && i % 100 != 11) { return PLURAL_CATEGORY.ONE; } if (vf.v == 0 && i % 10 >= 2 && i % 10 <= 4 && (i % 100 < 12 || i % 100 > 14)) { return PLURAL_CATEGORY.FEW; } if (vf.v == 0 && i % 10 == 0 || vf.v == 0 && i % 10 >= 5 && i % 10 <= 9 || vf.v == 0 && i % 100 >= 11 && i % 100 <= 14) { return PLURAL_CATEGORY.MANY; } return PLURAL_CATEGORY.OTHER;} }); }]);
// // Copyright (c) Microsoft and contributors. 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. // var assert = require('assert'); // Test includes var testutil = require('../../framework/util'); // Lib includes var ISO8061Date = require('../../../lib/common/util/iso8061date'); var date = require('../../../lib/common/util/date'); describe('iso8061date-tests', function () { it('parse should work', function (done) { var datetime = new Date(Date.UTC(2011, 6, 17, 14, 0, 23, 270)); var datetimeAtom = "2011-07-17T14:00:23.270Z"; var parsed = ISO8061Date.parse(datetimeAtom); assert.deepEqual(parsed, datetime); done(); }); it('parsing a long Timestamp should work', function (done) { var datetime = new Date(Date.UTC(2011, 6, 17, 14, 0, 23, 270)); var datetimeAtom = "2011-07-17T14:00:23.2701234Z"; var parsed = ISO8061Date.parse(datetimeAtom); assert.deepEqual(parsed, datetime); done(); }); it('parsing a long Timestamp with rounding shoudl work', function (done) { var datetime = new Date(Date.UTC(2011, 6, 17, 14, 0, 23, 270)); var datetimeAtom = "2011-07-17T14:00:23.26993Z"; var parsed = ISO8061Date.parse(datetimeAtom); assert.deepEqual(parsed, datetime); done(); }); it('parsing a short Millisecond field should work', function (done) { var datetime = new Date(Date.UTC(2011, 6, 17, 14, 0, 23, 200)); var datetimeAtom = "2011-07-17T14:00:23.2Z"; var parsed = ISO8061Date.parse(datetimeAtom); assert.deepEqual(parsed, datetime); done(); }); it('parsing padded short Milliseconds should work', function (done) { var datetime = new Date(Date.UTC(2011, 6, 17, 14, 0, 23, 3)); var datetimeAtom = "2011-07-17T14:00:23.003Z"; var parsed = ISO8061Date.parse(datetimeAtom); assert.deepEqual(parsed, datetime); done(); }); it('format should work', function (done) { var datetime = Date.UTC(2011, 6, 17, 14, 0, 23, 270); var datetimeAtom = "2011-07-17T14:00:23.2700000Z"; var strdate = ISO8061Date.format(new Date(datetime)); assert.equal(strdate, datetimeAtom); done(); }); }); describe('date-tests', function () { it ('daysFromNow should work', function (done) { var shift = 5; assert.equal(date.daysFromNow(shift).getDay(), ((new Date()).getDay() + shift) % 7); done(); }); it ('hoursFromNow should work', function (done) { var shift = 20; assert.equal(date.hoursFromNow(shift).getHours(), ((new Date()).getHours() + shift) % 24); done(); }); it ('minutesFromNow should work', function (done) { var shift = 20; assert.equal(date.minutesFromNow(shift).getMinutes(), ((new Date()).getMinutes() + shift) % 60); done(); }); it ('secondsFromNow should work', function (done) { var shift = 58; assert.equal(date.secondsFromNow(shift).getSeconds(), ((new Date()).getSeconds() + shift) % 60); done(); }); });
// 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.8 description: > Throws a TypeError if `this` object does not have a [[MapData]] internal slot. info: | Map.prototype.keys () 1. Let M be the this value. 2. Return CreateMapIterator(M, "key"). 23.1.5.1 CreateMapIterator Abstract Operation ... 2. If map does not have a [[MapData]] internal slot, throw a TypeError exception. ... ---*/ var m = new Map(); assert.throws(TypeError, function() { Map.prototype.keys.call([]); }); assert.throws(TypeError, function() { m.keys.call([]); }); assert.throws(TypeError, function() { Map.prototype.keys.call({}); }); assert.throws(TypeError, function() { m.keys.call({}); });
import TLSFingerprints from "./models/TLSFingerprints"; import FingerPrintsTemplate from "./templates/Fingerprints.html"; import FingerPrintTemplate from "./templates/Fingerprint.html"; import FingerPrintDialogContent from "./templates/FingerPrintDialogContent.html"; const model = new TLSFingerprints(); const FingerPrintSingle = Backbone.View.extend({ initialize: function(params) { this.ua = params.ua; }, events: { "click button": "trust_fingerprint" }, render: function () { this.$el.html(FingerPrintTemplate(this.model.toJSON())); }, trust_fingerprint: function() { const that = this; BootstrapDialog.show({ type: BootstrapDialog.TYPE_INFO, title: "Save new fingerprint", message: $('<div></div>').html(FingerPrintDialogContent({})), buttons: [{ label: "Save", cssClass: 'btn-primary', icon: 'fa fa-floppy-o ', action: function (dlg) { // bind to controller that.handle_trust( dlg.$modalBody.find('#fp_description').val(), dlg.$modalBody.find('#fp_trusted').is(':checked') ); dlg.close(); } }, { label: 'Close', action: function (dlg) { dlg.close(); } }] }); }, handle_trust: function (description, trusted) { ajaxCall( "/api/nginx/settings/addtls_fingerprint", { 'tls_fingerprint': { 'curves' : this.model.get('curves'), 'ciphers': this.model.get('ciphers'), 'user_agent': this.ua, 'trusted': trusted ? '1' : '0', 'description': description } }, function (data, status) { } ); } }); const FingerPrintList = Backbone.View.extend({ initialize: function (params) { this.ua = params.ua; this.render(); }, render: function () { const that = this; this.$el.html(FingerPrintsTemplate({ua: this.ua})); const content_holder = this.$el.find('.content_holder'); const chart_holder = this.$el.find('.chart_holder'); const chart_data = this.collection.map(function (d) { return {label: d.get('ciphers') + "||" + d.get('curves'), value: d.get('count')}; }); this.collection.forEach(function (fingerprint) { const row = new FingerPrintSingle({'model': fingerprint, 'ua': that.ua}); content_holder.append(row.$el); row.render(); }); try { nv.addGraph(function () { const chart = nv.models.pieChart(); chart.x(function (d) { return d.label; }); chart.y(function (d) { return d.value; }); chart.showLabels(false); chart.labelType("value"); chart.donut(true); chart.donutRatio(0.2); d3.select(chart_holder[0]) .datum(chart_data) .transition().duration(350) .call(chart); return chart; }); } catch (e) { console.log(e); } } }); const FingerprintMain = Backbone.View.extend({ initialize: function() { this.listenTo(this.model, "sync", this.render); }, render: function () { this.$el.html(''); this.render_all(this.model.attributes); }, render_all(attributes) { for (const ua in attributes) { // skip loop if the property is from prototype if (attributes.hasOwnProperty(ua)) { const fingerprints = new Backbone.Collection(attributes[ua]); const fingerprints_view = new FingerPrintList({'collection': fingerprints, 'ua': ua}); this.$el.append(fingerprints_view.$el); } } }, }); const fpm = new FingerprintMain({'model': model}); $('#tls_handshakes_application').append(fpm.$el); model.fetch();
// Copyright 2009 the Sputnik authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- info: | If pos is a value of Number type that is an integer, then the result of x.charAt(pos) is equal to the result of x.substring(pos, pos+1) es5id: 15.5.4.4_A4_T2 description: > Compare results of x.charAt(pos) and x.substring(pos, pos+1), wheb pos is smaller of zero ---*/ ////////////////////////////////////////////////////////////////////////////// //CHECK#1 for (var i = -2; i < 0; i++) { if ("ABC\u0041\u0042\u0043".charAt(i) !== "\u0041\u0042\u0043ABC".substring(i, i + 1)) { $ERROR('#' + (i + 2) + ': "ABC\\u0041\\u0042\\u0043".charAt(' + i + ') === "\\u0041\\u0042\\u0043ABC".substring(' + i + ', ' + (i + 1) + '). Actual: "ABC\\u0041\\u0042\\u0043".charAt(' + i + ') ===' + ("ABC\u0041\u0042\u0043".charAt(i))); } } // //////////////////////////////////////////////////////////////////////////////
"use strict"; module.exports = { delegates: { im_too_lazy: function() { $C("button", { name: "my first button" }, function(btn) { $("#button_holder").empty(); // extra btn.prependTo($("#button_holder")); // alright, this is technically extra btn.$el.hide(); btn.$el.fadeIn(); }); } } };