text
stringlengths 2
6.14k
|
|---|
'use strict';
var gulp = require('gulp');
//var config = require('../config');
gulp.task('test', function() {
// Run all tests
});
|
var Ref = exports.Ref = function() {}
|
ace.define('ace/mode/lucene', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/lucene_highlight_rules'], function(require, exports, module) {
var oop = require("../lib/oop");
var TextMode = require("./text").Mode;
var Tokenizer = require("../tokenizer").Tokenizer;
var LuceneHighlightRules = require("./lucene_highlight_rules").LuceneHighlightRules;
var Mode = function() {
this.$tokenizer = new Tokenizer(new LuceneHighlightRules().getRules());
};
oop.inherits(Mode, TextMode);
(function() {
this.$id = "ace/mode/lucene";
}).call(Mode.prototype);
exports.Mode = Mode;
});ace.define('ace/mode/lucene_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
var oop = require("../lib/oop");
var lang = require("../lib/lang");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var LuceneHighlightRules = function() {
this.$rules = {
"start" : [
{
token : "constant.character.negation",
regex : "[\\-]"
}, {
token : "constant.character.interro",
regex : "[\\?]"
}, {
token : "constant.character.asterisk",
regex : "[\\*]"
}, {
token: 'constant.character.proximity',
regex: '~[0-9]+\\b'
}, {
token : 'keyword.operator',
regex: '(?:AND|OR|NOT)\\b'
}, {
token : "paren.lparen",
regex : "[\\(]"
}, {
token : "paren.rparen",
regex : "[\\)]"
}, {
token : "keyword",
regex : "[\\S]+:"
}, {
token : "string", // " string
regex : '".*?"'
}, {
token : "text",
regex : "\\s+"
}
]
};
};
oop.inherits(LuceneHighlightRules, TextHighlightRules);
exports.LuceneHighlightRules = LuceneHighlightRules;
});
|
'use strict';
module.exports = {
x: 1,
y: 2,
foo: 'bar',
z: 3,
t: 4
};
|
jQuery(document).ready(function($) { $('select:not(#mo-fonts)').chosen();});
|
'use strict';
var gutil = require('gulp-util');
var escapeStringRegexp = require('escape-string-regexp');
var emitErr = require('./utils').emitErr;
var logger = {};
// Remove intermediate directory for more Sass-like logging
logger.prettifyDirectoryLogging = function (msg, intermediateDir) {
var escapedDir = escapeStringRegexp(intermediateDir);
return msg.replace(new RegExp(escapedDir + '/?', 'g'), './');
};
// TODO: Now that we've standardized on --update, remove parsing that only
// applies to single, non update compilations.
logger.verbose = function (command, args) {
gutil.log('Running command ' + command + ' ' + args.join(' '));
};
logger.stdout = function (stream, intermediateDir, data) {
// Bundler error: no Sass version found
if (/bundler: command not found: sass/.test(data)) {
emitErr(stream, 'bundler: command not found: sass');
}
// Bundler error: Gemfile not found
else if (/Could not locate Gemfile or .bundle\/ directory/.test(data)) {
emitErr(stream, 'bundler: could not locate Gemfile or .bundle directory');
}
// Sass error: directory missing
else if (/No such file or directory @ rb_sysopen/.test(data)) {
emitErr(stream, data.trim());
}
// Not an error: Sass logging
else {
data = logger.prettifyDirectoryLogging(data, intermediateDir);
data = data.trim();
gutil.log(data);
}
};
logger.stderr = function (stream, intermediateDir, data) {
var bundlerMissing = /Could not find 'bundler' \((.*?)\)/.exec(data);
var sassVersionMissing = /Could not find gem 'sass \((.*?)\) ruby'/.exec(data);
// Ruby error: Bundler gem not installed
if (bundlerMissing) {
emitErr(stream, 'ruby: Could not find \'bundler\' (' + bundlerMissing[1] + ').');
}
// Bundler error: no matching Sass version
else if (sassVersionMissing) {
emitErr(stream, 'bundler: Could not find gem \'sass (' + sassVersionMissing[1] + ')\'.');
}
// Sass error: file missing
else if (/No such file or directory @ rb_sysopen/.test(data)) {
emitErr(stream, data.trim());
}
// Not an error: Sass warnings, debug statements
else {
data = logger.prettifyDirectoryLogging(data, intermediateDir);
data = data.trim();
gutil.log(data);
}
};
logger.error = function (stream, err) {
if (err.code === 'ENOENT') {
// Spawn error: gems not installed
emitErr(stream, 'Gem ' + err.path + ' is not installed.');
}
else {
// Other errors
emitErr(stream, err);
}
};
module.exports = logger;
|
Proj4js.defs["EPSG:3045"] = "+proj=utm +zone=33 +ellps=GRS80 +units=m +no_defs";
|
/**
* Private class which acts as a HeaderContainer for the Lockable which aggregates all columns
* from both sides of the Lockable. It is never rendered, it's just used to interrogate the
* column collection.
* @private
*/
Ext.define('Ext.grid.locking.HeaderContainer', {
extend: 'Ext.grid.header.Container',
requires: [
'Ext.grid.ColumnManager'
],
headerCtRelayEvents: [
"blur",
"focus",
"move",
"resize",
"destroy",
"beforedestroy",
"boxready",
"afterrender",
"render",
"beforerender",
"removed",
"hide",
"beforehide",
"show",
"beforeshow",
"enable",
"disable",
"added",
"deactivate",
"beforedeactivate",
"activate",
"beforeactivate",
"remove",
"add",
"beforeremove",
"beforeadd",
"afterlayout",
"menucreate",
"sortchange",
"columnschanged",
"columnshow",
"columnhide",
"columnmove",
"headertriggerclick",
"headercontextmenu",
"headerclick",
"columnresize",
"statesave",
"beforestatesave",
"staterestore",
"beforestaterestore"
],
constructor: function(lockable) {
var me = this,
lockedGrid = lockable.lockedGrid,
normalGrid = lockable.normalGrid;
me.lockable = lockable;
me.callParent();
// Create the unified column manager for the lockable grid assembly
lockedGrid.visibleColumnManager.rootColumns =
normalGrid.visibleColumnManager.rootColumns =
lockable.visibleColumnManager =
me.visibleColumnManager = new Ext.grid.ColumnManager(true, lockedGrid.headerCt, normalGrid.headerCt);
lockedGrid.columnManager.rootColumns =
normalGrid.columnManager.rootColumns =
lockable.columnManager =
me.columnManager = new Ext.grid.ColumnManager(false, lockedGrid.headerCt, normalGrid.headerCt);
// Relay *all* events from the two HeaderContainers
me.relayEvents(lockedGrid.headerCt, me.headerCtRelayEvents);
me.relayEvents(normalGrid.headerCt, me.headerCtRelayEvents);
},
getRefItems: function() {
return this.lockable.lockedGrid.headerCt.getRefItems().concat(this.lockable.normalGrid.headerCt.getRefItems());
},
// This is the function which all other column access methods are based upon
// Return the full column set for the whole Lockable assembly
getGridColumns: function() {
return this.lockable.lockedGrid.headerCt.getGridColumns().concat(this.lockable.normalGrid.headerCt.getGridColumns());
},
// Lockable uses its headerCt to gather column state
getColumnsState: function () {
var me = this,
locked = me.lockable.lockedGrid.headerCt.getColumnsState(),
normal = me.lockable.normalGrid.headerCt.getColumnsState();
return locked.concat(normal);
},
// Lockable uses its headerCt to apply column state
applyColumnsState: function (columns) {
var me = this,
lockedGrid = me.lockable.lockedGrid,
lockedHeaderCt = lockedGrid.headerCt,
normalHeaderCt = me.lockable.normalGrid.headerCt,
lockedCols = Ext.Array.toValueMap(lockedHeaderCt.items.items, 'headerId'),
normalCols = Ext.Array.toValueMap(normalHeaderCt.items.items, 'headerId'),
locked = [],
normal = [],
lockedWidth = 1,
length = columns.length,
i, existing,
lockedDefault,
col;
for (i = 0; i < length; i++) {
col = columns[i];
lockedDefault = lockedCols[col.id];
existing = lockedDefault || normalCols[col.id];
if (existing) {
if (existing.applyColumnState) {
existing.applyColumnState(col);
}
if (existing.locked === undefined) {
existing.locked = !!lockedDefault;
}
if (existing.locked) {
locked.push(existing);
if (!existing.hidden && typeof existing.width === 'number') {
lockedWidth += existing.width;
}
} else {
normal.push(existing);
}
}
}
// state and config must have the same columns (compare counts for now):
if (locked.length + normal.length === lockedHeaderCt.items.getCount() + normalHeaderCt.items.getCount()) {
lockedHeaderCt.removeAll(false);
normalHeaderCt.removeAll(false);
lockedHeaderCt.add(locked);
normalHeaderCt.add(normal);
lockedGrid.setWidth(lockedWidth);
}
},
disable: function() {
var topGrid = this.lockable;
topGrid.lockedGrid.headerCt.disable();
topGrid.normalGrid.headerCt.disable();
},
enable: function() {
var topGrid = this.lockable;
topGrid.lockedGrid.headerCt.enable();
topGrid.normalGrid.headerCt.enable();
}
});
|
//// [returns.js]
// @ts-check
/**
* @returns {string} This comment is not currently exposed
*/
function f() {
return 5;
}
/**
* @returns {string | number} This comment is not currently exposed
*/
function f1() {
return 5 || true;
}
//// [dummy.js]
// @ts-check
/**
* @returns {string} This comment is not currently exposed
*/
function f() {
return 5;
}
/**
* @returns {string | number} This comment is not currently exposed
*/
function f1() {
return 5 || true;
}
|
/*
Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'justify', 'eu', {
block: 'Justifikatu',
center: 'Erdian',
left: 'Lerrokatu ezkerrean',
right: 'Lerrokatu eskuinean'
} );
|
import React from 'react';
import './Cover.less';
export default class Cover {
render() {
return (
<div className="Cover">
<div className="Cover-header">
<p className="Cover-description">
Drag and Drop for React
</p>
</div>
</div>
);
}
}
|
jQuery(document).ready(function($) {
var btn = $('div#DiscussionForm form :submit');
var parent = $(btn).parents('div#DiscussionForm');
var frm = $(parent).find('form');
frm.bind('BeforeDiscussionSubmit', function(e, frm, btn) {
var taglist = $(frm).find('input#Form_Tags');
taglist.triggerHandler('BeforeSubmit', [frm]);
});
var tags;
var data_tags = $("#Form_Tags").data('tags');
if (data_tags) {
tags = [];
if (jQuery.isPlainObject(data_tags)) {
for (id in data_tags) {
tags.push({id: id, name: data_tags[id]});
}
}
} else {
tags = $("#Form_Tags").val();
if (tags && tags.length) {
tags = tags.split(",");
for (i = 0; i < tags.length; i++) {
tags[i] = {id: tags[i], name: tags[i]};
}
} else {
tags = [];
}
}
var TagSearch = gdn.definition('PluginsTaggingSearchUrl', false);
var TagAdd = gdn.definition('PluginsTaggingAdd', false);
$("#Form_Tags").tokenInput(TagSearch, {
hintText: gdn.definition("TagHint", "Start to type..."),
searchingText: '', // search text gives flickery ux, don't like
searchDelay: 300,
animateDropdown: false,
minChars: 1,
maxLength: 25,
prePopulate: tags,
dataFields: ["#Form_CategoryID"],
allowFreeTagging: TagAdd
});
// Show available link
$(document).on('click', '.ShowTags a', function() {
$('.ShowTags a').hide();
$('.AvailableTags').show();
return false;
});
// Use available tags
$(document).on('click', '.AvailableTag', function() {
//$(this).hide();
var tag = $(this).attr('data-id');
$("#Form_Tags").tokenInput('add', {id: tag, name: $(this).text()});
return false;
});
});
|
(function ($) {
$.Redactor.opts.langs['ru'] = {
html: 'Код',
video: 'Видео',
image: 'Изображение',
table: 'Таблица',
link: 'Ссылка',
link_insert: 'Вставить ссылку ...',
link_edit: 'Изменить ссылку',
unlink: 'Удалить ссылку',
formatting: 'Форматирование',
paragraph: 'Обычный текст',
quote: 'Цитата',
code: 'Код',
header1: 'Заголовок 1',
header2: 'Заголовок 2',
header3: 'Заголовок 3',
header4: 'Заголовок 4',
header5: 'Заголовок 5',
bold: 'Полужирный',
italic: 'Наклонный',
fontcolor: 'Цвет текста',
backcolor: 'Заливка текста',
unorderedlist: 'Обычный список',
orderedlist: 'Нумерованный список',
outdent: 'Уменьшить отступ',
indent: 'Увеличить отступ',
cancel: 'Отменить',
insert: 'Вставить',
save: 'Сохранить',
_delete: 'Удалить',
insert_table: 'Вставить таблицу',
insert_row_above: 'Добавить строку сверху',
insert_row_below: 'Добавить строку снизу',
insert_column_left: 'Добавить столбец слева',
insert_column_right: 'Добавить столбец справа',
delete_column: 'Удалить столбец',
delete_row: 'Удалить строку',
delete_table: 'Удалить таблицу',
rows: 'Строки',
columns: 'Столбцы',
add_head: 'Добавить заголовок',
delete_head: 'Удалить заголовок',
title: 'Подсказка',
image_position: 'Обтекание текстом',
none: 'Нет',
left: 'Cлева',
right: 'Cправа',
image_web_link: 'Cсылка на изображение',
text: 'Текст',
mailto: 'Эл. почта',
web: 'URL',
video_html_code: 'Код видео ролика',
file: 'Файл',
upload: 'Загрузить',
download: 'Скачать',
choose: 'Выбрать',
or_choose: 'Или выберите',
drop_file_here: 'Перетащите файл сюда',
align_left: 'По левому краю',
align_center: 'По центру',
align_right: 'По правому краю',
align_justify: 'Выровнять текст по ширине',
horizontalrule: 'Горизонтальная линейка',
fullscreen: 'Во весь экран',
deleted: 'Зачеркнутый',
anchor: 'Якорь',
link_new_tab: 'Открывать в новой вкладке',
underline: 'Подчеркнутый',
alignment: 'Выравнивание',
filename: 'Название (необязательно)',
edit: 'Ред.',
center: 'По центру',
change_font_size: 'Изменить размер шрифта',
remove_font_size: 'По умолчанию',
change_font_family: 'Изменить шрифт',
remove_font_family: 'По умолчанию'
};
})( jQuery );
|
//// [amdDependencyCommentName1.ts]
///<amd-dependency path='bar' name='b'/>
import m1 = require("m2")
m1.f();
//// [amdDependencyCommentName1.js]
"use strict";
///<amd-dependency path='bar' name='b'/>
exports.__esModule = true;
var m1 = require("m2");
m1.f();
|
//! moment.js locale configuration
//! locale : Welsh (cy)
//! author : Robert Allen
import moment from '../moment';
export default moment.defineLocale('cy', {
months: 'Ionawr_Chwefror_Mawrth_Ebrill_Mai_Mehefin_Gorffennaf_Awst_Medi_Hydref_Tachwedd_Rhagfyr'.split('_'),
monthsShort: 'Ion_Chwe_Maw_Ebr_Mai_Meh_Gor_Aws_Med_Hyd_Tach_Rhag'.split('_'),
weekdays: 'Dydd Sul_Dydd Llun_Dydd Mawrth_Dydd Mercher_Dydd Iau_Dydd Gwener_Dydd Sadwrn'.split('_'),
weekdaysShort: 'Sul_Llun_Maw_Mer_Iau_Gwe_Sad'.split('_'),
weekdaysMin: 'Su_Ll_Ma_Me_Ia_Gw_Sa'.split('_'),
// time formats are the same as en-gb
longDateFormat: {
LT: 'HH:mm',
LTS : 'HH:mm:ss',
L: 'DD/MM/YYYY',
LL: 'D MMMM YYYY',
LLL: 'D MMMM YYYY HH:mm',
LLLL: 'dddd, D MMMM YYYY HH:mm'
},
calendar: {
sameDay: '[Heddiw am] LT',
nextDay: '[Yfory am] LT',
nextWeek: 'dddd [am] LT',
lastDay: '[Ddoe am] LT',
lastWeek: 'dddd [diwethaf am] LT',
sameElse: 'L'
},
relativeTime: {
future: 'mewn %s',
past: '%s yn ôl',
s: 'ychydig eiliadau',
m: 'munud',
mm: '%d munud',
h: 'awr',
hh: '%d awr',
d: 'diwrnod',
dd: '%d diwrnod',
M: 'mis',
MM: '%d mis',
y: 'blwyddyn',
yy: '%d flynedd'
},
ordinalParse: /\d{1,2}(fed|ain|af|il|ydd|ed|eg)/,
// traditional ordinal numbers above 31 are not commonly used in colloquial Welsh
ordinal: function (number) {
var b = number,
output = '',
lookup = [
'', 'af', 'il', 'ydd', 'ydd', 'ed', 'ed', 'ed', 'fed', 'fed', 'fed', // 1af to 10fed
'eg', 'fed', 'eg', 'eg', 'fed', 'eg', 'eg', 'fed', 'eg', 'fed' // 11eg to 20fed
];
if (b > 20) {
if (b === 40 || b === 50 || b === 60 || b === 80 || b === 100) {
output = 'fed'; // not 30ain, 70ain or 90ain
} else {
output = 'ain';
}
} else if (b > 0) {
output = lookup[b];
}
return number + output;
},
week : {
dow : 1, // Monday is the first day of the week.
doy : 4 // The week that contains Jan 4th is the first week of the year.
}
});
|
/**
* Returns elements from an observable sequence as long as a specified condition is true.
* The element's index is used in the logic of the predicate function.
* @param {Function} predicate A function to test each element for a condition; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence that contains the elements from the input sequence that occur before the element at which the test no longer passes.
*/
observableProto.takeWhile = function (predicate, thisArg) {
var observable = this;
return new AnonymousObservable(function (observer) {
var i = 0, running = true;
return observable.subscribe(function (x) {
if (running) {
try {
running = predicate.call(thisArg, x, i++, observable);
} catch (e) {
observer.onError(e);
return;
}
if (running) {
observer.onNext(x);
} else {
observer.onCompleted();
}
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
|
define([
"dojo/_base/declare",
"dojo/sniff",
"dojo/dom-class",
"dojo/dom-construct",
"dojo/dom-style",
"dojo/dom-attr",
"dijit/_Contained",
"dijit/_Container",
"dijit/_WidgetBase",
"dojo/has!dojo-bidi?dojox/mobile/bidi/IconMenu",
"./IconMenuItem"
], function(declare, has, domClass, domConstruct, domStyle, domAttr, Contained, Container, WidgetBase, BidiIconMenu){
// module:
// dojox/mobile/IconMenu
var IconMenu = declare(has("dojo-bidi") ? "dojox.mobile.NonBidiIconMenu" : "dojox.mobile.IconMenu", [WidgetBase, Container, Contained], {
// summary:
// A pop-up menu.
// description:
// The dojox/mobile/IconMenu widget displays a pop-up menu just
// like iPhone's call options menu that is shown while you are on a
// call. Each menu item must be dojox/mobile/IconMenuItem.
// transition: String
// The default animated transition effect for child items.
transition: "slide",
// iconBase: String
// The default icon path for child items.
iconBase: "",
// iconPos: String
// The default icon position for child items.
iconPos: "",
// cols: Number
// The number of child items in a row.
cols: 3,
// tag: String
// A name of html tag to create as domNode.
tag: "ul",
/* internal properties */
selectOne: false,
// baseClass: String
// The name of the CSS class of this widget.
baseClass: "mblIconMenu",
// childItemClass: String
// The name of the CSS class of menu items.
childItemClass: "mblIconMenuItem",
// _createTerminator: [private] Boolean
_createTerminator: false,
buildRendering: function(){
this.domNode = this.containerNode = this.srcNodeRef || domConstruct.create(this.tag);
domAttr.set(this.domNode, "role", "menu");
this.inherited(arguments);
if(this._createTerminator){
var t = this._terminator = domConstruct.create("br");
t.className = this.childItemClass + "Terminator";
this.domNode.appendChild(t);
}
},
startup: function(){
if(this._started){ return; }
this.refresh();
this.inherited(arguments);
},
refresh: function(){
var p = this.getParent();
if(p){
domClass.remove(p.domNode, "mblSimpleDialogDecoration");
}
var children = this.getChildren();
if(this.cols){
var nRows = Math.ceil(children.length / this.cols);
var w = Math.floor(100/this.cols);
var _w = 100 - w*this.cols;
var h = Math.floor(100 / nRows);
var _h = 100 - h*nRows;
if(has("ie")){
_w--;
_h--;
}
}
for(var i = 0; i < children.length; i++){
var item = children[i];
if(this.cols){
var first = ((i % this.cols) === 0); // first column
var last = (((i + 1) % this.cols) === 0); // last column
var rowIdx = Math.floor(i / this.cols);
domStyle.set(item.domNode, {
width: w + (last ? _w : 0) + "%",
height: h + ((rowIdx + 1 === nRows) ? _h : 0) + "%"
});
domClass.toggle(item.domNode, this.childItemClass + "FirstColumn", first);
domClass.toggle(item.domNode, this.childItemClass + "LastColumn", last);
domClass.toggle(item.domNode, this.childItemClass + "FirstRow", rowIdx === 0);
domClass.toggle(item.domNode, this.childItemClass + "LastRow", rowIdx + 1 === nRows);
}
};
},
addChild: function(widget, /*Number?*/insertIndex){
this.inherited(arguments);
this.refresh();
},
hide: function(){
var p = this.getParent();
if(p && p.hide){
p.hide();
}
}
});
return has("dojo-bidi") ? declare("dojox.mobile.IconMenu", [IconMenu, BidiIconMenu]) : IconMenu;
});
|
///////////////////////////////////////////////////////////////////////////////
// CancelEventArgs
var ss_CancelEventArgs = function#? DEBUG CancelEventArgs$##() {
ss_EventArgs.call(this);
this.cancel = false;
}
ss_CancelEventArgs.__typeName = 'ss.CancelEventArgs';
ss.CancelEventArgs = ss_CancelEventArgs;
ss.initClass(ss_CancelEventArgs, ss, {}, ss_EventArgs);
|
/**
* jQuery EasyUI 1.4.1
*
* Copyright (c) 2009-2014 www.jeasyui.com. All rights reserved.
*
* Licensed under the GPL license: http://www.gnu.org/licenses/gpl.txt
* To use it on other terms please contact us at info@jeasyui.com
*
*/
(function($){
function _1(_2){
$(_2).addClass("droppable");
$(_2).bind("_dragenter",function(e,_3){
$.data(_2,"droppable").options.onDragEnter.apply(_2,[e,_3]);
});
$(_2).bind("_dragleave",function(e,_4){
$.data(_2,"droppable").options.onDragLeave.apply(_2,[e,_4]);
});
$(_2).bind("_dragover",function(e,_5){
$.data(_2,"droppable").options.onDragOver.apply(_2,[e,_5]);
});
$(_2).bind("_drop",function(e,_6){
$.data(_2,"droppable").options.onDrop.apply(_2,[e,_6]);
});
};
$.fn.droppable=function(_7,_8){
if(typeof _7=="string"){
return $.fn.droppable.methods[_7](this,_8);
}
_7=_7||{};
return this.each(function(){
var _9=$.data(this,"droppable");
if(_9){
$.extend(_9.options,_7);
}else{
_1(this);
$.data(this,"droppable",{options:$.extend({},$.fn.droppable.defaults,$.fn.droppable.parseOptions(this),_7)});
}
});
};
$.fn.droppable.methods={options:function(jq){
return $.data(jq[0],"droppable").options;
},enable:function(jq){
return jq.each(function(){
$(this).droppable({disabled:false});
});
},disable:function(jq){
return jq.each(function(){
$(this).droppable({disabled:true});
});
}};
$.fn.droppable.parseOptions=function(_a){
var t=$(_a);
return $.extend({},$.parser.parseOptions(_a,["accept"]),{disabled:(t.attr("disabled")?true:undefined)});
};
$.fn.droppable.defaults={accept:null,disabled:false,onDragEnter:function(e,_b){
},onDragOver:function(e,_c){
},onDragLeave:function(e,_d){
},onDrop:function(e,_e){
}};
})(jQuery);
|
// Copyright 2009 the Sputnik authors. All rights reserved.
/**
* The production CharacterClass :: [ [lookahead \notin {^}] ClassRanges ] evaluates by evaluating ClassRanges to obtain a CharSet and returning that CharSet and the boolean false
*
* @path ch15/15.10/15.10.2/15.10.2.13/S15.10.2.13_A1_T8.js
* @description Execute /[d-h]+/.exec("abcdefghijkl") and check results
*/
__executed = /[d-h]+/.exec("abcdefghijkl");
__expected = ["defgh"];
__expected.index = 3;
__expected.input = "abcdefghijkl";
//CHECK#1
if (__executed.length !== __expected.length) {
$ERROR('#1: __executed = /[d-h]+/.exec("abcdefghijkl"); __executed.length === ' + __expected.length + '. Actual: ' + __executed.length);
}
//CHECK#2
if (__executed.index !== __expected.index) {
$ERROR('#2: __executed = /[d-h]+/.exec("abcdefghijkl"); __executed.index === ' + __expected.index + '. Actual: ' + __executed.index);
}
//CHECK#3
if (__executed.input !== __expected.input) {
$ERROR('#3: __executed = /[d-h]+/.exec("abcdefghijkl"); __executed.input === ' + __expected.input + '. Actual: ' + __executed.input);
}
//CHECK#4
for(var index=0; index<__expected.length; index++) {
if (__executed[index] !== __expected[index]) {
$ERROR('#4: __executed = /[d-h]+/.exec("abcdefghijkl"); __executed[' + index + '] === ' + __expected[index] + '. Actual: ' + __executed[index]);
}
}
|
import "../color/color";
import "../color/rgb";
import "rgb";
import "object";
import "array";
import "number";
import "string";
d3.interpolate = d3_interpolate;
function d3_interpolate(a, b) {
var i = d3.interpolators.length, f;
while (--i >= 0 && !(f = d3.interpolators[i](a, b)));
return f;
}
d3.interpolators = [
function(a, b) {
var t = typeof b;
return (t === "string" ? (d3_rgb_names.has(b) || /^(#|rgb\(|hsl\()/.test(b) ? d3_interpolateRgb : d3_interpolateString)
: b instanceof d3_Color ? d3_interpolateRgb
: Array.isArray(b) ? d3_interpolateArray
: t === "object" && isNaN(b) ? d3_interpolateObject
: d3_interpolateNumber)(a, b);
}
];
|
$.fullCalendar.lang("ro", {
defaultButtonText: {
prev: "precedentă", // override JQUI's translations, which contains the word "month"
next: "următoare", // "
month: "Lună",
week: "Săptămână",
day: "Zi",
list: "Agendă"
},
allDayText: "Toată ziua",
eventLimitText: function(n) {
return "+alte " + n;
}
});
|
var a = [42,1,2,3,4];
var r = [
a.shift()==42,
a.length==4,
a[0]==1,
a[3]==4,
a.unshift(5,6,7,8) == 8,
a.length==8,
a[4]==1,
a[3]==8
];
var pass = 0;
r.forEach(function(n) { if (n) pass++; });
result = pass==r.length;
|
'use strict';
module.exports = function(context) {
var MESSAGE = 'Use a language key instead of a literal';
var LOG_METHODS = ['info', 'log', 'step', 'error', 'warn', 'success'];
function isLiteral(node) {
return node.type === 'Literal' ||
(node.type === 'BinaryExpression' && (isLiteral(node.left) || isLiteral(node.right)));
}
function getCallee(node) {
if (node.type !== 'CallExpression' || node.arguments.length === 0) {
return;
}
var callee = node.callee;
while (callee.type === 'MemberExpression' && callee.property.type === 'MemberExpression') {
callee = callee.property;
}
if (callee.type !== 'MemberExpression' || callee.computed) {
return;
}
var object = callee.object;
if (object.type !== 'Identifier' || object.name !== 'reporter') {
return;
}
return callee;
}
return {
CallExpression: function(node) {
var callee = getCallee(node);
if (callee && LOG_METHODS.indexOf(callee.property.name) >= 1) {
var arg = node.arguments[node.arguments.length - 1];
if (isLiteral(arg)) {
context.report(
arg,
MESSAGE
);
}
}
},
ThrowStatement: function(node) {
var argument = node.argument;
if (argument.type !== 'NewExpression') {
return;
}
var callee = argument.callee;
if (callee.type !== 'Identifier' || callee.name !== 'MessageError') {
return;
}
var args = argument.arguments;
if (args.length && isLiteral(args[0])) {
context.report(
args[0],
MESSAGE
);
}
}
};
};
module.exports.schema = [];
|
/**
* @file Data zoom action
*/
define(function(require) {
var zrUtil = require('zrender/core/util');
var helper = require('./helper');
var echarts = require('../../echarts');
echarts.registerAction('dataZoom', function (payload, ecModel) {
var linkedNodesFinder = helper.createLinkedNodesFinder(
zrUtil.bind(ecModel.eachComponent, ecModel, 'dataZoom'),
helper.eachAxisDim,
function (model, dimNames) {
return model.get(dimNames.axisIndex);
}
);
var effectedModels = [];
ecModel.eachComponent(
{mainType: 'dataZoom', query: payload},
function (model, index) {
effectedModels.push.apply(
effectedModels, linkedNodesFinder(model).nodes
);
}
);
zrUtil.each(effectedModels, function (dataZoomModel, index) {
dataZoomModel.setRawRange({
start: payload.start,
end: payload.end,
startValue: payload.startValue,
endValue: payload.endValue
});
});
});
});
|
module('system/object/reopenClass');
test('adds new properties to subclass', function() {
var Subclass = Ember.Object.extend();
Subclass.reopenClass({
foo: function() { return 'FOO'; },
bar: 'BAR'
});
equal(Subclass.foo(), 'FOO', 'Adds method');
equal(Ember.get(Subclass, 'bar'), 'BAR', 'Adds property');
});
test('class properties inherited by subclasses', function() {
var Subclass = Ember.Object.extend();
Subclass.reopenClass({
foo: function() { return 'FOO'; },
bar: 'BAR'
});
var SubSub = Subclass.extend();
equal(SubSub.foo(), 'FOO', 'Adds method');
equal(Ember.get(SubSub, 'bar'), 'BAR', 'Adds property');
});
|
const MongoClient = require("mongodb").MongoClient;
const mongoUrl = "mongodb://tfb-database:27017";
const dbName = "hello_world";
let client;
async function getCollection(name) {
if (!client) {
client = await MongoClient.connect(
mongoUrl,
{ useNewUrlParser: true }
);
}
const db = client.db(dbName);
return db.collection(name);
}
async function allFortunes() {
const collection = await getCollection("fortune");
const fortunes = await collection.find({}, { projection: { _id: 0 } });
return fortunes.toArray();
}
async function getWorld(id) {
const collection = await getCollection("world");
return collection.findOne({ id }, { projection: { _id: 0 } });
}
async function saveWorlds(worlds) {
const collection = await getCollection("world");
const bulk = collection.initializeUnorderedBulkOp();
worlds.forEach(world => {
bulk.find({ id: world.id }).updateOne(world);
});
return bulk.execute();
}
module.exports = {
getWorld,
saveWorlds,
allFortunes
};
|
/* global describe, it, xit, expect */
describe('Error', function () {
'use strict';
var supportsDescriptors = Object.defineProperty && (function () {
try {
var obj = {};
Object.defineProperty(obj, 'x', { enumerable: false, value: obj });
for (var _ in obj) { return false; }
return obj.x === obj;
} catch (e) { /* this is ES3 */
return false;
}
}());
var ifSupportsDescriptorsIt = supportsDescriptors ? it : xit;
describe('#toString()', function () {
it('stringifies a newed error properly', function () {
var msg = 'test';
var error = new RangeError(msg);
expect(error.name).toBe('RangeError');
expect(error.message).toBe(msg);
expect(String(error)).toBe(error.name + ': ' + msg);
});
it('stringifies a thrown error properly', function () {
var msg = 'test';
var error;
try {
throw new RangeError(msg);
} catch (e) {
error = e;
}
expect(error.name).toBe('RangeError');
expect(error.message).toBe(msg);
expect(String(error)).toBe(error.name + ': ' + msg);
});
});
describe('enumerability of prototype properties', function () {
ifSupportsDescriptorsIt('#message', function () {
expect(Object.prototype.propertyIsEnumerable.call(Error.prototype, 'message')).toBe(false);
});
ifSupportsDescriptorsIt('#name', function () {
expect(Object.prototype.propertyIsEnumerable.call(Error.prototype, 'name')).toBe(false);
});
});
});
|
(function ($) {
$(function () {
$.ajaxSetup({
error: function () {
if (!$('#jsn-updater-download').hasClass('update-success')) {
$('#jsn-updater-download').addClass('update-failed');
}
if (!$('#jsn-updater-install').hasClass('update-success')) {
$('#jsn-updater-install').addClass('update-failed');
}
}
});
$('#jsn-updater-button-update')
.click(function () {
$(this).hide();
$('#jsn-updater-link-cancel').hide();
$('#jsn-updater-download').show();
$.getJSON('index.php?option=com_poweradmin&task=update.download&format=json', function (response) {
if (response.status != 'done') {
$('#jsn-updater-download').addClass('update-failed');
return;
}
$('#jsn-updater-download').addClass('update-success');
$('#jsn-updater-install').show();
$.getJSON('index.php?option=com_poweradmin&task=update.install&format=json', function (response) {
if (response.status != 'done') {
$('#jsn-updater-install').addClass('update-failed');
return;
}
$('#jsn-updater-install').addClass('update-success');
$('#jsn-updater-successfully').show();
$('#jsn-updater-button-finish')
.click(function () {
window.location = 'index.php?option=com_poweradmin';
})
.show();
});
});
});
});
})(JoomlaShine.jQuery);
|
"use strict";
var React = require('react');
var CalculatorDisplay = React.createClass({
displayName: "CalculatorDisplay",
render: function() {
return React.createElement(
"div",
null,
"Current value: " + this.props.calculator.number
);
}
});
module.exports = CalculatorDisplay;
|
define(
({
redLabel: "r",
greenLabel: "v",
blueLabel: "b",
hueLabel: "t",
saturationLabel: "s",
valueLabel: "v", /* aka intensity or brightness */
degLabel: "\u00B0",
hexLabel: "hex",
huePickerTitle: "Sélecteur de teinte",
saturationPickerTitle: "Sélecteur de saturation"
})
);
|
jQuery.fn.center = function() {
this.css("position", "absolute");
this.css("top", Math.max(0, (($(window).height() - $(this).outerHeight()) / 2) +
$(window).scrollTop()) - 30 + "px");
this.css("left", Math.max(0, (($(window).width() - $(this).outerWidth()) / 2) +
$(window).scrollLeft()) + "px");
return this;
}
|
/*jshint strict:false */
/* globals test, ok */
test('failing test', function() {
ok(false, 'test should fail to confirm ember test exit code');
});
|
'use strict';
var gulp = require('gulp');
var exec = require('child_process').exec;
gulp.task('esdoc', ['clean-docs'], function (cb) {
exec('./node_modules/.bin/esdoc -c esdoc.json', function (err, stdout, stderr) {
if (stderr) {
console.log('stderr:', stderr);
}
if (stdout) {
console.log('stdout:', stdout);
}
cb(err);
});
});
|
// This file is part of Moodle - http://moodle.org/
//
// Moodle 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.
//
// Moodle 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 Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Potential user selector module.
*
* @module tool_dataprivacy/expand_contract
* @class page-expand-contract
* @package tool_dataprivacy
* @copyright 2018 Adrian Greeve
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define(['jquery', 'core/url', 'core/str'], function($, url, str) {
var expandedImage = $('<img alt="" src="' + url.imageUrl('t/expanded') + '"/>');
var collapsedImage = $('<img alt="" src="' + url.imageUrl('t/collapsed') + '"/>');
return /** @alias module:tool_dataprivacy/expand-collapse */ {
/**
* Expand or collapse a selected node.
*
* @param {object} targetnode The node that we want to expand / collapse
* @param {object} thisnode The node that was clicked.
*/
expandCollapse: function(targetnode, thisnode) {
if (targetnode.hasClass('hide')) {
targetnode.removeClass('hide');
targetnode.addClass('visible');
targetnode.attr('aria-expanded', true);
thisnode.find(':header i.fa').removeClass('fa-plus-square');
thisnode.find(':header i.fa').addClass('fa-minus-square');
thisnode.find(':header img.icon').attr('src', expandedImage.attr('src'));
} else {
targetnode.removeClass('visible');
targetnode.addClass('hide');
targetnode.attr('aria-expanded', false);
thisnode.find(':header i.fa').removeClass('fa-minus-square');
thisnode.find(':header i.fa').addClass('fa-plus-square');
thisnode.find(':header img.icon').attr('src', collapsedImage.attr('src'));
}
},
/**
* Expand or collapse all nodes on this page.
*
* @param {string} nextstate The next state to change to.
*/
expandCollapseAll: function(nextstate) {
var currentstate = (nextstate == 'visible') ? 'hide' : 'visible';
var ariaexpandedstate = (nextstate == 'visible') ? true : false;
var iconclassnow = (nextstate == 'visible') ? 'fa-plus-square' : 'fa-minus-square';
var iconclassnext = (nextstate == 'visible') ? 'fa-minus-square' : 'fa-plus-square';
var imagenow = (nextstate == 'visible') ? expandedImage.attr('src') : collapsedImage.attr('src');
$('.' + currentstate).each(function() {
$(this).removeClass(currentstate);
$(this).addClass(nextstate);
$(this).attr('aria-expanded', ariaexpandedstate);
});
$('.tool_dataprivacy-expand-all').data('visibilityState', currentstate);
str.get_string(currentstate, 'tool_dataprivacy').then(function(langString) {
$('.tool_dataprivacy-expand-all').html(langString);
return;
}).catch(Notification.exception);
$(':header i.fa').each(function() {
$(this).removeClass(iconclassnow);
$(this).addClass(iconclassnext);
});
$(':header img.icon').each(function() {
$(this).attr('src', imagenow);
});
}
};
});
|
/*
Copyright © 2001-2004 World Wide Web Consortium,
(Massachusetts Institute of Technology, European Research Consortium
for Informatics and Mathematics, Keio University). All
Rights Reserved. This work is distributed under the W3C® Software License [1] 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.
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
*/
/**
* Gets URI that identifies the test.
* @return uri identifier of test
*/
function getTargetURI() {
return "http://www.w3.org/2001/DOM-Test-Suite/level3/core/textiselementcontentwhitespace01";
}
var docsLoaded = -1000000;
var builder = null;
//
// This function is called by the testing framework before
// running the test suite.
//
// If there are no configuration exceptions, asynchronous
// document loading is started. Otherwise, the status
// is set to complete and the exception is immediately
// raised when entering the body of the test.
//
function setUpPage() {
setUpPageStatus = 'running';
try {
//
// creates test document builder, may throw exception
//
builder = createConfiguredBuilder();
docsLoaded = 0;
var docRef = null;
if (typeof(this.doc) != 'undefined') {
docRef = this.doc;
}
docsLoaded += preload(docRef, "doc", "barfoo");
if (docsLoaded == 1) {
setUpPageStatus = 'complete';
}
} catch(ex) {
catchInitializationError(builder, ex);
setUpPageStatus = 'complete';
}
}
//
// This method is called on the completion of
// each asychronous load started in setUpTests.
//
// When every synchronous loaded document has completed,
// the page status is changed which allows the
// body of the test to be executed.
function loadComplete() {
if (++docsLoaded == 1) {
setUpPageStatus = 'complete';
}
}
/**
*
Invoke isElementContentWhitespace on a newly created Text Node that contains only whitespace.
Should be false since there is no content model to determine if the node appears within element content.
* @author IBM
* @author Neil Delima
* @see http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Text3-isElementContentWhitespace
*/
function textiselementcontentwhitespace01() {
var success;
if(checkInitialization(builder, "textiselementcontentwhitespace01") != null) return;
var doc;
var newText;
var hasWhitespace;
var docRef = null;
if (typeof(this.doc) != 'undefined') {
docRef = this.doc;
}
doc = load(docRef, "doc", "barfoo");
newText = doc.createTextNode(" ");
hasWhitespace = newText.isElementContentWhitespace;
assertFalse("isWhitespace",hasWhitespace);
}
function runTest() {
textiselementcontentwhitespace01();
}
|
/**
* @fileoverview Enforce PasalCase for user-defined JSX components
* @author Jake Marsh
*/
'use strict';
// ------------------------------------------------------------------------------
// Constants
// ------------------------------------------------------------------------------
var PASCAL_CASE_REGEX = /^([A-Z0-9]|[A-Z0-9]+[a-z0-9]+(?:[A-Z0-9]+[a-z0-9]*)*)$/;
var COMPAT_TAG_REGEX = /^[a-z]|\-/;
// ------------------------------------------------------------------------------
// Rule Definition
// ------------------------------------------------------------------------------
module.exports = function(context) {
return {
JSXOpeningElement: function(node) {
switch (node.name.type) {
case 'JSXIdentifier':
node = node.name;
break;
case 'JSXMemberExpression':
node = node.name.object;
break;
case 'JSXNamespacedName':
node = node.name.namespace;
break;
default:
break;
}
var isPascalCase = PASCAL_CASE_REGEX.test(node.name);
var isCompatTag = COMPAT_TAG_REGEX.test(node.name);
if (!isPascalCase && !isCompatTag) {
context.report({
node: node,
message: 'Imported JSX component ' + node.name + ' must be in PascalCase'
});
}
}
};
};
|
var step = '<font style="font-size:85%">'
+'<p>Test Purpose: </p>'
+'<p>Verifies device and system information can be got.</p>'
+'<p>Expected Result: </p>'
+'<p>Test passes if the cpu, storage, memory, display, avcodecs information of device and system can be displayed.</p>'
+'</font>';
|
var _ = require('lodash'),
Promise = require('bluebird'),
errors = require('../errors'),
api = require('../api'),
loader = require('./loader'),
// Holds the available apps
availableApps = {};
function getInstalledApps() {
return api.settings.read({context: {internal: true}, key: 'installedApps'}).then(function (response) {
var installed = response.settings[0];
installed.value = installed.value || '[]';
try {
installed = JSON.parse(installed.value);
} catch (e) {
return Promise.reject(e);
}
return installed;
});
}
function saveInstalledApps(installedApps) {
return getInstalledApps().then(function (currentInstalledApps) {
var updatedAppsInstalled = _.uniq(installedApps.concat(currentInstalledApps));
return api.settings.edit({settings: [{key: 'installedApps', value: updatedAppsInstalled}]}, {context: {internal: true}});
});
}
module.exports = {
init: function () {
var appsToLoad;
try {
// We have to parse the value because it's a string
api.settings.read({context: {internal: true}, key: 'activeApps'}).then(function (response) {
var aApps = response.settings[0];
appsToLoad = JSON.parse(aApps.value) || [];
});
} catch (e) {
errors.logError(
'Failed to parse activeApps setting value: ' + e.message,
'Your apps will not be loaded.',
'Check your settings table for typos in the activeApps value. It should look like: ["app-1", "app2"] (double quotes required).'
);
return Promise.resolve();
}
// Grab all installed apps, install any not already installed that are in appsToLoad.
return getInstalledApps().then(function (installedApps) {
var loadedApps = {},
recordLoadedApp = function (name, loadedApp) {
// After loading the app, add it to our hash of loaded apps
loadedApps[name] = loadedApp;
return Promise.resolve(loadedApp);
},
loadPromises = _.map(appsToLoad, function (app) {
// If already installed, just activate the app
if (_.contains(installedApps, app)) {
return loader.activateAppByName(app).then(function (loadedApp) {
return recordLoadedApp(app, loadedApp);
});
}
// Install, then activate the app
return loader.installAppByName(app).then(function () {
return loader.activateAppByName(app);
}).then(function (loadedApp) {
return recordLoadedApp(app, loadedApp);
});
});
return Promise.all(loadPromises).then(function () {
// Save our installed apps to settings
return saveInstalledApps(_.keys(loadedApps));
}).then(function () {
// Extend the loadedApps onto the available apps
_.extend(availableApps, loadedApps);
}).catch(function (err) {
errors.logError(
err.message || err,
'The app will not be loaded',
'Check with the app creator, or read the app documentation for more details on app requirements'
);
});
});
},
availableApps: availableApps
};
|
/*
Copyright (c) 2010, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.com/yui/license.html
version: 3.2.0
build: 2676
*/
YUI.add('yui-throttle', function(Y) {
/**
* Provides a throttle/limiter for function calls
* @module yui
* @submodule yui-throttle
*/
/**
* Throttles a call to a method based on the time between calls.
* @method throttle
* @for YUI
* @param fn {function} The function call to throttle.
* @param ms {int} The number of milliseconds to throttle the method call. Can set
* globally with Y.config.throttleTime or by call. Passing a -1 will disable the throttle. Defaults to 150
* @return {function} Returns a wrapped function that calls fn throttled.
* @since 3.1.0
*/
/*! Based on work by Simon Willison: http://gist.github.com/292562 */
var throttle = function(fn, ms) {
ms = (ms) ? ms : (Y.config.throttleTime || 150);
if (ms === -1) {
return (function() {
fn.apply(null, arguments);
});
}
var last = (new Date()).getTime();
return (function() {
var now = (new Date()).getTime();
if (now - last > ms) {
last = now;
fn.apply(null, arguments);
}
});
};
Y.throttle = throttle;
// We added the redundant definition to later for backwards compatibility.
// I don't think we need to do the same thing here
// Y.Lang.throttle = throttle;
}, '3.2.0' ,{requires:['yui-base']});
|
/* global appendChartID, loadDateFixture */
describe('dc.bubbleOverlay', function () {
var chart, data;
var dimension, group;
describe('creation', function () {
beforeEach(function () {
data = crossfilter(loadDateFixture());
dimension = data.dimension(function (d) {return d.state;});
group = dimension.group().reduceSum(function (d) {return d.value;});
var id = 'bubble-overlay';
var parent = appendChartID(id);
var svg = parent.append('svg');
chart = dc.bubbleOverlay('#' + id)
.svg(svg)
.dimension(dimension)
.group(group)
.width(300)
.height(200)
.transitionDuration(0)
.title(function (d) {return 'Title: ' + d.key;})
.r(d3.scale.linear().domain([0, 500]))
.ordinalColors(['blue'])
.point('California', 100, 120)
.point('Colorado', 300, 120)
.point('Delaware', 500, 220)
.point('Ontario', 180, 90)
.point('Mississippi', 120, 220)
.point('Oklahoma', 200, 350);
chart.render();
});
it('should generate an instance of the dc chart', function () {
expect(dc.instanceOfChart(chart)).toBeTruthy();
});
it('should be registered', function () {
expect(dc.hasChart(chart)).toBeTruthy();
});
it('should generate the correct number of overlay groups', function () {
expect(chart.selectAll('g.node')[0].length).toEqual(6);
});
it('should generate a correct class name for the overlay groups', function () {
expect(d3.select(chart.selectAll('g.node')[0][0]).attr('class')).toEqual('node california');
expect(d3.select(chart.selectAll('g.node')[0][3]).attr('class')).toEqual('node ontario');
});
it('should generate the correct number of overlay bubbles', function () {
expect(chart.selectAll('circle.bubble')[0].length).toEqual(6);
});
it('should generate a correct translate for overlay groups', function () {
expect(d3.select(chart.selectAll('g.node')[0][0]).attr('transform')).toMatchTranslate(100, 120);
expect(d3.select(chart.selectAll('g.node')[0][3]).attr('transform')).toMatchTranslate(180, 90);
});
it('should generate correct radii for circles', function () {
expect(d3.select(chart.selectAll('circle.bubble')[0][0]).attr('r')).toEqual('34.64');
expect(d3.select(chart.selectAll('circle.bubble')[0][3]).attr('r')).toEqual('22.32');
});
it('should generate correct labels', function () {
expect(d3.select(chart.selectAll('g.node text')[0][0]).text()).toEqual('California');
expect(d3.select(chart.selectAll('g.node text')[0][3]).text()).toEqual('Ontario');
});
it('should generate the label only once', function () {
chart.redraw();
expect(chart.selectAll('g.node text')[0].length).toEqual(6);
});
it('generate the correct titles', function () {
expect(d3.select(chart.selectAll('g.node title')[0][0]).text()).toEqual('Title: California');
expect(d3.select(chart.selectAll('g.node title')[0][3]).text()).toEqual('Title: Ontario');
});
it('should only generate titles once', function () {
chart.redraw();
expect(chart.selectAll('g.node title')[0].length).toEqual(6);
});
it('should fill circles with the specified colors', function () {
expect(d3.select(chart.selectAll('circle.bubble')[0][0]).attr('fill')).toEqual('blue');
expect(d3.select(chart.selectAll('circle.bubble')[0][3]).attr('fill')).toEqual('blue');
});
it('should highlight the filtered bubbles', function () {
chart.filter('Colorado');
chart.filter('California');
chart.redraw();
expect(d3.select(chart.selectAll('g.node')[0][0]).attr('class')).toEqual('node california selected');
expect(d3.select(chart.selectAll('g.node')[0][1]).attr('class')).toEqual('node colorado selected');
expect(d3.select(chart.selectAll('g.node')[0][3]).attr('class')).toEqual('node ontario deselected');
});
});
});
|
describe('Binding: Text', function() {
beforeEach(jasmine.prepareTestNode);
it('Should assign the value to the node, HTML-encoding the value', function () {
var model = { textProp: "'Val <with> \"special\" <i>characters</i>'" };
testNode.innerHTML = "<span data-bind='text:textProp'></span>";
ko.applyBindings(model, testNode);
expect(testNode.childNodes[0].textContent || testNode.childNodes[0].innerText).toEqual(model.textProp);
});
it('Should assign an empty string as value if the model value is null', function () {
testNode.innerHTML = "<span data-bind='text:(null)' ></span>";
ko.applyBindings(null, testNode);
var actualText = "textContent" in testNode.childNodes[0] ? testNode.childNodes[0].textContent : testNode.childNodes[0].innerText;
expect(actualText).toEqual("");
});
it('Should assign an empty string as value if the model value is undefined', function () {
testNode.innerHTML = "<span data-bind='text:undefined' ></span>";
ko.applyBindings(null, testNode);
var actualText = "textContent" in testNode.childNodes[0] ? testNode.childNodes[0].textContent : testNode.childNodes[0].innerText;
expect(actualText).toEqual("");
});
it('Should work with virtual elements, adding a text node between the comments', function () {
var observable = ko.observable("Some text");
testNode.innerHTML = "xxx <!-- ko text: textProp --><!-- /ko -->";
ko.applyBindings({textProp: observable}, testNode);
expect(testNode).toContainText("xxx Some text");
expect(testNode).toContainHtml("xxx <!-- ko text: textprop -->some text<!-- /ko -->");
// update observable; should update text
observable("New text");
expect(testNode).toContainText("xxx New text");
expect(testNode).toContainHtml("xxx <!-- ko text: textprop -->new text<!-- /ko -->");
// clear observable; should remove text
observable(undefined);
expect(testNode).toContainText("xxx ");
expect(testNode).toContainHtml("xxx <!-- ko text: textprop --><!-- /ko -->");
});
it('Should work with virtual elements, removing any existing stuff between the comments', function () {
testNode.innerHTML = "xxx <!--ko text: undefined-->some random thing<span> that won't be here later</span><!--/ko-->";
ko.applyBindings(null, testNode);
expect(testNode).toContainText("xxx ");
expect(testNode).toContainHtml("xxx <!--ko text: undefined--><!--/ko-->");
});
it('Should not attempt data binding on the generated text node', function() {
this.restoreAfter(ko.bindingProvider, 'instance');
// Since custom binding providers can regard text nodes as bindable, it would be a
// security risk to bind against user-supplied text (XSS).
// First replace the binding provider with one that's hardcoded to replace all text
// content with a special message, via a binding handler that operates on text nodes
var originalBindingProvider = ko.bindingProvider.instance;
ko.bindingProvider.instance = {
nodeHasBindings: function(node, bindingContext) {
return true;
},
getBindingAccessors: function(node, bindingContext) {
if (node.nodeType === 3) {
return {
replaceTextNodeContent: function() { return "should not see this value in the output"; }
};
} else {
return originalBindingProvider.getBindingAccessors(node, bindingContext);
}
}
};
ko.bindingHandlers.replaceTextNodeContent = {
update: function(textNode, valueAccessor) { textNode.data = valueAccessor(); }
};
// Now check that, after applying the "text" binding, the emitted text node does *not*
// get replaced by the special message.
testNode.innerHTML = "<span data-bind='text: sometext'></span>";
ko.applyBindings({ sometext: 'hello' }, testNode);
expect("textContent" in testNode ? testNode.textContent : testNode.innerText).toEqual('hello');
});
});
|
/*!
* FileInput Korean Translations
*
* This file must be loaded after 'fileinput.js'. Patterns in braces '{}', or
* any HTML markup tags in the messages must not be converted or translated.
*
* @see http://github.com/kartik-v/bootstrap-fileinput
*
* NOTE: this file must be saved in UTF-8 encoding.
*/
(function ($) {
"use strict";
$.fn.fileinputLocales['kr'] = {
fileSingle: '파일',
filePlural: '파일들',
browseLabel: '찾기 …',
removeLabel: '지우기',
removeTitle: '선택한 파일들 지우기',
cancelLabel: '취소',
cancelTitle: '업로드 중단하기',
uploadLabel: '업로드',
uploadTitle: '선택한 파일 업로드하기',
msgNo: '아니요',
msgNoFilesSelected: '선택한 파일이 없습니다.',
msgCancelled: '취소되었습니다.',
msgZoomModalHeading: '자세한 미리보기',
msgFileRequired: 'You must select a file to upload.',
msgSizeTooSmall: '파일 "{name}" (<b>{size} KB</b>)이 너무 작습니다. <b>{minSize} KB</b>보다 용량이 커야 합니다..',
msgSizeTooLarge: '파일 "{name}" (<b>{size} KB</b>)이 너무 큽니다. 허용 파일 사이즈는 <b>{maxSize} KB</b>.입니다.',
msgFilesTooLess: '업로드하기 위해 최소 <b>{n}</b> {files}개의 파일을 선택해야 합니다.',
msgFilesTooMany: '선택한 파일의 수 <b>({n})</b>가 업로드 허용 최고치인 <b>{m}</b>를 넘었습니다..',
msgFileNotFound: '파일 "{name}"을 찾을 수 없습니다.!',
msgFileSecured: '보안상의 이유로 파일 "{name}"을/를 읽을 수 없습니다..',
msgFileNotReadable: '파일 "{name}"은/는 읽을 수 없습니다.',
msgFilePreviewAborted: '파일 "{name}"의 미리보기가 중단되었습니다.',
msgFilePreviewError: '파일 "{name}"을/를 읽다가 에러가 발생했습니다.',
msgInvalidFileName: '파일 "{name}" 중 지원 불가능한 문자가 포함되어 있습니다.',
msgInvalidFileType: '파일 "{name}"의 타입은 지원하지 않습니다. "{types}" 타입의 파일을 선택해 주십시요.',
msgInvalidFileExtension: '파일 "{name}"의 익스텐션은 지원하지 않습니다. "{extensions}" 타입의 익스텐션을 선택해 주십시요.',
msgFileTypes: {
'image': 'image',
'html': 'HTML',
'text': 'text',
'video': 'video',
'audio': 'audio',
'flash': 'flash',
'pdf': 'PDF',
'object': 'object'
},
msgUploadAborted: '파일 업로드가 중단되었습니다.',
msgUploadThreshold: '업로드 중...',
msgUploadBegin: 'Initializing...',
msgUploadEnd: 'Done',
msgUploadEmpty: '업로드 가능 데이터가 존재하지 않습니다.',
msgValidationError: '유효성 오류',
msgLoading: '파일 {files} 중 {index}번째를 로딩하고 있습니다. …',
msgProgress: '파일 {files}의 {name}이 {percent}% 로딩되었습니다. ',
msgSelected: '{n} {files}이 선택 되었습니다.',
msgFoldersNotAllowed: '드래그 앤 드랍 파일만 가능합니다! 드랍한 {n}번째 폴더를 건너 뛰었습니다.',
msgImageWidthSmall: '이미지 파일 "{name}"의 가로는 최소 {size} px가 되어야 합니다.',
msgImageHeightSmall: '이미지 파일 "{name}"의 세로는 최소 {size} px가 되어야 합니다.',
msgImageWidthLarge: '이미지 파일 "{name}"의 가로는 최대 {size} px를 넘을수 없습니다.',
msgImageHeightLarge: '이미지 파일 "{name}"의 세로는 최대 {size} px를 넘을수 없습니다.',
msgImageResizeError: '이미지의 사이즈를 재조정을 위한 이미지 사이즈를 가져올 수 없습니다.',
msgImageResizeException: '이미지 사이즈 재조정이 다음 이유로 실패했습니다.<pre>{errors}</pre>',
msgAjaxError: 'Something went wrong with the {operation} operation. Please try again later!',
msgAjaxProgressError: '{operation} failed',
ajaxOperations: {
deleteThumb: 'file delete',
uploadThumb: 'file upload',
uploadBatch: 'batch file upload',
uploadExtra: 'form data upload'
},
dropZoneTitle: '파일을 여기에 드래그인 드랍을 하십시요 …',
dropZoneClickTitle: '<br>(또는 {files} 선택을 위해 클릭하십시요)',
fileActionSettings: {
removeTitle: '파일 지우기',
uploadTitle: '파일 업로드 하기',
zoomTitle: '세부 정보 보기',
dragTitle: '옭기기 / 재배열하기',
indicatorNewTitle: '아직 업로드가 안되었습니다.',
indicatorSuccessTitle: '업로드가 성공하였습니다.',
indicatorErrorTitle: '업로드 중 에러가 발행했습니다.',
indicatorLoadingTitle: '업로드 중 ...'
},
previewZoomButtonTitles: {
prev: '전 파일 보기',
next: '다음 파일 보기',
toggleheader: '머릿글 토글하기',
fullscreen: '전채화면 토글하기',
borderless: '무 테두리 토글하기',
close: '세부 정보 미리보기 토글하기'
}
};
})(window.jQuery);
|
(function() {
function vendorModule() {
'use strict';
return {
'default': self['<%= name %>'],
__esModule: true,
};
}
define('<%= name %>', [], vendorModule);
})();
|
var parseScope = require('lexical-scope');
var through = require('through2');
var merge = require('xtend');
var path = require('path');
var processPath = require.resolve('process/browser.js');
var combineSourceMap = require('combine-source-map');
var defaultVars = {
process: function () {
return 'require(' + JSON.stringify(processPath) + ')';
},
global: function () {
return 'typeof global !== "undefined" ? global : '
+ 'typeof self !== "undefined" ? self : '
+ 'typeof window !== "undefined" ? window : {}'
;
},
Buffer: function () {
return 'require("buffer").Buffer';
},
__filename: function (file, basedir) {
var filename = '/' + path.relative(basedir, file);
return JSON.stringify(filename);
},
__dirname: function (file, basedir) {
var dir = path.dirname('/' + path.relative(basedir, file));
return JSON.stringify(dir);
}
};
module.exports = function (file, opts) {
if (/\.json$/i.test(file)) return through();
if (!opts) opts = {};
var basedir = opts.basedir || '/';
var vars = merge(defaultVars, opts.vars);
var varNames = Object.keys(vars);
var quick = RegExp(varNames.map(function (name) {
return '\\b' + name + '\\b';
}).join('|'));
var chunks = [];
return through(write, end);
function write (chunk, enc, next) { chunks.push(chunk); next() }
function end () {
var self = this;
var source = Buffer.isBuffer(chunks[0])
? Buffer.concat(chunks).toString('utf8')
: chunks.join('')
;
source = source
.replace(/^\ufeff/, '')
.replace(/^#![^\n]*\n/, '\n');
if (opts.always !== true && !quick.test(source)) {
this.push(source);
this.push(null);
return;
}
try {
var scope = opts.always
? { globals: { implicit: varNames } }
: parseScope('(function(){\n' + source + '\n})()')
;
}
catch (err) {
var e = new SyntaxError(
(err.message || err) + ' while parsing ' + file
);
e.type = 'syntax';
e.filename = file;
return this.emit('error', e);
}
var globals = {};
varNames.forEach(function (name) {
if (scope.globals.implicit.indexOf(name) >= 0) {
var value = vars[name](file, basedir);
if (value) {
globals[name] = value;
self.emit('global', name);
}
}
});
this.push(closeOver(globals, source, file, opts));
this.push(null);
}
};
module.exports.vars = defaultVars;
function closeOver (globals, src, file, opts) {
var keys = Object.keys(globals);
if (keys.length === 0) return src;
var values = keys.map(function (key) { return globals[key] });
var wrappedSource;
if (keys.length <= 3) {
wrappedSource = '(function (' + keys.join(',') + '){\n'
+ src + '\n}).call(this,' + values.join(',') + ')'
;
}
else {
// necessary to make arguments[3..6] still work for workerify etc
// a,b,c,arguments[3..6],d,e,f...
var extra = [ '__argument0', '__argument1', '__argument2', '__argument3' ];
var names = keys.slice(0,3).concat(extra).concat(keys.slice(3));
values.splice(3, 0,
'arguments[3]','arguments[4]',
'arguments[5]','arguments[6]'
);
wrappedSource = '(function (' + names.join(',') + '){\n'
+ src + '\n}).call(this,' + values.join(',') + ')';
}
// Generate source maps if wanted. Including the right offset for
// the wrapped source.
if (!opts.debug) {
return wrappedSource;
}
var sourceFile = path.relative(opts.basedir, file)
.replace(/\\/g, '/');
var sourceMap = combineSourceMap.create().addFile(
{ sourceFile: sourceFile, source: src},
{ line: 1 });
return combineSourceMap.removeComments(wrappedSource) + "\n"
+ sourceMap.comment();
}
|
/**
* View Model that holds the "selectedColor" of the color picker container.
*/
Ext.define('Ext.ux.colorpick.SelectorModel', {
extend : 'Ext.app.ViewModel',
alias : 'viewmodel.colorpick-selectormodel',
requires: [
'Ext.ux.colorpick.ColorUtils'
],
data: {
selectedColor: {
r : 255, // red
g : 255, // green
b : 255, // blue
h : 0, // hue,
s : 1, // saturation
v : 1, // value
a : 1 // alpha (opacity)
},
previousColor: {
r : 0, // red
g : 0, // green
b : 0, // blue
h : 0, // hue,
s : 1, // saturation
v : 1, // value
a : 1 // alpha (opacity)
}
},
formulas: {
// Hexadecimal representation of the color
hex: {
get: function (get) {
var r = get('selectedColor.r').toString(16),
g = get('selectedColor.g').toString(16),
b = get('selectedColor.b').toString(16),
result;
result = Ext.ux.colorpick.ColorUtils.rgb2hex(r, g, b);
return '#' + result;
},
set: function (hex) {
var rgb = Ext.ux.colorpick.ColorUtils.hex2rgb(hex);
this.changeRGB(rgb);
}
},
// "R" in "RGB"
red: {
get: function(get) {
return get('selectedColor.r');
},
set: function(r) {
this.changeRGB({ r: r });
}
},
// "G" in "RGB"
green: {
get: function(get) {
return get('selectedColor.g');
},
set: function(g) {
this.changeRGB({ g: g });
}
},
// "B" in "RGB"
blue: {
get: function(get) {
return get('selectedColor.b');
},
set: function(b) {
this.changeRGB({ b: b });
}
},
// "H" in HSV
hue: {
get: function(get) {
return get('selectedColor.h') * 360;
},
set: function(hue) {
this.changeHSV({ h: hue / 360 });
}
},
// "S" in HSV
saturation: {
get : function(get) {
return get('selectedColor.s') * 100;
},
set: function(saturation) {
this.changeHSV({ s: saturation / 100 });
}
},
// "V" in HSV
value: {
get: function(get) {
var v = get('selectedColor.v');
return v * 100;
},
set: function(value) {
this.changeHSV({ v: value / 100 });
}
},
alpha: {
get: function(data) {
var a = data('selectedColor.a');
return a * 100;
},
set: function(alpha) {
this.set('selectedColor', Ext.applyIf({
a: alpha / 100
}, this.data.selectedColor));
}
}
}, // formulas
changeHSV: function (hsv) {
Ext.applyIf(hsv, this.data.selectedColor);
var rgb = Ext.ux.colorpick.ColorUtils.hsv2rgb(hsv.h, hsv.s, hsv.v);
hsv.r = rgb.r;
hsv.g = rgb.g;
hsv.b = rgb.b;
this.set('selectedColor', hsv);
},
changeRGB: function (rgb) {
Ext.applyIf(rgb, this.data.selectedColor);
var hsv = Ext.ux.colorpick.ColorUtils.rgb2hsv(rgb.r, rgb.g, rgb.b);
rgb.h = hsv.h;
rgb.s = hsv.s;
rgb.v = hsv.v;
this.set('selectedColor', rgb);
}
});
|
var EventEmitter = require('events').EventEmitter,
inherits = require('util').inherits;
module.exports = SessionStub;
function SessionStub() {
this.debuggerClient = new DebuggerClientStub();
this.frontendClient = new FrontendClientStub();
this.resourceTreeResolved = true;
}
inherits(SessionStub, EventEmitter);
function DebuggerClientStub() {}
inherits(DebuggerClientStub, EventEmitter);
DebuggerClientStub.prototype.close = function() {
this.emit('close');
};
function FrontendClientStub() {}
inherits(FrontendClientStub, EventEmitter);
FrontendClientStub.prototype.sendEvent = function(event, message) {
this.emit(event, message);
};
FrontendClientStub.prototype.sendLogToConsole = function(type, message) {
throw new Error(message);
};
FrontendClientStub.prototype.off = function() {
this.removeListener.apply(this, arguments);
};
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Netscape Communication Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
gTestfile = 'expression-008.js';
/**
File Name: expression-008
Corresponds To: 11.2.2-3-n.js
ECMA Section: 11.2.2. The new operator
Description:
Author: christine@netscape.com
Date: 12 november 1997
*/
var SECTION = "expression-008";
var VERSION = "JS1_4";
var TITLE = "The new operator";
startTest();
writeHeaderToLog( SECTION + " "+ TITLE);
var NULL = null;
var result = "Failed";
var exception = "No exception thrown";
var expect = "Passed";
try {
result = new NULL();
} catch ( e ) {
result = expect;
exception = e.toString();
}
new TestCase(
SECTION,
"NULL = null; result = new NULL()" +
" (threw " + exception +")",
expect,
result );
test();
|
module.exports = require('./lib/mysql');
|
/*************************************************************
*
* MathJax/jax/output/HTML-CSS/fonts/STIX/General/Regular/SuperAndSubscripts.js
*
* Copyright (c) 2009-2017 The MathJax Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
MathJax.Hub.Insert(
MathJax.OutputJax['HTML-CSS'].FONTDATA.FONTS['STIXGeneral'],
{
0x207F: [676,-270,541,57,484] // SUPERSCRIPT LATIN SMALL LETTER N
}
);
MathJax.Ajax.loadComplete(MathJax.OutputJax["HTML-CSS"].fontDir + "/General/Regular/SuperAndSubscripts.js");
|
require("../env");
var vows = require("vows"),
assert = require("assert");
var suite = vows.describe("d3.geo.mercator");
suite.addBatch({
"mercator": {
topic: function() {
return d3.geo.mercator().translate([0, 0]).scale(100);
},
"Arctic": function(mercator) {
var coords = mercator([0, 85]);
assert.inDelta(coords[0], 0, 1e-6);
assert.inDelta(coords[1], -49.8362085, 1e-6);
var lonlat = mercator.invert(coords);
assert.inDelta(lonlat[0], 0, 1e-6);
assert.inDelta(lonlat[1], 85, 1e-6);
},
"Antarctic": function(mercator) {
var coords = mercator([0, -85]);
assert.inDelta(coords[0], 0, 1e-6);
assert.inDelta(coords[1], 49.8362085, 1e-6);
var lonlat = mercator.invert(coords);
assert.inDelta(lonlat[0], 0, 1e-6);
assert.inDelta(lonlat[1], -85, 1e-6);
},
"Hawaii": function(mercator) {
var coords = mercator([-180, 0]);
assert.inDelta(coords[0], -50, 1e-6);
assert.inDelta(coords[1], 0, 1e-6);
var lonlat = mercator.invert(coords);
assert.inDelta(lonlat[0], -180, 1e-6);
assert.inDelta(lonlat[1], 0, 1e-6);
},
"Phillipines": function(mercator) {
var coords = mercator([180, 0]);
assert.inDelta(coords[0], 50, 1e-6);
assert.inDelta(coords[1], 0, 1e-6);
var lonlat = mercator.invert(coords);
assert.inDelta(lonlat[0], 180, 1e-6);
assert.inDelta(lonlat[1], 0, 1e-6);
},
"Inversion works for non-zero translation": function() {
var mercator = d3.geo.mercator().translate([123, 99]).scale(100),
coords = mercator([0, 85]),
lonlat = mercator.invert(coords);
assert.inDelta(lonlat[0], 0, 1e-6);
assert.inDelta(lonlat[1], 85, 1e-6);
}
}
});
suite.export(module);
|
var fs = require('fs'),
sprintf = require('sprintf');
if (process.argv.length <= 2) {
console.log('You need to enter title');
return;
}
var content = fs.readFileSync('./template.html').toString(),
title = process.argv[2];
content = sprintf(content, {
title: title
});
fs.writeFileSync(sprintf('./%s.html', title.replace(/\//g, '-')), content);
|
integration("User");
test("Activity Streams", function() {
expect(14);
var streamTest = function(url) {
visit(url).then(function() {
ok(exists(".user-main"), "The main content is rendered");
ok(exists(".user-navigation"), "The navigation is rendered");
});
};
streamTest("/users/eviltrout");
streamTest("/users/eviltrout/activity/topics");
streamTest("/users/eviltrout/activity/posts");
streamTest("/users/eviltrout/activity/replies");
streamTest("/users/eviltrout/activity/likes-given");
streamTest("/users/eviltrout/activity/likes-received");
streamTest("/users/eviltrout/activity/edits");
});
|
// https://d3js.org/d3-timer/ Version 1.0.5. Copyright 2017 Mike Bostock.
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(factory((global.d3 = global.d3 || {})));
}(this, (function (exports) { 'use strict';
var frame = 0;
var timeout = 0;
var interval = 0;
var pokeDelay = 1000;
var taskHead;
var taskTail;
var clockLast = 0;
var clockNow = 0;
var clockSkew = 0;
var clock = typeof performance === "object" && performance.now ? performance : Date;
var setFrame = typeof requestAnimationFrame === "function" ? requestAnimationFrame : function(f) { setTimeout(f, 17); };
function now() {
return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew);
}
function clearNow() {
clockNow = 0;
}
function Timer() {
this._call =
this._time =
this._next = null;
}
Timer.prototype = timer.prototype = {
constructor: Timer,
restart: function(callback, delay, time) {
if (typeof callback !== "function") throw new TypeError("callback is not a function");
time = (time == null ? now() : +time) + (delay == null ? 0 : +delay);
if (!this._next && taskTail !== this) {
if (taskTail) taskTail._next = this;
else taskHead = this;
taskTail = this;
}
this._call = callback;
this._time = time;
sleep();
},
stop: function() {
if (this._call) {
this._call = null;
this._time = Infinity;
sleep();
}
}
};
function timer(callback, delay, time) {
var t = new Timer;
t.restart(callback, delay, time);
return t;
}
function timerFlush() {
now(); // Get the current time, if not already set.
++frame; // Pretend we’ve set an alarm, if we haven’t already.
var t = taskHead, e;
while (t) {
if ((e = clockNow - t._time) >= 0) t._call.call(null, e);
t = t._next;
}
--frame;
}
function wake() {
clockNow = (clockLast = clock.now()) + clockSkew;
frame = timeout = 0;
try {
timerFlush();
} finally {
frame = 0;
nap();
clockNow = 0;
}
}
function poke() {
var now = clock.now(), delay = now - clockLast;
if (delay > pokeDelay) clockSkew -= delay, clockLast = now;
}
function nap() {
var t0, t1 = taskHead, t2, time = Infinity;
while (t1) {
if (t1._call) {
if (time > t1._time) time = t1._time;
t0 = t1, t1 = t1._next;
} else {
t2 = t1._next, t1._next = null;
t1 = t0 ? t0._next = t2 : taskHead = t2;
}
}
taskTail = t0;
sleep(time);
}
function sleep(time) {
if (frame) return; // Soonest alarm already set, or will be.
if (timeout) timeout = clearTimeout(timeout);
var delay = time - clockNow;
if (delay > 24) {
if (time < Infinity) timeout = setTimeout(wake, delay);
if (interval) interval = clearInterval(interval);
} else {
if (!interval) clockLast = clockNow, interval = setInterval(poke, pokeDelay);
frame = 1, setFrame(wake);
}
}
var timeout$1 = function(callback, delay, time) {
var t = new Timer;
delay = delay == null ? 0 : +delay;
t.restart(function(elapsed) {
t.stop();
callback(elapsed + delay);
}, delay, time);
return t;
};
var interval$1 = function(callback, delay, time) {
var t = new Timer, total = delay;
if (delay == null) return t.restart(callback, delay, time), t;
delay = +delay, time = time == null ? now() : +time;
t.restart(function tick(elapsed) {
elapsed += total;
t.restart(tick, total += delay, time);
callback(elapsed);
}, delay, time);
return t;
};
exports.now = now;
exports.timer = timer;
exports.timerFlush = timerFlush;
exports.timeout = timeout$1;
exports.interval = interval$1;
Object.defineProperty(exports, '__esModule', { value: true });
})));
|
;(function (define, undefined) {
'use strict';
define([
'gettext', 'jquery', 'underscore', 'backbone'
], function (gettext, $, _, Backbone) {
var LearnerProfileView = Backbone.View.extend({
initialize: function () {
this.template = _.template($('#learner_profile-tpl').text());
_.bindAll(this, 'showFullProfile', 'render', 'renderFields', 'showLoadingError');
this.listenTo(this.options.preferencesModel, "change:" + 'account_privacy', this.render);
},
showFullProfile: function () {
var isAboveMinimumAge = this.options.accountSettingsModel.isAboveMinimumAge();
if (this.options.ownProfile) {
return isAboveMinimumAge && this.options.preferencesModel.get('account_privacy') === 'all_users';
} else {
return this.options.accountSettingsModel.get('profile_is_public');
}
},
render: function () {
this.$el.html(this.template({
username: this.options.accountSettingsModel.get('username'),
ownProfile: this.options.ownProfile,
showFullProfile: this.showFullProfile()
}));
this.renderFields();
return this;
},
renderFields: function() {
var view = this;
if (this.options.ownProfile) {
var fieldView = this.options.accountPrivacyFieldView,
settings = this.options.accountSettingsModel;
fieldView.profileIsPrivate = !settings.get('year_of_birth');
fieldView.requiresParentalConsent = settings.get('requires_parental_consent');
fieldView.isAboveMinimumAge = settings.isAboveMinimumAge();
fieldView.undelegateEvents();
this.$('.wrapper-profile-field-account-privacy').append(fieldView.render().el);
fieldView.delegateEvents();
}
this.$('.profile-section-one-fields').append(this.options.usernameFieldView.render().el);
var imageView = this.options.profileImageFieldView;
this.$('.profile-image-field').append(imageView.render().el);
if (this.showFullProfile()) {
_.each(this.options.sectionOneFieldViews, function (fieldView) {
view.$('.profile-section-one-fields').append(fieldView.render().el);
});
_.each(this.options.sectionTwoFieldViews, function (fieldView) {
view.$('.profile-section-two-fields').append(fieldView.render().el);
});
}
},
showLoadingError: function () {
this.$('.ui-loading-indicator').addClass('is-hidden');
this.$('.ui-loading-error').removeClass('is-hidden');
}
});
return LearnerProfileView;
});
}).call(this, define || RequireJS.define);
|
module.exports = {
'grid': function (browser) {
var columns = ['name', 'power']
browser
.url('http://localhost:8080/examples/grid/')
.waitForElementVisible('table', 1000)
.assert.count('th', 2)
.assert.count('th.active', 0)
.assert.containsText('th:nth-child(1)', 'Name')
.assert.containsText('th:nth-child(2)', 'Power')
assertTable([
{ name: 'Chuck Norris', power: Infinity },
{ name: 'Bruce Lee', power: 9000 },
{ name: 'Jackie Chan', power: 7000 },
{ name: 'Jet Li', power: 8000 }
])
browser
.click('th:nth-child(1)')
.assert.count('th.active:nth-child(1)', 1)
.assert.count('th.active:nth-child(2)', 0)
.assert.count('th:nth-child(1) .arrow.dsc', 1)
.assert.count('th:nth-child(2) .arrow.dsc', 0)
assertTable([
{ name: 'Jet Li', power: 8000 },
{ name: 'Jackie Chan', power: 7000 },
{ name: 'Chuck Norris', power: Infinity },
{ name: 'Bruce Lee', power: 9000 }
])
browser
.click('th:nth-child(2)')
.assert.count('th.active:nth-child(1)', 0)
.assert.count('th.active:nth-child(2)', 1)
.assert.count('th:nth-child(1) .arrow.dsc', 1)
.assert.count('th:nth-child(2) .arrow.dsc', 1)
assertTable([
{ name: 'Chuck Norris', power: Infinity },
{ name: 'Bruce Lee', power: 9000 },
{ name: 'Jet Li', power: 8000 },
{ name: 'Jackie Chan', power: 7000 }
])
browser
.click('th:nth-child(2)')
.assert.count('th.active:nth-child(1)', 0)
.assert.count('th.active:nth-child(2)', 1)
.assert.count('th:nth-child(1) .arrow.dsc', 1)
.assert.count('th:nth-child(2) .arrow.asc', 1)
assertTable([
{ name: 'Jackie Chan', power: 7000 },
{ name: 'Jet Li', power: 8000 },
{ name: 'Bruce Lee', power: 9000 },
{ name: 'Chuck Norris', power: Infinity }
])
browser
.click('th:nth-child(1)')
.assert.count('th.active:nth-child(1)', 1)
.assert.count('th.active:nth-child(2)', 0)
.assert.count('th:nth-child(1) .arrow.asc', 1)
.assert.count('th:nth-child(2) .arrow.asc', 1)
assertTable([
{ name: 'Bruce Lee', power: 9000 },
{ name: 'Chuck Norris', power: Infinity },
{ name: 'Jackie Chan', power: 7000 },
{ name: 'Jet Li', power: 8000 }
])
browser
.setValue('input[name="query"]', 'j')
assertTable([
{ name: 'Jackie Chan', power: 7000 },
{ name: 'Jet Li', power: 8000 }
])
browser
.clearValue('input[name="query"]')
.setValue('input[name="query"]', 'infinity')
assertTable([
{ name: 'Chuck Norris', power: Infinity }
])
browser
.clearValue('input[name="query"]')
.assert.count('p', 0)
.setValue('input[name="query"]', 'stringthatdoesnotexistanywhere')
.assert.count('p', 1)
browser.end()
function assertTable (data) {
browser.assert.count('td', data.length * columns.length)
for (var i = 0; i < data.length; i++) {
for (var j = 0; j < columns.length; j++) {
browser.assert.containsText(
'tr:nth-child(' + (i + 1) + ') td:nth-child(' + (j + 1) + ')',
data[i][columns[j]]
)
}
}
}
}
}
|
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _pure = require('recompose/pure');
var _pure2 = _interopRequireDefault(_pure);
var _SvgIcon = require('../../SvgIcon');
var _SvgIcon2 = _interopRequireDefault(_SvgIcon);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var ActionViewCarousel = function ActionViewCarousel(props) {
return _react2.default.createElement(
_SvgIcon2.default,
props,
_react2.default.createElement('path', { d: 'M7 19h10V4H7v15zm-5-2h4V6H2v11zM18 6v11h4V6h-4z' })
);
};
ActionViewCarousel = (0, _pure2.default)(ActionViewCarousel);
ActionViewCarousel.displayName = 'ActionViewCarousel';
ActionViewCarousel.muiName = 'SvgIcon';
exports.default = ActionViewCarousel;
|
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _pure = require('recompose/pure');
var _pure2 = _interopRequireDefault(_pure);
var _SvgIcon = require('../../SvgIcon');
var _SvgIcon2 = _interopRequireDefault(_SvgIcon);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var PlacesGolfCourse = function PlacesGolfCourse(props) {
return _react2.default.createElement(
_SvgIcon2.default,
props,
_react2.default.createElement('circle', { cx: '19.5', cy: '19.5', r: '1.5' }),
_react2.default.createElement('path', { d: 'M17 5.92L9 2v18H7v-1.73c-1.79.35-3 .99-3 1.73 0 1.1 2.69 2 6 2s6-.9 6-2c0-.99-2.16-1.81-5-1.97V8.98l6-3.06z' })
);
};
PlacesGolfCourse = (0, _pure2.default)(PlacesGolfCourse);
PlacesGolfCourse.displayName = 'PlacesGolfCourse';
PlacesGolfCourse.muiName = 'SvgIcon';
exports.default = PlacesGolfCourse;
|
description("This test checks the SVGTransformList API");
var svgElement = document.createElementNS("http://www.w3.org/2000/svg", "svg");
var rectElement = document.createElementNS("http://www.w3.org/2000/svg", "rect");
var transform = rectElement.transform.baseVal;
debug("");
debug("Check passing invalid arguments to 'createSVGTransformFromMatrix'");
shouldThrow("transform.createSVGTransformFromMatrix()");
shouldThrow("transform.createSVGTransformFromMatrix(svgElement.createSVGTransform())");
shouldThrow("transform.createSVGTransformFromMatrix(svgElement)");
shouldThrow("transform.createSVGTransformFromMatrix('aString')");
shouldThrow("transform.createSVGTransformFromMatrix(1)");
shouldThrow("transform.createSVGTransformFromMatrix(true)");
shouldThrow("transform.createSVGTransformFromMatrix(undefined)");
shouldThrow("transform.createSVGTransformFromMatrix(null)");
successfullyParsed = true;
|
// (C) Copyright 2015 Martin Dougiamas
//
// 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.
angular.module('mm.core')
/**
* This directive adds a "bar" with arrows to navigate forward/backward and a "info" icon to display more data.
*
* @module mm.core
* @ngdoc directive
* @name mmNavigationBar
* @description
* This directive will show two arrows at the left and right of the screen to navigate to previous/next item when clicked.
* If no previous/next item is defined, that arrow won't be shown. It will also show a button to show more info.
*
* @param {Mixed} [previous] Previous item. If not defined, the previous arrow won't be shown.
* @param {Mixed} [next] Next item. If not defined, the next arrow won't be shown.
* @param {Function} [action] Function to call when an arrow is clicked. Will receive as a param the item to load.
* @param {String} [info] Info to show when clicking the info button. If not defined, the info button won't be shown.
* @param {String} [title] Title to show when seeing the info (new state).
*/
.directive('mmNavigationBar', function($state, $translate) {
return {
restrict: 'E',
scope: {
previous: '=?',
next: '=?',
action: '=?',
info: '=?'
},
templateUrl: 'core/templates/navigationbar.html',
link: function(scope, element, attrs) {
scope.title = attrs.title || $translate.instant('mm.core.info');
scope.showInfo = function() {
$state.go('site.mm_textviewer', {
title: scope.title,
content: scope.info
});
};
}
};
});
|
/*
* Globalize Culture fr-MC
*
* http://github.com/jquery/globalize
*
* Copyright Software Freedom Conservancy, Inc.
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* This file was generated by the Globalize Culture Generator
* Translation: bugs found in this file need to be fixed in the generator
*/
(function( window, undefined ) {
var Globalize;
if ( typeof require !== "undefined"
&& typeof exports !== "undefined"
&& typeof module !== "undefined" ) {
// Assume CommonJS
Globalize = require( "globalize" );
} else {
// Global variable
Globalize = window.Globalize;
}
Globalize.addCultureInfo( "fr-MC", "default", {
name: "fr-MC",
englishName: "French (Monaco)",
nativeName: "français (Principauté de Monaco)",
language: "fr",
numberFormat: {
",": " ",
".": ",",
NaN: "Non Numérique",
negativeInfinity: "-Infini",
positiveInfinity: "+Infini",
percent: {
",": " ",
".": ","
},
currency: {
pattern: ["-n $","n $"],
",": " ",
".": ",",
symbol: "€"
}
},
calendars: {
standard: {
firstDay: 1,
days: {
names: ["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"],
namesAbbr: ["dim.","lun.","mar.","mer.","jeu.","ven.","sam."],
namesShort: ["di","lu","ma","me","je","ve","sa"]
},
months: {
names: ["janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre",""],
namesAbbr: ["janv.","févr.","mars","avr.","mai","juin","juil.","août","sept.","oct.","nov.","déc.",""]
},
AM: null,
PM: null,
eras: [{"name":"ap. J.-C.","start":null,"offset":0}],
patterns: {
d: "dd/MM/yyyy",
D: "dddd d MMMM yyyy",
t: "HH:mm",
T: "HH:mm:ss",
f: "dddd d MMMM yyyy HH:mm",
F: "dddd d MMMM yyyy HH:mm:ss",
M: "d MMMM",
Y: "MMMM yyyy"
}
}
}
});
}( this ));
|
tinyMCE.addI18n('lb.style_dlg',{
title:"CSS-Styles beaarbechten",
apply:"Iwwerhuelen",
text_tab:"Text",
background_tab:"Hannergrond",
block_tab:"Block",
box_tab:"Box",
border_tab:"Rumm",
list_tab:"L\u00EBscht",
positioning_tab:"Position\u00E9ierung",
text_props:"Text",
text_font:"Schr\u00EBftaart",
text_size:"Gr\u00E9isst",
text_weight:"D\u00E9ckt",
text_style:"Stil",
text_variant:"Variant",
text_lineheight:"Zeilenh\u00E9icht",
text_case:"Schreiwung",
text_color:"Fuerf",
text_decoration:"Gestaltung",
text_overline:"iwwerstrach",
text_underline:"\u00EBnnerstrach",
text_striketrough:"duerchgestrach",
text_blink:"bl\u00EBnkend",
text_none:"keng",
background_color:"Hannergrondfuerf",
background_image:"Hannergrondbild",
background_repeat:"Widderhuelung",
background_attachment:"Waasserzeecheneffekt",
background_hpos:"Positioun X",
background_vpos:"Positioun Y",
block_wordspacing:"Wuertofstand",
block_letterspacing:"Buschtawenofstand",
block_vertical_alignment:"Vertikal Ausriichtung",
block_text_align:"Ausriichtung",
block_text_indent:"Ar\u00E9ckung",
block_whitespace:"Automateschen \u00CBmbroch",
block_display:"\u00CBmbrochverhalen",
box_width:"Breet",
box_height:"H\u00E9icht",
box_float:"\u00CBmfl\u00E9issung",
box_clear:"\u00CBmfl\u00E9issung verh\u00EBnneren",
padding:"Banneschten Ofstand",
same:"All selwecht",
top:"Uewen",
right:"Riets",
bottom:"\u00CBnnen",
left:"L\u00E9nks",
margin:"Baussechten Ofstand",
style:"Format",
width:"Breet",
height:"H\u00E9icht",
color:"Textfuerf",
list_type:"L\u00EBschtepunkt-Aart",
bullet_image:"L\u00EBschtepunkt-Grafik",
position:"Position\u00E9ierung",
positioning_type:"Aart vun der Position\u00E9ierung",
visibility:"Siichtbar",
zindex:"Z-W\u00E4ert",
overflow:"Verhale bei Iwwergr\u00E9isst",
placement:"Plaz\u00E9ierung",
clip:"Ausschn\u00EBtt"
});
|
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'templates', 'el', {
button: 'Πρότυπα',
emptyListMsg: '(Δεν έχουν καθοριστεί πρότυπα)',
insertOption: 'Αντικατάσταση υπάρχοντων περιεχομένων',
options: 'Επιλογές Προτύπου',
selectPromptMsg: 'Παρακαλώ επιλέξτε πρότυπο για εισαγωγή στο πρόγραμμα',
title: 'Πρότυπα Περιεχομένου'
} );
|
/*
* JavaScript Debug - v0.3 - 6/8/2009
* http://benalman.com/projects/javascript-debug-console-log/
*
* Copyright (c) 2009 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*
* With lots of help from Paul Irish!
* http://paulirish.com/
*/
window.debug=(function(){var c=this,e=Array.prototype.slice,b=c.console,i={},f,g,j=9,d=["error","warn","info","debug","log"],m="assert clear count dir dirxml group groupEnd profile profileEnd time timeEnd trace".split(" "),k=m.length,a=[];while(--k>=0){(function(n){i[n]=function(){j!==0&&b&&b[n]&&b[n].apply(b,arguments)}})(m[k])}k=d.length;while(--k>=0){(function(n,o){i[o]=function(){var q=e.call(arguments),p=[o].concat(q);a.push(p);h(p);if(!b||!l(n)){return}b.firebug?b[o].apply(c,q):b[o]?b[o](q):b.log(q)}})(k,d[k])}function h(n){if(f&&(g||!b||!b.log)){f.apply(c,n)}}i.setLevel=function(n){j=typeof n==="number"?n:9};function l(n){return j>0?j>n:d.length+j<=n}i.setCallback=function(){var o=e.call(arguments),n=a.length,p=n;f=o.shift()||null;g=typeof o[0]==="boolean"?o.shift():false;p-=typeof o[0]==="number"?o.shift():n;while(p<n){h(a[p++])}};return i})();
|
/**
* $Id: editor_plugin_src.js 42 2006-08-08 14:32:24Z spocke $
*
* @author Moxiecode - based on work by Andrew Tetlaw
* @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
*/
function init() {
SXE.initElementDialog('del');
if (SXE.currentAction == "update") {
setFormValue('datetime', tinyMCEPopup.editor.dom.getAttrib(SXE.updateElement, 'datetime'));
setFormValue('cite', tinyMCEPopup.editor.dom.getAttrib(SXE.updateElement, 'cite'));
SXE.showRemoveButton();
}
}
function setElementAttribs(elm) {
setAllCommonAttribs(elm);
setAttrib(elm, 'datetime');
setAttrib(elm, 'cite');
}
function insertDel() {
var elm = tinyMCEPopup.editor.dom.getParent(SXE.focusElement, 'DEL');
tinyMCEPopup.execCommand('mceBeginUndoLevel');
if (elm == null) {
var s = SXE.inst.selection.getContent();
if(s.length > 0) {
tinyMCEPopup.execCommand('mceInsertContent', false, '<del id="#sxe_temp_del#">' + s + '</del>');
var elementArray = tinymce.grep(SXE.inst.dom.select('del'), function(n) {return n.id == '#sxe_temp_del#';});
for (var i=0; i<elementArray.length; i++) {
var elm = elementArray[i];
setElementAttribs(elm);
}
}
} else {
setElementAttribs(elm);
}
tinyMCEPopup.editor.nodeChanged();
tinyMCEPopup.execCommand('mceEndUndoLevel');
tinyMCEPopup.close();
}
function removeDel() {
SXE.removeElement('del');
tinyMCEPopup.close();
}
tinyMCEPopup.onInit.add(init);
|
require('../lib/node_loader');
var AWS = require('../lib/core');
var Service = require('../lib/service');
var apiLoader = require('../lib/api_loader');
apiLoader.services['mobileanalytics'] = {};
AWS.MobileAnalytics = Service.defineService('mobileanalytics', ['2014-06-05']);
Object.defineProperty(apiLoader.services['mobileanalytics'], '2014-06-05', {
get: function get() {
var model = require('../apis/mobileanalytics-2014-06-05.min.json');
return model;
},
enumerable: true,
configurable: true
});
module.exports = AWS.MobileAnalytics;
|
/**
* @fileoverview Disallows multiple blank lines.
* implementation adapted from the no-trailing-spaces rule.
* @author Greg Cochard
*/
"use strict";
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
module.exports = {
meta: {
docs: {
description: "disallow multiple empty lines",
category: "Stylistic Issues",
recommended: false
},
fixable: "whitespace",
schema: [
{
type: "object",
properties: {
max: {
type: "integer",
minimum: 0
},
maxEOF: {
type: "integer",
minimum: 0
},
maxBOF: {
type: "integer",
minimum: 0
}
},
required: ["max"],
additionalProperties: false
}
]
},
create(context) {
// Use options.max or 2 as default
let max = 2,
maxEOF = max,
maxBOF = max;
if (context.options.length) {
max = context.options[0].max;
maxEOF = typeof context.options[0].maxEOF !== "undefined" ? context.options[0].maxEOF : max;
maxBOF = typeof context.options[0].maxBOF !== "undefined" ? context.options[0].maxBOF : max;
}
const sourceCode = context.getSourceCode();
// Swallow the final newline, as some editors add it automatically and we don't want it to cause an issue
const allLines = sourceCode.lines[sourceCode.lines.length - 1] === "" ? sourceCode.lines.slice(0, -1) : sourceCode.lines;
const templateLiteralLines = new Set();
//--------------------------------------------------------------------------
// Public
//--------------------------------------------------------------------------
return {
TemplateLiteral(node) {
node.quasis.forEach(literalPart => {
// Empty lines have a semantic meaning if they're inside template literals. Don't count these as empty lines.
for (let ignoredLine = literalPart.loc.start.line; ignoredLine < literalPart.loc.end.line; ignoredLine++) {
templateLiteralLines.add(ignoredLine);
}
});
},
"Program:exit"(node) {
return allLines
// Given a list of lines, first get a list of line numbers that are non-empty.
.reduce((nonEmptyLineNumbers, line, index) => {
if (line.trim() || templateLiteralLines.has(index + 1)) {
nonEmptyLineNumbers.push(index + 1);
}
return nonEmptyLineNumbers;
}, [])
// Add a value at the end to allow trailing empty lines to be checked.
.concat(allLines.length + 1)
// Given two line numbers of non-empty lines, report the lines between if the difference is too large.
.reduce((lastLineNumber, lineNumber) => {
let message, maxAllowed;
if (lastLineNumber === 0) {
message = "Too many blank lines at the beginning of file. Max of {{max}} allowed.";
maxAllowed = maxBOF;
} else if (lineNumber === allLines.length + 1) {
message = "Too many blank lines at the end of file. Max of {{max}} allowed.";
maxAllowed = maxEOF;
} else {
message = "More than {{max}} blank {{pluralizedLines}} not allowed.";
maxAllowed = max;
}
if (lineNumber - lastLineNumber - 1 > maxAllowed) {
context.report({
node,
loc: { start: { line: lastLineNumber + 1, column: 0 }, end: { line: lineNumber, column: 0 } },
message,
data: { max: maxAllowed, pluralizedLines: maxAllowed === 1 ? "line" : "lines" },
fix(fixer) {
const rangeStart = sourceCode.getIndexFromLoc({ line: lastLineNumber + 1, column: 0 });
/*
* The end of the removal range is usually the start index of the next line.
* However, at the end of the file there is no next line, so the end of the
* range is just the length of the text.
*/
const lineNumberAfterRemovedLines = lineNumber - maxAllowed;
const rangeEnd = lineNumberAfterRemovedLines <= allLines.length
? sourceCode.getIndexFromLoc({ line: lineNumberAfterRemovedLines, column: 0 })
: sourceCode.text.length;
return fixer.removeRange([rangeStart, rangeEnd]);
}
});
}
return lineNumber;
}, 0);
}
};
}
};
|
var tape = require('tape')
var through = require('through2')
var concat = require('concat-stream')
var net = require('net')
var duplexify = require('./')
tape('passthrough', function(t) {
t.plan(2)
var pt = through()
var dup = duplexify(pt, pt)
dup.end('hello world')
dup.on('finish', function() {
t.ok(true, 'should finish')
})
dup.pipe(concat(function(data) {
t.same(data.toString(), 'hello world', 'same in as out')
}))
})
tape('passthrough + double end', function(t) {
t.plan(2)
var pt = through()
var dup = duplexify(pt, pt)
dup.end('hello world')
dup.end()
dup.on('finish', function() {
t.ok(true, 'should finish')
})
dup.pipe(concat(function(data) {
t.same(data.toString(), 'hello world', 'same in as out')
}))
})
tape('async passthrough + end', function(t) {
t.plan(2)
var pt = through.obj({highWaterMark:1}, function(data, enc, cb) {
setTimeout(function() {
cb(null, data)
}, 100)
})
var dup = duplexify(pt, pt)
dup.write('hello ')
dup.write('world')
dup.end()
dup.on('finish', function() {
t.ok(true, 'should finish')
})
dup.pipe(concat(function(data) {
t.same(data.toString(), 'hello world', 'same in as out')
}))
})
tape('duplex', function(t) {
var readExpected = ['read-a', 'read-b', 'read-c']
var writeExpected = ['write-a', 'write-b', 'write-c']
t.plan(readExpected.length+writeExpected.length+2)
var readable = through.obj()
var writable = through.obj(function(data, enc, cb) {
t.same(data, writeExpected.shift(), 'onwrite should match')
cb()
})
var dup = duplexify.obj(writable, readable)
readExpected.slice().forEach(function(data) {
readable.write(data)
})
readable.end()
writeExpected.slice().forEach(function(data) {
dup.write(data)
})
dup.end()
dup.on('data', function(data) {
t.same(data, readExpected.shift(), 'ondata should match')
})
dup.on('end', function() {
t.ok(true, 'should end')
})
dup.on('finish', function() {
t.ok(true, 'should finish')
})
})
tape('async', function(t) {
var dup = duplexify()
var pt = through()
dup.pipe(concat(function(data) {
t.same(data.toString(), 'i was async', 'same in as out')
t.end()
}))
dup.write('i')
dup.write(' was ')
dup.end('async')
setTimeout(function() {
dup.setWritable(pt)
setTimeout(function() {
dup.setReadable(pt)
}, 50)
}, 50)
})
tape('destroy', function(t) {
t.plan(2)
var write = through()
var read = through()
var dup = duplexify(write, read)
write.destroy = function() {
t.ok(true, 'write destroyed')
}
dup.on('close', function() {
t.ok(true, 'close emitted')
})
dup.destroy()
dup.destroy() // should only work once
})
tape('destroy both', function(t) {
t.plan(3)
var write = through()
var read = through()
var dup = duplexify(write, read)
write.destroy = function() {
t.ok(true, 'write destroyed')
}
read.destroy = function() {
t.ok(true, 'read destroyed')
}
dup.on('close', function() {
t.ok(true, 'close emitted')
})
dup.destroy()
dup.destroy() // should only work once
})
tape('bubble read errors', function(t) {
t.plan(2)
var write = through()
var read = through()
var dup = duplexify(write, read)
dup.on('error', function(err) {
t.same(err.message, 'read-error', 'received read error')
})
dup.on('close', function() {
t.ok(true, 'close emitted')
})
read.emit('error', new Error('read-error'))
write.emit('error', new Error('write-error')) // only emit first error
})
tape('bubble write errors', function(t) {
t.plan(2)
var write = through()
var read = through()
var dup = duplexify(write, read)
dup.on('error', function(err) {
t.same(err.message, 'write-error', 'received write error')
})
dup.on('close', function() {
t.ok(true, 'close emitted')
})
write.emit('error', new Error('write-error'))
read.emit('error', new Error('read-error')) // only emit first error
})
tape('reset writable / readable', function(t) {
t.plan(3)
var toUpperCase = function(data, enc, cb) {
cb(null, data.toString().toUpperCase())
}
var passthrough = through()
var upper = through(toUpperCase)
var dup = duplexify(passthrough, passthrough)
dup.once('data', function(data) {
t.same(data.toString(), 'hello')
dup.setWritable(upper)
dup.setReadable(upper)
dup.once('data', function(data) {
t.same(data.toString(), 'HELLO')
dup.once('data', function(data) {
t.same(data.toString(), 'HI')
t.end()
})
})
dup.write('hello')
dup.write('hi')
})
dup.write('hello')
})
tape('cork', function(t) {
var passthrough = through()
var dup = duplexify(passthrough, passthrough)
var ok = false
dup.on('prefinish', function() {
dup.cork()
setTimeout(function() {
ok = true
dup.uncork()
}, 100)
})
dup.on('finish', function() {
t.ok(ok)
t.end()
})
dup.end()
})
tape('prefinish not twice', function(t) {
var passthrough = through()
var dup = duplexify(passthrough, passthrough)
var prefinished = false
dup.on('prefinish', function() {
t.ok(!prefinished, 'only prefinish once')
prefinished = true
})
dup.on('finish', function() {
t.end()
})
dup.end()
})
tape('close', function(t) {
var passthrough = through()
var dup = duplexify(passthrough, passthrough)
passthrough.emit('close')
dup.on('close', function() {
t.ok(true, 'should forward close')
t.end()
})
})
tape('works with node native streams (net)', function(t) {
t.plan(1)
var server = net.createServer(function(socket) {
var dup = duplexify(socket, socket)
dup.once('data', function(chunk) {
t.same(chunk, Buffer('hello world'))
server.close()
socket.end()
t.end()
})
})
server.listen(0, function () {
var socket = net.connect(server.address().port)
var dup = duplexify(socket, socket)
dup.write(Buffer('hello world'))
})
})
|
"use strict";
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; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var Subject_1 = require('../Subject');
var tryCatch_1 = require('../util/tryCatch');
var errorObject_1 = require('../util/errorObject');
var OuterSubscriber_1 = require('../OuterSubscriber');
var subscribeToResult_1 = require('../util/subscribeToResult');
/**
* Returns an Observable that emits the same values as the source observable with the exception of an `error`.
* An `error` will cause the emission of the Throwable that cause the error to the Observable returned from
* notificationHandler. If that Observable calls onComplete or `error` then retry will call `complete` or `error`
* on the child subscription. Otherwise, this Observable will resubscribe to the source observable, on a particular
* Scheduler.
*
* <img src="./img/retryWhen.png" width="100%">
*
* @param {notificationHandler} receives an Observable of notifications with which a user can `complete` or `error`,
* aborting the retry.
* @param {scheduler} the Scheduler on which to subscribe to the source Observable.
* @return {Observable} the source Observable modified with retry logic.
* @method retryWhen
* @owner Observable
*/
function retryWhen(notifier) {
return this.lift(new RetryWhenOperator(notifier, this));
}
exports.retryWhen = retryWhen;
var RetryWhenOperator = (function () {
function RetryWhenOperator(notifier, source) {
this.notifier = notifier;
this.source = source;
}
RetryWhenOperator.prototype.call = function (subscriber, source) {
return source.subscribe(new RetryWhenSubscriber(subscriber, this.notifier, this.source));
};
return RetryWhenOperator;
}());
/**
* We need this JSDoc comment for affecting ESDoc.
* @ignore
* @extends {Ignored}
*/
var RetryWhenSubscriber = (function (_super) {
__extends(RetryWhenSubscriber, _super);
function RetryWhenSubscriber(destination, notifier, source) {
_super.call(this, destination);
this.notifier = notifier;
this.source = source;
}
RetryWhenSubscriber.prototype.error = function (err) {
if (!this.isStopped) {
var errors = this.errors;
var retries = this.retries;
var retriesSubscription = this.retriesSubscription;
if (!retries) {
errors = new Subject_1.Subject();
retries = tryCatch_1.tryCatch(this.notifier)(errors);
if (retries === errorObject_1.errorObject) {
return _super.prototype.error.call(this, errorObject_1.errorObject.e);
}
retriesSubscription = subscribeToResult_1.subscribeToResult(this, retries);
}
else {
this.errors = null;
this.retriesSubscription = null;
}
this.unsubscribe();
this.closed = false;
this.errors = errors;
this.retries = retries;
this.retriesSubscription = retriesSubscription;
errors.next(err);
}
};
RetryWhenSubscriber.prototype._unsubscribe = function () {
var _a = this, errors = _a.errors, retriesSubscription = _a.retriesSubscription;
if (errors) {
errors.unsubscribe();
this.errors = null;
}
if (retriesSubscription) {
retriesSubscription.unsubscribe();
this.retriesSubscription = null;
}
this.retries = null;
};
RetryWhenSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
var _a = this, errors = _a.errors, retries = _a.retries, retriesSubscription = _a.retriesSubscription;
this.errors = null;
this.retries = null;
this.retriesSubscription = null;
this.unsubscribe();
this.isStopped = false;
this.closed = false;
this.errors = errors;
this.retries = retries;
this.retriesSubscription = retriesSubscription;
this.source.subscribe(this);
};
return RetryWhenSubscriber;
}(OuterSubscriber_1.OuterSubscriber));
//# sourceMappingURL=retryWhen.js.map
|
/**
* @license
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
* The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
* Code distributed by Google as part of the polymer project is also
* subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
*/
(function() {
// Feature detect which polyfill needs to be imported.
let polyfills = [];
if (!('import' in document.createElement('link'))) {
polyfills.push('hi');
}
if (!('attachShadow' in Element.prototype && 'getRootNode' in Element.prototype) ||
(window.ShadyDOM && window.ShadyDOM.force)) {
polyfills.push('sd');
}
if (!window.customElements || window.customElements.forcePolyfill) {
polyfills.push('ce');
}
if (!('content' in document.createElement('template')) || !window.Promise ||
// Edge has broken fragment cloning which means you cannot clone template.content
!(document.createDocumentFragment().cloneNode() instanceof DocumentFragment)) {
polyfills.push('pf');
}
if (polyfills.length === 4) { // hi-ce-sd-pf is actually called lite.
polyfills = ['lite'];
}
if (polyfills.length) {
var script = document.querySelector('script[src*="webcomponents-loader.js"]');
let newScript = document.createElement('script');
// Load it from the right place.
var url = script.src.replace(
'webcomponents-loader.js', `webcomponents-${polyfills.join('-')}.js`);
newScript.src = url;
document.head.appendChild(newScript);
} else {
// Ensure `WebComponentsReady` is fired also when there are no polyfills loaded.
requestAnimationFrame(function() {
window.dispatchEvent(new CustomEvent('WebComponentsReady'));
});
}
})();
|
(function( factory ) {
if ( typeof define === "function" && define.amd ) {
define( ["jquery", "../jquery.validate"], factory );
} else {
factory( jQuery );
}
}(function( $ ) {
/*
* Translated default messages for the jQuery validation plugin.
* Locale: bn_BD (Bengali, Bangladesh)
*/
$.extend($.validator.messages, {
required: "এই তথ্যটি আবশ্যক।",
remote: "এই তথ্যটি ঠিক করুন।",
email: "অনুগ্রহ করে একটি সঠিক মেইল ঠিকানা লিখুন।",
url: "অনুগ্রহ করে একটি সঠিক লিঙ্ক দিন।",
date: "তারিখ সঠিক নয়।",
dateISO: "অনুগ্রহ করে একটি সঠিক (ISO) তারিখ লিখুন।",
number: "অনুগ্রহ করে একটি সঠিক নম্বর লিখুন।",
digits: "এখানে শুধু সংখ্যা ব্যবহার করা যাবে।",
creditcard: "অনুগ্রহ করে একটি ক্রেডিট কার্ডের সঠিক নম্বর লিখুন।",
equalTo: "একই মান আবার লিখুন।",
extension: "সঠিক ধরনের ফাইল আপলোড করুন।",
maxlength: $.validator.format("{0}টির বেশি অক্ষর লেখা যাবে না।"),
minlength: $.validator.format("{0}টির কম অক্ষর লেখা যাবে না।"),
rangelength: $.validator.format("{0} থেকে {1} টি অক্ষর সম্বলিত মান লিখুন।"),
range: $.validator.format("{0} থেকে {1} এর মধ্যে একটি মান ব্যবহার করুন।"),
max: $.validator.format("অনুগ্রহ করে {0} বা তার চাইতে কম মান ব্যবহার করুন।"),
min: $.validator.format("অনুগ্রহ করে {0} বা তার চাইতে বেশি মান ব্যবহার করুন।")
});
}));
|
/*************************************************************
*
* MathJax/jax/output/HTML-CSS/fonts/STIX/SizeThreeSym/Regular/Main.js
*
* Copyright (c) 2009-2015 The MathJax Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
MathJax.OutputJax['HTML-CSS'].FONTDATA.FONTS['STIXSizeThreeSym'] = {
directory: 'SizeThreeSym/Regular',
family: 'STIXSizeThreeSym',
Ranges: [
[0x2B0,0x2FF,"All"],
[0x300,0x338,"All"],
[0x203E,0x203E,"All"],
[0x20D0,0x20EF,"All"],
[0x221A,0x221C,"All"],
[0x239B,0x23B9,"All"],
[0x23DC,0x23E1,"All"],
[0x2772,0x2773,"All"],
[0x27E6,0x27EB,"All"],
[0x2983,0x2986,"All"]
],
0x20: [0,0,250,0,0], // SPACE
0x28: [2066,394,750,182,667], // LEFT PARENTHESIS
0x29: [2066,394,750,83,568], // RIGHT PARENTHESIS
0x2F: [2066,394,1101,30,1071], // SOLIDUS
0x5B: [2066,394,508,225,491], // LEFT SQUARE BRACKET
0x5C: [2066,394,1101,30,1071], // REVERSE SOLIDUS
0x5D: [2066,394,508,17,283], // RIGHT SQUARE BRACKET
0x5F: [-127,177,2000,0,2000], // LOW LINE
0x7B: [2066,394,906,143,717], // LEFT CURLY BRACKET
0x7D: [2066,394,906,189,763], // RIGHT CURLY BRACKET
0xA0: [0,0,250,0,0], // NO-BREAK SPACE
0x302: [777,-564,0,-1610,-150], // COMBINING CIRCUMFLEX ACCENT
0x303: [774,-608,0,-1612,-152], // COMBINING TILDE
0x221A: [2565,510,1076,112,1110], // SQUARE ROOT
0x2308: [2066,394,565,225,550], // LEFT CEILING
0x2309: [2066,394,565,15,340], // RIGHT CEILING
0x230A: [2066,394,565,225,550], // LEFT FLOOR
0x230B: [2066,394,565,15,340], // RIGHT FLOOR
0x23DE: [157,86,1886,0,1886], // TOP CURLY BRACKET (mathematical use)
0x23DF: [815,-572,1886,0,1886], // BOTTOM CURLY BRACKET (mathematical use)
0x27E8: [2066,394,765,96,670], // MATHEMATICAL LEFT ANGLE BRACKET
0x27E9: [2066,394,765,95,669] // MATHEMATICAL RIGHT ANGLE BRACKET
};
MathJax.OutputJax["HTML-CSS"].initFont("STIXSizeThreeSym");
MathJax.Ajax.loadComplete(MathJax.OutputJax["HTML-CSS"].fontDir + "/SizeThreeSym/Regular/Main.js");
|
/*!
* Stylus - Node
* Copyright(c) 2010 LearnBoost <dev@learnboost.com>
* MIT Licensed
*/
/**
* Module dependencies.
*/
var Evaluator = require('../visitor/evaluator')
, utils = require('../utils')
, nodes = require('./');
/**
* Initialize a new `CoercionError` with the given `msg`.
*
* @param {String} msg
* @api private
*/
function CoercionError(msg) {
this.name = 'CoercionError'
this.message = msg
Error.captureStackTrace(this, CoercionError);
}
/**
* Inherit from `Error.prototype`.
*/
CoercionError.prototype.__proto__ = Error.prototype;
/**
* Node constructor.
*
* @api public
*/
var Node = module.exports = function Node(){
this.lineno = nodes.lineno;
this.filename = nodes.filename;
};
Node.prototype = {
constructor: Node,
/**
* Return this node.
*
* @return {Node}
* @api public
*/
get first() {
return this;
},
/**
* Return hash.
*
* @return {String}
* @api public
*/
get hash() {
return this.val;
},
/**
* Return node name.
*
* @return {String}
* @api public
*/
get nodeName() {
return this.constructor.name.toLowerCase();
},
/**
* Return this node.
*
* @return {Node}
* @api public
*/
clone: function(){
return this;
},
/**
* Return a JSON representation of this node.
*
* @return {Object}
* @api public
*/
toJSON: function(){
return {
lineno: this.lineno,
filename: this.filename
};
},
/**
* Nodes by default evaluate to themselves.
*
* @return {Node}
* @api public
*/
eval: function(){
return new Evaluator(this).evaluate();
},
/**
* Return true.
*
* @return {Boolean}
* @api public
*/
toBoolean: function(){
return nodes.true;
},
/**
* Return the expression, or wrap this node in an expression.
*
* @return {Expression}
* @api public
*/
toExpression: function(){
if ('expression' == this.nodeName) return this;
var expr = new nodes.Expression;
expr.push(this);
return expr;
},
/**
* Return false if `op` is generally not coerced.
*
* @param {String} op
* @return {Boolean}
* @api private
*/
shouldCoerce: function(op){
switch (op) {
case 'is a':
case 'in':
case '||':
case '&&':
return false;
default:
return true;
}
},
/**
* Operate on `right` with the given `op`.
*
* @param {String} op
* @param {Node} right
* @return {Node}
* @api public
*/
operate: function(op, right){
switch (op) {
case 'is a':
if ('string' == right.nodeName) {
return nodes.Boolean(this.nodeName == right.val);
} else {
throw new Error('"is a" expects a string, got ' + right.toString());
}
case '==':
return nodes.Boolean(this.hash == right.hash);
case '!=':
return nodes.Boolean(this.hash != right.hash);
case '>=':
return nodes.Boolean(this.hash >= right.hash);
case '<=':
return nodes.Boolean(this.hash <= right.hash);
case '>':
return nodes.Boolean(this.hash > right.hash);
case '<':
return nodes.Boolean(this.hash < right.hash);
case '||':
return this.toBoolean().isTrue
? this
: right;
case 'in':
var vals = utils.unwrap(right).nodes
, len = vals && vals.length
, hash = this.hash;
if (!vals) throw new Error('"in" given invalid right-hand operand, expecting an expression');
// 'prop' in obj
if (1 == len && 'object' == vals[0].nodeName) {
return nodes.Boolean(vals[0].has(this.hash));
}
for (var i = 0; i < len; ++i) {
if (hash == vals[i].hash) {
return nodes.true;
}
}
return nodes.false;
case '&&':
var a = this.toBoolean()
, b = right.toBoolean();
return a.isTrue && b.isTrue
? right
: a.isFalse
? this
: right;
default:
if ('[]' == op) {
var msg = 'cannot perform '
+ this
+ '[' + right + ']';
} else {
var msg = 'cannot perform'
+ ' ' + this
+ ' ' + op
+ ' ' + right;
}
throw new Error(msg);
}
},
/**
* Default coercion throws.
*
* @param {Node} other
* @return {Node}
* @api public
*/
coerce: function(other){
if (other.nodeName == this.nodeName) return other;
throw new CoercionError('cannot coerce ' + other + ' to ' + this.nodeName);
}
};
|
var app = angular.module('parsedExpressionBenchmark', []);
app.config(function($compileProvider) {
if ($compileProvider.debugInfoEnabled) {
$compileProvider.debugInfoEnabled(false);
}
});
app.filter('noop', function() {
return function(input) {
return input;
};
});
//Executes the specified expression as a watcher
app.directive('bmPeWatch', function() {
return {
restrict: 'A',
compile: function($element, $attrs) {
$element.text( $attrs.bmPeWatch );
return function($scope, $element, $attrs) {
$scope.$watch($attrs.bmPeWatch, function(val) {
$element.text(val);
});
};
}
};
});
//Executes the specified expression as a watcher
//Adds a simple wrapper method to allow use of $watch instead of $watchCollection
app.directive('bmPeWatchLiteral', function($parse) {
function retZero() {
return 0;
}
return {
restrict: 'A',
compile: function($element, $attrs) {
$element.text( $attrs.bmPeWatchLiteral );
return function($scope, $element, $attrs) {
$scope.$watch( $parse($attrs.bmPeWatchLiteral, retZero) );
};
}
};
});
app.controller('DataController', function($scope, $rootScope) {
var totalRows = 10000;
var data = $scope.data = [];
var star = '*';
$scope.func = function() { return star;};
for (var i=0; i<totalRows; i++) {
data.push({
index: i,
odd: i%2 === 0,
even: i%2 === 1,
str0: "foo-" + Math.random()*Date.now(),
str1: "bar-" + Math.random()*Date.now(),
str2: "baz-" + Math.random()*Date.now(),
num0: Math.random()*Date.now(),
num1: Math.random()*Date.now(),
num2: Math.random()*Date.now(),
date0: new Date(Math.random()*Date.now()),
date1: new Date(Math.random()*Date.now()),
date2: new Date(Math.random()*Date.now()),
func: function(){ return star; },
obj: data[i-1],
keys: data[i-1] && (data[i-1].keys || Object.keys(data[i-1])),
constructor: data[i-1]
});
}
benchmarkSteps.push({
name: '$apply',
fn: function() {
for (var i=0; i<50; i++) {
$rootScope.$digest();
}
}
});
});
|
/**
* angular-strap
* @version v2.0.0-rc.2 - 2014-01-29
* @link http://mgcrea.github.io/angular-strap
* @author [object Object]
* @license MIT License, http://www.opensource.org/licenses/MIT
*/
angular.module('mgcrea.ngStrap.modal').run(['$templateCache', function($templateCache) {
'use strict';
$templateCache.put('modal/modal.tpl.html',
"<div class=\"modal\" tabindex=\"-1\" role=\"dialog\"><div class=\"modal-dialog\"><div class=\"modal-content\"><div class=\"modal-header\" ng-show=\"title\"><button type=\"button\" class=\"close\" ng-click=\"$hide()\">×</button><h4 class=\"modal-title\" ng-bind=\"title\"></h4></div><div class=\"modal-body\" ng-bind=\"content\"></div><div class=\"modal-footer\"><button type=\"button\" class=\"btn btn-default\" ng-click=\"$hide()\">Close</button></div></div></div></div>"
);
}]);
|
/* Copyright (C) 1999 Masanao Izumo <iz@onicos.co.jp>
* Version: 1.0
* LastModified: Dec 25 1999
* This library is free. You can redistribute it and/or modify it.
*/
/*
* Interfaces:
* b64 = base64encode(data);
* data = base64decode(b64);
*/
(function() {
var base64EncodeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
var base64DecodeChars = [
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63,
52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1,
-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1,
-1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1];
function base64encode(str) {
var out, i, len;
var c1, c2, c3;
len = str.length;
i = 0;
out = "";
while(i < len) {
c1 = str.charCodeAt(i++) & 0xff;
if(i == len)
{
out += base64EncodeChars.charAt(c1 >> 2);
out += base64EncodeChars.charAt((c1 & 0x3) << 4);
out += "==";
break;
}
c2 = str.charCodeAt(i++);
if(i == len)
{
out += base64EncodeChars.charAt(c1 >> 2);
out += base64EncodeChars.charAt(((c1 & 0x3)<< 4) | ((c2 & 0xF0) >> 4));
out += base64EncodeChars.charAt((c2 & 0xF) << 2);
out += "=";
break;
}
c3 = str.charCodeAt(i++);
out += base64EncodeChars.charAt(c1 >> 2);
out += base64EncodeChars.charAt(((c1 & 0x3)<< 4) | ((c2 & 0xF0) >> 4));
out += base64EncodeChars.charAt(((c2 & 0xF) << 2) | ((c3 & 0xC0) >>6));
out += base64EncodeChars.charAt(c3 & 0x3F);
}
return out;
}
function base64decode(str) {
var c1, c2, c3, c4;
var i, len, out;
len = str.length;
i = 0;
out = "";
while(i < len) {
/* c1 */
do {
c1 = base64DecodeChars[str.charCodeAt(i++) & 0xff];
} while(i < len && c1 == -1);
if(c1 == -1)
break;
/* c2 */
do {
c2 = base64DecodeChars[str.charCodeAt(i++) & 0xff];
} while(i < len && c2 == -1);
if(c2 == -1)
break;
out += String.fromCharCode((c1 << 2) | ((c2 & 0x30) >> 4));
/* c3 */
do {
c3 = str.charCodeAt(i++) & 0xff;
if(c3 == 61)
return out;
c3 = base64DecodeChars[c3];
} while(i < len && c3 == -1);
if(c3 == -1)
break;
out += String.fromCharCode(((c2 & 0XF) << 4) | ((c3 & 0x3C) >> 2));
/* c4 */
do {
c4 = str.charCodeAt(i++) & 0xff;
if(c4 == 61)
return out;
c4 = base64DecodeChars[c4];
} while(i < len && c4 == -1);
if(c4 == -1)
break;
out += String.fromCharCode(((c3 & 0x03) << 6) | c4);
}
return out;
}
if (!window.btoa) window.btoa = base64encode;
if (!window.atob) window.atob = base64decode;
})();
|
/**
* @author bhouston / http://exocortex.com
* @author mrdoob / http://mrdoob.com/
*/
THREE.Sphere = function ( center, radius ) {
this.center = ( center !== undefined ) ? center : new THREE.Vector3();
this.radius = ( radius !== undefined ) ? radius : 0;
};
THREE.Sphere.prototype = {
constructor: THREE.Sphere,
set: function ( center, radius ) {
this.center.copy( center );
this.radius = radius;
return this;
},
setFromPoints: function () {
var box = new THREE.Box3();
return function ( points, optionalCenter ) {
var center = this.center;
if ( optionalCenter !== undefined ) {
center.copy( optionalCenter );
} else {
box.setFromPoints( points ).center( center );
}
var maxRadiusSq = 0;
for ( var i = 0, il = points.length; i < il; i ++ ) {
maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( points[ i ] ) );
}
this.radius = Math.sqrt( maxRadiusSq );
return this;
};
}(),
copy: function ( sphere ) {
this.center.copy( sphere.center );
this.radius = sphere.radius;
return this;
},
empty: function () {
return ( this.radius <= 0 );
},
containsPoint: function ( point ) {
return ( point.distanceToSquared( this.center ) <= ( this.radius * this.radius ) );
},
distanceToPoint: function ( point ) {
return ( point.distanceTo( this.center ) - this.radius );
},
intersectsSphere: function ( sphere ) {
var radiusSum = this.radius + sphere.radius;
return sphere.center.distanceToSquared( this.center ) <= ( radiusSum * radiusSum );
},
clampPoint: function ( point, optionalTarget ) {
var deltaLengthSq = this.center.distanceToSquared( point );
var result = optionalTarget || new THREE.Vector3();
result.copy( point );
if ( deltaLengthSq > ( this.radius * this.radius ) ) {
result.sub( this.center ).normalize();
result.multiplyScalar( this.radius ).add( this.center );
}
return result;
},
getBoundingBox: function ( optionalTarget ) {
var box = optionalTarget || new THREE.Box3();
box.set( this.center, this.center );
box.expandByScalar( this.radius );
return box;
},
applyMatrix4: function ( matrix ) {
this.center.applyMatrix4( matrix );
this.radius = this.radius * matrix.getMaxScaleOnAxis();
return this;
},
translate: function ( offset ) {
this.center.add( offset );
return this;
},
equals: function ( sphere ) {
return sphere.center.equals( this.center ) && ( sphere.radius === this.radius );
},
clone: function () {
return new THREE.Sphere().copy( this );
}
};
|
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
var fs = require("graceful-fs");
function SyncNodeJsInputFileSystem() {}
module.exports = SyncNodeJsInputFileSystem;
SyncNodeJsInputFileSystem.prototype.isSync = function() {
return true;
};
function asAsync(fn, context) {
return function() {
var args = Array.prototype.slice.call(arguments);
var callback = args.pop();
try {
callback(null, fn.apply(context, args));
} catch(e) {
callback(e);
}
};
}
SyncNodeJsInputFileSystem.prototype.stat = asAsync(fs.statSync, fs);
SyncNodeJsInputFileSystem.prototype.readdir = asAsync(function readdirSync(path) {
var files = fs.readdirSync(path);
return files && files.map(function (file) {
return file.normalize ? file.normalize("NFC") : file;
});
}, fs);
SyncNodeJsInputFileSystem.prototype.readFile = asAsync(fs.readFileSync, fs);
SyncNodeJsInputFileSystem.prototype.readlink = asAsync(fs.readlinkSync, fs);
|
define([
"./core",
"./core/init",
"./manipulation", // clone
"./traversing" // parent, contents
], function( jQuery ) {
jQuery.fn.extend({
wrapAll: function( html ) {
if ( jQuery.isFunction( html ) ) {
return this.each(function(i) {
jQuery(this).wrapAll( html.call(this, i) );
});
}
if ( this[0] ) {
// The elements to wrap the target around
var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);
if ( this[0].parentNode ) {
wrap.insertBefore( this[0] );
}
wrap.map(function() {
var elem = this;
while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
elem = elem.firstChild;
}
return elem;
}).append( this );
}
return this;
},
wrapInner: function( html ) {
if ( jQuery.isFunction( html ) ) {
return this.each(function(i) {
jQuery(this).wrapInner( html.call(this, i) );
});
}
return this.each(function() {
var self = jQuery( this ),
contents = self.contents();
if ( contents.length ) {
contents.wrapAll( html );
} else {
self.append( html );
}
});
},
wrap: function( html ) {
var isFunction = jQuery.isFunction( html );
return this.each(function(i) {
jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );
});
},
unwrap: function() {
return this.parent().each(function() {
if ( !jQuery.nodeName( this, "body" ) ) {
jQuery( this ).replaceWith( this.childNodes );
}
}).end();
}
});
return jQuery;
});
|
'use strict';
var Buffer = require('../../').Buffer;
var assert = require('assert');
var Buffer = require('../../').Buffer;
var LENGTH = 16;
var ab = new ArrayBuffer(LENGTH);
var dv = new DataView(ab);
var ui = new Uint8Array(ab);
var buf = Buffer.from(ab);
assert.ok(buf instanceof Buffer);
// For backwards compatibility of old .parent property test that if buf is not
// a slice then .parent should be undefined.
assert.equal(buf.parent, undefined);
assert.equal(buf.buffer, ab);
assert.equal(buf.length, ab.byteLength);
buf.fill(0xC);
for (var i = 0; i < LENGTH; i++) {
assert.equal(ui[i], 0xC);
ui[i] = 0xF;
assert.equal(buf[i], 0xF);
}
buf.writeUInt32LE(0xF00, 0);
buf.writeUInt32BE(0xB47, 4);
buf.writeDoubleLE(3.1415, 8);
assert.equal(dv.getUint32(0, true), 0xF00);
assert.equal(dv.getUint32(4), 0xB47);
assert.equal(dv.getFloat64(8, true), 3.1415);
// Now test protecting users from doing stupid things
assert.throws(function() {
function AB() { }
Object.setPrototypeOf(AB, ArrayBuffer);
Object.setPrototypeOf(AB.prototype, ArrayBuffer.prototype);
Buffer.from(new AB());
}, TypeError);
// write{Double,Float}{LE,BE} with noAssert should not crash, cf. #3766
var b = Buffer.allocUnsafe(1);
b.writeFloatLE(11.11, 0, true);
b.writeFloatBE(11.11, 0, true);
b.writeDoubleLE(11.11, 0, true);
b.writeDoubleBE(11.11, 0, true);
// Test the byteOffset and length arguments
{
var ab = new Uint8Array(5);
ab[0] = 1;
ab[1] = 2;
ab[2] = 3;
ab[3] = 4;
ab[4] = 5;
var buf = Buffer.from(ab.buffer, 1, 3);
assert.equal(buf.length, 3);
assert.equal(buf[0], 2);
assert.equal(buf[1], 3);
assert.equal(buf[2], 4);
buf[0] = 9;
assert.equal(ab[1], 9);
assert.throws(() => Buffer.from(ab.buffer, 6), (err) => {
assert(err instanceof RangeError);
assert(/'offset' is out of bounds/.test(err.message));
return true;
});
assert.throws(() => Buffer.from(ab.buffer, 3, 6), (err) => {
assert(err instanceof RangeError);
assert(/'length' is out of bounds/.test(err.message));
return true;
});
}
// Test the deprecated Buffer() version also
{
var ab = new Uint8Array(5);
ab[0] = 1;
ab[1] = 2;
ab[2] = 3;
ab[3] = 4;
ab[4] = 5;
var buf = Buffer(ab.buffer, 1, 3);
assert.equal(buf.length, 3);
assert.equal(buf[0], 2);
assert.equal(buf[1], 3);
assert.equal(buf[2], 4);
buf[0] = 9;
assert.equal(ab[1], 9);
assert.throws(() => Buffer(ab.buffer, 6), (err) => {
assert(err instanceof RangeError);
assert(/'offset' is out of bounds/.test(err.message));
return true;
});
assert.throws(() => Buffer(ab.buffer, 3, 6), (err) => {
assert(err instanceof RangeError);
assert(/'length' is out of bounds/.test(err.message));
return true;
});
}
|
import baseAt from './_baseAt.js';
import flatRest from './_flatRest.js';
/**
* Creates an array of values corresponding to `paths` of `object`.
*
* @static
* @memberOf _
* @since 1.0.0
* @category Object
* @param {Object} object The object to iterate over.
* @param {...(string|string[])} [paths] The property paths to pick.
* @returns {Array} Returns the picked values.
* @example
*
* var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
*
* _.at(object, ['a[0].b.c', 'a[1]']);
* // => [3, 4]
*/
var at = flatRest(baseAt);
export default at;
|
var map = require("map-stream"),
Path = require("path");
module.exports = function (obj) {
"use strict";
function parsePath(path) {
var extname = Path.extname(path);
return {
dirname: Path.dirname(path),
basename: Path.basename(path, extname),
extname: extname
};
}
function rename(file, callback) {
var parsedPath = parsePath(file.relative);
var path;
var type = typeof obj;
if (type === "string" && obj !== "") {
path = obj;
} else if (type === "function") {
var result = obj(parsedPath) || parsedPath;
path = Path.join(result.dirname, result.basename + result.extname);
} else if (type === "object" && obj !== undefined && obj !== null) {
var dirname = 'dirname' in obj ? obj.dirname : parsedPath.dirname,
prefix = obj.prefix || "",
suffix = obj.suffix || "",
basename = 'basename' in obj ? obj.basename : parsedPath.basename,
extname = 'extname' in obj ? obj.extname : parsedPath.extname;
path = Path.join(dirname, prefix + basename + suffix + extname);
} else {
callback(new Error("Unsupported renaming parameter type supplied"), undefined);
return;
}
file.path = Path.join(file.base, path);
callback(null, file);
}
return map(rename);
};
|
'use strict';
const MongoClient = require('mongodb').MongoClient;
const mongo = {
client: null,
db: null,
};
function init(env, cb, forceNewConnection) {
function maybe_connect(cb) {
if (mongo.db != null && !forceNewConnection) {
console.log('Reusing MongoDB connection handler');
// If there is a valid callback, then return the Mongo-object
if (cb && cb.call) {
cb(null, mongo);
}
} else {
if (!env.storageURI) {
throw new Error('MongoDB connection string is missing. Please set MONGODB_URI environment variable');
}
console.log('Setting up new connection to MongoDB');
const options = {
useNewUrlParser: true,
useUnifiedTopology: true,
};
const connect_with_retry = async function (i) {
mongo.client = new MongoClient(env.storageURI, options);
try {
await mongo.client.connect();
console.log('Successfully established connection to MongoDB');
const dbName = mongo.client.s.options.dbName;
mongo.db = mongo.client.db(dbName);
const result = await mongo.db.command({ connectionStatus: 1 });
const roles = result.authInfo.authenticatedUserRoles;
if (roles.length > 0 && roles[0].role == 'readAnyDatabase') {
console.error('Mongo user is read only');
cb(new Error('MongoDB connection is in read only mode! Go back to MongoDB configuration and check your database user has read and write access.'), null);
}
console.log('Mongo user role seems ok:', roles);
// If there is a valid callback, then invoke the function to perform the callback
if (cb && cb.call) {
cb(null, mongo);
}
} catch (err) {
if (err.message && err.message.includes('AuthenticationFailed')) {
console.log('Authentication to Mongo failed');
cb(new Error('MongoDB authentication failed! Double check the URL has the right username and password in MONGODB_URI.'), null);
return;
}
if (err.name && err.name === "MongoServerSelectionError") {
const timeout = (i > 15) ? 60000 : i * 3000;
console.log('Error connecting to MongoDB: %j - retrying in ' + timeout / 1000 + ' sec', err);
setTimeout(connect_with_retry, timeout, i + 1);
if (i == 1) cb(new Error('MongoDB connection failed! Double check the MONGODB_URI setting in Heroku.'), null);
} else {
cb(new Error('MONGODB_URI seems invalid: ' + err.message));
}
}
};
return connect_with_retry(1);
}
}
mongo.collection = function get_collection(name) {
return mongo.db.collection(name);
};
mongo.ensureIndexes = function ensureIndexes(collection, fields) {
fields.forEach(function (field) {
console.info('ensuring index for: ' + field);
collection.createIndex(field, { 'background': true }, function (err) {
if (err) {
console.error('unable to ensureIndex for: ' + field + ' - ' + err);
}
});
});
};
return maybe_connect(cb);
}
module.exports = init;
|
日本語 = []
|
define(['a'], function (a) {
return {
name: 'c',
a: a
};
});
|
var registry = require('./registry');
var util = require('./util');
/**
* A module that manage services.
* @module woodpecker
*/
/**
Save a service
@param {Function} service - A named constructor function for a service.
*//**
Save a service
@param {string} name - The name under the service will be registered.
@param {Function} service - A constructor function for a service.
*//**
Save a service
@param {string} name - The name under the service will be registered.
@param {Function} service - A constructor function for a service.
@param {boolean} singleton - A flag to determine whether a service is to be constructed on every request.
*//**
Returns a service under the registered name
@returns {object} A service instance.
*/
module.exports.service = function() {
var args = util.extractArguments(Array.prototype.slice.call(arguments, 0));
if (args.load) {
return loadService(args.name);
} else {
return saveService(args.name, args.service, args.singleton);
}
};
/**
Clean up all services
*/
module.exports.clean = function() {
registry.clean();
};
function loadService(name) {
return registry.load(name);
}
function saveService(name, service, singleton) {
return registry.save(name, service, singleton);
}
|
/**
*
* @module lib/valve
* @author Brandon Kite
*/
if (process.env.MODE === 'desktop') {
module.exports = {
openValve: function() {},
closeValve: function() {}
}
} else {
var b = require('bonescript');
var BLACK_PIN = "P8_17";
var RED_PIN = "P8_15";
var TRANSITION_TIME = 4000;
b.pinMode(BLACK_PIN, b.OUTPUT);
b.digitalWrite(BLACK_PIN, b.LOW);
b.pinMode(RED_PIN, b.OUTPUT);
b.digitalWrite(RED_PIN, b.LOW);
function triggerValve(pin) {
return function openValve(callback) {
//reset any previous state
b.digitalWrite(BLACK_PIN, b.LOW);
b.digitalWrite(RED_PIN, b.LOW);
//start valve transitioning
b.digitalWrite(pin, b.HIGH);
setTimeout(function() {
b.digitalWrite(pin, b.LOW);
if (callback) {
callback();
}
}, TRANSITION_TIME);
}
}
module.exports = {
openValve: triggerValve(BLACK_PIN),
closeValve: triggerValve(RED_PIN)
}
}
|
'use strict';
var Firebase = require('firebase');
var cp = require('../../lib/cp');
describe('cp', function() {
var root;
beforeEach(function(done) {
root = new Firebase('brazier-cp-spec.firebaseio-demo.com');
root.set({
prisonCells: {
lotr: {
state: 'agitated',
names: ['Sam', 'Frodo'],
eyeOfSauron: 'nearby'
},
starwars: {
state: 'blase',
block: 1138,
names: ['Luke', 'Leia', 'Han', 'Chewie', 'garbage alien']
},
goldfinger: {
state: 'singed',
names: 'Bond, James Bond'
}
}
}, done);
});
it('copies data from one ref to another without overwriting existing values', function(done) {
cp(root.child('prisonCells/starwars'), root.child('prisonCells/lotr'), function(err) {
if (err) {
done(err);
} else {
root.child('prisonCells/lotr')
.once('value', function(snap) {
expect(snap.val()).toEqual({
state: 'agitated',
eyeOfSauron: 'nearby',
names: ['Sam', 'Frodo', 'Han', 'Chewie', 'garbage alien'],
block: 1138
});
done();
}, done);
}
});
});
it('optionally copies data and overwrites', function(done) {
cp(root.child('prisonCells/lotr'), root.child('prisonCells/starwars'), function(err) {
if (err) {
done(err);
} else {
root.child('prisonCells/starwars')
.once('value', function(snap) {
expect(snap.val()).toEqual({
state: 'agitated',
block: 1138,
eyeOfSauron: 'nearby',
names: ['Sam', 'Frodo', 'Han', 'Chewie', 'garbage alien']
});
done();
}, done);
}
}, true);
});
});
|
var Promise = require('promise'),
jsonDownload = require('./util/json-download'),
resolvePath = require('./util/resolve-path'),
bytes = require('bytes'),
fse = require('fs-extra');
module.exports = function(name, path) {
var localRegistry = this.registry,
emitter = this,
localRegistrySamples,
resolvedPath;
return localRegistry.read()
.then(function(data) {
localRegistrySamples = data.samples;
if (!localRegistrySamples.hasOwnProperty(name)) {
throw new Error("cannot install sample: \""+name+"\" not known in the registry")
}
resolvedPath = resolvePath(path, localRegistrySamples[name].url)
})
.then(function() {
if (!fse.existsSync(resolvedPath)) {
return jsonDownload(localRegistrySamples[name].url, path)
.then(function(stats) {
emitter.emit("log", {
message: "saved sample \"" + name + "\" to " + stats.path + " (" + bytes(stats.numBytes) + ")",
op: "add"
});
return { path: resolvedPath };
});
} else {
emitter.emit("log", {
"message": "skipping sample \"" + name + "\" because " + resolvedPath + " already exists"
});
return { path: resolvedPath };
}
})
};
|
/*!
* UI development toolkit for HTML5 (OpenUI5)
* (c) Copyright 2009-2016 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
sap.ui.define(['jquery.sap.global', './InputBase', './library'],
function(jQuery, InputBase, library) {
"use strict";
/**
* Constructor for a new ComboBoxTextField.
*
* @param {string} [sId] ID for the new control, generated automatically if no ID is given.
* @param {object} [mSettings] Initial settings for the new control.
*
* @class
* The <code>sap.m.ComboBoxTextField</code>.
* @extends sap.m.InputBase
*
* @author SAP SE
* @version 1.36.5
*
* @constructor
* @public
* @since 1.34
* @alias sap.m.ComboBoxTextField
* @ui5-metamodel This control will also be described in the UI5 (legacy) design time meta model.
*/
var ComboBoxTextField = InputBase.extend("sap.m.ComboBoxTextField", /** @lends sap.m.ComboBoxTextField.prototype */ {
metadata: {
library: "sap.m",
properties: {
/**
* Sets the maximum width of the text field.
*/
maxWidth: {
type: "sap.ui.core.CSSSize",
group: "Dimension",
defaultValue: "100%"
}
}
}
});
ComboBoxTextField.prototype.updateValueStateClasses = function(sValueState, sOldValueState) {
InputBase.prototype.updateValueStateClasses.apply(this, arguments);
var mValueState = sap.ui.core.ValueState,
CSS_CLASS = this.getRenderer().CSS_CLASS_COMBOBOXTEXTFIELD,
$DomRef = this.$();
if (sOldValueState !== mValueState.None) {
$DomRef.removeClass(CSS_CLASS + "State " + CSS_CLASS + sOldValueState);
}
if (sValueState !== mValueState.None) {
$DomRef.addClass(CSS_CLASS + "State " + CSS_CLASS + sValueState);
}
};
return ComboBoxTextField;
}, true);
|
//import edit from "./edit.js"
export function getName() {
console.log("module_a_detail");
}
|
import Collection from "./Collection";
import Sprite from "./Sprite";
export default class Group extends Sprite {
constructor (x, y, w, h) {
super(x, y, w, h);
this.isGroup = true;
this.items = new Collection();
}
}
|
'use strict'
const Circular = require('./Circular')
const Indenter = require('./Indenter')
const describe = require('./describe')
const lineBuilder = require('./lineBuilder')
const themeUtils = require('./themeUtils')
const alwaysFormat = () => true
const fixedIndent = new Indenter(0, ' ')
function formatDescriptor (subject, options) {
const theme = themeUtils.normalize(options)
if (subject.isPrimitive === true) {
const formatted = subject.formatDeep(themeUtils.applyModifiers(subject, theme), fixedIndent)
return formatted.toString({ diff: false })
}
const circular = new Circular()
const maxDepth = (options && options.maxDepth) || 0
let indent = fixedIndent
const buffer = lineBuilder.buffer()
const stack = []
let topIndex = -1
do {
if (circular.has(subject)) {
stack[topIndex].formatter.append(lineBuilder.single(theme.circular), subject)
} else {
let didFormat = false
if (typeof subject.formatDeep === 'function') {
const formatted = subject.formatDeep(themeUtils.applyModifiers(subject, theme), indent)
if (formatted !== null) {
didFormat = true
if (topIndex === -1) {
buffer.append(formatted)
} else {
stack[topIndex].formatter.append(formatted, subject)
}
}
}
if (!didFormat && typeof subject.formatShallow === 'function') {
const formatter = subject.formatShallow(themeUtils.applyModifiers(subject, theme), indent)
const recursor = subject.createRecursor()
if (formatter.increaseIndent && maxDepth > 0 && indent.level === maxDepth) {
const isEmpty = recursor() === null
const formatted = !isEmpty && typeof formatter.maxDepth === 'function'
? formatter.maxDepth()
: formatter.finalize()
stack[topIndex].formatter.append(formatted, subject)
} else {
stack.push({
formatter,
recursor,
decreaseIndent: formatter.increaseIndent,
shouldFormat: formatter.shouldFormat || alwaysFormat,
subject,
})
topIndex++
if (formatter.increaseIndent) indent = indent.increase()
circular.add(subject)
}
}
}
while (topIndex >= 0) {
do {
subject = stack[topIndex].recursor()
} while (subject && !stack[topIndex].shouldFormat(subject))
if (subject) {
break
}
const record = stack.pop()
topIndex--
if (record.decreaseIndent) indent = indent.decrease()
circular.delete(record.subject)
const formatted = record.formatter.finalize()
if (topIndex === -1) {
buffer.append(formatted)
} else {
stack[topIndex].formatter.append(formatted, record.subject)
}
}
} while (topIndex >= 0)
return buffer.toString({ diff: false })
}
exports.formatDescriptor = formatDescriptor
function format (value, options) {
return formatDescriptor(describe(value, options), options)
}
exports.format = format
|
// Copyright (c) 2014-2019, Quentin Rossetti <quentin.rossetti@gmail.com>
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
export const FLAGS = [
{ type: 'bool', api: 'alternateStreamExtract', cli: 'snc' }, // Extract file as alternate stream, if there is ':' character in name
{ type: 'bool', api: 'alternateStreamReplace', cli: 'snr' }, // Replace ':' character to '_' character in paths of alternate streams
{ type: 'bool', api: 'deleteFilesAfter', cli: 'sdel' }, // Delete files after compression
{ type: 'bool', api: 'fullyQualifiedPaths', cli: 'spf' }, // Use fully qualified file paths
{ type: 'bool', api: 'hardlinks', cli: 'snh' }, // Store hard links as links (WIM and TAR formats only)
{ type: 'bool', api: 'largePages', cli: 'spl' }, // Set Large Pages mode
{ type: 'bool', api: 'latestTimeStamp', cli: 'stl' }, // Set archive timestamp from the most recently modified file
{ type: 'bool', api: 'noArchiveOnFail', cli: 'sse' }, // Stop archive creating, if 7-Zip can't open some input file.
{ type: 'bool', api: 'noRootDuplication', cli: 'spe' }, // Eliminate duplication of root folder for extract command
{ type: 'bool', api: 'noWildcards', cli: 'spd' }, // Disable wildcard matching for file names
{ type: 'bool', api: 'ntSecurity', cli: 'sni' }, // Store NT security
{ type: 'bool', api: 'openFiles', cli: 'ssw' }, // Compress files open for writing
{ type: 'bool', api: 'recursive', cli: 'r' }, // Recurse subdirectories. For `-r0` usage see `raw`
{ type: 'bool', api: 'symlinks', cli: 'snl' }, // Store symbolic links as links (WIM and TAR formats only)
{ type: 'bool', api: 'techInfo', cli: 'slt' }, // Show technical information
{ type: 'bool', api: 'timeStats', cli: 'bt' },
{ type: 'bool', api: 'toStdout', cli: 'so' }, // Write data to stdout
{ type: 'bool', api: 'yes', cli: 'y' }, // Assume Yes on all queries
{ type: 'bool', api: 'sortByType', cli: 'mqs' }, // Sort files by type while adding to solid 7z archive
{ type: 'boolContext', api: 'alternateStreamStore', cli: 'sns' }, // Store NTFS alternate Streams
{ type: 'boolContext', api: 'caseSensitive', cli: 'ssc' }, // Set Sensitive Case mode
{ type: 'string', api: 'archiveNameMode', cli: 'sa' }, // Set Archive name mode
{ type: 'string', api: 'archiveType', cli: 't' }, // Type of archive
{ type: 'string', api: 'cpuAffinity', cli: 'stm' }, // Set CPU thread affinity mask (hexadecimal number).
{ type: 'string', api: 'excludeArchiveType', cli: 'stx' }, // Exclude archive type
{ type: 'string', api: 'fromStdin', cli: 'si' }, // Read data from StdIn
{ type: 'string', api: 'hashMethod', cli: 'scrc' }, // Set hash function
{ type: 'string', api: 'listFileCharset', cli: 'scs' }, // Set charset for list files
{ type: 'string', api: 'charset', cli: 'scc' }, // Set charset for console input/output
{ type: 'string', api: 'logLevel', cli: 'bb' }, // Set output log level
{ type: 'string', api: 'outputDir', cli: 'o' }, // Set Output directory
{ type: 'string', api: 'overwrite', cli: 'ao' }, // Overwrite mode
{ type: 'string', api: 'password', cli: 'p' }, // Set Password
{ type: 'string', api: 'sfx', cli: 'sfx' }, // Create SFX archive
{ type: 'string', api: 'updateOptions', cli: 'u' }, // Update options
{ type: 'string', api: 'workingDir', cli: 'w' }, // Set Working directory
{ type: 'string', api: 'multiBlockSize', cli: 'ms' }, // Creates multi-block xz archives by default. Block size can be specified with -ms[Size]{m|g} switch
{ type: 'stringArray', api: 'excludeArchive', cli: 'ax' }, // Exclude archive filenames
{ type: 'stringArray', api: 'exclude', cli: 'x' }, // Exclude filenames
{ type: 'stringArray', api: 'include', cli: 'i' }, // Include filenames
{ type: 'stringArray', api: 'includeArchive', cli: 'ai' }, // Include archive filenames
{ type: 'stringArray', api: 'method', cli: 'm' }, // Set Compression Method
{ type: 'stringArray', api: 'outputStreams', cli: 'bs' }, // Set output stream for output/error/progress
{ type: 'stringArray', api: 'volumes', cli: 'v' } // Create Volumes
// Advanced
]
export const OPTIONS_DEFAULT = {
yes: true,
logLevel: '3',
outputStreams: []
}
export const BIN_DEFAULT = '7z'
export const STAGE_HEADERS = Symbol('STAGE_HEADERS')
export const STAGE_BODY = Symbol('STAGE_BODY')
export const STAGE_FOOTERS = Symbol('STAGE_FOOTERS')
export const COMMAND_LETTERS = {
add: 'a',
delete: 'd',
extract: 'e',
extractFull: 'x',
hash: 'h',
list: 'l',
listTechInfo: 'l',
rename: 'rn',
test: 't',
update: 'u'
}
/* eslint-disable */
// =TU+R.-
export const SYMBOL_OPERATIONS = {
'=': 'renamed',
'T': 'tested',
'U': 'updated',
'R': 'skipped',
'.': 'deleted',
'-': 'extracted'
}
/* eslint-enable */
|
var test = require('tap').test
var mock = require('nodemock')
test("push a custom object", function(t){
var union = require('../index.js')().New()
var x = {};
union.push(x)
union.set('a', 'A')
t.equals(x['a'], 'A')
t.end()
})
test("pop a custom object", function(t){
var union = require('../index.js')().New()
var x = {};
union.set('b', 'B')
union.push(x)
union.set('a', 'A')
x = union.pop()
t.equals(x['a'], 'A')
t.equals(x['b'], undefined)
t.end()
})
|
'use strict'
const Joi = require('joi')
const recordBase = require('./record_base')
module.exports = recordBase.keys({
record_type: Joi.string().valid('TXT').required(),
// Allowed in TXT records are ASCII letters, plus a selected set of
// symbols, which translates to this gobbledygook you see in the regex
// below. The \[\\\]\ sequence just whitelists the characters [\], but
// since they all need escaping in regex, it becomes a bit strange.
text_content: Joi.string().required().regex(/^[A-Za-z0-9 !"#\$%&'()*+,-.\/:;<=>?@\[\\\]\^_`{\|}~-]+$/)
})
|
// Possible event.which values.
Cute.LEFT_BUTTON = 1
Cute.MIDDLE_BUTTON = 2
Cute.RIGHT_BUTTON = 3
// Possible event.keyCode values.
Cute.ENTER_KEY = 13
Cute.SHIFT_KEY = 16
Cute.CTRL_KEY = 17
Cute.ALT_KEY = 18
Cute.COMMAND_KEY = 19
Cute.ESC_KEY = 27
Cute.SPACE_KEY = 32
Cute.LEFT_KEY = 37
Cute.UP_KEY = 38
Cute.RIGHT_KEY = 39
Cute.DOWN_KEY = 40
Cute.on('keydown,keyup', function (element, event, type) {
Cute.on[event.keyCode] = (type !== 'keyup')
})
Cute.on('mousedown,mouseup', function (element, event, type) {
Cute.on[event.which] = (type !== 'mouseup')
})
|
/* global define, it, describe, afterEach, beforeEach, ... */
'use strict';
const chai = require('chai');
const BunyanCWLogger = require('./../index');
describe('_validate', () => {
const assert = chai.assert;
it('No arn', () => {
const bl = new BunyanCWLogger();
assert.throws(() => bl._validateInput(), Error, 'Unable to setup logger. No arn was supplied');
});
it('Bad arn', () => {
const arn = 'arn:aws:lambda:us-east-1:local';
const bl = new BunyanCWLogger(null, null, arn);
assert.throws(() => bl._validateInput(), Error, 'Invalid ARN');
});
it('Region name is missing', () => {
const arn = 'arn:aws:lambda::local:function:fnName:qualifier';
const bl = new BunyanCWLogger(null, null, arn);
assert.throws(() => bl._validateInput(), Error, 'ARN is missing region name');
});
it('Function name is missing', () => {
const arn = 'arn:aws:lambda:us-east-1:local:function::qualifier';
const bl = new BunyanCWLogger(null, null, arn);
assert.throws(() => bl._validateInput(), Error, 'ARN is missing function name');
});
it('Log group is missing', () => {
const arn = 'arn:aws:lambda:us-east-1:local:function:testFn:qualifier';
const bl = new BunyanCWLogger(null, null, arn);
assert.throws(() => bl._validateInput(), Error, 'logGroup is missing');
});
it('Stream name is missing', () => {
const arn = 'arn:aws:lambda:us-east-1:local:function:testFn:qualifier';
const bl = new BunyanCWLogger('test-Group', null, arn);
assert.throws(() => bl._validateInput(), Error, 'streamName is missing');
});
it('success', () => {
const arn = 'arn:aws:lambda:us-east-1:local:function:testFn:qualifier';
const bl = new BunyanCWLogger('test-Group', 'test-Stream', arn);
bl._validateInput();
});
});
|
module.exports = {
'v-tab': {
events: [
{
name: 'change',
value: 'void',
},
{
name: 'click',
value: 'ClickEvent',
},
{
name: 'keydown',
value: 'KeyboardEvent',
},
],
},
}
|
var React = require('react');
var BugActions = require("../bugactions");
var BugItem = React.createClass({displayName: "BugItem",
render: function() {
var bug = this.props.bug;
var checkboxId = bug.id+"-checkbox";
var className = 'normal';
if(bug.fixed) {
className = 'strike';
}
return (
React.createElement("li", null,
React.createElement("input", {
id: checkboxId,
type: "checkbox",
onChange: this._onChange}),
React.createElement("label", {className: className}, bug.text),
React.createElement("br", null),
React.createElement("a", {href: ""}, "Show Comments")
)
);
},
_onChange: function(event) {
if(event.target.checked) {
BugActions.markAsComplete(this.props.bug.id);
} else {
BugActions.unmarkAsComplete(this.props.bug.id);
}
}
});
module.exports = BugItem;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.