text
stringlengths 2
6.14k
|
|---|
module.exports = ChainInstance;
function ChainInstance(chain, cb) {
var instances = null;
var loading = false;
var queue = [];
var load = function () {
loading = true;
chain.run(function (err, items) {
instances = items;
return next();
});
};
var promise = function(hwd, next) {
return function () {
if (!loading) {
load();
}
queue.push({ hwd: hwd, args: arguments });
return calls;
};
};
var next = function () {
if (queue.length === 0) return;
var item = queue.shift();
item.hwd.apply(calls, item.args);
};
var calls = {
filter: promise(function (cb) {
instances = instances.filter(cb);
return next();
}),
forEach: promise(function (cb) {
instances.forEach(cb);
return next();
}),
sort: promise(function (cb) {
instances.sort(cb);
return next();
}),
count: promise(function (cb) {
cb(instances.length);
return next();
}),
get: promise(function (cb) {
cb(instances);
return next();
}),
save: promise(function (cb) {
var saveNext = function (i) {
if (i >= instances.length) {
if (typeof cb === "function") {
cb();
}
return next();
}
return instances[i].save(function (err) {
if (err) {
if (typeof cb === "function") {
cb(err);
}
return next();
}
return saveNext(i + 1);
});
};
return saveNext(0);
})
};
if (typeof cb === "function") {
return calls.forEach(cb);
}
return calls;
}
|
YUI.add('editor-lists', function (Y, NAME) {
/**
* Handles list manipulation inside the Editor. Adds keyboard manipulation and execCommand support.
* Adds overrides for the <a href="Plugin.ExecCommand.html#method_COMMANDS.insertorderedlist">insertorderedlist</a>
* and <a href="Plugin.ExecCommand.html#method_COMMANDS.insertunorderedlist">insertunorderedlist</a> execCommands.
* @class Plugin.EditorLists
* @constructor
* @extends Base
* @module editor
* @submodule editor-lists
*/
var EditorLists = function() {
EditorLists.superclass.constructor.apply(this, arguments);
}, LI = 'li', OL = 'ol', UL = 'ul', HOST = 'host';
Y.extend(EditorLists, Y.Base, {
/**
* Listener for host's nodeChange event and captures the tabkey interaction only when inside a list node.
* @private
* @method _onNodeChange
* @param {Event} e The Event facade passed from the host.
*/
_onNodeChange: function(e) {
var inst = this.get(HOST).getInstance(), li,
newList, sTab, par, moved = false, tag, focusEnd = false;
if (e.changedType === 'tab') {
if (e.changedNode.test(LI + ', ' + LI + ' *')) {
Y.log('Overriding TAB to move lists around', 'info', 'editorLists');
e.changedEvent.halt();
e.preventDefault();
li = e.changedNode;
sTab = e.changedEvent.shiftKey;
par = li.ancestor(OL + ',' + UL);
tag = UL;
if (par.get('tagName').toLowerCase() === OL) {
tag = OL;
}
Y.log('ShiftKey: ' + sTab, 'info', 'editorLists');
if (!li.test(LI)) {
li = li.ancestor(LI);
}
if (sTab) {
if (li.ancestor(LI)) {
Y.log('Shifting list up one level', 'info', 'editorLists');
li.ancestor(LI).insert(li, 'after');
moved = true;
focusEnd = true;
}
} else {
//li.setStyle('border', '1px solid red');
if (li.previous(LI)) {
Y.log('Shifting list down one level', 'info', 'editorLists');
newList = inst.Node.create('<' + tag + '></' + tag + '>');
li.previous(LI).append(newList);
newList.append(li);
moved = true;
}
}
}
if (moved) {
if (!li.test(LI)) {
li = li.ancestor(LI);
}
li.all(EditorLists.REMOVE).remove();
if (Y.UA.ie) {
li = li.append(EditorLists.NON).one(EditorLists.NON_SEL);
}
//Selection here..
Y.log('Selecting the new node', 'info', 'editorLists');
(new inst.EditorSelection()).selectNode(li, true, focusEnd);
}
}
},
initializer: function() {
this.get(HOST).on('nodeChange', Y.bind(this._onNodeChange, this));
}
}, {
/**
* The non element placeholder, used for positioning the cursor and filling empty items
* @property NON
* @static
*/
NON: '<span class="yui-non"> </span>',
/**
* The selector query to get all non elements
* @property NONSEL
* @static
*/
NON_SEL: 'span.yui-non',
/**
* The items to removed from a list when a list item is moved, currently removes BR nodes
* @property REMOVE
* @static
*/
REMOVE: 'br',
/**
* editorLists
* @property NAME
* @static
*/
NAME: 'editorLists',
/**
* lists
* @property NS
* @static
*/
NS: 'lists',
ATTRS: {
host: {
value: false
}
}
});
Y.namespace('Plugin');
Y.Plugin.EditorLists = EditorLists;
}, '@VERSION@', {"requires": ["editor-base"]});
|
var path = require('path');
var fs = require('fs');
var spawn = require('child_process').spawn;
function noop() {}
exports.noop = noop;
if (process.env.HTTP2_LOG) {
var logOutput = process.stderr;
if (process.stderr.isTTY) {
var bin = path.resolve(path.dirname(require.resolve('bunyan')), '..', 'bin', 'bunyan');
if(bin && fs.existsSync(bin)) {
logOutput = spawn(bin, ['-o', 'short'], {
stdio: [null, process.stderr, process.stderr]
}).stdin;
}
}
exports.createLogger = function(name) {
return require('bunyan').createLogger({
name: name,
stream: logOutput,
level: process.env.HTTP2_LOG,
serializers: require('../lib/http').serializers
});
};
exports.log = exports.createLogger('test');
exports.clientLog = exports.createLogger('client');
exports.serverLog = exports.createLogger('server');
} else {
exports.createLogger = function() {
return exports.log;
};
exports.log = exports.clientLog = exports.serverLog = {
fatal: noop,
error: noop,
warn : noop,
info : noop,
debug: noop,
trace: noop,
child: function() { return this; }
};
}
exports.callNTimes = function callNTimes(limit, done) {
if (limit === 0) {
done();
} else {
var i = 0;
return function() {
i += 1;
if (i === limit) {
done();
}
};
}
};
// Concatenate an array of buffers into a new buffer
exports.concat = function concat(buffers) {
var size = 0;
for (var i = 0; i < buffers.length; i++) {
size += buffers[i].length;
}
var concatenated = new Buffer(size);
for (var cursor = 0, j = 0; j < buffers.length; cursor += buffers[j].length, j++) {
buffers[j].copy(concatenated, cursor);
}
return concatenated;
};
exports.random = function random(min, max) {
return min + Math.floor(Math.random() * (max - min + 1));
};
// Concatenate an array of buffers and then cut them into random size buffers
exports.shuffleBuffers = function shuffleBuffers(buffers) {
var concatenated = exports.concat(buffers), output = [], written = 0;
while (written < concatenated.length) {
var chunk_size = Math.min(concatenated.length - written, Math.ceil(Math.random()*20));
output.push(concatenated.slice(written, written + chunk_size));
written += chunk_size;
}
return output;
};
|
/** PURE_IMPORTS_START PURE_IMPORTS_END */
export function hostReportError(err) {
setTimeout(function () { throw err; }, 0);
}
//# sourceMappingURL=hostReportError.js.map
|
// generated from ldml/main/*.xml, xpath: ldml/numbers
({
'decimal':",",
'group':".",
'list':";",
'percentSign':"%",
'nativeZeroDigit':"0",
'patternDigit':"#",
'plusSign':"+",
'minusSign':"-",
'exponential':"E",
'perMille':"‰",
'infinity':"∞",
'nan':"NaN",
'decimalFormat':"#,##0.###",
'scientificFormat':"#E0",
'percentFormat':"% #,##0",
'currencyFormat':"#,##0.00 ¤"
})
|
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule RelayRecordState
* @flow
* @typechecks
*/
'use strict';
export type RecordState = $Enum<typeof RelayRecordState>;
var RelayRecordState = {
/**
* Record exists (either fetched from the server or produced by a local,
* optimistic update).
*/
EXISTENT: 'EXISTENT',
/**
* Record is known not to exist (either as the result of a mutation, or
* because the server returned `null` when queried for the record).
*/
NONEXISTENT: 'NONEXISTENT',
/**
* Record State is unknown because it has not yet been fetched from the
* server.
*/
UNKNOWN: 'UNKNOWN',
};
module.exports = RelayRecordState;
|
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule PerformanceOverlay
* @flow
*/
'use strict';
var PerformanceLogger = require('PerformanceLogger');
var React = require('React');
var StyleSheet = require('StyleSheet');
var Text = require('Text');
var View = require('View');
var PerformanceOverlay = React.createClass({
render: function() {
var perfLogs = PerformanceLogger.getTimespans();
var items = [];
for (var key in perfLogs) {
if (perfLogs[key].totalTime) {
var unit = (key === 'BundleSize') ? 'b' : 'ms';
items.push(
<View style={styles.row} key={key}>
<Text style={[styles.text, styles.label]}>{key}</Text>
<Text style={[styles.text, styles.totalTime]}>
{perfLogs[key].totalTime + unit}
</Text>
</View>
);
}
}
return (
<View style={styles.container}>
{items}
</View>
);
}
});
var styles = StyleSheet.create({
container: {
height: 100,
paddingTop: 10,
},
label: {
flex: 1,
},
row: {
flexDirection: 'row',
paddingHorizontal: 10,
},
text: {
color: 'white',
fontSize: 12,
},
totalTime: {
paddingRight: 100,
},
});
module.exports = PerformanceOverlay;
|
tinyMCE.addI18n('ja.emotions_dlg',{
title:"\u30B9\u30DE\u30A4\u30EA\u30FC\u306E\u633F\u5165",
desc:"\u30B9\u30DE\u30A4\u30EA\u30FC",
cool:"Cool",
cry:"Cry",
embarassed:"Embarassed",
foot_in_mouth:"Foot in mouth",
frown:"Frown",
innocent:"Innocent",
kiss:"Kiss",
laughing:"Laughing",
money_mouth:"Money mouth",
sealed:"Sealed",
smile:"Smile",
surprised:"Surprised",
tongue_out:"Tongue out",
undecided:"Undecided",
wink:"Wink",
yell:"Yell"
});
|
/**
* Copyright 2018 The AMP HTML Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS-IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {dev} from '../log';
/** @const {string} */
const TAG = 'lru-cache';
/**
* @template T
*/
export class LruCache {
/**
* @param {number} capacity
*/
constructor(capacity) {
/** @private @const {number} */
this.capacity_ = capacity;
/** @private {number} */
this.size_ = 0;
/**
* An incrementing counter to define the last access.
* @private {number}
*/
this.access_ = 0;
/** @private {!Object<(number|string), {payload: T, access: number}>} */
this.cache_ = Object.create(null);
}
/**
* Returns whether key is cached.
*
* @param {number|string} key
* @return {boolean}
*/
has(key) {
return !!this.cache_[key];
}
/**
* @param {number|string} key
* @return {T} The cached payload.
*/
get(key) {
const cacheable = this.cache_[key];
if (cacheable) {
cacheable.access = ++this.access_;
return cacheable.payload;
}
return undefined;
}
/**
* @param {number|string} key
* @param {T} payload The payload to cache.
*/
put(key, payload) {
if (!this.has(key)) {
this.size_++;
}
this.cache_[key] = {payload, access: this.access_};
this.evict_();
}
/**
* Evicts the oldest cache entry, if we've exceeded capacity.
*/
evict_() {
if (this.size_ <= this.capacity_) {
return;
}
dev().warn(TAG, 'Trimming LRU cache');
const cache = this.cache_;
let oldest = this.access_ + 1;
let oldestKey;
for (const key in cache) {
const {access} = cache[key];
if (access < oldest) {
oldest = access;
oldestKey = key;
}
}
if (oldestKey !== undefined) {
delete cache[oldestKey];
this.size_--;
}
}
}
|
/*************************************************************
*
* MathJax/fonts/HTML-CSS/TeX/png/Main/Bold/LatinExtendedA.js
*
* Defines the image size data needed for the HTML-CSS OutputJax
* to display mathematics using fallback images when the fonts
* are not availble to the client browser.
*
* ---------------------------------------------------------------------
*
* Copyright (c) 2009-2013 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
*
* 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"].defineImageData({
"MathJax_Main-bold": {
0x131: [ // LATIN SMALL LETTER DOTLESS I
[3,3,0],[4,4,0],[4,5,0],[5,5,0],[6,6,0],[7,8,0],[8,9,0],[9,11,0],
[11,13,0],[12,15,0],[15,18,0],[17,21,0],[21,25,0],[24,30,0]
]
}
});
MathJax.Ajax.loadComplete(MathJax.OutputJax["HTML-CSS"].imgDir+"/Main/Bold"+
MathJax.OutputJax["HTML-CSS"].imgPacked+"/LatinExtendedA.js");
|
define([
'INST' /* INST */,
'i18n!submissions',
'jquery' /* $ */,
'str/htmlEscape',
'jquery.ajaxJSON' /* ajaxJSON */,
'jqueryui/dialog',
'jqueryui/progressbar' /* /\.progressbar/ */
], function(INST, I18n, $, htmlEscape) {
INST.downloadSubmissions = function(url) {
var cancelled = false;
var title = ENV.SUBMISSION_DOWNLOAD_DIALOG_TITLE;
title = title || I18n.t('#submissions.download_submissions',
'Download Assignment Submissions');
$("#download_submissions_dialog").dialog({
title: title,
close: function() {
cancelled = true;
}
});
$("#download_submissions_dialog .progress").progressbar({value: 0});
var checkForChange = function() {
if(cancelled || $("#download_submissions_dialog:visible").length == 0) { return; }
$("#download_submissions_dialog .status_loader").css('visibility', 'visible');
var lastProgress = null;
$.ajaxJSON(url, 'GET', {}, function(data) {
if(data && data.attachment) {
var attachment = data.attachment;
if(attachment.workflow_state == 'zipped') {
$("#download_submissions_dialog .progress").progressbar('value', 100);
var message = I18n.t("#submissions.finished_redirecting", "Finished! Redirecting to File...");
var link = "<a href=\"" + htmlEscape(url) + "\"><b> " + htmlEscape(I18n.t("#submissions.click_to_download", "Click here to download %{size_of_file}", {size_of_file: attachment.readable_size})) + "</b></a>"
$("#download_submissions_dialog .status").html(htmlEscape(message) + "<br>" + $.raw(link));
$("#download_submissions_dialog .status_loader").css('visibility', 'hidden');
location.href = url;
return;
} else {
var progress = parseInt(attachment.file_state, 10);
if(isNaN(progress)) { progress = 0; }
progress += 5
$("#download_submissions_dialog .progress").progressbar('value', progress);
var message = null;
if(progress >= 95){
message = I18n.t("#submissions.creating_zip", "Creating zip file...");
} else {
message = I18n.t("#submissions.gathering_files_progress", "Gathering Files (%{progress})...", {progress: I18n.toPercentage(progress)});
}
$("#download_submissions_dialog .status").text(message);
if(progress <= 5 || progress == lastProgress) {
$.ajaxJSON(url + "&compile=1", 'GET', {}, function() {}, function() {});
}
lastProgress = progress;
}
}
$("#download_submissions_dialog .status_loader").css('visibility', 'hidden');
setTimeout(checkForChange, 3000);
}, function(data) {
$("#download_submissions_dialog .status_loader").css('visibility', 'hidden');
setTimeout(checkForChange, 1000);
});
}
checkForChange();
};
});
|
//// [decoratorMetadataForMethodWithNoReturnTypeAnnotation01.ts]
declare var decorator: any;
class MyClass {
constructor(test: string, test2: number) {
}
@decorator
doSomething() {
}
}
//// [decoratorMetadataForMethodWithNoReturnTypeAnnotation01.js]
var MyClass = (function () {
function MyClass(test, test2) {
}
MyClass.prototype.doSomething = function () {
};
Object.defineProperty(MyClass.prototype, "doSomething",
__decorate([
decorator,
__metadata('design:type', Function),
__metadata('design:paramtypes', []),
__metadata('design:returntype', void 0)
], MyClass.prototype, "doSomething", Object.getOwnPropertyDescriptor(MyClass.prototype, "doSomething")));
return MyClass;
})();
|
/**
* Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences or Promises produces an element.
*
* @example
* 1 - obs = Rx.Observable.combineLatest(obs1, obs2, obs3, function (o1, o2, o3) { return o1 + o2 + o3; });
* 2 - obs = Rx.Observable.combineLatest([obs1, obs2, obs3], function (o1, o2, o3) { return o1 + o2 + o3; });
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
*/
var combineLatest = Observable.combineLatest = function () {
var args = slice.call(arguments), resultSelector = args.pop();
if (Array.isArray(args[0])) {
args = args[0];
}
return new AnonymousObservable(function (observer) {
var falseFactory = function () { return false; },
n = args.length,
hasValue = arrayInitialize(n, falseFactory),
hasValueAll = false,
isDone = arrayInitialize(n, falseFactory),
values = new Array(n);
function next(i) {
var res;
hasValue[i] = true;
if (hasValueAll || (hasValueAll = hasValue.every(identity))) {
try {
res = resultSelector.apply(null, values);
} catch (ex) {
observer.onError(ex);
return;
}
observer.onNext(res);
} else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) {
observer.onCompleted();
}
}
function done (i) {
isDone[i] = true;
if (isDone.every(identity)) {
observer.onCompleted();
}
}
var subscriptions = new Array(n);
for (var idx = 0; idx < n; idx++) {
(function (i) {
var source = args[i], sad = new SingleAssignmentDisposable();
isPromise(source) && (source = observableFromPromise(source));
sad.setDisposable(source.subscribe(function (x) {
values[i] = x;
next(i);
}, observer.onError.bind(observer), function () {
done(i);
}));
subscriptions[i] = sad;
}(idx));
}
return new CompositeDisposable(subscriptions);
});
};
|
// Generated by CoffeeScript 1.9.3
(function() {
var iframe_template, utils;
utils = require('./utils');
iframe_template = "<!DOCTYPE html>\n<html>\n<head>\n <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\" />\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n <script src=\"{{ sockjs_url }}\"></script>\n <script>\n document.domain = document.domain;\n SockJS.bootstrap_iframe();\n </script>\n</head>\n<body>\n <h2>Don't panic!</h2>\n <p>This is a SockJS hidden iframe. It's used for cross domain magic.</p>\n</body>\n</html>";
exports.app = {
iframe: function(req, res) {
var content, context, k, quoted_md5;
context = {
'{{ sockjs_url }}': this.options.sockjs_url
};
content = iframe_template;
for (k in context) {
content = content.replace(k, context[k]);
}
quoted_md5 = '"' + utils.md5_hex(content) + '"';
if ('if-none-match' in req.headers && req.headers['if-none-match'] === quoted_md5) {
res.statusCode = 304;
return '';
}
res.setHeader('Content-Type', 'text/html; charset=UTF-8');
res.setHeader('ETag', quoted_md5);
return content;
}
};
}).call(this);
|
/**
* @param func
* @return {Observable<R>}
* @method let
* @owner Observable
*/
export function letProto(func) {
return func(this);
}
//# sourceMappingURL=let.js.map
|
AT.prototype.atSepHelpers = {
sepText: function(){
return T9n.get(AccountsTemplates.texts.sep, markIfMissing=false);
},
};
|
/*
* Date Format 1.2.3
* (c) 2007-2009 Steven Levithan <stevenlevithan.com>
* MIT license
*
* Includes enhancements by Scott Trenda <scott.trenda.net>
* and Kris Kowal <cixar.com/~kris.kowal/>
*
* Accepts a date, a mask, or a date and a mask.
* Returns a formatted version of the given date.
* The date defaults to the current date/time.
* The mask defaults to dateFormat.masks.default.
*/
var dateFormat = function () {
var token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,
timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,
timezoneClip = /[^-+\dA-Z]/g,
pad = function (val, len) {
val = String(val);
len = len || 2;
while (val.length < len) val = "0" + val;
return val;
};
// Regexes and supporting functions are cached through closure
return function (date, mask, utc) {
var dF = dateFormat;
// You can't provide utc if you skip other args (use the "UTC:" mask prefix)
if (arguments.length == 1 && Object.prototype.toString.call(date) == "[object String]" && !/\d/.test(date)) {
mask = date;
date = undefined;
}
// Passing date through Date applies Date.parse, if necessary
date = date ? new Date(date) : new Date;
if (isNaN(date)) throw SyntaxError("invalid date");
mask = String(dF.masks[mask] || mask || dF.masks["default"]);
// Allow setting the utc argument via the mask
if (mask.slice(0, 4) == "UTC:") {
mask = mask.slice(4);
utc = true;
}
var _ = utc ? "getUTC" : "get",
d = date[_ + "Date"](),
D = date[_ + "Day"](),
m = date[_ + "Month"](),
y = date[_ + "FullYear"](),
H = date[_ + "Hours"](),
M = date[_ + "Minutes"](),
s = date[_ + "Seconds"](),
L = date[_ + "Milliseconds"](),
o = utc ? 0 : date.getTimezoneOffset(),
flags = {
d: d,
dd: pad(d),
ddd: dF.i18n.dayNames[D],
dddd: dF.i18n.dayNames[D + 7],
m: m + 1,
mm: pad(m + 1),
mmm: dF.i18n.monthNames[m],
mmmm: dF.i18n.monthNames[m + 12],
yy: String(y).slice(2),
yyyy: y,
h: H % 12 || 12,
hh: pad(H % 12 || 12),
H: H,
HH: pad(H),
M: M,
MM: pad(M),
s: s,
ss: pad(s),
l: pad(L, 3),
L: pad(L > 99 ? Math.round(L / 10) : L),
t: H < 12 ? "a" : "p",
tt: H < 12 ? "am" : "pm",
T: H < 12 ? "A" : "P",
TT: H < 12 ? "AM" : "PM",
Z: utc ? "UTC" : (String(date).match(timezone) || [""]).pop().replace(timezoneClip, ""),
o: (o > 0 ? "-" : "+") + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4),
S: ["th", "st", "nd", "rd"][d % 10 > 3 ? 0 : (d % 100 - d % 10 != 10) * d % 10]
};
return mask.replace(token, function ($0) {
return $0 in flags ? flags[$0] : $0.slice(1, $0.length - 1);
});
};
}();
// Some common format strings
dateFormat.masks = {
"default": "ddd mmm dd yyyy HH:MM:ss",
shortDate: "m/d/yy",
mediumDate: "mmm d, yyyy",
longDate: "mmmm d, yyyy",
fullDate: "dddd, mmmm d, yyyy",
shortTime: "h:MM TT",
mediumTime: "h:MM:ss TT",
longTime: "h:MM:ss TT Z",
isoDate: "yyyy-mm-dd",
isoTime: "HH:MM:ss",
isoDateTime: "yyyy-mm-dd'T'HH:MM:ss",
isoUtcDateTime: "UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"
};
// Internationalization strings
dateFormat.i18n = {
dayNames: [
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat",
"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
],
monthNames: [
"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
]
};
// For convenience...
Date.prototype.format = function (mask, utc) {
return dateFormat(this, mask, utc);
};
|
app.controller("LayersLayergroupSimpleController", [ "$scope", function($scope) {
angular.extend($scope, {
center: {
lat: 39,
lng: -100,
zoom: 3
},
layers: {
baselayers: {
xyz: {
name: 'OpenStreetMap (XYZ)',
url: 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
type: 'xyz'
}
},
overlays: {}
}
});
var tileLayer = {
name: 'Countries',
type: 'xyz',
url: 'http://{s}.tiles.mapbox.com/v3/milkator.press_freedom/{z}/{x}/{y}.png',
visible: true,
layerOptions: {
attribution: 'Map data © 2013 Natural Earth | Data © 2013 <a href="http://www.reporter-ohne-grenzen.de/ranglisten/rangliste-2013/">ROG/RSF</a>',
maxZoom: 5
}
};
var utfGrid = {
name: 'UtfGrid',
type: 'utfGrid',
url: 'http://{s}.tiles.mapbox.com/v3/milkator.press_freedom/{z}/{x}/{y}.grid.json?callback={cb}',
visible: true,
pluginOptions: {
maxZoom: 5,
resolution: 4
}
};
var group = {
name: 'Group Layer',
type: 'group',
visible: true,
layerOptions: {
layers: [ tileLayer, utfGrid],
maxZoom: 5
}
};
$scope.layers['overlays']['Group Layer'] = group;
$scope.$on('leafletDirectiveMap.utfgridMouseover', function(event, leafletEvent) {
$scope.country = leafletEvent.data.name;
});
}]);
|
import React from 'react/addons';
import ContainerListItem from './ContainerListItem.react';
var ContainerList = React.createClass({
componentWillMount: function () {
this.start = Date.now();
},
render: function () {
var containers = this.props.containers.map(container => {
return (
<ContainerListItem key={container.Id} container={container} start={this.start} />
);
});
return (
<ul>
{containers}
</ul>
);
}
});
module.exports = ContainerList;
|
'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 ContentContentPaste = function ContentContentPaste(props) {
return _react2.default.createElement(
_SvgIcon2.default,
props,
_react2.default.createElement('path', { d: 'M19 2h-4.18C14.4.84 13.3 0 12 0c-1.3 0-2.4.84-2.82 2H5c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-7 0c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zm7 18H5V4h2v3h10V4h2v16z' })
);
};
ContentContentPaste = (0, _pure2.default)(ContentContentPaste);
ContentContentPaste.displayName = 'ContentContentPaste';
ContentContentPaste.muiName = 'SvgIcon';
exports.default = ContentContentPaste;
|
/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/*************************************************************
*
* MathJax/localization/vi/MathML.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.Localization.addTranslation("vi","MathML",{
version: "2.5.0",
isLoaded: true,
strings: {
BadMglyph: "mglyph h\u1ECFng: %1",
BadMglyphFont: "Ph\u00F4ng ch\u1EEF h\u1ECFng: %1",
MathPlayer: "MathJax kh\u00F4ng th\u1EC3 thi\u1EBFt l\u1EADp MathPlayer.\n\nN\u1EBFu MathPlayer ch\u01B0a \u0111\u01B0\u1EE3c c\u00E0i \u0111\u1EB7t, b\u1EA1n c\u1EA7n ph\u1EA3i c\u00E0i \u0111\u1EB7t n\u00F3 tr\u01B0\u1EDBc ti\u00EAn.\nN\u1EBFu kh\u00F4ng, c\u00E1c t\u00F9y ch\u1ECDn b\u1EA3o m\u1EADt c\u1EE7a b\u1EA1n c\u00F3 th\u1EC3 ng\u0103n tr\u1EDF c\u00E1c \u0111i\u1EC1u khi\u1EC3n ActiveX. H\u00E3y ch\u1ECDn T\u00F9y ch\u1ECDn Internet trong tr\u00ECnh \u0111\u01A1n C\u00F4ng c\u1EE5, qua th\u1EBB B\u1EA3o m\u1EADt, v\u00E0 b\u1EA5m n\u00FAt M\u1EE9c t\u00F9y ch\u1EC9nh. Ki\u1EC3m c\u00E1c h\u1ED9p \u201CCh\u1EA1y \u0111i\u1EC1u khi\u1EC3n ActiveX\u201D v\u00E0 \u201CH\u00E0nh vi nh\u1ECB ph\u00E2n v\u00E0 k\u1ECBch b\u1EA3n\u201D.\n\nHi\u1EC7n t\u1EA1i b\u1EA1n s\u1EBD g\u1EB7p c\u00E1c th\u00F4ng b\u00E1o l\u1ED7i thay v\u00EC to\u00E1n h\u1ECDc \u0111\u01B0\u1EE3c k\u1EBFt xu\u1EA5t.",
CantCreateXMLParser: "MathJax kh\u00F4ng th\u1EC3 t\u1EA1o ra b\u1ED9 ph\u00E2n t\u00EDch XML cho MathML. H\u00E3y ch\u1ECDn T\u00F9y ch\u1ECDn Internet trong tr\u00ECnh \u0111\u01A1n C\u00F4ng c\u1EE5, qua th\u1EBB B\u1EA3o m\u1EADt, v\u00E0 b\u1EA5m n\u00FAt M\u1EE9c t\u00F9y ch\u1EC9nh. Ki\u1EC3m h\u1ED9p \u201CScript c\u00E1c \u0111i\u1EC1u khi\u1EC3n ActiveX \u0111\u01B0\u1EE3c \u0111\u00E1nh d\u1EA5u l\u00E0 an to\u00E0n\u201D.\n\nMathJax s\u1EBD kh\u00F4ng th\u1EC3 x\u1EED l\u00FD c\u00E1c ph\u01B0\u01A1ng tr\u00ECnh MathML.",
UnknownNodeType: "Ki\u1EC3u n\u00FAt kh\u00F4ng r\u00F5: %1",
UnexpectedTextNode: "N\u00FAt v\u0103n b\u1EA3n b\u1EA5t ng\u1EEB: %1",
ErrorParsingMathML: "L\u1ED7i khi ph\u00E2n t\u00EDch MathML",
ParsingError: "L\u1ED7i khi ph\u00E2n t\u00EDch MathML: %1",
MathMLSingleElement: "MathML ph\u1EA3i ch\u1EC9 c\u00F3 m\u1ED9t ph\u1EA7n t\u1EED g\u1ED1c",
MathMLRootElement: "Ph\u1EA7n t\u1EED g\u1ED1c c\u1EE7a MathML ph\u1EA3i l\u00E0 \u003Cmath\u003E, ch\u1EE9 kh\u00F4ng ph\u1EA3i %1"
}
});
MathJax.Ajax.loadComplete("[MathJax]/localization/vi/MathML.js");
|
/**
* Shopware 5
* Copyright (c) shopware AG
*
* According to our dual licensing model, this program can be used either
* under the terms of the GNU Affero General Public License, version 3,
* or under a proprietary license.
*
* The texts of the GNU Affero General Public License with an additional
* permission and of our proprietary license can be found at and
* in the LICENSE file you have received along with this program.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* "Shopware" is a registered trademark of shopware AG.
* The licensing of the program under the AGPLv3 does not imply a
* trademark license. Therefore any rights, title and interest in
* our trademarks remain entirely with us.
*
* @category Shopware
* @package CanceledOrder
* @subpackage Store
* @version $Id$
* @author shopware AG
*/
/**
* Shopware Store - canceled baskets' articles
*/
//{block name="backend/canceled_order/store/articles"}
Ext.define('Shopware.apps.CanceledOrder.store.Articles', {
extend: 'Ext.data.Store',
// Do not load data, when not explicitly requested
autoLoad: false,
model : 'Shopware.apps.CanceledOrder.model.Articles',
remoteFilter: true,
remoteSort: true,
/**
* Configure the data communication
* @object
*/
proxy: {
type: 'ajax',
/**
* Configure the url mapping
* @object
*/
api: {
read: '{url controller=CanceledOrder action="getArticle"}'
},
/**
* Configure the data reader
* @object
*/
reader: {
type: 'json',
root: 'data',
totalProperty:'total'
}
}
});
//{/block}
|
VectorCanvas.prototype.createPath = function (config) {
var node;
if (this.mode === 'svg') {
node = this.createSvgNode('path');
node.setAttribute('d', config.path);
if (this.params.borderColor !== null) {
node.setAttribute('stroke', this.params.borderColor);
}
if (this.params.borderWidth > 0) {
node.setAttribute('stroke-width', this.params.borderWidth);
node.setAttribute('stroke-linecap', 'round');
node.setAttribute('stroke-linejoin', 'round');
}
if (this.params.borderOpacity > 0) {
node.setAttribute('stroke-opacity', this.params.borderOpacity);
}
node.setFill = function (color) {
this.setAttribute('fill', color);
if (this.getAttribute('original') === null) {
this.setAttribute('original', color);
}
};
node.getFill = function () {
return this.getAttribute('fill');
};
node.getOriginalFill = function () {
return this.getAttribute('original');
};
node.setOpacity = function (opacity) {
this.setAttribute('fill-opacity', opacity);
};
} else {
node = this.createVmlNode('shape');
node.coordorigin = '0 0';
node.coordsize = this.width + ' ' + this.height;
node.style.width = this.width + 'px';
node.style.height = this.height + 'px';
node.fillcolor = JQVMap.defaultFillColor;
node.stroked = false;
node.path = VectorCanvas.pathSvgToVml(config.path);
var scale = this.createVmlNode('skew');
scale.on = true;
scale.matrix = '0.01,0,0,0.01,0,0';
scale.offset = '0,0';
node.appendChild(scale);
var fill = this.createVmlNode('fill');
node.appendChild(fill);
node.setFill = function (color) {
this.getElementsByTagName('fill')[0].color = color;
if (this.getAttribute('original') === null) {
this.setAttribute('original', color);
}
};
node.getFill = function () {
return this.getElementsByTagName('fill')[0].color;
};
node.getOriginalFill = function () {
return this.getAttribute('original');
};
node.setOpacity = function (opacity) {
this.getElementsByTagName('fill')[0].opacity = parseInt(opacity * 100, 10) + '%';
};
}
return node;
};
|
/**
* jQuery plugin wrapper for TinySort
* Does not use the first argument in tinysort.js since that is handled internally by the jQuery selector.
* Sub-selections (option.selector) do not use the jQuery selector syntax but regular CSS3 selector syntax.
* @summary jQuery plugin wrapper for TinySort
* @version 2.2.2
* @requires tinysort
* @license MIT/GPL
* @author Ron Valstar (http://www.sjeiti.com/)
* @copyright Ron Valstar <ron@ronvalstar.nl>
*/
!function(a){"use strict";"function"==typeof define&&define.amd?define(["jquery","tinysort"],a):jQuery&&!jQuery.fn.tsort&&a(jQuery,tinysort)}(function(a,b){"use strict";a.tinysort={defaults:b.defaults},a.fn.extend({tinysort:function(){var a,c,d=Array.prototype.slice.call(arguments);d.unshift(this),a=b.apply(null,d),c=a.length;for(var e=0,f=this.length;f>e;e++)c>e?this[e]=a[e]:delete this[e];return this.length=c,this}}),a.fn.tsort=a.fn.tinysort});
|
//// [inheritedConstructorWithRestParams2.ts]
class IBaseBase<T, U> {
constructor(x: U) { }
}
interface IBase<T, U> extends IBaseBase<T, U> { }
class BaseBase2 {
constructor(x: number) { }
}
declare class BaseBase<T, U> extends BaseBase2 implements IBase<T, U> {
constructor(x: T, ...y: U[]);
constructor(x1: T, x2: T, ...y: U[]);
constructor(x1: T, x2: U, y: T);
}
class Base extends BaseBase<string, number> {
}
class Derived extends Base { }
// Ok
new Derived("", "");
new Derived("", 3);
new Derived("", 3, 3);
new Derived("", 3, 3, 3);
new Derived("", 3, "");
new Derived("", "", 3);
new Derived("", "", 3, 3);
// Errors
new Derived(3);
new Derived("", 3, "", 3);
new Derived("", 3, "", "");
//// [inheritedConstructorWithRestParams2.js]
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var IBaseBase = (function () {
function IBaseBase(x) {
}
return IBaseBase;
})();
var BaseBase2 = (function () {
function BaseBase2(x) {
}
return BaseBase2;
})();
var Base = (function (_super) {
__extends(Base, _super);
function Base() {
_super.apply(this, arguments);
}
return Base;
})(BaseBase);
var Derived = (function (_super) {
__extends(Derived, _super);
function Derived() {
_super.apply(this, arguments);
}
return Derived;
})(Base);
// Ok
new Derived("", "");
new Derived("", 3);
new Derived("", 3, 3);
new Derived("", 3, 3, 3);
new Derived("", 3, "");
new Derived("", "", 3);
new Derived("", "", 3, 3);
// Errors
new Derived(3);
new Derived("", 3, "", 3);
new Derived("", 3, "", "");
|
// to indexed object, toObject with fallback for non-array-like ES3 strings
var IObject = require('./_iobject')
, defined = require('./_defined');
module.exports = function(it){
return IObject(defined(it));
};
|
// [Name] SVGLinearGradientElement-dom-x1-attr.js
// [Expected rendering result] green ellipse, no red visible - and a series of PASS messages
description("Tests dynamic updates of the 'x1' attribute of the SVGLinearGradientElement object")
createSVGTestCase();
var ellipseElement = createSVGElement("ellipse");
ellipseElement.setAttribute("cx", "150");
ellipseElement.setAttribute("cy", "150");
ellipseElement.setAttribute("rx", "100");
ellipseElement.setAttribute("ry", "150");
ellipseElement.setAttribute("fill", "url(#gradient)");
var defsElement = createSVGElement("defs");
rootSVGElement.appendChild(defsElement);
var linearGradientElement = createSVGElement("linearGradient");
linearGradientElement.setAttribute("id", "gradient");
linearGradientElement.setAttribute("x1", "100%");
var firstStopElement = createSVGElement("stop");
firstStopElement.setAttribute("offset", "0");
firstStopElement.setAttribute("stop-color", "red");
linearGradientElement.appendChild(firstStopElement);
var lastStopElement = createSVGElement("stop");
lastStopElement.setAttribute("offset", "1");
lastStopElement.setAttribute("stop-color", "green");
linearGradientElement.appendChild(lastStopElement);
defsElement.appendChild(linearGradientElement);
rootSVGElement.appendChild(ellipseElement);
shouldBeEqualToString("linearGradientElement.getAttribute('x1')", "100%");
function repaintTest() {
linearGradientElement.setAttribute("x1", "200%");
shouldBeEqualToString("linearGradientElement.getAttribute('x1')", "200%");
}
var successfullyParsed = true;
|
MessageFormat.locale.es = function ( n ) {
if ( n === 1 ) {
return "one";
}
return "other";
};
|
'use strict';
exports.__esModule = true;
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _warnOnce = require('./warn-once');
var _warnOnce2 = _interopRequireDefault(_warnOnce);
var _node = require('./node');
var _node2 = _interopRequireDefault(_node);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var Declaration = function (_Node) {
_inherits(Declaration, _Node);
function Declaration(defaults) {
_classCallCheck(this, Declaration);
var _this = _possibleConstructorReturn(this, _Node.call(this, defaults));
_this.type = 'decl';
return _this;
}
/* istanbul ignore next */
_createClass(Declaration, [{
key: '_value',
get: function get() {
(0, _warnOnce2.default)('Node#_value was deprecated. Use Node#raws.value');
return this.raws.value;
}
/* istanbul ignore next */
,
set: function set(val) {
(0, _warnOnce2.default)('Node#_value was deprecated. Use Node#raws.value');
this.raws.value = val;
}
/* istanbul ignore next */
}, {
key: '_important',
get: function get() {
(0, _warnOnce2.default)('Node#_important was deprecated. Use Node#raws.important');
return this.raws.important;
}
/* istanbul ignore next */
,
set: function set(val) {
(0, _warnOnce2.default)('Node#_important was deprecated. Use Node#raws.important');
this.raws.important = val;
}
}]);
return Declaration;
}(_node2.default);
exports.default = Declaration;
module.exports = exports['default'];
|
/**
* Require unassigned functions to be named inline
*
* Types: `Boolean` or `Object`
*
* Values:
* - `true`
* - `Object`:
* - `allExcept`: array of quoted identifiers
*
* #### Example
*
* ```js
* "requireNamedUnassignedFunctions": { "allExcept": ["describe", "it"] }
* ```
*
* ##### Valid
*
* ```js
* [].forEach(function x() {});
* var y = function() {};
* function z() {}
* it(function () {});
* ```
*
* ##### Invalid
*
* ```js
* [].forEach(function () {});
* before(function () {});
* ```
*/
var assert = require('assert');
var pathval = require('pathval');
function getNodeName(node) {
if (node.type === 'Identifier') {
return node.name;
} else {
return node.value;
}
}
module.exports = function() {};
module.exports.prototype = {
configure: function(options) {
assert(
options === true ||
typeof options === 'object',
this.getOptionName() + ' option requires true value ' +
'or an object with String[] `allExcept` property'
);
// verify first item in `allExcept` property in object (if it's an object)
assert(
typeof options !== 'object' ||
Array.isArray(options.allExcept) &&
typeof options.allExcept[0] === 'string',
'Property `allExcept` in ' + this.getOptionName() + ' should be an array of strings'
);
if (options.allExcept) {
this._allExceptItems = options.allExcept.map(function(item) {
var parts = pathval.parse(item).map(function extractPart(part) {
return part.i !== undefined ? part.i : part.p;
});
return JSON.stringify(parts);
});
}
},
getOptionName: function() {
return 'requireNamedUnassignedFunctions';
},
check: function(file, errors) {
var _this = this;
file.iterateNodesByType('FunctionExpression', function(node) {
var parentElement = node.parentElement;
// If the function has been named via left hand assignment, skip it
// e.g. `var hello = function() {`, `foo.bar = function() {`
if (parentElement.type.match(/VariableDeclarator|Property|AssignmentExpression/)) {
return;
}
// If the function has been named, skip it
// e.g. `[].forEach(function hello() {`
if (node.id !== null) {
return;
}
// If we have exceptions and the function is being invoked, detect whether we excepted it
if (_this._allExceptItems && parentElement.type === 'CallExpression') {
// Determine the path that resolves to our call expression
// We must cover both direct calls (e.g. `it(function() {`) and
// member expressions (e.g. `foo.bar(function() {`)
var memberNode = parentElement.callee;
var canBeRepresented = true;
var fullpathParts = [];
while (memberNode) {
if (memberNode.type.match(/Identifier|Literal/)) {
fullpathParts.unshift(getNodeName(memberNode));
} else if (memberNode.type === 'MemberExpression') {
fullpathParts.unshift(getNodeName(memberNode.property));
} else {
canBeRepresented = false;
break;
}
memberNode = memberNode.object;
}
// If the path is not-dynamic (i.e. can be represented by static parts),
// then check it against our exceptions
if (canBeRepresented) {
var fullpath = JSON.stringify(fullpathParts);
for (var i = 0, l = _this._allExceptItems.length; i < l; i++) {
if (fullpath === _this._allExceptItems[i]) {
return;
}
}
}
}
// Complain that this function must be named
errors.add('Inline functions need to be named', node);
});
}
};
|
function X2JS(_1){
"use strict";
var _2="1.1.2";
_1=_1||{};
_3();
function _3(){
if(_1.escapeMode===undefined){
_1.escapeMode=true;
}
if(_1.attributePrefix===undefined){
_1.attributePrefix="_";
}
if(_1.arrayAccessForm===undefined){
_1.arrayAccessForm="none";
}
if(_1.emptyNodeForm===undefined){
_1.emptyNodeForm="text";
}
};
var _4={ELEMENT_NODE:1,TEXT_NODE:3,CDATA_SECTION_NODE:4,DOCUMENT_NODE:9};
function _5(_6){
var _7=_6.localName;
if(_7==null){
_7=_6.baseName;
}
if(_7==null||_7==""){
_7=_6.nodeName;
}
return _7;
};
function _8(_9){
return _9.prefix;
};
function _a(_b){
if(typeof (_b)=="string"){
return _b.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/");
}else{
return _b;
}
};
function _c(_d){
return _d.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"\"").replace(/'/g,"'").replace(///g,"/");
};
function _e(_f,_10){
switch(_1.arrayAccessForm){
case "property":
if(!(_f[_10] instanceof Array)){
_f[_10+"_asArray"]=[_f[_10]];
}else{
_f[_10+"_asArray"]=_f[_10];
}
break;
}
};
function _11(_12){
if(_12.nodeType==_4.DOCUMENT_NODE){
var _13=new Object;
var _14=_12.firstChild;
var _15=_5(_14);
_13[_15]=_11(_14);
return _13;
}else{
if(_12.nodeType==_4.ELEMENT_NODE){
var _13=new Object;
_13.__cnt=0;
var _16=_12.childNodes;
for(var _17=0;_17<_16.length;_17++){
var _14=_16.item(_17);
var _15=_5(_14);
_13.__cnt++;
if(_13[_15]==null){
_13[_15]=_11(_14);
_e(_13,_15);
}else{
if(_13[_15]!=null){
if(!(_13[_15] instanceof Array)){
_13[_15]=[_13[_15]];
_e(_13,_15);
}
}
var _18=0;
while(_13[_15][_18]!=null){
_18++;
}
(_13[_15])[_18]=_11(_14);
}
}
for(var _19=0;_19<_12.attributes.length;_19++){
var _1a=_12.attributes.item(_19);
_13.__cnt++;
_13[_1.attributePrefix+_1a.name]=_1a.value;
}
var _1b=_8(_12);
if(_1b!=null&&_1b!=""){
_13.__cnt++;
_13.__prefix=_1b;
}
if(_13["#text"]!=null){
_13.__text=_13["#text"];
if(_13.__text instanceof Array){
_13.__text=_13.__text.join("\n");
}
if(_1.escapeMode){
_13.__text=_c(_13.__text);
}
delete _13["#text"];
if(_1.arrayAccessForm=="property"){
delete _13["#text_asArray"];
}
}
if(_13["#cdata-section"]!=null){
_13.__cdata=_13["#cdata-section"];
delete _13["#cdata-section"];
if(_1.arrayAccessForm=="property"){
delete _13["#cdata-section_asArray"];
}
}
if(_13.__cnt==1&&_13.__text!=null){
_13=_13.__text;
}else{
if(_13.__cnt==0&&_1.emptyNodeForm=="text"){
_13="";
}
}
delete _13.__cnt;
if(_13.__text!=null||_13.__cdata!=null){
_13.toString=function(){
return (this.__text!=null?this.__text:"")+(this.__cdata!=null?this.__cdata:"");
};
}
return _13;
}else{
if(_12.nodeType==_4.TEXT_NODE||_12.nodeType==_4.CDATA_SECTION_NODE){
return _12.nodeValue;
}
}
}
};
function _1c(_1d,_1e,_1f,_20){
var _21="<"+((_1d!=null&&_1d.__prefix!=null)?(_1d.__prefix+":"):"")+_1e;
if(_1f!=null){
for(var _22=0;_22<_1f.length;_22++){
var _23=_1f[_22];
var _24=_1d[_23];
_21+=" "+_23.substr(_1.attributePrefix.length)+"='"+_24+"'";
}
}
if(!_20){
_21+=">";
}else{
_21+="/>";
}
return _21;
};
function _25(_26,_27){
return "</"+(_26.__prefix!=null?(_26.__prefix+":"):"")+_27+">";
};
function _28(str,_29){
return str.indexOf(_29,str.length-_29.length)!==-1;
};
function _2a(_2b,_2c){
if((_1.arrayAccessForm=="property"&&_28(_2c.toString(),("_asArray")))||_2c.toString().indexOf(_1.attributePrefix)==0||_2c.toString().indexOf("__")==0||(_2b[_2c] instanceof Function)){
return true;
}else{
return false;
}
};
function _2d(_2e){
var _2f=0;
if(_2e instanceof Object){
for(var it in _2e){
if(_2a(_2e,it)){
continue;
}
_2f++;
}
}
return _2f;
};
function _30(_31){
var _32=[];
if(_31 instanceof Object){
for(var ait in _31){
if(ait.toString().indexOf("__")==-1&&ait.toString().indexOf(_1.attributePrefix)==0){
_32.push(ait);
}
}
}
return _32;
};
function _33(_34){
var _35="";
if(_34.__cdata!=null){
_35+="<![CDATA["+_34.__cdata+"]]>";
}
if(_34.__text!=null){
if(_1.escapeMode){
_35+=_a(_34.__text);
}else{
_35+=_34.__text;
}
}
return _35;
};
function _36(_37){
var _38="";
if(_37 instanceof Object){
_38+=_33(_37);
}else{
if(_37!=null){
if(_1.escapeMode){
_38+=_a(_37);
}else{
_38+=_37;
}
}
}
return _38;
};
function _39(_3a,_3b,_3c){
var _3d="";
if(_3a.length==0){
_3d+=_1c(_3a,_3b,_3c,true);
}else{
for(var _3e=0;_3e<_3a.length;_3e++){
_3d+=_1c(_3a[_3e],_3b,_30(_3a[_3e]),false);
_3d+=_3f(_3a[_3e]);
_3d+=_25(_3a[_3e],_3b);
}
}
return _3d;
};
function _3f(_40){
var _41="";
var _42=_2d(_40);
if(_42>0){
for(var it in _40){
if(_2a(_40,it)){
continue;
}
var _43=_40[it];
var _44=_30(_43);
if(_43==null||_43==undefined){
_41+=_1c(_43,it,_44,true);
}else{
if(_43 instanceof Object){
if(_43 instanceof Array){
_41+=_39(_43,it,_44);
}else{
var _45=_2d(_43);
if(_45>0||_43.__text!=null||_43.__cdata!=null){
_41+=_1c(_43,it,_44,false);
_41+=_3f(_43);
_41+=_25(_43,it);
}else{
_41+=_1c(_43,it,_44,true);
}
}
}else{
_41+=_1c(_43,it,_44,false);
_41+=_36(_43);
_41+=_25(_43,it);
}
}
}
}
_41+=_36(_40);
return _41;
};
this.parseXmlString=function(_46){
if(_46===undefined){
return null;
}
var _47;
if(window.DOMParser){
var _48=new window.DOMParser();
_47=_48.parseFromString(_46,"text/xml");
}else{
if(_46.indexOf("<?")==0){
_46=_46.substr(_46.indexOf("?>")+2);
}
_47=new ActiveXObject("Microsoft.XMLDOM");
_47.async="false";
_47.loadXML(_46);
}
return _47;
};
this.asArray=function(_49){
if(_49 instanceof Array){
return _49;
}else{
return [_49];
}
};
this.xml2json=function(_4a){
return _11(_4a);
};
this.xml_str2json=function(_4b){
var _4c=this.parseXmlString(_4b);
return this.xml2json(_4c);
};
this.json2xml_str=function(_4d){
return _3f(_4d);
};
this.json2xml=function(_4e){
var _4f=this.json2xml_str(_4e);
return this.parseXmlString(_4f);
};
this.getVersion=function(){
return _2;
};
};
|
'use strict';
var path = require('path');
exports.name = 'cssmin';
//
// Output a config for the furnished block
// The context variable is used both to take the files to be treated
// (inFiles) and to output the one(s) created (outFiles).
// It aslo conveys whether or not the current process is the last of the pipe
//
exports.createConfig = function(context, block) {
var cfg = {files: []};
// FIXME: check context has all the needed info
var outfile = path.join(context.outDir, block.dest);
// Depending whether or not we're the last of the step we're not going to output the same thing
var files = {};
files.dest = outfile;
files.src = [];
context.inFiles.forEach(function(f) { files.src.push(path.join(context.inDir, f));} );
cfg.files.push(files);
context.outFiles = [block.dest];
return cfg;
};
|
import "../arrays/merge";
import "../core/rebind";
import "layout";
d3.layout.hierarchy = function() {
var sort = d3_layout_hierarchySort,
children = d3_layout_hierarchyChildren,
value = d3_layout_hierarchyValue;
// Recursively compute the node depth and value.
// Also converts to a standard hierarchy structure.
function recurse(node, depth, nodes) {
var childs = children.call(hierarchy, node, depth);
node.depth = depth;
nodes.push(node);
if (childs && (n = childs.length)) {
var i = -1,
n,
c = node.children = [],
v = 0,
j = depth + 1,
d;
while (++i < n) {
d = recurse(childs[i], j, nodes);
d.parent = node;
c.push(d);
v += d.value;
}
if (sort) c.sort(sort);
if (value) node.value = v;
} else if (value) {
node.value = +value.call(hierarchy, node, depth) || 0;
}
return node;
}
// Recursively re-evaluates the node value.
function revalue(node, depth) {
var children = node.children,
v = 0;
if (children && (n = children.length)) {
var i = -1,
n,
j = depth + 1;
while (++i < n) v += revalue(children[i], j);
} else if (value) {
v = +value.call(hierarchy, node, depth) || 0;
}
if (value) node.value = v;
return v;
}
function hierarchy(d) {
var nodes = [];
recurse(d, 0, nodes);
return nodes;
}
hierarchy.sort = function(x) {
if (!arguments.length) return sort;
sort = x;
return hierarchy;
};
hierarchy.children = function(x) {
if (!arguments.length) return children;
children = x;
return hierarchy;
};
hierarchy.value = function(x) {
if (!arguments.length) return value;
value = x;
return hierarchy;
};
// Re-evaluates the `value` property for the specified hierarchy.
hierarchy.revalue = function(root) {
revalue(root, 0);
return root;
};
return hierarchy;
};
// A method assignment helper for hierarchy subclasses.
function d3_layout_hierarchyRebind(object, hierarchy) {
d3.rebind(object, hierarchy, "sort", "children", "value");
// Add an alias for nodes and links, for convenience.
object.nodes = object;
object.links = d3_layout_hierarchyLinks;
return object;
}
function d3_layout_hierarchyChildren(d) {
return d.children;
}
function d3_layout_hierarchyValue(d) {
return d.value;
}
function d3_layout_hierarchySort(a, b) {
return b.value - a.value;
}
// Returns an array source+target objects for the specified nodes.
function d3_layout_hierarchyLinks(nodes) {
return d3.merge(nodes.map(function(parent) {
return (parent.children || []).map(function(child) {
return {source: parent, target: child};
});
}));
}
|
/*!
* FileInput Czech 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['cz'] = {
fileSingle: 'soubor',
filePlural: 'soubory',
browseLabel: 'Vybrat …',
removeLabel: 'Odstranit',
removeTitle: 'Vyčistit vybrané soubory',
cancelLabel: 'Storno',
cancelTitle: 'Přerušit nahrávání',
uploadLabel: 'Nahrát',
uploadTitle: 'Nahrát vybrané soubory',
msgNo: 'Ne',
msgCancelled: 'Zrušeno',
msgZoomTitle: 'zobrazit podrobnosti',
msgZoomModalHeading: 'Detailní náhled',
msgSizeTooLarge: 'Soubor "{name}" (<b>{size} KB</b>): překročení - maximální povolená velikost <b>{maxSize} KB</b>.',
msgFilesTooLess: 'Musíte vybrat nejméně <b>{n}</b> {files} pro nahrání.',
msgFilesTooMany: 'Počet vybraných souborů pro nahrání <b>({n})</b>: překročení - maximální povolený limit <b>{m}</b>.',
msgFileNotFound: 'Soubor "{name}" nebyl nalezen!',
msgFileSecured: 'Zabezpečení souboru znemožnilo číst soubor "{name}".',
msgFileNotReadable: 'Soubor "{name}" není čitelný.',
msgFilePreviewAborted: 'Náhled souboru byl přerušen pro "{name}".',
msgFilePreviewError: 'Nastala chyba při načtení souboru "{name}".',
msgInvalidFileType: 'Neplatný typ souboru "{name}". Pouze "{types}" souborů jsou podporovány.',
msgInvalidFileExtension: 'Neplatná extenze souboru "{name}". Pouze "{extensions}" souborů jsou podporovány.',
msgUploadAborted: 'Soubor nahrávání byl přerušen',
msgValidationError: 'Chyba ověření',
msgLoading: 'Nahrávání souboru {index} z {files} …',
msgProgress: 'Nahrávání souboru {index} z {files} - {name} - {percent}% dokončeno.',
msgSelected: '{n} {files} vybrano',
msgFoldersNotAllowed: 'Táhni a pusť pouze soubory! Vynechané {n} pustěné složk(y).',
msgImageWidthSmall: 'Šířka image soubor "{name}", musí být alespoň {size} px.',
msgImageHeightSmall: 'Výška image soubor "{name}", musí být alespoň {size} px.',
msgImageWidthLarge: 'Šířka obrazového souboru "{name}" nelze překročit {size} px.',
msgImageHeightLarge: 'Výška obrazového souboru "{name}" nelze překročit {size} px.',
msgImageResizeError: 'Nelze získat rozměry obrázku změnit velikost.',
msgImageResizeException: 'Chyba při změně velikosti obrázku.<pre>{errors}</pre>',
dropZoneTitle: 'Táhni a pusť soubory sem …',
fileActionSettings: {
removeTitle: 'Odstranit soubor',
uploadTitle: 'nahrát soubor',
indicatorNewTitle: 'Ještě nenahrál',
indicatorSuccessTitle: 'Nahraný',
indicatorErrorTitle: 'Nahrát Chyba',
indicatorLoadingTitle: 'Nahrávání ...'
}
};
})(window.jQuery);
|
/**
@module ember
@submodule ember-htmlbars
*/
import Ember from 'ember-metal/core';
import EmberStringUtils from 'ember-runtime/system/string';
import { SafeString, escapeExpression } from 'htmlbars-util';
/**
Mark a string as safe for unescaped output with Ember templates. If you
return HTML from a helper, use this function to
ensure Ember's rendering layer does not escape the HTML.
```javascript
Ember.String.htmlSafe('<div>someString</div>')
```
@method htmlSafe
@for Ember.String
@static
@return {Handlebars.SafeString} a string that will not be html escaped by Handlebars
@public
*/
function htmlSafe(str) {
if (str === null || str === undefined) {
return '';
}
if (typeof str !== 'string') {
str = '' + str;
}
return new SafeString(str);
}
EmberStringUtils.htmlSafe = htmlSafe;
if (Ember.EXTEND_PROTOTYPES === true || Ember.EXTEND_PROTOTYPES.String) {
String.prototype.htmlSafe = function() {
return htmlSafe(this);
};
}
export {
SafeString,
htmlSafe,
escapeExpression
};
|
/*
* jQuery UI Effects Pulsate 1.7.2
*
* Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* http://docs.jquery.com/UI/Effects/Pulsate
*
* Depends:
* effects.core.js
*/
(function($) {
$.effects.pulsate = function(o) {
return this.queue(function() {
// Create element
var el = $(this);
// Set options
var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode
var times = o.options.times || 5; // Default # of times
var duration = o.duration ? o.duration / 2 : $.fx.speeds._default / 2;
// Adjust
if (mode == 'hide') times--;
if (el.is(':hidden')) { // Show fadeIn
el.css('opacity', 0);
el.show(); // Show
el.animate({opacity: 1}, duration, o.options.easing);
times = times-2;
}
// Animate
for (var i = 0; i < times; i++) { // Pulsate
el.animate({opacity: 0}, duration, o.options.easing).animate({opacity: 1}, duration, o.options.easing);
};
if (mode == 'hide') { // Last Pulse
el.animate({opacity: 0}, duration, o.options.easing, function(){
el.hide(); // Hide
if(o.callback) o.callback.apply(this, arguments); // Callback
});
} else {
el.animate({opacity: 0}, duration, o.options.easing).animate({opacity: 1}, duration, o.options.easing, function(){
if(o.callback) o.callback.apply(this, arguments); // Callback
});
};
el.queue('fx', function() { el.dequeue(); });
el.dequeue();
});
};
})(jQuery);
|
describe("Ext.dom.Element_scroll", function() {
var el;
afterEach(function(){
Ext.destroy(el);
el = null;
});
function expectLeft(left) {
expect(el.dom.scrollLeft).toBe(left);
}
function expectTop(top) {
expect(el.dom.scrollTop).toBe(top);
}
function expectLeftTop(left, top) {
expectLeft(left);
expectTop(top);
}
describe("scroll", function() {
var scrollSize = Ext.getScrollbarSize(),
maxHorz = 600 + scrollSize.width,
maxVert = 600 + scrollSize.height;
beforeEach(function(){
el = Ext.getBody().createChild({
style: {
width: '400px',
height: '400px',
overflow: 'auto'
},
cn: [{
style: {
width: '1000px',
height: '1000px'
}
}]
});
});
describe("right", function(){
it("should accept 'right' as a param", function(){
el.scroll('right', 200);
expectLeft(200);
});
it("should accept 'r' as a param", function(){
el.scroll('r', 175);
expectLeft(175);
});
it("should append to the current position", function(){
el.scroll('r', 200);
el.scroll('r', 300);
expectLeft(500);
});
it("should constrain the max scroll", function(){
el.scroll('r', 2000);
expectLeft(maxHorz);
});
});
describe("left", function(){
it("should accept 'left' as a param", function(){
el.scroll('r', 200);
el.scroll('left', 125);
expectLeft(75);
});
it("should accept 'l' as a param", function(){
el.scroll('r', 300);
el.scroll('l', 150);
expectLeft(150);
});
it("should append to the current position", function(){
el.scroll('r', 500);
el.scroll('l', 300);
el.scroll('l', 100);
expectLeft(100);
});
it("should constrain to 0", function(){
el.scroll('r', 100);
el.scroll('l', 350);
expectLeft(0);
});
});
describe("bottom", function(){
it("should accept 'bottom' as a param", function() {
el.scroll('bottom', 30);
expectTop(30);
});
it("should accept 'b' as a param", function() {
el.scroll('b', 120);
expectTop(120);
});
it("should accept 'down' as a param", function() {
el.scroll('down', 30);
expectTop(30);
});
it("should accept 'd' as a param", function() {
el.scroll('d', 375);
expectTop(375);
});
it("should append to the current position", function() {
el.scroll('b', 120);
el.scroll('b', 130);
expectTop(250);
});
it("should constrain the max scroll", function(){
el.scroll('b', 1500);
expectTop(maxVert);
});
});
describe("up", function(){
it("should accept 'up' as a param", function() {
el.scroll('b', 30);
el.scroll('u', 10);
expectTop(20);
});
it("should accept 'u' as a param", function() {
el.scroll('b', 120);
el.scroll('u', 50);
expectTop(70);
});
it("should accept 'top' as a param", function() {
el.scroll('b', 200);
el.scroll('top', 130);
expectTop(70);
});
it("should accept 't' as a param", function() {
el.scroll('b', 500);
el.scroll('t', 375);
expectTop(125);
});
it("should append to the current position", function() {
el.scroll('b', 300);
el.scroll('t', 120);
el.scroll('t', 130);
expectTop(50);
});
it("should constrain the max scroll", function() {
el.scroll('b', 300);
el.scroll('t', 3000);
expectTop(0);
});
});
});
});
|
/*
Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'wsc', 'km', {
btnIgnore: 'មិនផ្លាស់ប្តូរ',
btnIgnoreAll: 'មិនផ្លាស់ប្តូរ ទាំងអស់',
btnReplace: 'ជំនួស',
btnReplaceAll: 'ជំនួសទាំងអស់',
btnUndo: 'សារឡើងវិញ',
changeTo: 'ផ្លាស់ប្តូរទៅ',
errorLoading: 'Error loading application service host: %s.',
ieSpellDownload: 'ពុំមានកម្មវិធីពិនិត្យអក្ខរាវិរុទ្ធ ។ តើចង់ទាញយកពីណា?',
manyChanges: 'ការពិនិត្យអក្ខរាវិរុទ្ធបានចប់: %1 ពាក្យបានផ្លាស់ប្តូរ',
noChanges: 'ការពិនិត្យអក្ខរាវិរុទ្ធបានចប់: ពុំមានផ្លាស់ប្តូរ',
noMispell: 'ការពិនិត្យអក្ខរាវិរុទ្ធបានចប់: គ្មានកំហុស',
noSuggestions: '- គ្មានសំណើរ -',
notAvailable: 'Sorry, but service is unavailable now.',
notInDic: 'គ្មានក្នុងវចនានុក្រម',
oneChange: 'ការពិនិត្យអក្ខរាវិរុទ្ធបានចប់: ពាក្យមួយត្រូចបានផ្លាស់ប្តូរ',
progress: 'កំពុងពិនិត្យអក្ខរាវិរុទ្ធ...',
title: 'Spell Checker',
toolbar: 'ពិនិត្យអក្ខរាវិរុទ្ធ'
});
|
define(
"dojo/cldr/nls/hu/hebrew", //begin v1.x content
{
"months-format-abbr": [
"Tisri",
"Hesván",
"Kiszlév",
"Tévész",
"Svát",
"Ádár I",
"Ádár",
"Niszán",
"Ijár",
"Sziván",
"Tamuz",
"Áv",
"Elul"
],
"months-format-abbr-leap": "Ádár II",
"months-format-wide": [
"Tisri",
"Hesván",
"Kiszlév",
"Tévész",
"Svát",
"Ádár risón",
"Ádár",
"Niszán",
"Ijár",
"Sziván",
"Tamuz",
"Áv",
"Elul"
],
"months-format-wide-leap": "Ádár séni",
"months-standAlone-abbr": [
"Tisri",
"Hesván",
"Kiszlév",
"Tévész",
"Svát",
"Ádár risón",
"Ádár",
"Niszán",
"Ijár",
"Sziván",
"Tamuz",
"Áv",
"Elul"
],
"months-standAlone-abbr-leap": "Ádár II",
"months-standAlone-wide": [
"Tisri",
"Hesván",
"Kiszlév",
"Tévész",
"Svát",
"Ádár risón",
"Ádár",
"Niszán",
"Ijár",
"Sziván",
"Tamuz",
"Áv",
"Elul"
],
"months-standAlone-wide-leap": "Ádár II",
"eraAbbr": [
"TÉ"
],
"eraNames": [
"TÉ"
],
"eraNarrow": [
"TÉ"
],
"days-format-abbr": [
"V",
"H",
"K",
"Sze",
"Cs",
"P",
"Szo"
],
"days-format-narrow": [
"V",
"H",
"K",
"Sz",
"Cs",
"P",
"Sz"
],
"days-format-wide": [
"vasárnap",
"hétfő",
"kedd",
"szerda",
"csütörtök",
"péntek",
"szombat"
],
"days-standAlone-abbr": [
"V",
"H",
"K",
"Sze",
"Cs",
"P",
"Szo"
],
"days-standAlone-narrow": [
"V",
"H",
"K",
"Sz",
"Cs",
"P",
"Sz"
],
"days-standAlone-wide": [
"vasárnap",
"hétfő",
"kedd",
"szerda",
"csütörtök",
"péntek",
"szombat"
],
"quarters-format-abbr": [
"N1",
"N2",
"N3",
"N4"
],
"quarters-format-wide": [
"I. negyedév",
"II. negyedév",
"III. negyedév",
"IV. negyedév"
],
"quarters-standAlone-abbr": [
"N1",
"N2",
"N3",
"N4"
],
"quarters-standAlone-wide": [
"1. negyedév",
"2. negyedév",
"3. negyedév",
"4. negyedév"
],
"dayPeriods-format-narrow-am": "de.",
"dayPeriods-format-narrow-pm": "du.",
"dayPeriods-format-wide-am": "de.",
"dayPeriods-format-wide-pm": "du.",
"dateFormat-full": "y. MMMM d., EEEE",
"dateFormat-long": "y. MMMM d.",
"dateFormat-medium": "yyyy.MM.dd.",
"dateFormat-short": "yyyy.MM.dd.",
"dateFormatItem-Ed": "d., E",
"dateFormatItem-h": "a h",
"dateFormatItem-H": "H",
"dateFormatItem-hm": "a h:mm",
"dateFormatItem-Hm": "H:mm",
"dateFormatItem-hms": "a h:mm:ss",
"dateFormatItem-Hms": "H:mm:ss",
"dateFormatItem-Md": "M. d.",
"dateFormatItem-MEd": "M. d., E",
"dateFormatItem-MMMd": "MMM d.",
"dateFormatItem-MMMEd": "MMM d., E",
"dateFormatItem-yM": "y.M.",
"dateFormatItem-yMd": "yyyy.MM.dd.",
"dateFormatItem-yMEd": "yyyy.MM.dd., E",
"dateFormatItem-yMMM": "y. MMM",
"dateFormatItem-yMMMd": "y. MMM d.",
"dateFormatItem-yMMMEd": "y. MMM d., E",
"dateFormatItem-yQQQ": "y. QQQ",
"timeFormat-full": "H:mm:ss zzzz",
"timeFormat-long": "H:mm:ss z",
"timeFormat-medium": "H:mm:ss",
"timeFormat-short": "H:mm"
}
//end v1.x content
);
|
module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.initConfig({
jshint: {
options: { jshintrc: true },
all: ['*.js', 'lib/*.js', 'test/*.js']
}
});
grunt.registerTask('default', ['jshint']);
};
|
/*
Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang("widget","no",{move:"Klikk og dra for å flytte",label:"%1 widget"});
|
/*
Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'pastefromword', 'pt-br', {
confirmCleanup: 'O texto que você deseja colar parece ter sido copiado do Word. Você gostaria de remover a formatação antes de colar?',
error: 'Não foi possível limpar os dados colados devido a um erro interno',
title: 'Colar do Word',
toolbar: 'Colar do Word'
});
|
var assert = require('assert')
var UINT32 = require('..').UINT32
describe('and method', function () {
describe('0&1', function () {
it('should return 0', function (done) {
var u = UINT32(0).and( UINT32(1) )
assert.equal( u.toNumber(), 0 )
done()
})
})
describe('1&2', function () {
it('should return 0', function (done) {
var u = UINT32(1).and( UINT32(2) )
assert.equal( u.toNumber(), 0 )
done()
})
})
describe('1&2^16', function () {
it('should return 0', function (done) {
var n = Math.pow(2, 16)
var u = UINT32(1).and( UINT32(n) )
assert.equal( u.toNumber(), 0 )
done()
})
})
describe('2^16&1', function () {
it('should return 0', function (done) {
var n = Math.pow(2, 16)
var u = UINT32(n).and( UINT32(1) )
assert.equal( u.toNumber(), 0 )
done()
})
})
describe('2^16&2^16', function () {
it('should return n', function (done) {
var n = Math.pow(2, 16)
var u = UINT32(n).and( UINT32(n) )
assert.equal( u.toNumber(), n )
done()
})
})
})
|
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _rest = require('./internal/rest');
var _rest2 = _interopRequireDefault(_rest);
var _initialParams = require('./internal/initialParams');
var _initialParams2 = _interopRequireDefault(_initialParams);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Returns a function that when called, calls-back with the values provided.
* Useful as the first function in a [`waterfall`]{@link module:ControlFlow.waterfall}, or for plugging values in to
* [`auto`]{@link module:ControlFlow.auto}.
*
* @name constant
* @static
* @memberOf module:Utils
* @method
* @category Util
* @param {...*} arguments... - Any number of arguments to automatically invoke
* callback with.
* @returns {AsyncFunction} Returns a function that when invoked, automatically
* invokes the callback with the previous given arguments.
* @example
*
* async.waterfall([
* async.constant(42),
* function (value, next) {
* // value === 42
* },
* //...
* ], callback);
*
* async.waterfall([
* async.constant(filename, "utf8"),
* fs.readFile,
* function (fileData, next) {
* //...
* }
* //...
* ], callback);
*
* async.auto({
* hostname: async.constant("https://server.net/"),
* port: findFreePort,
* launchServer: ["hostname", "port", function (options, cb) {
* startServer(options, cb);
* }],
* //...
* }, callback);
*/
exports.default = (0, _rest2.default)(function (values) {
var args = [null].concat(values);
return (0, _initialParams2.default)(function (ignoredArgs, callback) {
return callback.apply(this, args);
});
});
module.exports = exports['default'];
|
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const HTMLElement = require("./HTMLElement.js");
const impl = utils.implSymbol;
const mixin = utils.mixin;
const WindowEventHandlers = require("./WindowEventHandlers.js");
function HTMLBodyElement() {
throw new TypeError("Illegal constructor");
}
HTMLBodyElement.prototype = Object.create(HTMLElement.interface.prototype);
HTMLBodyElement.prototype.constructor = HTMLBodyElement;
mixin(HTMLBodyElement.prototype, WindowEventHandlers.interface.prototype);
WindowEventHandlers.mixedInto.push(HTMLBodyElement);
HTMLBodyElement.prototype.toString = function () {
if (this === HTMLBodyElement.prototype) {
return "[object HTMLBodyElementPrototype]";
}
return HTMLElement.interface.prototype.toString.call(this);
};
Object.defineProperty(HTMLBodyElement.prototype, "text", {
get() {
const value = this.getAttribute("text");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V, { treatNullAsEmptyString: true });
this.setAttribute("text", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLBodyElement.prototype, "link", {
get() {
const value = this.getAttribute("link");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V, { treatNullAsEmptyString: true });
this.setAttribute("link", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLBodyElement.prototype, "vLink", {
get() {
const value = this.getAttribute("vLink");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V, { treatNullAsEmptyString: true });
this.setAttribute("vLink", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLBodyElement.prototype, "aLink", {
get() {
const value = this.getAttribute("aLink");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V, { treatNullAsEmptyString: true });
this.setAttribute("aLink", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLBodyElement.prototype, "bgColor", {
get() {
const value = this.getAttribute("bgColor");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V, { treatNullAsEmptyString: true });
this.setAttribute("bgColor", V);
},
enumerable: true,
configurable: true
});
Object.defineProperty(HTMLBodyElement.prototype, "background", {
get() {
const value = this.getAttribute("background");
return value === null ? "" : value;
},
set(V) {
V = conversions["DOMString"](V);
this.setAttribute("background", V);
},
enumerable: true,
configurable: true
});
module.exports = {
mixedInto: [],
is(obj) {
if (obj) {
if (obj[impl] instanceof Impl.implementation) {
return true;
}
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (obj instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
isImpl(obj) {
if (obj) {
if (obj instanceof Impl.implementation) {
return true;
}
const wrapper = utils.wrapperForImpl(obj);
for (let i = 0; i < module.exports.mixedInto.length; ++i) {
if (wrapper instanceof module.exports.mixedInto[i]) {
return true;
}
}
}
return false;
},
create(constructorArgs, privateData) {
let obj = Object.create(HTMLBodyElement.prototype);
this.setup(obj, constructorArgs, privateData);
return obj;
},
createImpl(constructorArgs, privateData) {
let obj = Object.create(HTMLBodyElement.prototype);
this.setup(obj, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
HTMLElement._internalSetup(obj);
},
setup(obj, constructorArgs, privateData) {
if (!privateData) privateData = {};
privateData.wrapper = obj;
this._internalSetup(obj);
obj[impl] = new Impl.implementation(constructorArgs, privateData);
obj[impl][utils.wrapperSymbol] = obj;
},
interface: HTMLBodyElement,
expose: {
Window: { HTMLBodyElement: HTMLBodyElement }
}
};
const Impl = require("../nodes/HTMLBodyElement-impl.js");
|
/*
* Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
* Copyright (C) IBM Corp. 2009 All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* @extends {WebInspector.View}
* @constructor
*/
WebInspector.ResourceView = function(resource)
{
WebInspector.View.call(this);
this.registerRequiredCSS("resourceView.css");
this.element.addStyleClass("resource-view");
this.resource = resource;
}
WebInspector.ResourceView.prototype = {
hasContent: function()
{
return false;
},
__proto__: WebInspector.View.prototype
}
/**
* @param {WebInspector.Resource} resource
*/
WebInspector.ResourceView.hasTextContent = function(resource)
{
if (resource.type.isTextType())
return true;
if (resource.type === WebInspector.resourceTypes.Other)
return resource.content && !resource.contentEncoded;
return false;
}
/**
* @param {WebInspector.Resource} resource
*/
WebInspector.ResourceView.nonSourceViewForResource = function(resource)
{
switch (resource.type) {
case WebInspector.resourceTypes.Image:
return new WebInspector.ImageView(resource);
case WebInspector.resourceTypes.Font:
return new WebInspector.FontView(resource);
default:
return new WebInspector.ResourceView(resource);
}
}
/**
* @extends {WebInspector.SourceFrame}
* @constructor
* @param {WebInspector.Resource} resource
*/
WebInspector.ResourceSourceFrame = function(resource)
{
this._resource = resource;
WebInspector.SourceFrame.call(this, resource);
}
WebInspector.ResourceSourceFrame.prototype = {
get resource()
{
return this._resource;
},
populateTextAreaContextMenu: function(contextMenu, lineNumber)
{
contextMenu.appendApplicableItems(this._resource);
},
__proto__: WebInspector.SourceFrame.prototype
}
/**
* @constructor
* @extends {WebInspector.View}
* @param {WebInspector.Resource} resource
*/
WebInspector.ResourceSourceFrameFallback = function(resource)
{
WebInspector.View.call(this);
this._resource = resource;
this.element.addStyleClass("fill");
this.element.addStyleClass("script-view");
this._content = this.element.createChild("div", "script-view-fallback monospace");
}
WebInspector.ResourceSourceFrameFallback.prototype = {
wasShown: function()
{
if (!this._contentRequested) {
this._contentRequested = true;
this._resource.requestContent(this._contentLoaded.bind(this));
}
},
/**
* @param {?string} content
* @param {boolean} contentEncoded
* @param {string} mimeType
*/
_contentLoaded: function(content, contentEncoded, mimeType)
{
this._content.textContent = content;
},
__proto__: WebInspector.View.prototype
}
|
/**
* Provides live preview facilities for the event date format fields, akin
* to (and using the same ajax mechanism as) the date format preview in WP's
* general settings screen.
*/
jQuery( document ).ready( function( $ ) {
// Whenever the input field for a date format changes, update the matching
// live preview area
$( ".live-date-preview" ).siblings( "input" ).change( function() {
var $format_field = $( this );
var new_format = $format_field.val();
var $preview_field = $format_field.siblings( ".live-date-preview" );
/**
* Update the preview field when we get our response back from WP.
*/
var show_update = function( preview_text ) {
preview_text = $( "<div/>" ).html( preview_text ).text(); // Escaping!
$preview_field.html( preview_text );
}
// Before making the request, show the spinner (this should naturally be "wiped"
// when the response is rendered)
$preview_field.append( "<span class='spinner'></span>" );
$preview_field.find( ".spinner" ).css( "visibility", "visible" );
var request = {
action: "date_format",
date: new_format
}
$.post( ajaxurl, request, show_update, "text" );
} );
} );
|
var which = require('which');
var spawnSync = require('child_process').spawnSync;
module.exports.detect = function(gulp) {
var DART_SDK = false;
try {
which.sync('dart');
if (process.platform === 'win32') {
DART_SDK = {
ANALYZER: 'dartanalyzer.bat',
DARTDOCGEN: 'dartdoc.bat',
DARTFMT: 'dartfmt.bat',
PUB: 'pub.bat',
VM: 'dart.exe'
};
} else {
DART_SDK = {
ANALYZER: 'dartanalyzer',
DARTDOCGEN: 'dartdoc',
DARTFMT: 'dartfmt',
PUB: 'pub',
VM: 'dart'
};
}
console.log('Dart SDK detected:');
} catch (e) {
console.log('Dart SDK is not available, Dart tasks will be skipped.');
var gulpTaskFn = gulp.task.bind(gulp);
gulp.task = function (name, deps, fn) {
if (name.indexOf('.dart') === -1) {
return gulpTaskFn(name, deps, fn);
} else {
return gulpTaskFn(name, function() {
console.log('Dart SDK is not available. Skipping task: ' + name);
});
}
};
}
return DART_SDK;
}
module.exports.logVersion = function(dartSdk) {
console.log('DART SDK:') ;
console.log('- dart: ' + spawnSync(dartSdk.VM, ['--version']).stderr.toString().replace(/\n/g, ''));
console.log('- pub: ' + spawnSync(dartSdk.PUB, ['--version']).stdout.toString().replace(/\n/g, ''));
}
|
/**
* @fileoverview Rule to spot scenarios where a newline looks like it is ending a statement, but is not.
* @author Glen Mailer
* @copyright 2015 Glen Mailer
*/
"use strict";
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
module.exports = function(context) {
var FUNCTION_MESSAGE = "Unexpected newline between function and ( of function call.";
var PROPERTY_MESSAGE = "Unexpected newline between object and [ of property access.";
/**
* Check to see if the bracket prior to the node is continuing the previous
* line's expression
* @param {ASTNode} node The node to check.
* @param {string} msg The error message to use.
* @returns {void}
* @private
*/
function checkForBreakBefore(node, msg) {
var tokens = context.getTokensBefore(node, 2);
var paren = tokens[1];
var before = tokens[0];
if (paren.loc.start.line !== before.loc.end.line) {
context.report(node, paren.loc.start, msg, { char: paren.value });
}
}
//--------------------------------------------------------------------------
// Public API
//--------------------------------------------------------------------------
return {
"MemberExpression": function(node) {
if (!node.computed) {
return;
}
checkForBreakBefore(node.property, PROPERTY_MESSAGE);
},
"CallExpression": function(node) {
if (node.arguments.length === 0) {
return;
}
checkForBreakBefore(node.arguments[0], FUNCTION_MESSAGE);
}
};
};
module.exports.schema = [];
|
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _postcss = require('postcss');
var _clone = require('../clone');
var _clone2 = _interopRequireDefault(_clone);
var _hasAllProps = require('../hasAllProps');
var _hasAllProps2 = _interopRequireDefault(_hasAllProps);
var _getLastNode = require('../getLastNode');
var _getLastNode2 = _interopRequireDefault(_getLastNode);
var _canMerge = require('../canMerge');
var _canMerge2 = _interopRequireDefault(_canMerge);
exports['default'] = function (direction) {
var wsc = ['width', 'style', 'color'].map(function (d) {
return 'border-' + direction + '-' + d;
});
var defaults = ['medium', 'none', 'currentColor'];
var declaration = 'border-' + direction;
var processor = {
explode: function explode(rule) {
rule.walkDecls(declaration, function (decl) {
var values = _postcss.list.space(decl.value);
wsc.forEach(function (prop, index) {
var node = (0, _clone2['default'])(decl);
node.prop = prop;
node.value = values[index];
if (node.value === undefined) {
node.value = defaults[index];
}
rule.insertAfter(decl, node);
});
decl.remove();
});
},
merge: function merge(rule) {
var decls = rule.nodes.filter(function (node) {
return node.prop && ~wsc.indexOf(node.prop);
});
var _loop = function () {
var lastNode = decls[decls.length - 1];
var props = decls.filter(function (node) {
return node.important === lastNode.important;
});
if (_hasAllProps2['default'].apply(undefined, [props].concat(wsc)) && _canMerge2['default'].apply(undefined, props)) {
var values = wsc.map(function (prop) {
return (0, _getLastNode2['default'])(props, prop).value;
});
var value = values.concat(['']).reduceRight(function (prev, cur, i) {
if (prev === '' && cur === defaults[i]) {
return prev;
}
return cur + " " + prev;
}).trim();
if (value === '') {
value = defaults[0];
}
var shorthand = (0, _clone2['default'])(lastNode);
shorthand.prop = declaration;
shorthand.value = value;
rule.insertAfter(lastNode, shorthand);
props.forEach(function (prop) {
return prop.remove();
});
}
decls = decls.filter(function (node) {
return ! ~props.indexOf(node);
});
};
while (decls.length) {
_loop();
}
}
};
return processor;
};
module.exports = exports['default'];
|
module.exports = collect
function collect (stream) {
if (stream._collected) return
stream._collected = true
stream.pause()
stream.on("data", save)
stream.on("end", save)
var buf = []
function save (b) {
if (typeof b === "string") b = new Buffer(b)
if (Buffer.isBuffer(b) && !b.length) return
buf.push(b)
}
stream.on("entry", saveEntry)
var entryBuffer = []
function saveEntry (e) {
collect(e)
entryBuffer.push(e)
}
stream.on("proxy", proxyPause)
function proxyPause (p) {
p.pause()
}
// replace the pipe method with a new version that will
// unlock the buffered stuff. if you just call .pipe()
// without a destination, then it'll re-play the events.
stream.pipe = (function (orig) { return function (dest) {
// console.error(" === open the pipes", dest && dest.path)
// let the entries flow through one at a time.
// Once they're all done, then we can resume completely.
var e = 0
;(function unblockEntry () {
var entry = entryBuffer[e++]
// console.error(" ==== unblock entry", entry && entry.path)
if (!entry) return resume()
entry.on("end", unblockEntry)
if (dest) dest.add(entry)
else stream.emit("entry", entry)
})()
function resume () {
stream.removeListener("entry", saveEntry)
stream.removeListener("data", save)
stream.removeListener("end", save)
stream.pipe = orig
if (dest) stream.pipe(dest)
buf.forEach(function (b) {
if (b) stream.emit("data", b)
else stream.emit("end")
})
stream.resume()
}
return dest
}})(stream.pipe)
}
|
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, or any plugin's
// vendor/assets/javascripts directory can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file. JavaScript code in this file should be added after the last require_* statement.
//
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require rails-ujs
//= require turbolinks
//= require_tree .
|
YUI.add('escape', function(Y) {
/**
Provides utility methods for escaping strings.
@module escape
@class Escape
@static
@since 3.3.0
**/
var HTML_CHARS = {
'&': '&',
'<': '<',
'>': '>',
'"': '"',
"'": ''',
'/': '/',
'`': '`'
},
Escape = {
// -- Public Static Methods ------------------------------------------------
/**
Returns a copy of the specified string with special HTML characters
escaped. The following characters will be converted to their
corresponding character entities:
& < > " ' / `
This implementation is based on the [OWASP HTML escaping
recommendations][1]. In addition to the characters in the OWASP
recommendations, we also escape the <code>`</code> character, since IE
interprets it as an attribute delimiter.
If _string_ is not already a string, it will be coerced to a string.
[1]: http://www.owasp.org/index.php/XSS_(Cross_Site_Scripting)_Prevention_Cheat_Sheet
@method html
@param {String} string String to escape.
@return {String} Escaped string.
@static
**/
html: function (string) {
return (string + '').replace(/[&<>"'\/`]/g, Escape._htmlReplacer);
},
/**
Returns a copy of the specified string with special regular expression
characters escaped, allowing the string to be used safely inside a regex.
The following characters, and all whitespace characters, are escaped:
- # $ ^ * ( ) + [ ] { } | \ , . ?
If _string_ is not already a string, it will be coerced to a string.
@method regex
@param {String} string String to escape.
@return {String} Escaped string.
@static
**/
regex: function (string) {
return (string + '').replace(/[\-#$\^*()+\[\]{}|\\,.?\s]/g, '\\$&');
},
// -- Protected Static Methods ---------------------------------------------
/**
* Regex replacer for HTML escaping.
*
* @method _htmlReplacer
* @param {String} match Matched character (must exist in HTML_CHARS).
* @returns {String} HTML entity.
* @static
* @protected
*/
_htmlReplacer: function (match) {
return HTML_CHARS[match];
}
};
Escape.regexp = Escape.regex;
Y.Escape = Escape;
}, '@VERSION@' ,{requires:['yui-base']});
|
import React, {useState} from 'react';
import {
ScrollView,
StyleSheet,
Text,
TouchableOpacity,
Platform,
Linking,
} from 'react-native';
import AutoHeightWebView from 'react-native-autoheight-webview';
import {
autoHeightHtml0,
autoHeightHtml1,
autoHeightScript,
autoWidthHtml0,
autoWidthHtml1,
autoWidthScript,
autoDetectLinkScript,
style0,
inlineBodyStyle,
} from './config';
const onShouldStartLoadWithRequest = result => {
console.log(result);
return true;
};
const onError = ({nativeEvent}) =>
console.error('WebView error: ', nativeEvent);
const onMessage = event => {
const {data} = event.nativeEvent;
let messageData;
// maybe parse stringified JSON
try {
messageData = JSON.parse(data);
} catch (e) {
console.log(e.message);
}
if (typeof messageData === 'object') {
const {url} = messageData;
// check if this message concerns us
if (url && url.startsWith('http')) {
Linking.openURL(url).catch(error =>
console.error('An error occurred', error),
);
}
}
};
const onHeightLoadStart = () => console.log('height on load start');
const onHeightLoad = () => console.log('height on load');
const onHeightLoadEnd = () => console.log('height on load end');
const onWidthLoadStart = () => console.log('width on load start');
const onWidthLoad = () => console.log('width on load');
const onWidthLoadEnd = () => console.log('width on load end');
const Explorer = () => {
const [{widthHtml, heightHtml}, setHtml] = useState({
widthHtml: autoWidthHtml0,
heightHtml: autoHeightHtml0,
});
const changeSource = () =>
setHtml({
widthHtml: widthHtml === autoWidthHtml0 ? autoWidthHtml1 : autoWidthHtml0,
heightHtml:
heightHtml === autoHeightHtml0 ? autoHeightHtml1 : autoHeightHtml0,
});
const [{widthStyle, heightStyle}, setStyle] = useState({
heightStyle: null,
widthStyle: inlineBodyStyle,
});
const changeStyle = () =>
setStyle({
widthStyle:
widthStyle === inlineBodyStyle
? style0 + inlineBodyStyle
: inlineBodyStyle,
heightStyle: heightStyle === null ? style0 : null,
});
const [{widthScript, heightScript}, setScript] = useState({
heightScript: autoDetectLinkScript,
widthScript: null,
});
const changeScript = () =>
setScript({
widthScript: widthScript == autoWidthScript ? autoWidthScript : null,
heightScript:
heightScript !== autoDetectLinkScript
? autoDetectLinkScript
: autoHeightScript + autoDetectLinkScript,
});
const [heightSize, setHeightSize] = useState({height: 0, width: 0});
const [widthSize, setWidthSize] = useState({height: 0, width: 0});
return (
<ScrollView
style={{
paddingTop: 45,
backgroundColor: 'lightyellow',
}}
contentContainerStyle={{
justifyContent: 'center',
alignItems: 'center',
}}>
<AutoHeightWebView
customStyle={heightStyle}
onError={onError}
onLoad={onHeightLoad}
onLoadStart={onHeightLoadStart}
onLoadEnd={onHeightLoadEnd}
onShouldStartLoadWithRequest={onShouldStartLoadWithRequest}
onSizeUpdated={setHeightSize}
source={{html: heightHtml}}
customScript={heightScript}
onMessage={onMessage}
/>
<Text style={{padding: 5}}>
height: {heightSize.height}, width: {heightSize.width}
</Text>
<AutoHeightWebView
style={{
marginTop: 15,
}}
customStyle={widthStyle}
onError={onError}
onLoad={onWidthLoad}
onLoadStart={onWidthLoadStart}
onLoadEnd={onWidthLoadEnd}
onShouldStartLoadWithRequest={onShouldStartLoadWithRequest}
onSizeUpdated={setWidthSize}
allowFileAccessFromFileURLs={true}
allowUniversalAccessFromFileURLs={true}
source={{
html: widthHtml,
baseUrl:
Platform.OS === 'android' ? 'file:///android_asset/' : 'web/',
}}
customScript={widthScript}
/>
<Text style={{padding: 5}}>
height: {widthSize.height}, width: {widthSize.width}
</Text>
<TouchableOpacity onPress={changeSource} style={styles.button}>
<Text>change source</Text>
</TouchableOpacity>
<TouchableOpacity onPress={changeStyle} style={styles.button}>
<Text>change style</Text>
</TouchableOpacity>
<TouchableOpacity
onPress={changeScript}
style={[styles.button, {marginBottom: 100}]}>
<Text>change script</Text>
</TouchableOpacity>
</ScrollView>
);
};
const styles = StyleSheet.create({
button: {
marginTop: 15,
backgroundColor: 'aliceblue',
borderRadius: 5,
padding: 5,
},
});
export default Explorer;
|
"use strict";
import clear from "rollup-plugin-clear";
import resolve from "rollup-plugin-node-resolve";
import commonjs from "rollup-plugin-commonjs";
import typescript from "rollup-plugin-typescript2";
import screeps from "rollup-plugin-screeps";
let cfg;
const dest = process.env.DEST;
if (!dest) {
console.log("No destination specified - code will be compiled but not uploaded");
} else if ((cfg = require("./screeps.json")[dest]) == null) {
throw new Error("Invalid upload destination");
}
export default {
input: "src/main.ts",
output: {
file: "dist/main.js",
format: "cjs",
sourcemap: true
},
plugins: [
clear({ targets: ["dist"] }),
resolve(),
commonjs(),
typescript({tsconfig: "./tsconfig.json"}),
screeps({config: cfg, dryRun: cfg == null})
]
}
|
import { timeout as d3_timeout } from 'd3-timer';
export function uiFlash(context) {
var _flashTimer;
var _duration = 2000;
var _iconName = '#iD-icon-no';
var _iconClass = 'disabled';
var _text = '';
var _textClass;
function flash() {
if (_flashTimer) {
_flashTimer.stop();
}
context.container().select('.main-footer-wrap')
.classed('footer-hide', true)
.classed('footer-show', false);
context.container().select('.flash-wrap')
.classed('footer-hide', false)
.classed('footer-show', true);
var content = context.container().select('.flash-wrap').selectAll('.flash-content')
.data([0]);
// Enter
var contentEnter = content.enter()
.append('div')
.attr('class', 'flash-content');
var iconEnter = contentEnter
.append('svg')
.attr('class', 'flash-icon')
.append('g')
.attr('transform', 'translate(10,10)');
iconEnter
.append('circle')
.attr('r', 9);
iconEnter
.append('use')
.attr('transform', 'translate(-7,-7)')
.attr('width', '14')
.attr('height', '14');
contentEnter
.append('div')
.attr('class', 'flash-text');
// Update
content = content
.merge(contentEnter);
content
.selectAll('.flash-icon')
.attr('class', 'flash-icon ' + (_iconClass || ''));
content
.selectAll('.flash-icon use')
.attr('xlink:href', _iconName);
content
.selectAll('.flash-text')
.attr('class', 'flash-text ' + (_textClass || ''))
.text(_text);
_flashTimer = d3_timeout(function() {
_flashTimer = null;
context.container().select('.main-footer-wrap')
.classed('footer-hide', false)
.classed('footer-show', true);
context.container().select('.flash-wrap')
.classed('footer-hide', true)
.classed('footer-show', false);
}, _duration);
return content;
}
flash.duration = function(_) {
if (!arguments.length) return _duration;
_duration = _;
return flash;
};
flash.text = function(_) {
if (!arguments.length) return _text;
_text = _;
return flash;
};
flash.textClass = function(_) {
if (!arguments.length) return _textClass;
_textClass = _;
return flash;
};
flash.iconName = function(_) {
if (!arguments.length) return _iconName;
_iconName = _;
return flash;
};
flash.iconClass = function(_) {
if (!arguments.length) return _iconClass;
_iconClass = _;
return flash;
};
return flash;
}
|
var parseString = require('xml2js').parseString;
module.exports = function(req, res, next){
if (req.is('xml')){
var data = '';
req.setEncoding('utf8');
req.on('data', function(chunk){
data += chunk;
});
req.on('end', function(){
if (!data){
return next();
}
parseString(data, {
trim: true,
explicitArray: false
}, function(err, result){
if (!err){
req.body = result || {};
} else {
return res.error('BAD_REQUEST');
}
next();
});
});
} else {
next();
}
};
|
"use strict";
var CustomError = require('custom-error-instance');
var inventory = require('./inventory');
var menu = require('./menu');
var OrderError = CustomError('OrderError');
module.exports = function() {
var done = false;
var factory = {};
var store = {};
/**
* Add an item from the menu to the order.
* @param {string} name The name of the menu item to add.
*/
factory.add = function(name) {
var item = menu.get(name);
if (done) throw new OrderError('Order has been closed.', { code: 'EDONE' });
if (!item) throw new OrderError('Menu item does not exist: ' + name, { code: 'EDNE' });
if (!menu.available(name)) throw new OrderError('Insufficient inventory', { code: 'EINV' });
if (!store.hasOwnProperty(name)) store[name] = 0;
store[name]++;
item.ingredients.forEach(function(ingredient) {
inventory.changeQuantity(ingredient.name, -1 * ingredient.quantity);
});
return factory;
};
factory.checkout = function() {
done = true;
console.log('Order complete. Income: $' + factory.cost());
};
factory.cost = function() {
var total = 0;
Object.keys(store).forEach(function(menuItemName) {
var item = menu.get(menuItemName);
if (item) {
total += item.cost;
} else {
factory.remove(menuItemName);
}
});
return total;
};
factory.remove = function(name) {
var item;
if (done) throw new OrderError('Order has been closed.', { code: 'EDONE' });
if (!store.hasOwnProperty(name)) return;
store[name]--;
if (store[name] <= 0) delete store[name];
item = menu.get(name);
item.ingredients.forEach(function(ingredient) {
inventory.changeQuantity(ingredient.name, ingredient.quantity);
});
return factory;
};
return factory;
};
|
const test = require('tape')
const helpers = require('../test/helpers')
const bindFunc = helpers.bindFunc
const unary = require('./unary')
test('unary helper', t => {
const f = bindFunc(unary)
const err = /unary: Argument must be a Function/
t.throws(f(undefined), err, 'throws with undefined')
t.throws(f(null), err, 'throws with null')
t.throws(f(0), err, 'throws with falsey number')
t.throws(f(1), err, 'throws with truthy number')
t.throws(f(''), err, 'throws with falsey string')
t.throws(f('string'), err, 'throws with truthy string')
t.throws(f(false), err, 'throws with false')
t.throws(f(true), err, 'throws with true')
t.throws(f({}), err, 'throws with object')
t.throws(f([]), err, 'throws with array')
const fn = unary((x, y, z) => ({ x: x, y: y, z: z }))
t.same(fn(1, 2, 3), { x: 1, y: undefined, z: undefined }, 'only applies first argument to function')
t.end()
})
|
export const DEFAULTS = {
API_BASE_URI: 'http://localhost:3000/axway',
granularity: 'monthly',
startDate: '2010-01-01',
cacheExpirySeconds: 300//5 minutes
};
export class Settings {
/**
* @param {string} setting
* @returns {*}
*/
getSetting(setting) {
return DEFAULTS[setting];
}
/**
* @param {string} customerNumber
* @param {string} meterType
* @returns {string} usageEndpoint
*/
getUsageEndpoint(customerNumber, meterType) {
return `/v1/customers/${customerNumber}/usage/${meterType}`;
}
}
export default new Settings;
|
'use strict';
var DB = require('./lib/database');
var rc_util = require('./lib/utility.js');
var modelsFactory = require('./lib/models.js');
var selective = require('./program').selective;
var Promise = require('bluebird');
module.exports = function(dbUrl, commander, lastCrawl) {
return new Promise(function(resolve, reject) {
function useLatestCrawl(latestCrawl) {
var ipps = rc_util.getIpps(latestCrawl);
if (ipps) {
selective(ipps, commander)
.then(resolve)
.catch(reject);
}
}
if (lastCrawl) {
useLatestCrawl(lastCrawl);
} else {
rc_util.getLatestRow(dbUrl, commander.logsql)
.then(function(row) {
useLatestCrawl(JSON.parse(row.data));
})
.catch(reject);
}
});
};
|
import {takeEvery} from 'redux-saga'
import {call, put, take, fork, select, cancel} from 'redux-saga/effects'
import * as Actions from './actions/actions'
let ws = null
const getUsername = state => state.username
function* createWebSocket(url) {
ws = new WebSocket(url)
let deferred, open_deferred, close_deferred, error_deferred;
ws.onopen = event => {
if (open_deferred) {
open_deferred.resolve(event)
open_deferred = null
}
}
ws.onmessage = event => {
if (deferred) {
deferred.resolve(JSON.parse(event.data))
deferred = null
}
}
ws.onerror = event => {
if (error_deferred) {
error_deferred.resolve(JSON.parse(event.data))
error_deferred = null
}
}
ws.onclose = event => {
if (close_deferred) {
close_deferred.resolve(event)
close_deferred = null
}
}
return {
open: {
nextMessage() {
if (!open_deferred) {
open_deferred = {}
open_deferred.promise = new Promise(resolve => open_deferred.resolve = resolve)
}
return open_deferred.promise
}
},
message: {
nextMessage() {
if (!deferred) {
deferred = {}
deferred.promise = new Promise(resolve => deferred.resolve = resolve)
}
return deferred.promise
}
},
error: {
nextMessage() {
if (!error_deferred) {
error_deferred = {}
error_deferred.promise = new Promise(resolve => error_deferred.resolve = resolve)
}
return error_deferred.promise
}
},
close: {
nextMessage() {
if (!close_deferred) {
close_deferred = {}
close_deferred.promise = new Promise(resolve => close_deferred.resolve = resolve)
}
return close_deferred.promise
}
}
}
}
function* watchOpen(ws) {
let msg = yield call(ws.nextMessage)
while (msg) {
yield put(Actions.connected(msg.srcElement))
msg = yield call(ws.nextMessage)
}
}
function* watchClose(ws) {
let msg = yield call(ws.nextMessage)
yield put(Actions.disconnected())
ws = null
}
function* watchErrors(ws) {
let msg = yield call(ws.nextMessage)
while (msg) {
msg = yield call(ws.nextMessage)
}
}
function* watchMessages(ws) {
let msg = yield call(ws.nextMessage)
while (msg) {
yield put(msg)
msg = yield call(ws.nextMessage)
}
}
function* connect() {
let openTask, msgTask, errTask, closeTask
while (true) {
const {ws_url} = yield take('connect')
const ws = yield call(createWebSocket, ws_url)
if (openTask) {
yield cancel(openTask)
yield cancel(msgTask)
yield cancel(errTask)
yield cancel(closeTask)
}
openTask = yield fork(watchOpen, ws.open)
msgTask = yield fork(watchMessages, ws.message)
errTask = yield fork(watchErrors, ws.error)
closeTask = yield fork(watchClose, ws.close)
}
}
const send = (data) => {
try {
ws.send(JSON.stringify(data))
} catch (error) {
alert("Send error: " + error)
}
}
function* login() {
while (true) {
const login_action = yield take('login')
send(login_action)
}
}
function* hello() {
while (true) {
const hello_action = yield take('hello')
const username = yield select(getUsername)
if (username) {
send(Actions.login(username))
}
}
}
function* disconnected() {
while (true) {
yield take('disconnected')
}
}
export default function* rootSaga() {
yield [
connect(),
hello(),
login(),
disconnected()
]
}
|
import React from 'react';
const isArray = x => Array.isArray(x);
const isString = x => typeof x === 'string' && x.length > 0;
const isSelector = x => isString(x) && (startsWith(x, '.') || startsWith(x, '#'));
const isChildren = x => /string|number|boolean/.test(typeof x) || isArray(x);
const startsWith = (string, start) => string.indexOf(start) === 0;
const split = (string, separator) => string.split(separator);
const subString = (string, start, end) => string.substring(start, end);
const parseSelector = selector => {
const classIdSplit = /([\.#]?[a-zA-Z0-9\u007F-\uFFFF_:-]+)/;
const parts = split(selector, classIdSplit);
return parts.reduce((acc, part) => {
if (startsWith(part, '#')) {
acc.id = subString(part, 1);
} else if (startsWith(part, '.')) {
acc.className = `${acc.className} ${subString(part, 1)}`.trim();
}
return acc;
}, { className: '' });
};
const createElement = (nameOrType, properties = {}, children = []) => {
if (properties.isRendered !== undefined && !properties.isRendered) {
return null;
}
const { isRendered, ...props } = properties;
const args = [nameOrType, props];
if (!isArray(children)) {
args.push(children);
} else {
args.push(...children);
}
return React.createElement.apply(React, args);
};
export const hh = nameOrType => (first, second, third) => {
if (isSelector(first)) {
const selector = parseSelector(first);
// selector, children
if (isChildren(second)) {
return createElement(nameOrType, selector, second);
}
// selector, props, children
let { className = '' } = second || {};
className = `${selector.className} ${className} `.trim();
const props = { ...second, ...selector, className };
if (isChildren(third)) {
return createElement(nameOrType, props, third);
}
return createElement(nameOrType, props);
}
// children
if (isChildren(first)) {
return createElement(nameOrType, {}, first);
}
// props, children
if (isChildren(second)) {
return createElement(nameOrType, first, second);
}
return createElement(nameOrType, first);
};
const h = (nameOrType, ...rest) => hh(nameOrType)(...rest);
const TAG_NAMES = [
'a', 'abbr', 'address', 'area', 'article', 'aside', 'audio', 'b', 'base', 'bdi', 'bdo',
'big', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'cite', 'code', 'col',
'colgroup', 'data', 'datalist', 'dd', 'del', 'details', 'dfn', 'dialog', 'div', 'dl', 'dt',
'em', 'embed', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'h1', 'h2', 'h3', 'h4',
'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'iframe', 'img', 'input', 'ins',
'kbd', 'keygen', 'label', 'legend', 'li', 'link', 'main', 'map', 'mark', 'menu', 'menuitem',
'meta', 'meter', 'nav', 'noscript', 'object', 'ol', 'optgroup', 'option', 'output', 'p', 'param',
'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'script', 'section', 'select',
'small', 'source', 'span', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td',
'textarea', 'tfoot', 'th', 'thead', 'time', 'title', 'tr', 'track', 'u', 'ul', 'video',
'wbr', 'circle', 'clipPath', 'defs', 'ellipse', 'g', 'image', 'line', 'linearGradient', 'mask',
'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'svg', 'text', 'tspan'
];
module.exports = TAG_NAMES.reduce((exported, type) => {
exported[type] = hh(type);
return exported;
}, { h, hh });
|
'use strict';
import path from 'path';
import webpack, { optimize, HotModuleReplacementPlugin, NoErrorsPlugin } from 'webpack';
export default {
devtool: 'eval-cheap-module-source-map',
entry: [
'webpack-hot-middleware/client',
'./app/js/bootstrap'
],
output: {
path: path.join(__dirname, 'dist'),
filename: 'bundle.js',
publicPath: '/static/'
},
plugins: [
new optimize.OccurenceOrderPlugin(),
new HotModuleReplacementPlugin(),
new NoErrorsPlugin()
],
module: {
loaders: [
{
test: /\.js$/,
loaders: ['babel'],
exclude: path.resolve(__dirname, 'node_modules'),
include: [
path.resolve(__dirname)
]
}
]
}
};
|
"use strict";
(function (ConflictType) {
ConflictType[ConflictType["IndividualAttendeeConflict"] = 0] = "IndividualAttendeeConflict";
ConflictType[ConflictType["GroupConflict"] = 1] = "GroupConflict";
ConflictType[ConflictType["GroupTooBigConflict"] = 2] = "GroupTooBigConflict";
ConflictType[ConflictType["UnknownAttendeeConflict"] = 3] = "UnknownAttendeeConflict";
})(exports.ConflictType || (exports.ConflictType = {}));
var ConflictType = exports.ConflictType;
|
export default function applyLocationOffset(rect, location, isOffsetBody) {
var top = rect.top;
var left = rect.left;
if (isOffsetBody) {
left = 0;
top = 0;
}
return {
top: top + location.top,
left: left + location.left,
height: rect.height,
width: rect.width
};
}
//# sourceMappingURL=apply-location-offset.js.map
|
KB.component('task-move-position', function (containerElement, options) {
function getSelectedValue(id) {
var element = KB.dom(document).find('#' + id);
if (element) {
return parseInt(element.options[element.selectedIndex].value);
}
return null;
}
function getSwimlaneId() {
var swimlaneId = getSelectedValue('form-swimlanes');
return swimlaneId === null ? options.board[0].id : swimlaneId;
}
function getColumnId() {
var columnId = getSelectedValue('form-columns');
return columnId === null ? options.board[0].columns[0].id : columnId;
}
function getPosition() {
var position = getSelectedValue('form-position');
return position === null ? 1 : position;
}
function getPositionChoice() {
var element = KB.find('input[name=positionChoice]:checked');
if (element) {
return element.value;
}
return 'before';
}
function onSwimlaneChanged() {
var columnSelect = KB.dom(document).find('#form-columns');
KB.dom(columnSelect).replace(buildColumnSelect());
var taskSection = KB.dom(document).find('#form-tasks');
KB.dom(taskSection).replace(buildTasks());
}
function onColumnChanged() {
var taskSection = KB.dom(document).find('#form-tasks');
KB.dom(taskSection).replace(buildTasks());
}
function onError(message) {
KB.trigger('modal.stop');
KB.find('#message-container')
.replace(KB.dom('div')
.attr('id', 'message-container')
.attr('class', 'alert alert-error')
.text(message)
.build()
);
}
function onSubmit() {
var position = getPosition();
var positionChoice = getPositionChoice();
if (positionChoice === 'after') {
position++;
}
KB.find('#message-container').replace(KB.dom('div').attr('id', 'message-container').build());
KB.http.postJson(options.saveUrl, {
"column_id": getColumnId(),
"swimlane_id": getSwimlaneId(),
"position": position
}).success(function () {
window.location.reload(true);
}).error(function (response) {
if (response) {
onError(response.message);
}
});
}
function buildSwimlaneSelect() {
var swimlanes = [];
options.board.forEach(function(swimlane) {
swimlanes.push({'value': swimlane.id, 'text': swimlane.name});
});
return KB.dom('select')
.attr('id', 'form-swimlanes')
.change(onSwimlaneChanged)
.for('option', swimlanes)
.build();
}
function buildColumnSelect() {
var columns = [];
var swimlaneId = getSwimlaneId();
options.board.forEach(function(swimlane) {
if (swimlaneId === swimlane.id) {
swimlane.columns.forEach(function(column) {
columns.push({'value': column.id, 'text': column.title});
});
}
});
return KB.dom('select')
.attr('id', 'form-columns')
.change(onColumnChanged)
.for('option', columns)
.build();
}
function buildTasks() {
var tasks = [];
var swimlaneId = getSwimlaneId();
var columnId = getColumnId();
var container = KB.dom('div').attr('id', 'form-tasks');
options.board.forEach(function (swimlane) {
if (swimlaneId === swimlane.id) {
swimlane.columns.forEach(function (column) {
if (columnId === column.id) {
column.tasks.forEach(function (task) {
tasks.push({'value': task.position, 'text': '#' + task.id + ' - ' + task.title});
});
}
});
}
});
if (tasks.length > 0) {
container
.add(KB.html.label(options.positionLabel, 'form-position'))
.add(KB.dom('select').attr('id', 'form-position').for('option', tasks).build())
.add(KB.html.radio(options.beforeLabel, 'positionChoice', 'before'))
.add(KB.html.radio(options.afterLabel, 'positionChoice', 'after'))
;
}
return container.build();
}
this.render = function () {
KB.on('modal.submit', onSubmit);
var form = KB.dom('div')
.on('submit', onSubmit)
.add(KB.dom('div').attr('id', 'message-container').build())
.add(KB.html.label(options.swimlaneLabel, 'form-swimlanes'))
.add(buildSwimlaneSelect())
.add(KB.html.label(options.columnLabel, 'form-columns'))
.add(buildColumnSelect())
.add(buildTasks())
.build();
containerElement.appendChild(form);
};
});
|
const AES = require('./aesjs');
function encrypt(text, key) {
key = new TextEncoder().encode(key);
const textBytes = AES.utils.utf8.toBytes(text);
const aesCtr = new AES.ModeOfOperation.ctr(key);
const encryptedBytes = aesCtr.encrypt(textBytes);
return AES.utils.hex.fromBytes(encryptedBytes);
}
function decrypt(encryptedHex, key) {
key = new TextEncoder().encode(key);
const encryptedBytes = AES.utils.hex.toBytes(encryptedHex);
const aesCtr = new AES.ModeOfOperation.ctr(key);
const decryptedBytes = aesCtr.decrypt(encryptedBytes);
return AES.utils.utf8.fromBytes(decryptedBytes);
}
module.exports = {
encrypt,
decrypt,
};
|
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _index = require('../../isSameWeek/index.js');
var _index2 = _interopRequireDefault(_index);
var _index3 = require('../_lib/convertToFP/index.js');
var _index4 = _interopRequireDefault(_index3);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// This file is generated automatically by `scripts/build/fp.js`. Please, don't change it.
var isSameWeekWithOptions = (0, _index4.default)(_index2.default, 3);
exports.default = isSameWeekWithOptions;
module.exports = exports['default'];
|
angular.module('EggApp', ['ngRoute'], function($routeProvider) {
$routeProvider
.when('/', {
templateUrl: '/app/view/search.html',
controller: 'SearchController'
})
.when('/show/:id', {
templateUrl: '/app/view/show.html',
controller: 'ShowController'
})
.otherwise({
redirectTo: '/'
});
});
|
var Phaser = require('phaser-unofficial');
/**
* Wall class.
* @param {object} game
* @param {number} x
* @param {number} y
*/
Wall = function (game, x, y) {
Phaser.Sprite.call(this, game, x, y, 'paddle');
this.game.physics.arcade.enable(this);
this.width = 200;
this.height = this.game.world.bounds.height;
this.blendMode = Phaser.blendModes.ADD;
this.body.bounce.setTo(1, 1);
this.body.immovable = true;
this.alpha = 0;
};
Wall.prototype = Object.create(Phaser.Sprite.prototype);
Wall.prototype.constructor = Wall;
module.exports = Wall;
|
exports.definition = {
/**
* Add custom methods to your Model`s Records
* just define a function:
* ```js
* this.function_name = function(){
* //this == Record
* };
* ```
* This will automatically add the new method to your Record
*
* @class Definition
* @name Custom Record Methods
*
*/
mixinCallback: function() {
var objKeys = []
var self = this
this.use(function() {
// get all current property names
objKeys = Object.keys(this)
}, 90)
this.on('finished', function() {
// an now search for new ones ==> instance methods for our new model class
Object.keys(self).forEach(function(name) {
if (objKeys.indexOf(name) === -1) {
self.instanceMethods[name] = self[name]
delete self[name]
}
})
})
}
}
|
import { exec, getById } from "../database/database";
import Gender from "../entities/gender";
export default class GenderController {
constructor() {}
static getById(id, as_object = true) {
let gender = null;
let results = getById(id,
`
SELECT
t1.id,
t1.identifier as name
FROM genders as t1
`);
if(results) {
gender = (as_object) ? new Gender(results) : results;
}
console.log(results);
return gender;
}
}
|
'use strict';
var format = require('util').format
, scripts = require('./scripts')
, loadScriptSource = require('./load-script-source')
// Ports: https://code.google.com/p/chromium/codesearch#chromium/src/third_party/WebKit/Source/core/inspector/InspectorDebuggerAgent.cpp
function ignore(cb) { cb() }
function InspectorDebuggerAgent() {
if (!(this instanceof InspectorDebuggerAgent)) return new InspectorDebuggerAgent();
this._enabled = false;
this._breakpointsCookie = {}
}
module.exports = InspectorDebuggerAgent;
var proto = InspectorDebuggerAgent.prototype;
proto.enable = function enable(cb) {
this._enabled = true;
cb()
}
proto.disable = function disable(cb) {
this._enabled = false;
cb()
}
// https://code.google.com/p/chromium/codesearch#chromium/src/third_party/WebKit/Source/core/inspector/InspectorDebuggerAgent.cpp&l=606
proto._resolveBreakpoint = function _resolveBreakpoint(breakpointId, script, breakpoint, cb) {
var result = { breakpointId: breakpointId, locations: [ ] };
// if a breakpoint registers on startup, the script's source may not have been loaded yet
// in that case we load it, the script's source is set automatically during that step
// should not be needed once other debugger methods are implemented
if (script.source) onensuredSource();
else loadScriptSource(script.url, onensuredSource)
function onensuredSource(err) {
if (err) return cb(err);
if (breakpoint.lineNumber < script.startLine || script.endLine < breakpoint.lineNumber) return cb(null, result);
// TODO: scriptDebugServer().setBreakpoint(scriptId, breakpoint, &actualLineNumber, &actualColumnNumber, false);
// https://code.google.com/p/chromium/codesearch#chromium/src/third_party/WebKit/Source/bindings/core/v8/ScriptDebugServer.cpp&l=89
var debugServerBreakpointId = 'TBD'
if (!debugServerBreakpointId) return cb(null, result);
// will be returned from call to script debug server
var actualLineNumber = breakpoint.lineNumber
, actualColumnNumber = breakpoint.columnNumber
result.locations.push({
scriptId : script.id
, lineNumber : actualLineNumber
, columnNumber : actualColumnNumber
})
cb(null, result);
}
}
// https://code.google.com/p/chromium/codesearch#chromium/src/third_party/WebKit/Source/core/inspector/InspectorDebuggerAgent.cpp&l=333
proto.setBreakpointByUrl = function setBreakpointByUrl(opts, cb) {
if (opts.urlRegex) return cb(new Error('Not supporting setBreakpointByUrl with urlRegex'));
var isAntibreakpoint = !!opts.isAntibreakpoint
, url = opts.url
, condition = opts.condition || ''
, lineNumber = opts.lineNumber
, columnNumber
if (typeof opts.columnNumber === Number) {
columnNumber = opts.columnNumber;
if (columnNumber < 0) return cb(new Error('Incorrect column number.'));
} else {
columnNumber = isAntibreakpoint ? -1 : 0;
}
var breakpointId = format('%s:%d:%d', url, lineNumber, columnNumber);
if (this._breakpointsCookie[breakpointId]) return cb(new Error('Breakpoint at specified location already exists.'));
this._breakpointsCookie[breakpointId] = {
url : url
, lineNumber : lineNumber
, columnNumber : columnNumber
, condition : condition
, isAntibreakpoint : isAntibreakpoint
}
if (isAntibreakpoint) return cb(null, { breakpointId: breakpointId });
var match = scripts.byUrl[url];
if (!match) return cb(null, { breakpointId: breakpointId, locations: [] })
var breakpoint = { lineNumber: lineNumber, columnNumber: columnNumber, condition: condition }
this._resolveBreakpoint(breakpointId, match, breakpoint, cb)
}
proto._removeBreakpoint = function _removeBreakpoint(breakpointId, cb) {
// todo
cb()
}
// https://code.google.com/p/chromium/codesearch#chromium/src/third_party/WebKit/Source/core/inspector/InspectorDebuggerAgent.cpp&l=416
proto.removeBreakpoint = function removeBreakpoint(breakpointId, cb) {
var breakpoint = this._breakpointsCookie[breakpointId];
if (!breakpoint) return;
this._breakpointsCookie[breakpointId] = undefined;
if (!breakpoint.isAntibreakpoint) this._removeBreakpoint(breakpointId, cb);
else cb()
}
proto.getScriptSource = function getScriptSource(id, cb) {
var script = scripts.byId[id];
if (!script) return cb(new Error('Script with id ' + id + 'was not found'))
cb(null, { scriptSource: script.source })
}
proto.setBreakpointsActive = ignore
proto.setSkipAllPauses = ignore
proto.setBreakpoint = ignore
proto.continueToLocation = ignore
proto.stepOver = ignore
proto.stepInto = ignore
proto.stepOut = ignore
proto.pause = ignore
proto.resume = ignore
proto.searchInContent = ignore
proto.canSetScriptSource = ignore
proto.setScriptSource = ignore
proto.restartFrame = ignore
proto.getFunctionDetails = ignore
proto.getCollectionEntries = ignore
proto.setPauseOnExceptions = ignore
proto.evaluateOnCallFrame = ignore
proto.compileScript = ignore
proto.runScript = ignore
proto.setOverlayMessage = ignore
proto.setVariableValue = ignore
proto.getStepInPositions = ignore
proto.getBacktrace = ignore
proto.skipStackFrames = ignore
proto.setAsyncCallStackDepth = ignore
proto.enablePromiseTracker = ignore
proto.disablePromiseTracker = ignore
proto.getPromises = ignore
proto.getPromiseById = ignore
|
/* eslint no-console: 0 */
'use strict';
const fs = require('fs');
const mkdirp = require('mkdirp');
const rollup = require('rollup');
const nodeResolve = require('rollup-plugin-node-resolve');
const commonjs = require('rollup-plugin-commonjs');
const uglify = require('rollup-plugin-uglify');
const src = 'src';
const dest = 'dist/rollup-aot';
Promise.all([
// build main/app
rollup.rollup({
entry: `${src}/main-aot.js`,
context: 'this',
plugins: [
nodeResolve({ jsnext: true, module: true }),
commonjs(),
uglify({
output: {
comments: /@preserve|@license|@cc_on/i,
},
mangle: {
keep_fnames: true,
},
compress: {
warnings: false,
},
}),
],
}).then(app =>
app.write({
format: 'iife',
dest: `${dest}/app.js`,
sourceMap: false,
})
),
// build polyfills
rollup.rollup({
entry: `${src}/polyfills-aot.js`,
context: 'this',
plugins: [
nodeResolve({ jsnext: true, module: true }),
commonjs(),
uglify(),
],
}).then(app =>
app.write({
format: 'iife',
dest: `${dest}/polyfills.js`,
sourceMap: false,
})
),
// create index.html
new Promise((resolve, reject) => {
fs.readFile(`${src}/index.html`, 'utf-8', (readErr, indexHtml) => {
if (readErr) return reject(readErr);
const newIndexHtml = indexHtml
.replace('</head>', '<script src="polyfills.js"></script></head>')
.replace('</body>', '<script src="app.js"></script></body>');
mkdirp(dest, mkdirpErr => {
if (mkdirpErr) return reject(mkdirpErr);
return true;
});
return fs.writeFile(
`${dest}/index.html`,
newIndexHtml,
'utf-8',
writeErr => {
if (writeErr) return reject(writeErr);
console.log('Created index.html');
return resolve();
}
);
});
}),
]).then(() => {
console.log('Rollup complete');
}).catch(err => {
console.error('Rollup failed with ', err);
});
|
function checkHeadersSent(res, cb) {
return (err, results) => {
if (res.headersSent) {
if (err) {
return cb(err)
}
return null
}
cb(err, results)
}
}
exports.finish = function finish(req, res, next) {
const check = checkHeadersSent.bind(null, res)
if (req.method === 'GET') {
return check((err, results) => {
if (err) {
return next(err) // Send to default handler
}
res.json(results)
})
} else if (req.method === 'POST') {
return check((err, results) => {
if (err) {
return next(err) // Send to default handler
}
/* eslint-disable max-len */
// http://www.vinaysahni.com/best-practices-for-a-pragmatic-restful-api?hn#useful-post-responses
if (results) {
res.json(results, 200)
} else {
res.json(204, {})
}
})
} else if (req.method === 'PUT') {
return check((err, results) => {
if (err) {
return next(err) // Send to default handler
}
if (results) {
res.json(results, 200)
} else {
res.json(204, {})
}
})
} else if (req.method === 'PATCH') {
return check((err, results) => {
if (err) {
return next(err) // Send to default handler
}
if (results) {
res.json(results)
} else {
res.json(204, {})
}
})
} else if (req.method === 'DELETE') {
return check((err, results) => {
if (err) {
return next(err) // Send to default handler
}
if (results) {
res.json(results)
} else {
res.json(204, {})
}
})
}
}
|
const createImmutableEqualsSelector = require('./customSelectorCreator');
const compare = require('../util/compare');
const exampleReducers = require('../reducers/exampleReducers');
/**
* Get state function
*/
const getSortingState = exampleReducers.getSortingState;
const getPaginationState = exampleReducers.getPaginationState;
const getDataState = exampleReducers.getDataState;
/**
* Sorting immutable data source
* @param {Map} source immutable data source
* @param {string} sortingKey property of data
* @param {string} orderByCondition 'asc' or 'desc'
* @return {List} immutable testing data source with sorting
*/
const sortingData = (source, sortingKey, orderByCondition) => {
let orderBy = orderByCondition === 'asc' ? 1 : -1;
return source.sortBy(data => data.get(sortingKey), (v, k) => orderBy * compare(v, k));
}
/**
* Paginating data from sortingSelector
* @param {List} sortedData immutable data source with sorting
* @param {number} start
* @param {number} end
* @return {array} sorting data with pagination and converting Immutable.List to array
*/
const pagination = (sortedData, start, end) => sortedData.slice(start, end).toList().toJS()
/**
* Partial selector only to do sorting
*/
const sortingSelector = createImmutableEqualsSelector(
[
getDataState, // get data source
getSortingState
],
(dataState, sortingCondition) => sortingData(dataState, sortingCondition.get('sortingKey'), sortingCondition.get('orderBy'))
)
/**
* Root selector to paginate data from sortingSelector
*/
const paginationSelector = createImmutableEqualsSelector(
[
sortingSelector, // bind selector to be new data source
getPaginationState
],
(sortedData, paginationCondition) => pagination(sortedData, paginationCondition.get('start'), paginationCondition.get('end'))
)
module.exports = paginationSelector;
|
var stream = require('readable-stream')
var util = require('util')
var fifo = require('fifo')
var toStreams2 = function(s) {
if (s._readableState) return s
var wrap = new stream.Readable().wrap(s)
if (s.destroy) wrap.destroy = s.destroy.bind(s)
return wrap
}
var Parallel = function(streams, opts) {
if (!(this instanceof Parallel)) return new Parallel(streams, opts)
stream.Readable.call(this, opts)
this.destroyed = false
this._forwarding = false
this._drained = false
this._queue = fifo()
for (var i = 0; i < streams.length; i++) this.add(streams[i])
this._current = this._queue.node
}
util.inherits(Parallel, stream.Readable)
Parallel.obj = function(streams) {
return new Parallel(streams, {objectMode: true, highWaterMark: 16})
}
Parallel.prototype.add = function(s) {
s = toStreams2(s)
var self = this
var node = this._queue.push(s)
var onend = function() {
if (node === self._current) self._current = node.next
self._queue.remove(node)
s.removeListener('readable', onreadable)
s.removeListener('end', onend)
s.removeListener('error', onerror)
s.removeListener('close', onclose)
self._forward()
}
var onreadable = function() {
self._forward()
}
var onclose = function() {
if (!s._readableState.ended) self.destroy()
}
var onerror = function(err) {
self.destroy(err)
}
s.on('end', onend)
s.on('readable', onreadable)
s.on('close', onclose)
s.on('error', onerror)
}
Parallel.prototype._read = function () {
this._drained = true
this._forward()
}
Parallel.prototype._forward = function () {
if (this._forwarding || !this._drained) return
this._forwarding = true
var stream = this._get()
if (!stream) return
var chunk
while ((chunk = stream.read()) !== null) {
this._current = this._current.next
this._drained = this.push(chunk)
stream = this._get()
if (!stream) return
}
this._forwarding = false
}
Parallel.prototype._get = function() {
var stream = this._current && this._queue.get(this._current)
if (!stream) this.push(null)
else return stream
}
Parallel.prototype.destroy = function (err) {
if (this.destroyed) return
this.destroyed = true
var next
while ((next = this._queue.shift())) {
if (next.destroy) next.destroy()
}
if (err) this.emit('error', err)
this.emit('close')
}
module.exports = Parallel
|
const App = require('./spec/app');
module.exports = config => {
const params = {
basePath: '',
frameworks: [
'express-http-server',
'jasmine'
],
files: [
'lib/**/*.js'
],
colors: true,
singleRun: true,
logLevel: config.LOG_WARN,
browsers: [
'Chrome',
'PhantomJS'
],
concurrency: Infinity,
reporters: [
'spec',
'coverage'
],
preprocessors: {
'lib/**/*.js': ['coverage']
},
coverageReporter: {
dir: 'coverage/',
reporters: [
{
type: 'html',
subdir: 'report'
},
{
type: 'lcovonly',
subdir: './',
file: 'coverage-front.info'
},
{
type: 'lcov',
subdir: '.'
}
]
},
browserDisconnectTimeout: 15000,
browserNoActivityTimeout: 120000,
expressHttpServer: {
port: 8092,
appVisitor: App
}
};
if (process.env.TRAVIS) {
params.browsers = [
'PhantomJS'
];
}
config.set(params);
};
|
"use strict";
let fs = require("fs")
, chalk = require("chalk");
module.exports = function(name) {
let file = process.env.CONFIG_PATH + "initializers/" + name;
if (!fs.existsSync(file + ".js")) console.log(chalk.red("\tInitializer", name + ".js not found, add it on /config/initializers"));
return require(file);
};
|
"use strict";
// Controller
function Avatar(app, req, res) {
// HTTP action
this.action = (params) => {
app.sendFile(res, './storage/users/' + params[0] + '/' + params[1]);
};
};
module.exports = Avatar;
|
"use strict";
var Response = (function () {
function Response(result, childWork) {
this.result = result;
this.childWork = childWork;
}
return Response;
}());
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = Response;
//# sourceMappingURL=response.js.map
|
Package.describe({
name: 'craigslist-utils',
summary: 'Npm Craigslist-utils packaged for Meteor.'
});
Npm.depends ({
'craigslist-utils': '0.0.7'
});
Package.on_use(function (api) {
api.add_files('craigslist-utils.js', ['server']);
api.export('CL');
});
Package.on_test(function (api) {
api.use('craigslist-utils');
api.use('tinytest');
api.add_files('craigslist-utils_tests.js');
});
|
'use strict';
import Application from '../../core/Application.js';
import Action from '../../core/Action.js';
describe('Action', () => {
var app;
var action;
class ChildAction extends Action {
get name() {
return 'ChildAction';
}
}
beforeEach(() => {
app = new Application();
action = new ChildAction(app);
});
it('has to be defined, be a function and can be instantiated', () => {
expect(ChildAction).toBeDefined();
expect(ChildAction).toEqual(jasmine.any(Function));
expect(action instanceof ChildAction).toBe(true);
});
it('holds an app instance', () => {
var myApp = action.app;
expect(myApp).toEqual(jasmine.any(Application));
expect(myApp).toBe(app);
});
it('has an execute function that throws an error if it is not implemented', () => {
expect(action.execute).toEqual(jasmine.any(Function));
expect(() => action.execute(payload)).toThrow();
});
});
|
$(document).ready(function() {
$('#mostrar_menu').click(function() {
$('#sidebar-wrapper').toggle(300);
});
});
|
const { app, BrowserWindow } = require('electron');
const {ipcMain} = require('electron');
// shared to-do list data
global.sharedData = {
itemList: [
{
id: 0,
text: "First meet up with David Lau on 5th July",
isCompleted: true
},
{
id: 1,
text: "David Bewick meet with David Lau on Monday",
isCompleted: true
},
{
id: 2,
text: "David Lau to speak with Kaspar on Wednesday",
isCompleted: false
}
],
itemLatestID: 2
};
// electron main process
app.on('ready', () => {
const numOfWindows = 3; // number of windows, can grow dynamically
var windows = [];
for(var i = 0; i < numOfWindows; i++){
const win = new BrowserWindow({
width: 800,
height: 600,
show: true,
});
win.loadURL(`file://${__dirname}/dist/index.html`);
// win.openDevTools();
windows.push(win);
}
ipcMain.on('item-list-update', () => {
windows.forEach((win) => {
win.webContents.send('refresh-item-data');
});
});
});
|
var expect = chai.expect;
describe("sails", function() {
beforeEach(function() { });
afterEach(function() { });
it('should not fail', function() { expect(true).to.be.true; });
});
|
export default {
navigator: {
doc: 'Docs',
demo: 'Demo',
started: 'Get Started'
},
features: {
userExperience: {
title: 'Optimize Experience',
desc: 'To make scroll more smoothly, We support flexible configurations about inertial scrolling, rebound, fade scrollbar, etc. which could optimize user experience obviously.'
},
application: {
title: 'Rich Features',
desc: 'It can be applied to normal scroll list, picker, slide, index list, start guidance, etc. What\'s more, some complicated needs like pull down refresh and pull up load can be implemented much easier.'
},
dependence: {
title: 'Dependence Free',
desc: 'As a plain JavaScript library, BetterScroll doesn\'t depend on any framework, you could use it alone, or with any other MVVM frameworks.'
}
},
examples: {
normalScrollList: 'Normal Scroll List',
indexList: 'Index List',
picker: 'Picker',
slide: 'Slide',
startGuidance: 'Start Guidance',
freeScroll: 'Free Scroll',
formList: 'Form List',
verticalScrollImg: 'vertical-scroll-en.jpeg',
indexListImg: 'index-list.jpeg',
pickerImg: 'picker-en.jpeg',
slideImg: 'slide.jpeg',
startGuidanceImg: 'full-page-slide.jpeg',
freeScrollImg: 'free-scroll.jpeg',
formListImg: 'form-list-en.jpeg'
},
normalScrollListPage: {
desc: 'Nomal scroll list based on BetterScroll',
scrollbar: 'Scrollbar',
pullDownRefresh: 'Pull Down Refresh',
pullUpLoad: 'Pull Up Load',
previousTxt: 'I am the No.',
followingTxt: ' line',
newDataTxt: 'I am new data: '
},
scrollComponent: {
defaultLoadTxtMore: 'Load more',
defaultLoadTxtNoMore: 'There is no more data',
defaultRefreshTxt: 'Refresh success'
},
indexListPage: {
title: 'Current City: Beijing'
},
pickerPage: {
desc: 'Picker is a typical choose component at mobile end. And it could dynamic change the data of every column to realize linkage picker.',
picker: ' picker',
pickerDemo: ' picker demo ...',
oneColumn: 'One column',
twoColumn: 'Two column',
threeColumn: 'Three column',
linkage: 'Linkage',
confirmTxt: 'confirm | ok',
cancelTxt: 'cancel | close'
},
slidePage: {
desc: 'Slide is a typical component at mobile end, support horizontal move.'
},
fullPageSlideComponent: {
buttonTxt: 'Start Use'
},
freeScrollPage: {
desc: 'Free scroll supports horizontal and vertical move at the same time.'
},
formListPage: {
desc: 'To use form in better-scroll, you need to make sure the option click is configured as false, since some native element events will be prevented when click is true. And in this situation, we recommend to handle click by listening tap event.',
previousTxt: 'No.',
followingTxt: ' option'
}
}
|
/* @flow */
import assert from 'assert';
import { CONVERSION_TABLE } from './06-export';
import type { Unit, UnitValue } from './06-export';
// We didn't cover any edge cases yet, so let's do this now
export function convertUnit(from: Unit, to: Unit, value: number): ?number {
if (from === to) {
return value;
}
// If there is no conversion possible, return null
// Note how we are using '== null' instead of '=== null'
// because the first notation will cover both cases, 'null'
// and 'undefined', which spares us a lot of extra code.
// You will need to set eslint's 'eqeqeq' rule to '[2, "smart"]'
if (CONVERSION_TABLE[from] == null || CONVERSION_TABLE[from][to] == null) {
return null;
}
const transform = CONVERSION_TABLE[from][to];
return transform(value);
}
// Intersection Type for assuming unit to be 'm'
// unit cannot be anything but a `Unit`, so we even
// prevent errors on definition
type MeterUnitValue = {
unit: 'm'
} & UnitValue;
// Convert whole UnitValues instead of single values
function convertToKm(unitValue: MeterUnitValue): ?UnitValue {
const { unit, value } = unitValue;
const converted = convertUnit(unit, 'km', value);
if (converted == null) {
return null;
}
return {
unit: 'km',
value: converted,
}
}
const value = convertToKm({ unit: 'm', value: 1500 });
assert.deepEqual(value, { unit: 'km', value: 1.5 });
|
$(document).ready(function () {
// add classes to check boxes
$('#id_notify_at_threshold').addClass('form-control');
$('#id_in_live_deal').addClass('form-control');
$('#id_is_subscription').addClass('form-control');
});
|
import React, { Component } from 'react';
export default React.createClass({
getInitialState: function () {
return { title: '', body: '' };
},
handleChangeTitle: function (e) {
this.setState({ title: e.target.value });
},
handleChangeBody: function (e) {
this.setState({ body: e.target.value });
},
handleSubmit: function (e) {
e.preventDefault();
this.props.addPost(this.state);
},
render() {
return (
<div>
<h3>New post</h3>
<form onSubmit={this.handleSubmit}>
<input type="text"
placeholder="sdfsd"
value={this.title}
placeholder="title"
onChange={this.handleChangeTitle} />
<br />
<textarea type="text"
placeholder="sdfsd"
placeholder="body"
onChange={this.handleChangeBody} >
{this.body}
</textarea>
<button>Submit</button>
</form>
</div>
);
},
});
|
export default {
'/': {
component: require('./components/NowPlayingView'),
name: 'NowPlaying'
}
}
|
/**
Copyright (c) 2007 Bill Orcutt (http://lilyapp.org, http://publicbeta.cx)
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* Construct a new color object
* @class
* @constructor
* @extends LilyObjectBase
*/
function $color(arg)
{
var thisPtr=this;
var websafe=arg||false;
this.outlet1 = new this.outletClass("outlet1",this,"random color in hexadecimal");
this.inlet1=new this.inletClass("inlet1",this,"\"bang\" outputs random color");
// getRandomColor()
// Returns a random hex color. Passing true for safe returns a web safe color
//code hijacked from http://www.scottandrew.com/js/js_util.js
function getRandomColor(safe)
{
var vals,r,n;
if (safe)
{
v = "0369CF";
n = 3;
} else
{
v = "0123456789ABCDEF";
n = 6;
}
var c = "#";
for (var i=0;i<n;i++)
{
var ch = v.charAt(Math.round(Math.random() * (v.length-1)));
c += (safe)?ch+ch:ch;
}
return c;
}
function RGBtoHex(R,G,B) {
return toHex(R)+toHex(G)+toHex(B);
}
function toHex(N) {
if (N==null) return "00";
N=parseInt(N); if (N==0 || isNaN(N)) return "00";
N=Math.max(0,N); N=Math.min(N,255); N=Math.round(N);
return "0123456789ABCDEF".charAt((N-N%16)/16) + "0123456789ABCDEF".charAt(N%16);
}
function HSLtoRGB (h,s,l) {
if (s == 0) return [l,l,l] // achromatic
h=h*360/255;s/=255;l/=255;
if (l <= 0.5) rm2 = l + l * s;
else rm2 = l + s - l * s;
rm1 = 2.0 * l - rm2;
return [toRGB1(rm1, rm2, h + 120.0),toRGB1(rm1, rm2, h),toRGB1(rm1, rm2, h - 120.0)];
}
function toRGB1(rm1,rm2,rh) {
if (rh > 360.0) rh -= 360.0;
else if (rh < 0.0) rh += 360.0;
if (rh < 60.0) rm1 = rm1 + (rm2 - rm1) * rh / 60.0;
else if (rh < 180.0) rm1 = rm2;
else if (rh < 240.0) rm1 = rm1 + (rm2 - rm1) * (240.0 - rh) / 60.0;
return Math.round(rm1 * 255);
}
//output random color
this.inlet1["random"]=function() {
thisPtr.outlet1.doOutlet(getRandomColor(websafe));
}
//convert RGB to hex
this.inlet1["RGBtoHEX"]=function(rgb) {
var tmp = rgb.split(" ");
thisPtr.outlet1.doOutlet("#"+RGBtoHex(tmp[0],tmp[1],tmp[2]));
}
//convert HSL to hex
this.inlet1["HSLtoHEX"]=function(hsl) {
var tmp = hsl.split(" ");
var rgb = HSLtoRGB(tmp[0],tmp[1],tmp[2]);
thisPtr.outlet1.doOutlet("#"+RGBtoHex(rgb[0],rgb[1],rgb[2]));
}
return this;
}
var $colorMetaData = {
textName:"color",
htmlName:"color",
objectCategory:"Math",
objectSummary:"Various color related utilities",
objectArguments:"websafe colors only [false]"
}
|
Ext.provide('Phlexible.users.UserWindow');
Ext.require('Ext.ux.TabPanel');
Phlexible.users.UserWindow = Ext.extend(Ext.Window, {
title: Phlexible.users.Strings.user,
strings: Phlexible.users.Strings,
plain: true,
iconCls: 'p-user-user-icon',
width: 530,
minWidth: 530,
height: 400,
minHeight: 400,
layout: 'fit',
border: false,
modal: true,
initComponent: function () {
this.addEvents(
'save'
);
var panels = Phlexible.PluginRegistry.get('userEditPanels');
this.items = [{
xtype: 'uxtabpanel',
tabPosition: 'left',
tabStripWidth: 150,
activeTab: 0,
border: true,
deferredRender: false,
items: panels
}];
this.tbar = new Ext.Toolbar({
hidden: true,
cls: 'p-users-disabled',
items: [
'->',
{
iconCls: 'p-user-user_account-icon',
text: this.strings.account_is_disabled,
handler: function () {
this.getComponent(0).setActiveTab(4);
},
scope: this
}]
});
this.buttons = [
{
text: this.strings.cancel,
handler: this.close,
scope: this
},
{
text: this.strings.save,
iconCls: 'p-user-save-icon',
handler: this.save,
scope: this
}
];
Phlexible.users.UserWindow.superclass.initComponent.call(this);
},
show: function (user) {
this.user = user;
if (user.get('username')) {
this.setTitle(this.strings.user + ' "' + user.get('username') + '"');
} else {
this.setTitle(this.strings.new_user);
}
Phlexible.users.UserWindow.superclass.show.call(this);
this.getComponent(0).items.each(function(p) {
if (typeof p.loadUser === 'function') {
p.loadUser(user);
}
});
if (!user.get('enabled')) {
this.getTopToolbar().show();
}
},
save: function () {
var data = {};
var valid = true;
this.getComponent(0).items.each(function(p) {
if (typeof p.isValid === 'function' && typeof p.getData === 'function') {
if (p.isValid()) {
Ext.apply(data, p.getData());
} else {
valid = false;
}
}
});
if (!valid) {
return;
}
var url, method;
if (this.user.get('uid')) {
url = Phlexible.Router.generate('users_users_update', {userId: this.user.get('uid')});
method = 'PUT';
} else {
url = Phlexible.Router.generate('users_users_create');
method = 'POST';
}
Ext.Ajax.request({
url: url,
method: method,
params: data,
success: this.onSaveSuccess,
scope: this
});
},
onSaveSuccess: function (response) {
var data = Ext.decode(response.responseText);
if (data.success) {
this.uid = data.uid;
Phlexible.success(data.msg);
this.fireEvent('save', this.uid);
this.close();
} else {
Ext.Msg.alert('Failure', data.msg);
}
}
});
|
'use strict';
angular.module('rvplusplus').directive('initFocus', function() {
return {
restrict: 'A', // only activate on element attribute
link: function(scope, element, attrs) {
element.focus();
}
};
});
|
/**
* @arliteam/arli v0.2.1
* https://github.com/arliteam/arli
*
* Copyright (c) Mohamed Elkebir (https://getsupercode.com)
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
"use strict";
exports.__esModule = true;
/**
* Test if a date string is in latin DMY format.
*
* Date format: DD/MM/YY[YY] DD.MM.YY[YY] DD-MM-YY[YY] DD MM YY[YY]
*
* https://en.wikipedia.org/wiki/Date_format_by_country
*
* @example
* 30/12/2000 | 30/12/99
* 30-12-2000 | 30-12-99
* 30.12.2000 | 30.12.99
* 30 12 2000 | 30 12 99
*
* @param date A string of date to be tested
*/
exports.isDateDMY = function (date) {
var pattern = /^(31|30|(?:0[1-9]|[1-2][0-9]))(\/|\.|-| )(12|11|10|0[1-9])(\2)(\d{4}|\d{2})$/;
return pattern.test(date);
};
/**
* Test if a date string is in latin MDY format.
*
* Date format: MM/DD/YY[YY] MM.DD.YY[YY] MM-DD-YY[YY] MM DD YY[YY]
*
* https://en.wikipedia.org/wiki/Date_format_by_country
*
* @example
* 12/30/2000 | 12/30/99
* 12-30-2000 | 12-30-99
* 12.30.2000 | 12.30.99
* 12 30 2000 | 12 30 99
*
* @param date A string of date to be tested
*/
exports.isDateMDY = function (date) {
var pattern = /^(12|11|10|0[1-9])(\/|\.|-| )(31|30|(?:0[1-9]|[1-2][0-9]))(\2)(\d{4}|\d{2})$/;
return pattern.test(date);
};
/**
* Test if a date string is in latin YMD format.
*
* Date format: YY[YY]/MM/DD YY[YY].MM.DD YY[YY]-MM-DD YY[YY] MM DD
*
* https://en.wikipedia.org/wiki/Date_format_by_country
*
* @example
* 2000/12/30 | 99/12/30
* 2000-12-30 | 99-12-30
* 2000.12.30 | 99.12.30
* 2000 12 30 | 99 12 30
*
* @param date A string of date to be tested
*/
exports.isDateYMD = function (date) {
var pattern = /^(\d{4}|\d{2})(\/|\.|-| )(12|11|10|0[1-9])(\2)(31|30|(?:0[1-9]|[1-2][0-9]))$/;
return pattern.test(date);
};
|
import external from '../../../externalModules.js';
import getNumberValues from './getNumberValues.js';
import parseImageId from '../parseImageId.js';
import dataSetCacheManager from '../dataSetCacheManager.js';
import getImagePixelModule from './getImagePixelModule.js';
import getOverlayPlaneModule from './getOverlayPlaneModule.js';
import getLUTs from './getLUTs.js';
import getModalityLUTOutputPixelRepresentation from './getModalityLUTOutputPixelRepresentation.js';
function metaDataProvider(type, imageId) {
const { dicomParser } = external;
const parsedImageId = parseImageId(imageId);
const dataSet = dataSetCacheManager.get(parsedImageId.url);
if (!dataSet) {
return;
}
if (type === 'generalSeriesModule') {
return {
modality: dataSet.string('x00080060'),
seriesInstanceUID: dataSet.string('x0020000e'),
seriesNumber: dataSet.intString('x00200011'),
studyInstanceUID: dataSet.string('x0020000d'),
seriesDate: dicomParser.parseDA(dataSet.string('x00080021')),
seriesTime: dicomParser.parseTM(dataSet.string('x00080031') || ''),
};
}
if (type === 'patientStudyModule') {
return {
patientAge: dataSet.intString('x00101010'),
patientSize: dataSet.floatString('x00101020'),
patientWeight: dataSet.floatString('x00101030'),
};
}
if (type === 'imagePlaneModule') {
const imageOrientationPatient = getNumberValues(dataSet, 'x00200037', 6);
const imagePositionPatient = getNumberValues(dataSet, 'x00200032', 3);
const pixelSpacing = getNumberValues(dataSet, 'x00280030', 2);
let columnPixelSpacing = null;
let rowPixelSpacing = null;
if (pixelSpacing) {
rowPixelSpacing = pixelSpacing[0];
columnPixelSpacing = pixelSpacing[1];
}
let rowCosines = null;
let columnCosines = null;
if (imageOrientationPatient) {
rowCosines = [
parseFloat(imageOrientationPatient[0]),
parseFloat(imageOrientationPatient[1]),
parseFloat(imageOrientationPatient[2]),
];
columnCosines = [
parseFloat(imageOrientationPatient[3]),
parseFloat(imageOrientationPatient[4]),
parseFloat(imageOrientationPatient[5]),
];
}
return {
frameOfReferenceUID: dataSet.string('x00200052'),
rows: dataSet.uint16('x00280010'),
columns: dataSet.uint16('x00280011'),
imageOrientationPatient,
rowCosines,
columnCosines,
imagePositionPatient,
sliceThickness: dataSet.floatString('x00180050'),
sliceLocation: dataSet.floatString('x00201041'),
pixelSpacing,
rowPixelSpacing,
columnPixelSpacing,
};
}
if (type === 'imagePixelModule') {
return getImagePixelModule(dataSet);
}
if (type === 'modalityLutModule') {
return {
rescaleIntercept: dataSet.floatString('x00281052'),
rescaleSlope: dataSet.floatString('x00281053'),
rescaleType: dataSet.string('x00281054'),
modalityLUTSequence: getLUTs(
dataSet.uint16('x00280103'),
dataSet.elements.x00283000
),
};
}
if (type === 'voiLutModule') {
const modalityLUTOutputPixelRepresentation = getModalityLUTOutputPixelRepresentation(
dataSet
);
return {
windowCenter: getNumberValues(dataSet, 'x00281050', 1),
windowWidth: getNumberValues(dataSet, 'x00281051', 1),
voiLUTSequence: getLUTs(
modalityLUTOutputPixelRepresentation,
dataSet.elements.x00283010
),
};
}
if (type === 'sopCommonModule') {
return {
sopClassUID: dataSet.string('x00080016'),
sopInstanceUID: dataSet.string('x00080018'),
};
}
if (type === 'petIsotopeModule') {
const radiopharmaceuticalInfo = dataSet.elements.x00540016;
if (radiopharmaceuticalInfo === undefined) {
return;
}
const firstRadiopharmaceuticalInfoDataSet =
radiopharmaceuticalInfo.items[0].dataSet;
return {
radiopharmaceuticalInfo: {
radiopharmaceuticalStartTime: dicomParser.parseTM(
firstRadiopharmaceuticalInfoDataSet.string('x00181072') || ''
),
radionuclideTotalDose: firstRadiopharmaceuticalInfoDataSet.floatString(
'x00181074'
),
radionuclideHalfLife: firstRadiopharmaceuticalInfoDataSet.floatString(
'x00181075'
),
},
};
}
if (type === 'overlayPlaneModule') {
return getOverlayPlaneModule(dataSet);
}
}
export default metaDataProvider;
|
import Tablesaw from '../../dist/tablesaw';
console.log( "this should be the tablesaw object: ", Tablesaw );
|
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
// about supported directives.
//
//
//= require_tree .
|
/**
* Vector
*/
(function()
{
var global = this,
nspace = global.Util,
Exception = global.Exception,
math = global.mathjs();
/**
*
* @type Vector
* @param {Array} basis The basis vectors, ordered correctly, orthonormal and complete
*/
var Vector = nspace.Vector = function(basis)
{
if (!basis || ('length' in basis && basis.length === 0))
{
throw new Exception.InvalidPreparation('Basis vector cannot be empty');
}
// Set basis and init components with same length and value of 1
this.basis = basis;
this.components = basis.map(function()
{
return 1;
});
};
/**
* Computes the inner product of two vectors, <v1|v2>
*
* @returns {mathjs} Scalar
*/
Vector.innerProduct = function(v1, v2)
{
var basis1 = v1.getBasis(),
basis2 = v2.getBasis();
// Must have same basis lengths
if (basis1.length !== basis2.length)
{
throw new Exception.InvalidPreparation('Basis must be same length');
}
var comp1 = v1.getComponents(),
comp2 = v2.getComponents();
var product = 0;
// Essentially a foil operation, but this will support greater than two terms
for (var i = 0; i < basis1.length; i++)
{
for (var j = 0; j < basis2.length; j++)
{
var comp = math.multiply(math.conj(comp1[i]), comp2[j]);
var basis = math.multiply(math.conj(math.transpose(basis1[i])), basis2[j]);
product = math.add(product, math.multiply(comp, basis));
}
}
return product.get([0,0]);
};
/**
* Computes the outer product of two vectors,
* (|v1x><v1x| + |v1y><v1y|)(|v2x> + |v2y>)
*
* @returns {undefined}
*/
Vector.outerProduct = function(v1, v2)
{
var basis1 = v1.getBasis(),
basis2 = v2.getBasis();
// Must have same basis lengths
if (basis1.length !== basis2.length)
{
throw new Exception.InvalidPreparation('Basis must be same length');
}
var comp1 = v1.getComponents(),
comp2 = v2.getComponents();
var product = new Vector(basis1);
// Essentially a foil operation, but this will support greater than two terms
for (var i = 0; i < basis1.length; i++)
{
var productComp = 0;
for (var j = 0; j < basis2.length; j++)
{
var comp = math.multiply(math.conj(comp1[i]), comp2[j]);
var basis = math.multiply(math.conj(math.transpose(basis1[i])), basis2[j]);
productComp = math.add(productComp, math.multiply(comp, basis));
}
product.setComponent(i, productComp.get([0,0]));
}
return product;
};
/**
*
*/
Vector.prototype =
{
basis: null,
components: null,
/**
*
* @param {Number} index The basis vector index
* @param {Mixed} value
* @returns {Vector}
*/
setComponent: function(index, value)
{
if (index >= this.components.length)
{
throw new Exception.InvalidProperty('Invalid basis index');
}
this.components[index] = value;
return this;
},
/**
*
* @param {Number} index The basis vector index
* @returns {Number}
*/
getComponent: function(index)
{
if (index >= this.components.length)
{
throw new Exception.InvalidProperty('Invalid basis index');
}
return this.components[index];
},
/**
*
* @param {Array} values
* @returns {Vector}
*/
setComponents: function(values)
{
if (values.length !== this.components.length)
{
throw new Exception.InvalidProperty('Invalid');
}
this.components = values;
return this;
},
/**
*
* @returns {Number[]}
*/
getComponents: function()
{
return this.components;
},
/**
*
* @returns {mathjs}
*/
getBasis: function()
{
return this.basis;
},
/**
* Applies a scalar to the vector components, simulates applying a scalar to
* vector mathematically
*
* @param {Number} scalar
* @returns {Vector}
*/
scale: function(scalar)
{
this.components = this.components.map(function(component)
{
return math.multiply(scalar, component);
});
return this;
},
/**
* Determines the magnitude of the vector, sqrt(x*x + y*y)
*
* @returns {mathjs}
*/
getMagnitude: function()
{
var magnitude = 0;
for (var i = 0; i < this.components.length; i++)
{
var c = this.components[i];
magnitude = math.add(magnitude, math.multiply(math.conj(c),c));
}
return math.sqrt(magnitude);
},
/**
* Multiplies the components by a scalar to that makes the magnitude 1
*
* @returns {Vector}
*/
normalize: function()
{
var magSq = Vector.innerProduct(this, this);
// Already normalized
if (magSq === 1)
{
return this;
}
return this.scale(math.divide(1,math.sqrt(magSq)));
},
/**
*
* @returns {Vector}
*/
clone: function()
{
var v = new Vector(this.getBasis());
v.setComponents(this.getComponents());
return v;
},
/**
* Returns a new vector that is just one basis dir, by index of the basis
* set
*
* @param {Number} index
* @returns {Vector}
*/
getBasisVector: function(index)
{
var v = this.clone();
// Set all other component values to zero other than the index
v.setComponents(this.components.map(function(val, i)
{
return (i === index)
? val
: 0;
}));
return v.normalize();
}
};
})();
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.