text
stringlengths 2
6.14k
|
|---|
/* */
var $def = require("./$.def"),
$entries = require("./$.object-to-array")(true);
$def($def.S, 'Object', {entries: function entries(it) {
return $entries(it);
}});
|
// META: script=/service-workers/service-worker/resources/test-helpers.sub.js
// META: script=resources/utils.js
'use strict';
// "If parsedURL includes credentials, then throw a TypeError."
// https://fetch.spec.whatwg.org/#dom-request
// (Added by https://github.com/whatwg/fetch/issues/26).
// "A URL includes credentials if its username or password is not the empty
// string."
// https://url.spec.whatwg.org/#include-credentials
backgroundFetchTest((t, bgFetch) => {
return bgFetch.fetch(uniqueTag(), 'https://example.com');
}, 'fetch without credentials in URL should register ok');
backgroundFetchTest((t, bgFetch) => {
return promise_rejects(
t, new TypeError(),
bgFetch.fetch(uniqueTag(), 'https://username:password@example.com'));
}, 'fetch with username and password in URL should reject');
backgroundFetchTest((t, bgFetch) => {
return promise_rejects(
t, new TypeError(),
bgFetch.fetch(uniqueTag(), 'https://username:@example.com'));
}, 'fetch with username and empty password in URL should reject');
backgroundFetchTest((t, bgFetch) => {
return promise_rejects(
t, new TypeError(),
bgFetch.fetch(uniqueTag(), 'https://:password@example.com'));
}, 'fetch with empty username and password in URL should reject');
|
var assert = require('assert');
var R = require('..');
describe('mapObjIndexed', function() {
var times2 = function(x) {return x * 2;};
var addIndexed = function(x, key) {return x + key;};
var squareVowels = function(x, key) {
var vowels = ['a', 'e', 'i', 'o', 'u'];
return R.contains(key, vowels) ? x * x : x;
};
it('works just like a normal mapObj', function() {
assert.deepEqual(R.mapObjIndexed(times2, {a: 1, b: 2, c: 3, d: 4}), {a: 2, b: 4, c: 6, d: 8});
});
it('passes the index as a second parameter to the callback', function() {
assert.deepEqual(R.mapObjIndexed(addIndexed, {a: 8, b: 6, c: 7, d: 5, e: 3, f: 0, g: 9}),
{a: '8a', b: '6b', c: '7c', d: '5d', e: '3e', f: '0f', g: '9g'});
});
it('passes the entire list as a third parameter to the callback', function() {
assert.deepEqual(R.mapObjIndexed(squareVowels, {a: 8, b: 6, c: 7, d: 5, e: 3, f: 0, g: 9}),
{a: 64, b: 6, c: 7, d: 5, e: 9, f: 0, g: 9});
});
it('is curried', function() {
var makeSquareVowels = R.mapObjIndexed(squareVowels);
assert.deepEqual(makeSquareVowels({a: 8, b: 6, c: 7, d: 5, e: 3, f: 0, g: 9}),
{a: 64, b: 6, c: 7, d: 5, e: 9, f: 0, g: 9});
});
});
|
var convert = require('./convert'),
func = convert('wrapperLodash', require('../wrapperLodash'), require('./_falseOptions'));
func.placeholder = require('./placeholder');
module.exports = func;
|
define(
({
nomatchMessage: "Lozinke se ne podudaraju.",
badPasswordMessage: "Neispravna lozinka."
})
);
|
loadjs = (function () {
/**
* Global dependencies.
* @global {Object} document - DOM
*/
var devnull = function() {},
bundleIdCache = {},
bundleResultCache = {},
bundleCallbackQueue = {};
/**
* Subscribe to bundle load event.
* @param {string[]} bundleIds - Bundle ids
* @param {Function} callbackFn - The callback function
*/
function subscribe(bundleIds, callbackFn) {
// listify
bundleIds = bundleIds.push ? bundleIds : [bundleIds];
var depsNotFound = [],
i = bundleIds.length,
numWaiting = i,
fn,
bundleId,
r,
q;
// define callback function
fn = function (bundleId, pathsNotFound) {
if (pathsNotFound.length) depsNotFound.push(bundleId);
numWaiting--;
if (!numWaiting) callbackFn(depsNotFound);
};
// register callback
while (i--) {
bundleId = bundleIds[i];
// execute callback if in result cache
r = bundleResultCache[bundleId];
if (r) {
fn(bundleId, r);
continue;
}
// add to callback queue
q = bundleCallbackQueue[bundleId] = bundleCallbackQueue[bundleId] || [];
q.push(fn);
}
}
/**
* Publish bundle load event.
* @param {string} bundleId - Bundle id
* @param {string[]} pathsNotFound - List of files not found
*/
function publish(bundleId, pathsNotFound) {
// exit if id isn't defined
if (!bundleId) return;
var q = bundleCallbackQueue[bundleId];
// cache result
bundleResultCache[bundleId] = pathsNotFound;
// exit if queue is empty
if (!q) return;
// empty callback queue
while (q.length) {
q[0](bundleId, pathsNotFound);
q.splice(0, 1);
}
}
/**
* Load individual file.
* @param {string} path - The file path
* @param {Function} callbackFn - The callback function
*/
function loadFile(path, callbackFn, args, numTries) {
var doc = document,
async = args.async,
maxTries = (args.numRetries || 0) + 1,
beforeCallbackFn = args.before || devnull,
isCss,
e;
numTries = numTries || 0;
if (/\.css$/.test(path)) {
isCss = true;
// css
e = doc.createElement('link');
e.rel = 'stylesheet';
e.href = path;
} else {
// javascript
e = doc.createElement('script');
e.src = path;
e.async = async === undefined ? true : async;
}
e.onload = e.onerror = e.onbeforeload = function (ev) {
var result = ev.type[0];
// Note: The following code isolates IE using `hideFocus` and treats empty
// stylesheets as failures to get around lack of onerror support
if (isCss && 'hideFocus' in e) {
try {
if (!e.sheet.cssText.length) result = 'e';
} catch (x) {
// sheets objects created from load errors don't allow access to
// `cssText`
result = 'e';
}
}
// handle retries in case of load failure
if (result == 'e') {
// increment counter
numTries += 1;
// exit function and try again
if (numTries < maxTries) {
return loadFile(path, callbackFn, args, numTries);
}
}
// execute callback
callbackFn(path, result, ev.defaultPrevented);
};
// execute before callback
beforeCallbackFn(path, e);
// add to document
doc.head.appendChild(e);
}
/**
* Load multiple files.
* @param {string[]} paths - The file paths
* @param {Function} callbackFn - The callback function
*/
function loadFiles(paths, callbackFn, args) {
// listify paths
paths = paths.push ? paths : [paths];
var numWaiting = paths.length,
x = numWaiting,
pathsNotFound = [],
fn,
i;
// define callback function
fn = function(path, result, defaultPrevented) {
// handle error
if (result == 'e') pathsNotFound.push(path);
// handle beforeload event. If defaultPrevented then that means the load
// will be blocked (ex. Ghostery/ABP on Safari)
if (result == 'b') {
if (defaultPrevented) pathsNotFound.push(path);
else return;
}
numWaiting--;
if (!numWaiting) callbackFn(pathsNotFound);
};
// load scripts
for (i=0; i < x; i++) loadFile(paths[i], fn, args);
}
/**
* Initiate script load and register bundle.
* @param {(string|string[])} paths - The file paths
* @param {(string|Function)} [arg1] - The bundleId or success callback
* @param {Function} [arg2] - The success or error callback
* @param {Function} [arg3] - The error callback
*/
function loadjs(paths, arg1, arg2) {
var bundleId,
args;
// bundleId (if string)
if (arg1 && arg1.trim) bundleId = arg1;
// args (default is {})
args = (bundleId ? arg2 : arg1) || {};
// throw error if bundle is already defined
if (bundleId) {
if (bundleId in bundleIdCache) {
throw "LoadJS";
} else {
bundleIdCache[bundleId] = true;
}
}
// load scripts
loadFiles(paths, function (pathsNotFound) {
// success and error callbacks
if (pathsNotFound.length) (args.error || devnull)(pathsNotFound);
else (args.success || devnull)();
// publish bundle load event
publish(bundleId, pathsNotFound);
}, args);
}
/**
* Execute callbacks when dependencies have been satisfied.
* @param {(string|string[])} deps - List of bundle ids
* @param {Object} args - success/error arguments
*/
loadjs.ready = function ready(deps, args) {
// subscribe to bundle load event
subscribe(deps, function (depsNotFound) {
// execute callbacks
if (depsNotFound.length) (args.error || devnull)(depsNotFound);
else (args.success || devnull)();
});
return loadjs;
};
/**
* Manually satisfy bundle dependencies.
* @param {string} bundleId - The bundle id
*/
loadjs.done = function done(bundleId) {
publish(bundleId, []);
};
/**
* Reset loadjs dependencies statuses
*/
loadjs.reset = function reset() {
bundleIdCache = {};
bundleResultCache = {};
bundleCallbackQueue = {};
};
/**
* Determine if bundle has already been defined
* @param String} bundleId - The bundle id
*/
loadjs.isDefined = function isDefined(bundleId) {
return bundleId in bundleIdCache;
};
// export
return loadjs;
})();
|
(function() {
"use strict";
window.GOVUK = window.GOVUK || {};
// For usage and initialisation see:
// https://github.com/alphagov/govuk_frontend_toolkit/blob/master/docs/analytics.md#create-an-analytics-tracker
var Tracker = function(config) {
this.trackers = [];
if (typeof config.universalId != 'undefined') {
this.trackers.push(new GOVUK.GoogleAnalyticsUniversalTracker(config.universalId, config.cookieDomain));
}
if (typeof config.classicId != 'undefined') {
this.trackers.push(new GOVUK.GoogleAnalyticsClassicTracker(config.classicId, config.cookieDomain));
}
};
Tracker.load = function() {
GOVUK.GoogleAnalyticsClassicTracker.load();
GOVUK.GoogleAnalyticsUniversalTracker.load();
};
Tracker.prototype.trackPageview = function(path, title) {
for (var i=0; i < this.trackers.length; i++) {
this.trackers[i].trackPageview(path, title);
}
};
/*
https://developers.google.com/analytics/devguides/collection/analyticsjs/events
options.label – Useful for categorizing events (eg nav buttons)
options.value – Values must be non-negative. Useful to pass counts
options.nonInteraction – Prevent event from impacting bounce rate
*/
Tracker.prototype.trackEvent = function(category, action, options) {
for (var i=0; i < this.trackers.length; i++) {
this.trackers[i].trackEvent(category, action, options);
}
};
Tracker.prototype.trackShare = function(network) {
var target = location.pathname;
for (var i=0; i < this.trackers.length; i++) {
this.trackers[i].trackSocial(network, 'share', target);
}
};
/*
Assumes that the index of the dimension is the same for both classic and universal.
Check this for your app before using this
*/
Tracker.prototype.setDimension = function(index, value, name, scope) {
for (var i=0; i < this.trackers.length; i++) {
this.trackers[i].setDimension(index, value, name, scope);
}
};
/*
Add a beacon to track a page in another GA account on another domain.
*/
Tracker.prototype.addLinkedTrackerDomain = function(trackerId, name, domain) {
for (var i=0; i < this.trackers.length; i++) {
this.trackers[i].addLinkedTrackerDomain(trackerId, name, domain);
}
};
GOVUK.Tracker = Tracker;
})();
|
/**
* @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
Object.append(Browser.Features, {
inputemail: (function() {
var i = document.createElement("input");
i.setAttribute("type", "email");
return i.type !== "text";
})()
});
/**
* Unobtrusive Form Validation library
*
* Inspired by: Chris Campbell <www.particletree.com>
*
* @package Joomla.Framework
* @subpackage Forms
* @since 1.5
*/
var JFormValidator = new Class({
initialize: function()
{
// Initialize variables
this.handlers = Object();
this.custom = Object();
// Default handlers
this.setHandler('username',
function (value) {
regex = new RegExp("[\<|\>|\"|\'|\%|\;|\(|\)|\&]", "i");
return !regex.test(value);
}
);
this.setHandler('password',
function (value) {
regex=/^\S[\S ]{2,98}\S$/;
return regex.test(value);
}
);
this.setHandler('numeric',
function (value) {
regex=/^(\d|-)?(\d|,)*\.?\d*$/;
return regex.test(value);
}
);
this.setHandler('email',
function (value) {
regex=/^[a-zA-Z0-9._-]+(\+[a-zA-Z0-9._-]+)*@([a-zA-Z0-9.-]+\.)+[a-zA-Z0-9.-]{2,4}$/;
return regex.test(value);
}
);
// Attach to forms with class 'form-validate'
var forms = $$('form.form-validate');
forms.each(function(form){ this.attachToForm(form); }, this);
},
setHandler: function(name, fn, en)
{
en = (en == '') ? true : en;
this.handlers[name] = { enabled: en, exec: fn };
},
attachToForm: function(form)
{
// Iterate through the form object and attach the validate method to all input fields.
form.getElements('input,textarea,select,button').each(function(el){
if (el.hasClass('required')) {
el.set('aria-required', 'true');
el.set('required', 'required');
}
if ((document.id(el).get('tag') == 'input' || document.id(el).get('tag') == 'button') && document.id(el).get('type') == 'submit') {
if (el.hasClass('validate')) {
el.onclick = function(){return document.formvalidator.isValid(this.form);};
}
} else {
el.addEvent('blur', function(){return document.formvalidator.validate(this);});
if (el.hasClass('validate-email') && Browser.Features.inputemail) {
el.type = 'email';
}
}
});
},
validate: function(el)
{
el = document.id(el);
// Ignore the element if its currently disabled, because are not submitted for the http-request. For those case return always true.
if(el.get('disabled')) {
this.handleResponse(true, el);
return true;
}
// If the field is required make sure it has a value
if (el.hasClass('required')) {
if (el.get('tag')=='fieldset' && (el.hasClass('radio') || el.hasClass('checkboxes'))) {
for(var i=0;;i++) {
if (document.id(el.get('id')+i)) {
if (document.id(el.get('id')+i).checked) {
break;
}
}
else {
this.handleResponse(false, el);
return false;
}
}
}
else if (!(el.get('value'))) {
this.handleResponse(false, el);
return false;
}
}
// Only validate the field if the validate class is set
var handler = (el.className && el.className.search(/validate-([a-zA-Z0-9\_\-]+)/) != -1) ? el.className.match(/validate-([a-zA-Z0-9\_\-]+)/)[1] : "";
if (handler == '') {
this.handleResponse(true, el);
return true;
}
// Check the additional validation types
if ((handler) && (handler != 'none') && (this.handlers[handler]) && el.get('value')) {
// Execute the validation handler and return result
if (this.handlers[handler].exec(el.get('value')) != true) {
this.handleResponse(false, el);
return false;
}
}
// Return validation state
this.handleResponse(true, el);
return true;
},
isValid: function(form)
{
var valid = true;
// Validate form fields
var elements = form.getElements('fieldset').concat(Array.from(form.elements));
for (var i=0;i < elements.length; i++) {
if (this.validate(elements[i]) == false) {
valid = false;
}
}
// Run custom form validators if present
new Hash(this.custom).each(function(validator){
if (validator.exec() != true) {
valid = false;
}
});
return valid;
},
handleResponse: function(state, el)
{
// Find the label object for the given field if it exists
if (!(el.labelref)) {
var labels = $$('label');
labels.each(function(label){
if (label.get('for') == el.get('id')) {
el.labelref = label;
}
});
}
// Set the element and its label (if exists) invalid state
if (state == false) {
el.addClass('invalid');
el.set('aria-invalid', 'true');
if (el.labelref) {
document.id(el.labelref).addClass('invalid');
document.id(el.labelref).set('aria-invalid', 'true');
}
} else {
el.removeClass('invalid');
el.set('aria-invalid', 'false');
if (el.labelref) {
document.id(el.labelref).removeClass('invalid');
document.id(el.labelref).set('aria-invalid', 'false');
}
}
}
});
document.formvalidator = null;
window.addEvent('domready', function(){
document.formvalidator = new JFormValidator();
});
|
"use strict";
/**
* @license
* Copyright 2017 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var utils = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
var Rule = (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
}
/* tslint:enable:object-literal-sort-keys */
Rule.FAILURE_STRING = function (name) {
return "Qualifier is unnecessary since '" + name + "' is in scope.";
};
Rule.prototype.applyWithProgram = function (sourceFile, program) {
return this.applyWithFunction(sourceFile, function (ctx) { return walk(ctx, program.getTypeChecker()); });
};
return Rule;
}(Lint.Rules.TypedRule));
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
ruleName: "no-unnecessary-qualifier",
description: "Warns when a namespace qualifier (`A.x`) is unnecessary.",
hasFix: true,
optionsDescription: "Not configurable.",
options: null,
optionExamples: [true],
type: "style",
typescriptOnly: true,
requiresTypeInfo: true,
};
exports.Rule = Rule;
function walk(ctx, checker) {
var namespacesInScope = [];
ts.forEachChild(ctx.sourceFile, cb);
function cb(node) {
switch (node.kind) {
case ts.SyntaxKind.ModuleDeclaration:
case ts.SyntaxKind.EnumDeclaration:
namespacesInScope.push(node);
ts.forEachChild(node, cb);
namespacesInScope.pop();
break;
case ts.SyntaxKind.QualifiedName:
var _a = node, left = _a.left, right = _a.right;
visitNamespaceAccess(node, left, right);
break;
case ts.SyntaxKind.PropertyAccessExpression:
var _b = node, expression = _b.expression, name = _b.name;
if (utils.isEntityNameExpression(expression)) {
visitNamespaceAccess(node, expression, name);
break;
}
// falls through
default:
ts.forEachChild(node, cb);
}
}
function visitNamespaceAccess(node, qualifier, name) {
if (qualifierIsUnnecessary(qualifier, name)) {
var fix = Lint.Replacement.deleteFromTo(qualifier.getStart(), name.getStart());
ctx.addFailureAtNode(qualifier, Rule.FAILURE_STRING(qualifier.getText()), fix);
}
else {
// Only look for nested qualifier errors if we didn't already fail on the outer qualifier.
ts.forEachChild(node, cb);
}
}
function qualifierIsUnnecessary(qualifier, name) {
var namespaceSymbol = checker.getSymbolAtLocation(qualifier);
if (namespaceSymbol === undefined || !symbolIsNamespaceInScope(namespaceSymbol)) {
return false;
}
var accessedSymbol = checker.getSymbolAtLocation(name);
if (accessedSymbol === undefined) {
return false;
}
// If the symbol in scope is different, the qualifier is necessary.
var fromScope = getSymbolInScope(qualifier, accessedSymbol.flags, name.text);
return fromScope === undefined || fromScope === accessedSymbol;
}
function getSymbolInScope(node, flags, name) {
// TODO:PERF `getSymbolsInScope` gets a long list. Is there a better way?
var scope = checker.getSymbolsInScope(node, flags);
return scope.find(function (scopeSymbol) { return scopeSymbol.name === name; });
}
function symbolIsNamespaceInScope(symbol) {
var symbolDeclarations = symbol.getDeclarations();
if (symbolDeclarations == null) {
return false;
}
else if (symbolDeclarations.some(function (decl) { return namespacesInScope.some(function (ns) { return ns === decl; }); })) {
return true;
}
var alias = tryGetAliasedSymbol(symbol, checker);
return alias !== undefined && symbolIsNamespaceInScope(alias);
}
}
function tryGetAliasedSymbol(symbol, checker) {
return Lint.isSymbolFlagSet(symbol, ts.SymbolFlags.Alias) ? checker.getAliasedSymbol(symbol) : undefined;
}
|
'use strict';
var SAX = require('sax'),
JSAPI = require('./jsAPI');
var config = {
strict: true,
trim: false,
normalize: true,
lowercase: true,
xmlns: true,
position: false
};
/**
* Convert SVG (XML) string to SVG-as-JS object.
*
* @param {String} data input data
* @param {Function} callback
*/
module.exports = function(data, callback) {
var sax = SAX.parser(config.strict, config),
root = new JSAPI({ elem: '#document' }),
current = root,
stack = [root],
textContext = null;
function pushToContent(content) {
content = new JSAPI(content, current);
(current.content = current.content || []).push(content);
return content;
}
sax.ondoctype = function(doctype) {
pushToContent({
doctype: doctype
});
};
sax.onprocessinginstruction = function(data) {
pushToContent({
processinginstruction: data
});
};
sax.oncomment = function(comment) {
pushToContent({
comment: comment.trim()
});
};
sax.oncdata = function(cdata) {
pushToContent({
cdata: cdata
});
};
sax.onopentag = function(data) {
var elem = {
elem: data.name,
prefix: data.prefix,
local: data.local
};
if (Object.keys(data.attributes).length) {
elem.attrs = {};
for (var name in data.attributes) {
elem.attrs[name] = {
name: name,
value: data.attributes[name].value,
prefix: data.attributes[name].prefix,
local: data.attributes[name].local
};
}
}
elem = pushToContent(elem);
current = elem;
// Save info about <text> tag to prevent trimming of meaningful whitespace
if (data.name == 'text' && !data.prefix) {
textContext = current;
}
stack.push(elem);
};
sax.ontext = function(text) {
if (/\S/.test(text) || textContext) {
if (!textContext)
text = text.trim();
pushToContent({
text: text
});
}
};
sax.onclosetag = function() {
var last = stack.pop();
// Trim text inside <text> tag.
if (last == textContext) {
trim(textContext);
textContext = null;
}
current = stack[stack.length - 1];
};
sax.onerror = function(e) {
callback({ error: 'Error in parsing: ' + e.message });
};
sax.onend = function() {
callback(root);
};
sax.write(data).close();
function trim(elem) {
if (!elem.content) return elem;
var start = elem.content[0],
end = elem.content[elem.content.length - 1];
while (start && !start.text) start = start.content[0];
if (start) start.text = start.text.replace(/^\s+/, '');
while (end && !end.text) end = end.content[end.content.length - 1];
if (end) end.text = end.text.replace(/\s+$/, '');
return elem;
}
};
|
/*
YUI 3.7.3 (build 5687)
Copyright 2012 Yahoo! Inc. All rights reserved.
Licensed under the BSD License.
http://yuilibrary.com/license/
*/
YUI.add("anim-xy",function(e,t){var n=Number;e.Anim.behaviors.xy={set:function(e,t,r,i,s,o,u){e._node.setXY([u(s,n(r[0]),n(i[0])-n(r[0]),o),u(s,n(r[1]),n(i[1])-n(r[1]),o)])},get:function(e){return e._node.getXY()}}},"3.7.3",{requires:["anim-base","node-screen"]});
|
module.exports = function(grunt) {
/**
* Initialize development environment for Testacular
*
* - register git hooks (commit-msg)
*/
grunt.registerTask('init-dev-env', 'Initialize dev environment.', function() {
var fs = require('fs');
var done = this.async();
fs.symlink('../../tasks/lib/validate-commit-msg.js', '.git/hooks/commit-msg', function(e) {
if (!e) {
grunt.log.ok('Hook "validate-commit-msg" installed.');
}
done();
});
});
};
|
var test = require("tap").test
var npm = require.resolve("../../bin/npm-cli.js")
var spawn = require("child_process").spawn
var node = process.execPath
// ignore-scripts/package.json has scripts that always exit with non-zero error
// codes. The "install" script is omitted so that npm tries to run node-gyp,
// which should also fail.
var pkg = __dirname + "/ignore-scripts"
test("ignore-scripts: install using the option", function(t) {
createChild([npm, "install", "--ignore-scripts"]).on("close", function(code) {
t.equal(code, 0)
t.end()
})
})
test("ignore-scripts: install NOT using the option", function(t) {
createChild([npm, "install"]).on("close", function(code) {
t.notEqual(code, 0)
t.end()
})
})
var scripts = [
"prepublish", "publish", "postpublish",
"preinstall", "install", "postinstall",
"preuninstall", "uninstall", "postuninstall",
"preupdate", "update", "postupdate",
"pretest", "test", "posttest",
"prestop", "stop", "poststop",
"prestart", "start", "poststart",
"prerestart", "restart", "postrestart"
]
scripts.forEach(function(script) {
test("ignore-scripts: run-script"+script+" using the option", function(t) {
createChild([npm, "--ignore-scripts", "run-script", script])
.on("close", function(code) {
t.equal(code, 0)
t.end()
})
})
})
scripts.forEach(function(script) {
test("ignore-scripts: run-script "+script+" NOT using the option", function(t) {
createChild([npm, "run-script", script]).on("close", function(code) {
t.notEqual(code, 0)
t.end()
})
})
})
function createChild (args) {
var env = {
HOME: process.env.HOME,
Path: process.env.PATH,
PATH: process.env.PATH
}
if (process.platform === "win32")
env.npm_config_cache = "%APPDATA%\\npm-cache"
return spawn(node, args, {
cwd: pkg,
stdio: "inherit",
env: env
})
}
|
// @flow
let tests = [
// setting a property
function(x: $Tainted<string>, y: string) {
let obj: Object = {};
obj.foo = x; // error, taint ~> any
obj[y] = x; // error, taint ~> any
},
// getting a property
function() {
let obj: Object = { foo: 'foo' };
(obj.foo: $Tainted<string>); // ok
},
// calling a method
function(x: $Tainted<string>) {
let obj: Object = {};
obj.foo(x); // error, taint ~> any
let foo = obj.foo;
foo(x); // error, taint ~> any
},
];
|
/**
* @author TristanVALCKE / https://github.com/Itee
* @author moraxy / https://github.com/moraxy
*/
/* global QUnit */
import { runStdLightTests } from '../../qunit-utils';
import { DirectionalLight } from '../../../../src/lights/DirectionalLight';
export default QUnit.module( 'Lights', () => {
QUnit.module( 'DirectionalLight', ( hooks ) => {
var lights = undefined;
hooks.beforeEach( function () {
const parameters = {
color: 0xaaaaaa,
intensity: 0.8
};
lights = [
new DirectionalLight(),
new DirectionalLight( parameters.color ),
new DirectionalLight( parameters.color, parameters.intensity )
];
} );
// INHERITANCE
QUnit.todo( "Extending", ( assert ) => {
assert.ok( false, "everything's gonna be alright" );
} );
// INSTANCING
QUnit.todo( "Instancing", ( assert ) => {
assert.ok( false, "everything's gonna be alright" );
} );
// PUBLIC STUFF
QUnit.todo( "isDirectionalLight", ( assert ) => {
assert.ok( false, "everything's gonna be alright" );
} );
QUnit.todo( "copy", ( assert ) => {
assert.ok( false, "everything's gonna be alright" );
} );
// OTHERS
QUnit.test( 'Standard light tests', ( assert ) => {
runStdLightTests( assert, lights );
} );
} );
} );
|
/**
* 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 Base
* @subpackage Model
* @version $Id$
* @author shopware AG
*/
/**
* Shopware Model - Global Stores and Models
*
* The shop model represents a data row of the s_core_tax or the
* Shopware\Models\Article\Tax doctrine model.
*/
//{block name="backend/base/model/tax"}
Ext.define('Shopware.apps.Base.model.Tax', {
/**
* Defines an alternate name for this class.
*/
alternateClassName:'Shopware.model.Tax',
/**
* Extends the standard ExtJS Model
* @string
*/
extend : 'Shopware.data.Model',
/**
* unique id
* @int
*/
idProperty:'id',
/**
* The fields used for this model
* @array
*/
fields : [
//{block name="backend/base/model/tax/fields"}{/block}
{ name : 'id', type: 'integer' },
{ name : 'tax',type: 'float' },
{ name : 'name',type: 'string' }
]
});
//{/block}
|
/* Copyright (c) 2011 by The Authors.
* Published under the LGPL 2.1 license.
* See /license-notice.txt for the full text of the license notice.
* See /license.txt for the full text of the license.
*/
describe('jsts.algorithm.InteriorPointArea', function() {
var ipa;
it('can be constructed', function() {
var shell = new jsts.geom.LinearRing([
new jsts.geom.Coordinate(2, 2),
new jsts.geom.Coordinate(6, 2),
new jsts.geom.Coordinate(6, 6),
new jsts.geom.Coordinate(2, 6),
new jsts.geom.Coordinate(2, 2)
]);
var polygon = new jsts.geom.Polygon(shell);
ipa = new jsts.algorithm.InteriorPointArea(polygon);
expect(ipa).toBeDefined();
});
it('interior point of simple square', function() {
var validCoord = new jsts.geom.Coordinate(4, 4);
expect(ipa.getInteriorPoint().distance(validCoord)).toEqual(0);
});
it('interior point of square with hole', function() {
var shell = new jsts.geom.LinearRing([
new jsts.geom.Coordinate(2, 2),
new jsts.geom.Coordinate(8, 2),
new jsts.geom.Coordinate(8, 6),
new jsts.geom.Coordinate(2, 6),
new jsts.geom.Coordinate(2, 2)
]);
var hole = new jsts.geom.LinearRing([
new jsts.geom.Coordinate(3, 3),
new jsts.geom.Coordinate(3, 5),
new jsts.geom.Coordinate(6, 5),
new jsts.geom.Coordinate(6, 3),
new jsts.geom.Coordinate(3, 3)
]);
var polygon = new jsts.geom.Polygon(shell, [hole]);
ipa = new jsts.algorithm.InteriorPointArea(polygon);
var validCoord = new jsts.geom.Coordinate(7, 4);
expect(ipa.getInteriorPoint().distance(validCoord)).toEqual(0);
});
it('interior point of the widest horizontal intersection in geometry collection', function() {
var shell1 = new jsts.geom.LinearRing([
new jsts.geom.Coordinate(2, 2),
new jsts.geom.Coordinate(4, 2),
new jsts.geom.Coordinate(4, 4),
new jsts.geom.Coordinate(2, 4),
new jsts.geom.Coordinate(2, 2)
]);
var polygon1 = new jsts.geom.Polygon(shell1);
var shell2 = new jsts.geom.LinearRing([
new jsts.geom.Coordinate(5, 5),
new jsts.geom.Coordinate(11, 5),
new jsts.geom.Coordinate(11, 7),
new jsts.geom.Coordinate(5, 7),
new jsts.geom.Coordinate(5, 5)
]);
var polygon2 = new jsts.geom.Polygon(shell2);
var shell3 = new jsts.geom.LinearRing([
new jsts.geom.Coordinate(12, 12),
new jsts.geom.Coordinate(15, 12),
new jsts.geom.Coordinate(15, 25),
new jsts.geom.Coordinate(12, 25),
new jsts.geom.Coordinate(12, 12)
]);
var polygon3 = new jsts.geom.Polygon(shell3);
var gc = new jsts.geom.GeometryCollection([polygon1, polygon2, polygon3]);
ipa = new jsts.algorithm.InteriorPointArea(gc);
var validCoord = new jsts.geom.Coordinate(8, 6);
expect(ipa.getInteriorPoint().distance(validCoord)).toEqual(0);
});
});
|
/*
Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/
CKEDITOR.plugins.setLang("language","es",{button:"Fijar lenguaje",remove:"Quitar lenguaje"});
|
// Copyright 2008 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @fileoverview Similiar functionality of {@link goog.ui.ButtonRenderer},
* but uses a <div> element instead of a <button> or <input> element.
*
*/
goog.provide('goog.ui.FlatButtonRenderer');
goog.require('goog.a11y.aria');
goog.require('goog.a11y.aria.Role');
goog.require('goog.dom.classes');
goog.require('goog.ui.Button');
goog.require('goog.ui.ButtonRenderer');
goog.require('goog.ui.INLINE_BLOCK_CLASSNAME');
goog.require('goog.ui.registry');
/**
* Flat renderer for {@link goog.ui.Button}s. Flat buttons can contain
* almost arbitrary HTML content, will flow like inline elements, but can be
* styled like block-level elements.
* @constructor
* @extends {goog.ui.ButtonRenderer}
*/
goog.ui.FlatButtonRenderer = function() {
goog.ui.ButtonRenderer.call(this);
};
goog.inherits(goog.ui.FlatButtonRenderer, goog.ui.ButtonRenderer);
goog.addSingletonGetter(goog.ui.FlatButtonRenderer);
/**
* Default CSS class to be applied to the root element of components rendered
* by this renderer.
* @type {string}
*/
goog.ui.FlatButtonRenderer.CSS_CLASS = goog.getCssName('goog-flat-button');
/**
* Returns the control's contents wrapped in a div element, with
* the renderer's own CSS class and additional state-specific classes applied
* to it, and the button's disabled attribute set or cleared as needed.
* Overrides {@link goog.ui.ButtonRenderer#createDom}.
* @param {goog.ui.Control} button Button to render.
* @return {Element} Root element for the button.
* @override
*/
goog.ui.FlatButtonRenderer.prototype.createDom = function(button) {
var classNames = this.getClassNames(button);
var attributes = {
'class': goog.ui.INLINE_BLOCK_CLASSNAME + ' ' + classNames.join(' '),
'title': button.getTooltip() || ''
};
return button.getDomHelper().createDom(
'div', attributes, button.getContent());
};
/**
* Returns the ARIA role to be applied to flat buttons.
* @return {goog.a11y.aria.Role|undefined} ARIA role.
* @override
*/
goog.ui.FlatButtonRenderer.prototype.getAriaRole = function() {
return goog.a11y.aria.Role.BUTTON;
};
/**
* Returns true if this renderer can decorate the element. Overrides
* {@link goog.ui.ButtonRenderer#canDecorate} by returning true if the
* element is a DIV, false otherwise.
* @param {Element} element Element to decorate.
* @return {boolean} Whether the renderer can decorate the element.
* @override
*/
goog.ui.FlatButtonRenderer.prototype.canDecorate = function(element) {
return element.tagName == 'DIV';
};
/**
* Takes an existing element and decorates it with the flat button control.
* Initializes the control's ID, content, tooltip, value, and state based
* on the ID of the element, its child nodes, and its CSS classes, respectively.
* Returns the element. Overrides {@link goog.ui.ButtonRenderer#decorate}.
* @param {goog.ui.Control} button Button instance to decorate the element.
* @param {Element} element Element to decorate.
* @return {Element} Decorated element.
* @override
*/
goog.ui.FlatButtonRenderer.prototype.decorate = function(button, element) {
goog.dom.classes.add(element, goog.ui.INLINE_BLOCK_CLASSNAME);
return goog.ui.FlatButtonRenderer.superClass_.decorate.call(this, button,
element);
};
/**
* Flat buttons can't use the value attribute since they are div elements.
* Overrides {@link goog.ui.ButtonRenderer#getValue} to prevent trying to
* access the element's value.
* @param {Element} element The button control's root element.
* @return {string} Value not valid for flat buttons.
* @override
*/
goog.ui.FlatButtonRenderer.prototype.getValue = function(element) {
// Flat buttons don't store their value in the DOM.
return '';
};
/**
* Returns the CSS class to be applied to the root element of components
* rendered using this renderer.
* @return {string} Renderer-specific CSS class.
* @override
*/
goog.ui.FlatButtonRenderer.prototype.getCssClass = function() {
return goog.ui.FlatButtonRenderer.CSS_CLASS;
};
// Register a decorator factory function for Flat Buttons.
goog.ui.registry.setDecoratorByClassName(goog.ui.FlatButtonRenderer.CSS_CLASS,
function() {
// Uses goog.ui.Button, but with FlatButtonRenderer.
return new goog.ui.Button(null, goog.ui.FlatButtonRenderer.getInstance());
});
|
//=require rich/base
|
var Notify = require('../');
var notifier = new Notify();
notifier.notify({
"title": "Phil Coulson",
"subtitle": "Agent of S.H.I.E.L.D.",
"message": "If I come out, will you shoot me? 'Cause then I won't come out.",
"sound": "Funk", // case sensitive
"appIcon": __dirname + "/coulson.jpg",
"contentImage": __dirname + "/coulson.jpg",
"open": "file://" + __dirname + "/coulson.jpg"
});
setTimeout(function() {
console.log("Done");
}, 5000);
|
var numLimitInput = element(by.model('numLimit'));
var letterLimitInput = element(by.model('letterLimit'));
var longNumberLimitInput = element(by.model('longNumberLimit'));
var limitedNumbers = element(by.binding('numbers | limitTo:numLimit'));
var limitedLetters = element(by.binding('letters | limitTo:letterLimit'));
var limitedLongNumber = element(by.binding('longNumber | limitTo:longNumberLimit'));
it('should limit the number array to first three items', function() {
expect(numLimitInput.getAttribute('value')).toBe('3');
expect(letterLimitInput.getAttribute('value')).toBe('3');
expect(longNumberLimitInput.getAttribute('value')).toBe('3');
expect(limitedNumbers.getText()).toEqual('Output numbers: [1,2,3]');
expect(limitedLetters.getText()).toEqual('Output letters: abc');
expect(limitedLongNumber.getText()).toEqual('Output long number: 234');
});
// There is a bug in safari and protractor that doesn't like the minus key
// it('should update the output when -3 is entered', function() {
// numLimitInput.clear();
// numLimitInput.sendKeys('-3');
// letterLimitInput.clear();
// letterLimitInput.sendKeys('-3');
// longNumberLimitInput.clear();
// longNumberLimitInput.sendKeys('-3');
// expect(limitedNumbers.getText()).toEqual('Output numbers: [7,8,9]');
// expect(limitedLetters.getText()).toEqual('Output letters: ghi');
// expect(limitedLongNumber.getText()).toEqual('Output long number: 342');
// });
it('should not exceed the maximum size of input array', function() {
numLimitInput.clear();
numLimitInput.sendKeys('100');
letterLimitInput.clear();
letterLimitInput.sendKeys('100');
longNumberLimitInput.clear();
longNumberLimitInput.sendKeys('100');
expect(limitedNumbers.getText()).toEqual('Output numbers: [1,2,3,4,5,6,7,8,9]');
expect(limitedLetters.getText()).toEqual('Output letters: abcdefghi');
expect(limitedLongNumber.getText()).toEqual('Output long number: 2345432342');
});
|
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Competency rule config.
*
* @package tool_lp
* @copyright 2015 Frédéric Massart - FMCorz.net
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define(['jquery',
'core/str'],
function($, Str) {
var OUTCOME_NONE = 0,
OUTCOME_EVIDENCE = 1,
OUTCOME_COMPLETE = 2,
OUTCOME_RECOMMEND = 3;
return /** @alias module:tool_lp/competency_outcomes */ {
NONE: OUTCOME_NONE,
EVIDENCE: OUTCOME_EVIDENCE,
COMPLETE: OUTCOME_COMPLETE,
RECOMMEND: OUTCOME_RECOMMEND,
/**
* Get all the outcomes.
*
* @return {Object} Indexed by outcome code, contains code and name.
* @method getAll
*/
getAll: function() {
var self = this;
return Str.get_strings([
{ key: 'competencyoutcome_none', component: 'tool_lp' },
{ key: 'competencyoutcome_evidence', component: 'tool_lp' },
{ key: 'competencyoutcome_recommend', component: 'tool_lp' },
{ key: 'competencyoutcome_complete', component: 'tool_lp' },
]).then(function(strings) {
var outcomes = {};
outcomes[self.NONE] = { code: self.NONE, name: strings[0] };
outcomes[self.EVIDENCE] = { code: self.EVIDENCE, name: strings[1] };
outcomes[self.RECOMMEND] = { code: self.RECOMMEND, name: strings[2] };
outcomes[self.COMPLETE] = { code: self.COMPLETE, name: strings[3] };
return outcomes;
});
},
/**
* Get the string for an outcome.
*
* @param {Number} id The outcome code.
* @return {Promise Resolved with the string.
* @method getString
*/
getString: function(id) {
var self = this,
all = self.getAll();
return all.then(function(outcomes) {
if (typeof outcomes[id] === 'undefined') {
return $.Deferred().reject().promise();
}
return outcomes[id].name;
});
}
};
});
|
/*
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* NASHORN-105 : parseFloat function is not spec. compliant.
*
* @test
* @run
*/
print(parseFloat("3.14xyz"));
print(parseFloat("2.18 43.4543"));
print(parseFloat("2.9e8E-45"));
print(parseFloat("55654.6756.4546"));
print(parseFloat("343e"));
print(parseFloat("343e+"));
print(parseFloat("343e-"));
print(parseFloat("343e+35"));
print(parseFloat("Infinity1"));
print(parseFloat("-Infinity1"));
print(parseFloat("1ex"));
print(parseFloat("2343+"));
print(parseFloat("2ex"));
// invalid stuff
print(parseFloat(""));
print(parseFloat("+"));
print(parseFloat("-"));
print(parseFloat("e"));
print(parseFloat("sjdfhdsj"));
|
'use strict';
angular.module("ngLocale", [], ["$provide", function($provide) {
var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"};
function getDecimals(n) {
n = n + '';
var i = n.indexOf('.');
return (i == -1) ? 0 : n.length - i - 1;
}
function getVF(n, opt_precision) {
var v = opt_precision;
if (undefined === v) {
v = Math.min(getDecimals(n), 3);
}
var base = Math.pow(10, v);
var f = ((n * base) | 0) % base;
return {v: v, f: f};
}
$provide.value("$locale", {
"DATETIME_FORMATS": {
"AMPMS": [
"am",
"pm"
],
"DAY": [
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday"
],
"MONTH": [
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December"
],
"SHORTDAY": [
"Sun",
"Mon",
"Tue",
"Wed",
"Thu",
"Fri",
"Sat"
],
"SHORTMONTH": [
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
"Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec"
],
"fullDate": "EEEE, d MMMM y",
"longDate": "d MMMM y",
"medium": "d MMM y HH:mm:ss",
"mediumDate": "d MMM y",
"mediumTime": "HH:mm:ss",
"short": "dd/MM/y HH:mm",
"shortDate": "dd/MM/y",
"shortTime": "HH:mm"
},
"NUMBER_FORMATS": {
"CURRENCY_SYM": "\u00a3",
"DECIMAL_SEP": ".",
"GROUP_SEP": ",",
"PATTERNS": [
{
"gSize": 3,
"lgSize": 3,
"maxFrac": 3,
"minFrac": 0,
"minInt": 1,
"negPre": "-",
"negSuf": "",
"posPre": "",
"posSuf": ""
},
{
"gSize": 3,
"lgSize": 3,
"maxFrac": 2,
"minFrac": 2,
"minInt": 1,
"negPre": "\u00a4-",
"negSuf": "",
"posPre": "\u00a4",
"posSuf": ""
}
]
},
"id": "en-fk",
"pluralCat": function(n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (i == 1 && vf.v == 0) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;}
});
}]);
|
// add new post notification callback on post submit
postAfterSubmitMethodCallbacks.push(function (post) {
var adminIds = _.pluck(Meteor.users.find({'isAdmin': true}, {fields: {_id:1}}).fetch(), '_id');
var notifiedUserIds = _.pluck(Meteor.users.find({'profile.notifications.posts': 1}, {fields: {_id:1}}).fetch(), '_id');
// remove post author ID from arrays
var adminIds = _.without(adminIds, post.userId);
var notifiedUserIds = _.without(notifiedUserIds, post.userId);
if (post.status === STATUS_PENDING && !!adminIds.length) {
// if post is pending, only notify admins
Herald.createNotification(adminIds, {courier: 'newPendingPost', data: post});
} else if (!!notifiedUserIds.length) {
// if post is approved, notify everybody
Herald.createNotification(notifiedUserIds, {courier: 'newPost', data: post});
}
return post;
});
// notify users that their pending post has been approved
postApproveCallbacks.push(function (post) {
Herald.createNotification(post.userId, {courier: 'postApproved', data: post});
return post;
});
// add new comment notification callback on comment submit
commentAfterSubmitMethodCallbacks.push(function (comment) {
if(Meteor.isServer && !comment.disableNotifications){
var post = Posts.findOne(comment.postId),
notificationData = {
comment: _.pick(comment, '_id', 'userId', 'author', 'body'),
post: _.pick(post, '_id', 'userId', 'title', 'url')
},
userIdsNotified = [];
// 1. Notify author of post
// do not notify author of post if they're the ones posting the comment
if (comment.userId !== post.userId) {
Herald.createNotification(post.userId, {courier: 'newComment', data: notificationData});
userIdsNotified.push(post.userId);
}
// 2. Notify author of comment being replied to
if (!!comment.parentCommentId) {
var parentComment = Comments.findOne(comment.parentCommentId);
// do not notify author of parent comment if they're also post author or comment author
// (someone could be replying to their own comment)
if (parentComment.userId !== post.userId && parentComment.userId !== comment.userId) {
// add parent comment to notification data
notificationData.parentComment = _.pick(parentComment, '_id', 'userId', 'author');
Herald.createNotification(parentComment.userId, {courier: 'newReply', data: notificationData});
userIdsNotified.push(parentComment.userId);
}
}
// 3. Notify users subscribed to the thread
// TODO: ideally this would be injected from the telescope-subscribe-to-posts package
if (!!post.subscribers) {
// remove userIds of users that have already been notified
// and of comment author (they could be replying in a thread they're subscribed to)
var subscriberIdsToNotify = _.difference(post.subscribers, userIdsNotified, [comment.userId]);
Herald.createNotification(subscriberIdsToNotify, {courier: 'newCommentSubscribed', data: notificationData});
userIdsNotified = userIdsNotified.concat(subscriberIdsToNotify);
}
}
return comment;
});
var emailNotifications = {
propertyName: 'emailNotifications',
propertySchema: {
type: Boolean,
optional: true,
defaultValue: true,
autoform: {
group: 'notifications_fieldset',
instructions: 'Enable email notifications for new posts and new comments (requires restart).'
}
}
};
addToSettingsSchema.push(emailNotifications);
// make it possible to disable notifications on a per-comment basis
addToCommentsSchema.push(
{
propertyName: 'disableNotifications',
propertySchema: {
type: Boolean,
optional: true,
autoform: {
omit: true
}
}
}
);
function setNotificationDefaults (user) {
// set notifications default preferences
user.profile.notifications = {
users: false,
posts: false,
comments: true,
replies: true
};
return user;
}
userCreatedCallbacks.push(setNotificationDefaults);
|
'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 CommunicationPresentToAll = function CommunicationPresentToAll(props) {
return _react2.default.createElement(
_SvgIcon2.default,
props,
_react2.default.createElement('path', { d: 'M21 3H3c-1.11 0-2 .89-2 2v14c0 1.11.89 2 2 2h18c1.11 0 2-.89 2-2V5c0-1.11-.89-2-2-2zm0 16.02H3V4.98h18v14.04zM10 12H8l4-4 4 4h-2v4h-4v-4z' })
);
};
CommunicationPresentToAll = (0, _pure2.default)(CommunicationPresentToAll);
CommunicationPresentToAll.displayName = 'CommunicationPresentToAll';
CommunicationPresentToAll.muiName = 'SvgIcon';
exports.default = CommunicationPresentToAll;
|
var cssbeautify = require('gulp-cssbeautify');
var gulp = require('gulp');
var imagemin = require('gulp-imagemin');
var jsprettify = require('gulp-jsbeautifier');
var path = require('path');
var pngcrush = require('imagemin-pngcrush');
var ROOT = path.join(__dirname, '..');
gulp.task('format-css', function() {
var files = [
'src/**/*.css',
'!src/aui-css/css/*.css'
];
return gulp.src(files, { cwd: ROOT })
.pipe(cssbeautify())
.pipe(gulp.dest(path.join(ROOT, 'src/')));
});
gulp.task('format-js', function() {
var configFile = path.join(ROOT, '.jsbeautifyrc');
var files = [
'src/**/*.js',
'!build/**/*.js',
'!src/aui-base/js/aui-aliases.js',
'!src/aui-base/js/aui-loader.js',
'!src/yui/js/*.js'
];
return gulp.src(files, { cwd: ROOT })
.pipe(jsprettify({
config: configFile
}))
.pipe(gulp.dest(path.join(ROOT, 'src/')));
});
gulp.task('format-img', function() {
return gulp.src('src/**/*.png', { cwd: ROOT })
.pipe(imagemin({
progressive: true,
svgoPlugins: [{
removeViewBox: false
}],
use: [pngcrush()]
}))
.pipe(gulp.dest(path.join(ROOT, 'src/')));
});
gulp.task('format', ['format-css', 'format-js', 'format-img']);
|
/**
* @license Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.md or http://ckeditor.com/license
*/
/**
* This file was added automatically by CKEditor builder.
* You may re-use it at any time to build CKEditor again.
*
* If you would like to build CKEditor online again
* (for example to upgrade), visit one the following links:
*
* (1) http://ckeditor.com/builder
* Visit online builder to build CKEditor from scratch.
*
* (2) http://ckeditor.com/builder/e41bccb8290b6d530f8478ddafe95c48
* Visit online builder to build CKEditor, starting with the same setup as before.
*
* (3) http://ckeditor.com/builder/download/e41bccb8290b6d530f8478ddafe95c48
* Straight download link to the latest version of CKEditor (Optimized) with the same setup as before.
*
* NOTE:
* This file is not used by CKEditor, you may remove it.
* Changing this file will not change your CKEditor configuration.
*/
var CKBUILDER_CONFIG = {
skin: 'moono',
preset: 'standard',
ignore: [
'dev',
'.gitignore',
'.gitattributes',
'README.md',
'.mailmap'
],
plugins : {
'a11yhelp' : 1,
'about' : 1,
'basicstyles' : 1,
'blockquote' : 1,
'clipboard' : 1,
'contextmenu' : 1,
'elementspath' : 1,
'enterkey' : 1,
'entities' : 1,
'filebrowser' : 1,
'floatingspace' : 1,
'format' : 1,
'horizontalrule' : 1,
'htmlwriter' : 1,
'image' : 1,
'indentlist' : 1,
'link' : 1,
'list' : 1,
'magicline' : 1,
'maximize' : 1,
'pastefromword' : 1,
'pastetext' : 1,
'removeformat' : 1,
'resize' : 1,
'scayt' : 1,
'showborders' : 1,
'sourcearea' : 1,
'specialchar' : 1,
'stylescombo' : 1,
'tab' : 1,
'table' : 1,
'tabletools' : 1,
'toolbar' : 1,
'undo' : 1,
'wsc' : 1,
'wysiwygarea' : 1
},
languages : {
'af' : 1,
'ar' : 1,
'bg' : 1,
'bn' : 1,
'bs' : 1,
'ca' : 1,
'cs' : 1,
'cy' : 1,
'da' : 1,
'de' : 1,
'el' : 1,
'en' : 1,
'en-au' : 1,
'en-ca' : 1,
'en-gb' : 1,
'eo' : 1,
'es' : 1,
'et' : 1,
'eu' : 1,
'fa' : 1,
'fi' : 1,
'fo' : 1,
'fr' : 1,
'fr-ca' : 1,
'gl' : 1,
'gu' : 1,
'he' : 1,
'hi' : 1,
'hr' : 1,
'hu' : 1,
'id' : 1,
'is' : 1,
'it' : 1,
'ja' : 1,
'ka' : 1,
'km' : 1,
'ko' : 1,
'ku' : 1,
'lt' : 1,
'lv' : 1,
'mk' : 1,
'mn' : 1,
'ms' : 1,
'nb' : 1,
'nl' : 1,
'no' : 1,
'pl' : 1,
'pt' : 1,
'pt-br' : 1,
'ro' : 1,
'ru' : 1,
'si' : 1,
'sk' : 1,
'sl' : 1,
'sq' : 1,
'sr' : 1,
'sr-latn' : 1,
'sv' : 1,
'th' : 1,
'tr' : 1,
'tt' : 1,
'ug' : 1,
'uk' : 1,
'vi' : 1,
'zh' : 1,
'zh-cn' : 1
}
};
|
/**
* 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.
*/
'use strict';
var COLLECTION_PERIOD = 1000;
var _endedEvents = Object.create(null);
var _eventStarts = Object.create(null);
var _queuedActions = [];
var _scheduledCollectionTimer = null;
var _uuid = 1;
var _enabled = true;
function endEvent(eventId) {
var eventEndTime = Date.now();
if (!_eventStarts[eventId]) {
_throw('event(' + eventId + ') is not a valid event id!');
}
if (_endedEvents[eventId]) {
_throw('event(' + eventId + ') has already ended!');
}
_scheduleAction({
action: 'endEvent',
eventId: eventId,
tstamp: eventEndTime
});
_endedEvents[eventId] = true;
}
function signal(eventName, data) {
var signalTime = Date.now();
if (eventName == null) {
_throw('No event name specified');
}
if (data == null) {
data = null;
}
_scheduleAction({
action: 'signal',
data: data,
eventName: eventName,
tstamp: signalTime
});
}
function startEvent(eventName, data) {
var eventStartTime = Date.now();
if (eventName == null) {
_throw('No event name specified');
}
if (data == null) {
data = null;
}
var eventId = _uuid++;
var action = {
action: 'startEvent',
data: data,
eventId: eventId,
eventName: eventName,
tstamp: eventStartTime,
};
_scheduleAction(action);
_eventStarts[eventId] = action;
return eventId;
}
function disable() {
_enabled = false;
}
function _runCollection() {
/* jshint -W084 */
var action;
while ((action = _queuedActions.shift())) {
_writeAction(action);
}
_scheduledCollectionTimer = null;
}
function _scheduleAction(action) {
_queuedActions.push(action);
if (_scheduledCollectionTimer === null) {
_scheduledCollectionTimer = setTimeout(_runCollection, COLLECTION_PERIOD);
}
}
/**
* This a utility function that throws an error message.
*
* The only purpose of this utility is to make APIs like
* startEvent/endEvent/signal inlineable in the JIT.
*
* (V8 can't inline functions that statically contain a `throw`, and probably
* won't be adding such a non-trivial optimization anytime soon)
*/
function _throw(msg) {
var err = new Error(msg);
// Strip off the call to _throw()
var stack = err.stack.split('\n');
stack.splice(1, 1);
err.stack = stack.join('\n');
throw err;
}
function _writeAction(action) {
if (!_enabled) {
return;
}
var data = action.data ? ': ' + JSON.stringify(action.data) : '';
var fmtTime = new Date(action.tstamp).toLocaleTimeString();
switch (action.action) {
case 'startEvent':
console.log(
'[' + fmtTime + '] ' +
'<START> ' + action.eventName +
data
);
break;
case 'endEvent':
var startAction = _eventStarts[action.eventId];
var startData = startAction.data ? ': ' + JSON.stringify(startAction.data) : '';
console.log(
'[' + fmtTime + '] ' +
'<END> ' + startAction.eventName +
'(' + (action.tstamp - startAction.tstamp) + 'ms)' +
startData
);
delete _eventStarts[action.eventId];
break;
case 'signal':
console.log(
'[' + fmtTime + '] ' +
' ' + action.eventName + '' +
data
);
break;
default:
_throw('Unexpected scheduled action type: ' + action.action);
}
}
exports.endEvent = endEvent;
exports.signal = signal;
exports.startEvent = startEvent;
exports.disable = disable;
|
(function( factory ) {
if ( typeof define === "function" && define.amd ) {
define( ["jquery", "../jquery.validate"], factory );
} else if (typeof module === "object" && module.exports) {
module.exports = factory( require( "jquery" ) );
} else {
factory( jQuery );
}
}(function( $ ) {
/*
* Translated default messages for the jQuery validation plugin.
* Locale: ZH (Chinese, 中文 (Zhōngwén), 汉语, 漢語)
*/
$.extend( $.validator.messages, {
required: "这是必填字段",
remote: "请修正此字段",
email: "请输入有效的电子邮件地址",
url: "请输入有效的网址",
date: "请输入有效的日期",
dateISO: "请输入有效的日期 (YYYY-MM-DD)",
number: "请输入有效的数字",
digits: "只能输入数字",
creditcard: "请输入有效的信用卡号码",
equalTo: "你的输入不相同",
extension: "请输入有效的后缀",
maxlength: $.validator.format( "最多可以输入 {0} 个字符" ),
minlength: $.validator.format( "最少要输入 {0} 个字符" ),
rangelength: $.validator.format( "请输入长度在 {0} 到 {1} 之间的字符串" ),
range: $.validator.format( "请输入范围在 {0} 到 {1} 之间的数值" ),
step: $.validator.format( "请输入 {0} 的整数倍值" ),
max: $.validator.format( "请输入不大于 {0} 的数值" ),
min: $.validator.format( "请输入不小于 {0} 的数值" )
} );
return $;
}));
|
/*!
* Ext JS Library 3.4.0
* Copyright(c) 2006-2011 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
(function() {
Ext.override(Ext.list.Column, {
init : function() {
var types = Ext.data.Types,
st = this.sortType;
if(this.type){
if(Ext.isString(this.type)){
this.type = Ext.data.Types[this.type.toUpperCase()] || types.AUTO;
}
}else{
this.type = types.AUTO;
}
// named sortTypes are supported, here we look them up
if(Ext.isString(st)){
this.sortType = Ext.data.SortTypes[st];
}else if(Ext.isEmpty(st)){
this.sortType = this.type.sortType;
}
}
});
Ext.tree.Column = Ext.extend(Ext.list.Column, {});
Ext.tree.NumberColumn = Ext.extend(Ext.list.NumberColumn, {});
Ext.tree.DateColumn = Ext.extend(Ext.list.DateColumn, {});
Ext.tree.BooleanColumn = Ext.extend(Ext.list.BooleanColumn, {});
Ext.reg('tgcolumn', Ext.tree.Column);
Ext.reg('tgnumbercolumn', Ext.tree.NumberColumn);
Ext.reg('tgdatecolumn', Ext.tree.DateColumn);
Ext.reg('tgbooleancolumn', Ext.tree.BooleanColumn);
})();
|
'use strict';
module.exports.definition = {
set: function (v) {
this._setProperty('position', v);
},
get: function () {
return this.getPropertyValue('position');
},
enumerable: true,
configurable: true
};
|
openerp.gamification = function(instance) {
var QWeb = instance.web.qweb;
instance.gamification.Sidebar = instance.web.Widget.extend({
template: 'gamification.UserWallSidebar',
init: function (parent, action) {
var self = this;
this._super(parent, action);
this.deferred = $.Deferred();
this.goals_info = {};
this.challenge_suggestions = {};
$(document).off('keydown.klistener');
},
events: {
// update a challenge and related goals
'click a.oe_update_challenge': function(event) {
var self = this;
var challenge_id = parseInt(event.currentTarget.id, 10);
var goals_updated = new instance.web.Model('gamification.challenge').call('quick_update', [challenge_id]);
$.when(goals_updated).done(function() {
self.get_goal_todo_info();
});
},
// action to modify a goal
'click a.oe_goal_action': function(event) {
var self = this;
var goal_id = parseInt(event.currentTarget.id, 10);
var goal_action = new instance.web.Model('gamification.goal').call('get_action', [goal_id]).then(function(res) {
goal_action['action'] = res;
});
$.when(goal_action).done(function() {
var action = self.do_action(goal_action.action);
$.when(action).done(function () {
new instance.web.Model('gamification.goal').call('update', [[goal_id]]).then(function(res) {
self.get_goal_todo_info();
});
});
});
},
// get more info about a challenge request
'click a.oe_challenge_reply': function(event) {
var self = this;
var challenge_id = parseInt(event.currentTarget.id, 10);
var challenge_action = new instance.web.Model('gamification.challenge').call('reply_challenge_wizard', [challenge_id]).then(function(res) {
challenge_action['action'] = res;
});
$.when(challenge_action).done(function() {
self.do_action(challenge_action.action).done(function () {
self.get_goal_todo_info();
});
});
}
},
start: function() {
var self = this;
this._super.apply(this, arguments);
self.get_goal_todo_info();
self.get_challenge_suggestions();
},
get_goal_todo_info: function() {
var self = this;
var challenges = new instance.web.Model('res.users').call('get_serialised_gamification_summary', []).then(function(result) {
if (result.length === 0) {
self.$el.find(".oe_gamification_challenge_list").hide();
} else {
self.$el.find(".oe_gamification_challenge_list").empty();
_.each(result, function(item){
var $item = $(QWeb.render("gamification.ChallengeSummary", {challenge: item}));
self.render_money_fields($item);
self.render_user_avatars($item);
self.$el.find('.oe_gamification_challenge_list').append($item);
});
}
});
},
get_challenge_suggestions: function() {
var self = this;
var challenge_suggestions = new instance.web.Model('res.users').call('get_challenge_suggestions', []).then(function(result) {
if (result.length === 0) {
self.$el.find(".oe_gamification_suggestion").hide();
} else {
var $item = $(QWeb.render("gamification.ChallengeSuggestion", {challenges: result}));
self.$el.find('.oe_gamification_suggestion').append($item);
}
});
},
render_money_fields: function(item) {
var self = this;
self.dfm = new instance.web.form.DefaultFieldManager(self);
// Generate a FieldMonetary for each .oe_goal_field_monetary
item.find(".oe_goal_field_monetary").each(function() {
var currency_id = parseInt( $(this).attr('data-id'), 10);
money_field = new instance.web.form.FieldMonetary(self.dfm, {
attrs: {
modifiers: '{"readonly": true}'
}
});
money_field.set('currency', currency_id);
money_field.get_currency_info();
money_field.set('value', parseInt($(this).text(), 10));
money_field.replace($(this));
});
},
render_user_avatars: function(item) {
var self = this;
item.find(".oe_user_avatar").each(function() {
var user_id = parseInt( $(this).attr('data-id'), 10);
var url = instance.session.url('/web/binary/image', {model: 'res.users', field: 'image_small', id: user_id});
$(this).attr("src", url);
});
}
});
instance.web.WebClient.include({
to_kitten: function() {
this._super();
new instance.web.Model('gamification.badge').call('check_progress', []);
}
});
instance.mail.Wall.include({
start: function() {
this._super();
var sidebar = new instance.gamification.Sidebar(this);
sidebar.appendTo($('.oe_mail_wall_aside'));
},
});
};
|
/*syn@0.1.4#typeable*/
var syn = require('./synthetic.js');
var typeables = [];
var __indexOf = [].indexOf || function (item) {
for (var i = 0, l = this.length; i < l; i++) {
if (i in this && this[i] === item) {
return i;
}
}
return -1;
};
syn.typeable = function (fn) {
if (__indexOf.call(typeables, fn) === -1) {
typeables.push(fn);
}
};
syn.typeable.test = function (el) {
for (var i = 0, len = typeables.length; i < len; i++) {
if (typeables[i](el)) {
return true;
}
}
return false;
};
var type = syn.typeable;
var typeableExp = /input|textarea/i;
type(function (el) {
return typeableExp.test(el.nodeName);
});
type(function (el) {
return __indexOf.call([
'',
'true'
], el.getAttribute('contenteditable')) !== -1;
});
|
description("This tests from-by-animations adding to previous underlying values");
embedSVGTestCase("resources/svglength-additive-from-by-1.svg");
// Setup animation test
function sample1() {
shouldBeCloseEnough("rect.width.animVal.value", "10");
shouldBe("rect.width.baseVal.value", "10");
}
function sample2() {
shouldBeCloseEnough("rect.width.animVal.value", "30");
shouldBe("rect.width.baseVal.value", "10");
}
function sample3() {
shouldBeCloseEnough("rect.width.animVal.value", "50");
shouldBe("rect.width.baseVal.value", "10");
}
function sample4() {
shouldBeCloseEnough("rect.width.animVal.value", "75");
shouldBe("rect.width.baseVal.value", "10");
}
function sample5() {
shouldBeCloseEnough("rect.width.animVal.value", "100");
shouldBe("rect.width.baseVal.value", "10");
}
function executeTest() {
rect = rootSVGElement.ownerDocument.getElementsByTagName("rect")[0];
const expectedValues = [
// [animationId, time, sampleCallback]
["an1", 0.0, sample1],
["an1", 2.0, sample2],
["an1", 4.0, sample3],
["an1", 7.0, sample4],
["an1", 9.0, sample5],
["an1", 60.0, sample5]
];
runAnimationTest(expectedValues);
}
window.animationStartsImmediately = true;
var successfullyParsed = true;
|
/*
* Globalize Culture zh-HK
*
* http://github.com/jquery/globalize
*
* Copyright Software Freedom Conservancy, Inc.
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* This file was generated by the Globalize Culture Generator
* Translation: bugs found in this file need to be fixed in the generator
*/
(function( window, undefined ) {
var Globalize;
if ( typeof require !== "undefined"
&& typeof exports !== "undefined"
&& typeof module !== "undefined" ) {
// Assume CommonJS
Globalize = require( "globalize" );
} else {
// Global variable
Globalize = window.Globalize;
}
Globalize.addCultureInfo( "zh-HK", "default", {
name: "zh-HK",
englishName: "Chinese (Traditional, Hong Kong S.A.R.)",
nativeName: "中文(香港特別行政區)",
language: "zh-CHT",
numberFormat: {
NaN: "非數字",
negativeInfinity: "負無窮大",
positiveInfinity: "正無窮大",
percent: {
pattern: ["-n%","n%"]
},
currency: {
symbol: "HK$"
}
},
calendars: {
standard: {
days: {
names: ["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],
namesAbbr: ["週日","週一","週二","週三","週四","週五","週六"],
namesShort: ["日","一","二","三","四","五","六"]
},
months: {
names: ["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月",""],
namesAbbr: ["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月",""]
},
AM: ["上午","上午","上午"],
PM: ["下午","下午","下午"],
eras: [{"name":"公元","start":null,"offset":0}],
patterns: {
d: "d/M/yyyy",
D: "yyyy'年'M'月'd'日'",
t: "H:mm",
T: "H:mm:ss",
f: "yyyy'年'M'月'd'日' H:mm",
F: "yyyy'年'M'月'd'日' H:mm:ss",
M: "M'月'd'日'",
Y: "yyyy'年'M'月'"
}
}
}
});
}( this ));
|
function diff( now, props ) { //noinspection FallthroughInSwitchStatementJS
switch ( util.ntype( now ) ) {
case 'number' : case 'string' :
if ( valid( new Type( now ) ) )
now = new Type( now );
else {
if ( !props ) props = now;
now = Type.now();
break;
} // allow [specific] fall-through
case 'array' : case 'object' :
props = now;
now = Type.now();
break;
case 'date' : if ( valid( new Type( +now ) ) ) break; // allow [conditional] fall-through if not a valid date
default : now = Type.now();
}
var diff,
ms = +now - +this,
tense = ms < 0 ? 1 : ms > 0 ? -1 : 0;
if ( !tense ) {
diff = util.obj();
diff.value = 0;
}
else
diff = diff_get( Math.abs( ms ), diff_get_exclusions( props ) );
diff.tense = tense;
return diff;
}
function diff_eval( diff, calc, i, calcs ) {
var time;
if ( diff.__ms__ ) {
if ( !diff.excl[calc[0]] ) {
if ( diff.__ms__ >= calc[1] ) {
time = diff.__ms__ / calc[1];
if ( !( calc[0] in diff.val ) ) {
diff.__ms__ = ( time % 1 ) * calc[1];
diff.val[calc[0]] = Math.floor( time );
}
else {
time = Math.floor( time );
diff.__ms__ -= time * calc[1];
diff.val[calc[0]] += time;
}
}
return diff;
}
// round up or down depending on what's available
if ( ( !calcs[i + 1] || diff.excl[calcs[i + 1][0]] ) && ( calc = calcs[i - 1] ) ) {
time = diff.__ms__ / calc[1];
diff.__ms__ = ( Math.round( time ) * calc[1] ) + ( ( ( diff.__ms__ / calcs[i][1] ) % 1 ) * calcs[i][1] );
return diff_eval( diff, calc, i - 1, [] );
}
return diff;
}
return diff;
}
function diff_get( ms, excl ) {
var diff = time_map.reduce( diff_eval, {
__ms__ : ms, excl : excl, val : util.obj()
} ).val;
diff.value = ms;
return diff;
}
function diff_get_exclusions( props ) {
var excl = util.obj(), incl_remaining = true;
if ( props ) { //noinspection FallthroughInSwitchStatementJS
switch ( util.ntype( props ) ) {
case 'object' : incl_remaining = false; break;
case 'string' : props = props.split( ' ' ); // allow fall-through
case 'array' : props = props.reduce( diff_excl, excl );
incl_remaining = !!util.len( excl );
}
}
time_props.map( function( prop ) {
if ( !( prop in this ) )
this[prop] = !incl_remaining;
}, excl );
return excl;
}
function diff_excl( excl, val ) {
var prop = ( val = String( val ).toLowerCase() ).substring( 1 );
switch ( val.charAt( 0 ) ) {
case '-' : excl[prop] = true; break;
case '+' : excl[prop] = false; break;
case '>' :
time_map.map( diff_excl_iter, { excl : excl, prop : prop, val : true } );
break;
case '<' :
time_map.slice().reverse().map( diff_excl_iter, { excl : excl, prop : prop, val : false } );
break;
default : excl[val] = false;
}
return excl;
}
function diff_excl_iter( calc ) {
if ( calc[0] === this.prop )
this.SET_VALID = true;
if ( this.SET_VALID )
this.excl[calc[0]] = this.val;
}
// this ensures a diff's keys are always in descending order of
// number of milliseconds per unit of time, i.e. year, ..., millisecond
function diff_keys( diff ) {
diff = util.copy( diff ); util.remove( diff, 'tense', 'value' );
// while this may seem like overkill, only having to run `indexOf` once for each sort item means that
// the overall performance is dramatically improved
return Object.keys( diff ).map( function( k ) {
return [time_props.indexOf( k ), k];
} ).sort( function( a, b ) {
a = a[0]; b = b[0];
return a > b ? 1 : -1; // skipping `===` check as we know all indexes are unique
} ).pluck( 1 );
}
|
/*
* jQuery UI Progressbar 1.8.2
*
* Copyright (c) 2010 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/Progressbar
*
* Depends:
* jquery.ui.core.js
* jquery.ui.widget.js
*/
(function( $ ) {
$.widget( "ui.progressbar", {
options: {
value: 0
},
_create: function() {
this.element
.addClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
.attr({
role: "progressbar",
"aria-valuemin": this._valueMin(),
"aria-valuemax": this._valueMax(),
"aria-valuenow": this._value()
});
this.valueDiv = $( "<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>" )
.appendTo( this.element );
this._refreshValue();
},
destroy: function() {
this.element
.removeClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
.removeAttr( "role" )
.removeAttr( "aria-valuemin" )
.removeAttr( "aria-valuemax" )
.removeAttr( "aria-valuenow" );
this.valueDiv.remove();
$.Widget.prototype.destroy.apply( this, arguments );
},
value: function( newValue ) {
if ( newValue === undefined ) {
return this._value();
}
this._setOption( "value", newValue );
return this;
},
_setOption: function( key, value ) {
switch ( key ) {
case "value":
this.options.value = value;
this._refreshValue();
this._trigger( "change" );
break;
}
$.Widget.prototype._setOption.apply( this, arguments );
},
_value: function() {
var val = this.options.value;
// normalize invalid value
if ( typeof val !== "number" ) {
val = 0;
}
if ( val < this._valueMin() ) {
val = this._valueMin();
}
if ( val > this._valueMax() ) {
val = this._valueMax();
}
return val;
},
_valueMin: function() {
return 0;
},
_valueMax: function() {
return 100;
},
_refreshValue: function() {
var value = this.value();
this.valueDiv
[ value === this._valueMax() ? "addClass" : "removeClass"]( "ui-corner-right" )
.width( value + "%" );
this.element.attr( "aria-valuenow", value );
}
});
$.extend( $.ui.progressbar, {
version: "1.8.2"
});
})( jQuery );
|
Meteor.methods({
'livechat:removeCustomField'(_id) {
if (!Meteor.userId() || !RocketChat.authz.hasPermission(Meteor.userId(), 'view-livechat-manager')) {
throw new Meteor.Error('error-not-allowed', 'Not allowed', { method: 'livechat:removeCustomField' });
}
check(_id, String);
var customField = RocketChat.models.LivechatCustomField.findOneById(_id, { fields: { _id: 1 } });
if (!customField) {
throw new Meteor.Error('error-invalid-custom-field', 'Custom field not found', { method: 'livechat:removeCustomField' });
}
return RocketChat.models.LivechatCustomField.removeById(_id);
}
});
|
Object.is(1, 1);
Object.is(1, 2);
Object.is(1, {});
Object.is(1, NaN);
Object.is(0, 0);
Object.is(0, -0);
Object.is(NaN, NaN);
Object.is({}, {});
var emptyObject = {};
var emptyArray = [];
Object.is(emptyObject, emptyObject);
Object.is(emptyArray, emptyArray);
Object.is(emptyObject, emptyArray);
var squared = x => x * x;
Object.is(squared, squared);
var a: boolean = Object.is('a', 'a');
var b: string = Object.is('a', 'a');
var c: boolean = Object.is('a');
var d: boolean = Object.is('a', 'b', 'c');
|
'use strict'
/* global
* describe, it, beforeEach, afterEach, expect, spyOn,
* loadFixtures, Waypoint
*/
describe('Waypoints debug script', function() {
var waypoint, element
beforeEach(function() {
loadFixtures('standard.html')
})
afterEach(function() {
waypoint.destroy()
})
describe('display none detection', function() {
beforeEach(function() {
element = document.getElementById('same1')
waypoint = new Waypoint({
element: element,
handler: function() {}
})
element.style.display = 'none'
})
it('logs a console error', function() {
spyOn(console, 'error')
waypoint.context.refresh()
expect(console.error).toHaveBeenCalled()
})
})
describe('display fixed positioning detection', function() {
beforeEach(function() {
element = document.getElementById('same1')
waypoint = new Waypoint({
element: element,
handler: function() {}
})
element.style.position = 'fixed'
})
it('logs a console error', function() {
spyOn(console, 'error')
waypoint.context.refresh()
expect(console.error).toHaveBeenCalled()
})
})
describe('fixed position detection', function() {
})
describe('respect waypoint disabling', function() {
beforeEach(function() {
element = document.getElementById('same1')
waypoint = new Waypoint({
element: element,
handler: function() {}
})
element.style.display = 'none'
waypoint.disable()
})
it('does not log a console error', function() {
spyOn(console, 'error')
waypoint.context.refresh()
expect(console.error.calls.length).toEqual(0)
})
})
})
|
//// [constructorsWithSpecializedSignatures.ts]
// errors
declare class C {
constructor(x: "hi");
constructor(x: "foo");
constructor(x: number);
}
// ok
declare class C2 {
constructor(x: "hi");
constructor(x: "foo");
constructor(x: string);
}
// errors
class D {
constructor(x: "hi");
constructor(x: "foo");
constructor(x: number);
constructor(x: "hi") { }
}
// overloads are ok
class D2 {
constructor(x: "hi");
constructor(x: "foo");
constructor(x: string);
constructor(x: "hi") { } // error
}
// errors
interface I {
new (x: "hi");
new (x: "foo");
new (x: number);
}
// ok
interface I2 {
new (x: "hi");
new (x: "foo");
new (x: string);
}
//// [constructorsWithSpecializedSignatures.js]
// errors
var D = (function () {
function D(x) {
}
return D;
})();
// overloads are ok
var D2 = (function () {
function D2(x) {
} // error
return D2;
})();
|
/*!
* froala_editor v1.1.8 (http://editor.froala.com)
* Copyright 2014-2014 Froala
*/
/**
* English spoken in Canada
*/
$.Editable.LANGS['en_ca'] = {
translation: {
"Bold": "Bold",
"Italic": "Italic",
"Underline": "Underline",
"Strikethrough": "Strikethrough",
"Font Size": "Font Size",
"Color": "Colour",
"Background Color": "Background Colour",
"Text Color": "Text Colour",
"Format Block": "Format Block",
"Normal": "Normal",
"Paragraph": "Paragraph",
"Code": "Code",
"Quote": "Quote",
"Heading 1": "Heading 1",
"Heading 2": "Heading 2",
"Heading 3": "Heading 3",
"Heading 4": "Heading 4",
"Heading 5": "Heading 5",
"Heading 6": "Heading 6",
"Alignment": "Alignment",
"Align Left": "Align Left",
"Align Center": "Align Center",
"Align Right": "Align Right",
"Justify": "Justify",
"Numbered List": "Numbered List",
"Bulleted List": "Bulleted List",
"Indent Less": "Indent Less",
"Indent More": "Indent More",
"Select All": "Select All",
"Insert Link": "Insert Link",
"Insert Image": "Insert Image",
"Insert Video": "Insert Video",
"Undo": "Undo",
"Redo": "Redo",
"Show HTML": "Show HTML",
"Float Left": "Float Left",
"Float None": "Float None",
"Float Right": "Float Right",
"Replace Image": "Replace Image",
"Remove Image": "Remove Image",
"Title": "Title",
"Insert image": "Insert image",
"Drop image": "Drop image",
"or click": "or click",
"Enter URL": "Enter URL",
"Please wait!": "Please wait!",
"Are you sure? Image will be deleted.": "Are you sure? Image will be deleted.",
"UNLINK": "UNLINK",
"Open in new tab": "Open in new tab",
"Type something": "Type something",
"Cancel": "Cancel",
"OK": "OK",
"Manage images": "Manage images",
"Delete": "Delete",
"Font Family": "Font Family",
"Insert Horizontal Line": "Insert Horizontal Line",
"Table": "Table",
"Insert table": "Insert table",
"Cell": "Cell",
"Row": "Row",
"Column": "Column",
"Delete table": "Delete table",
"Insert cell before": "Insert cell before",
"Insert cell after": "Insert cell after",
"Delete cell": "Delete cell",
"Merge cells": "Merge cells",
"Horizontal split": "Horizontal split",
"Vertical split": "Vertical split",
"Insert row above": "Insert row above",
"Insert row below": "Insert row below",
"Delete row": "Delete row",
"Insert column before": "Insert column before",
"Insert column after": "Insert column after",
"Delete column": "Delete column"
},
direction: "ltr"
};
|
define(
"dojox/atom/widget/nls/ja/FeedEntryEditor", ({
doNew: "[新規]",
edit: "[編集]",
save: "[保存]",
cancel: "[キャンセル]"
})
);
|
function f() { /* infinite */ while (true) { } /* bar */ var each; }
|
//On page load
// TODO - remove nonconflict stuff once prototype is gone for good
var $j = jQuery.noConflict();
replace_ids = function(s){
var new_id = new Date().getTime();
return s.replace(/NEW_RECORD/g, new_id);
}
$j(function() {
$j('a[id*=nested]').click(function() {
var template = $j(this).attr('href').replace(/.*#/, '');
html = replace_ids(eval(template));
$j('#ul-' + $j(this).attr('id')).append(html);
update_remove_links();
});
update_remove_links();
})
var update_remove_links = function() {
$j('.remove').click(function() {
$j(this).prevAll(':first').val(1);
$j(this).parent().hide();
});
};
|
/*
* jQuery Textarea Characters Counter Plugin v 2.0
* Examples and documentation at: http://roy-jin.appspot.com/jsp/textareaCounter.jsp
* Copyright (c) 2010 Roy Jin
* Version: 2.0 (11-JUN-2010)
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
* Requires: jQuery v1.4.2 or later
*/
(function($){
$.fn.textareaCount = function(options, fn) {
var defaults = {
maxCharacterSize: -1,
originalStyle: 'originalTextareaInfo',
warningStyle: 'warningTextareaInfo',
warningNumber: 20,
displayFormat: '#input characters | #words words'
};
var options = $.extend(defaults, options);
var container = $(this);
$("<div class='charleft'> </div>").insertAfter(container);
//create charleft css
var charLeftCss = {
'width' : container.width()
};
var charLeftInfo = getNextCharLeftInformation(container);
charLeftInfo.addClass(options.originalStyle);
//charLeftInfo.css(charLeftCss);
var numInput = 0;
var maxCharacters = options.maxCharacterSize;
var numLeft = 0;
var numWords = 0;
container.bind('keyup', function(event){limitTextAreaByCharacterCount();})
.bind('mouseover', function(event){setTimeout(function(){limitTextAreaByCharacterCount();}, 10);})
.bind('paste', function(event){setTimeout(function(){limitTextAreaByCharacterCount();}, 10);});
limitTextAreaByCharacterCount();
function limitTextAreaByCharacterCount(){
charLeftInfo.html(countByCharacters());
//function call back
if(typeof fn != 'undefined'){
fn.call(this, getInfo());
}
return true;
}
function countByCharacters(){
var content = container.val();
var contentLength = content.length;
//Start Cut
if(options.maxCharacterSize > 0){
//If copied content is already more than maxCharacterSize, chop it to maxCharacterSize.
if(contentLength >= options.maxCharacterSize) {
content = content.substring(0, options.maxCharacterSize);
}
var newlineCount = getNewlineCount(content);
// newlineCount new line character. For windows, it occupies 2 characters
var systemmaxCharacterSize = options.maxCharacterSize - newlineCount;
if (!isWin()){
systemmaxCharacterSize = options.maxCharacterSize
}
if(contentLength > systemmaxCharacterSize){
//avoid scroll bar moving
var originalScrollTopPosition = this.scrollTop;
container.val(content.substring(0, systemmaxCharacterSize));
this.scrollTop = originalScrollTopPosition;
}
charLeftInfo.removeClass(options.warningStyle);
if(systemmaxCharacterSize - contentLength <= options.warningNumber){
charLeftInfo.addClass(options.warningStyle);
}
numInput = container.val().length + newlineCount;
if(!isWin()){
numInput = container.val().length;
}
numWords = countWord(getCleanedWordString(container.val()));
numLeft = maxCharacters - numInput;
} else {
//normal count, no cut
var newlineCount = getNewlineCount(content);
numInput = container.val().length + newlineCount;
if(!isWin()){
numInput = container.val().length;
}
numWords = countWord(getCleanedWordString(container.val()));
}
return formatDisplayInfo();
}
function formatDisplayInfo(){
var format = options.displayFormat;
format = format.replace('#input', numInput);
format = format.replace('#words', numWords);
//When maxCharacters <= 0, #max, #left cannot be substituted.
if(maxCharacters > 0){
format = format.replace('#max', maxCharacters);
format = format.replace('#left', numLeft);
}
return format;
}
function getInfo(){
var info = {
input: numInput,
max: maxCharacters,
left: numLeft,
words: numWords
};
return info;
}
function getNextCharLeftInformation(container){
return container.next('.charleft');
}
function isWin(){
var strOS = navigator.appVersion;
if (strOS.toLowerCase().indexOf('win') != -1){
return true;
}
return false;
}
function getNewlineCount(content){
var newlineCount = 0;
for(var i=0; i<content.length;i++){
if(content.charAt(i) == '\n'){
newlineCount++;
}
}
return newlineCount;
}
function getCleanedWordString(content){
var fullStr = content + " ";
var initial_whitespace_rExp = /^[^A-Za-z0-9]+/gi;
var left_trimmedStr = fullStr.replace(initial_whitespace_rExp, "");
var non_alphanumerics_rExp = rExp = /[^A-Za-z0-9]+/gi;
var cleanedStr = left_trimmedStr.replace(non_alphanumerics_rExp, " ");
var splitString = cleanedStr.split(" ");
return splitString;
}
function countWord(cleanedWordString){
var word_count = cleanedWordString.length-1;
return word_count;
}
};
})(jQuery);
|
/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/*************************************************************
*
* MathJax/jax/output/HTML-CSS/autoload/ms.js
*
* Implements the HTML-CSS output for <ms> elements.
*
* ---------------------------------------------------------------------
*
* Copyright (c) 2010-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.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
var VERSION = "2.6.0";
var MML = MathJax.ElementJax.mml,
HTMLCSS = MathJax.OutputJax["HTML-CSS"];
MML.ms.Augment({
toHTML: function (span) {
span = this.HTMLhandleSize(this.HTMLcreateSpan(span));
var values = this.getValues("lquote","rquote","mathvariant");
if (!this.hasValue("lquote") || values.lquote === '"') values.lquote = "\u201C";
if (!this.hasValue("rquote") || values.rquote === '"') values.rquote = "\u201D";
if (values.lquote === "\u201C" && values.mathvariant === "monospace") values.lquote = '"';
if (values.rquote === "\u201D" && values.mathvariant === "monospace") values.rquote = '"';
var text = values.lquote+this.data.join("")+values.rquote; // FIXME: handle mglyph?
this.HTMLhandleVariant(span,this.HTMLgetVariant(),text);
this.HTMLhandleSpace(span);
this.HTMLhandleColor(span);
this.HTMLhandleDir(span);
return span;
}
});
MathJax.Hub.Startup.signal.Post("HTML-CSS ms Ready");
MathJax.Ajax.loadComplete(HTMLCSS.autoloadDir+"/ms.js");
});
|
//// Copyright (c) Microsoft Corporation. All rights reserved
(function () {
"use strict";
var sampleTitle = "Adaptive Streaming";
var scenarios = [
{ url: "/html/scenario1.html", title: "Basic HLS/DASH Playback" },
{ url: "/html/scenario2.html", title: "Configuring HLS/DASH Playback" },
{ url: "/html/scenario3.html", title: "Customized Resource Acquisition" },
{ url: "/html/scenario4.html", title: "Playback with PlayReady DRM" }
];
WinJS.Namespace.define("SdkSample", {
sampleTitle: sampleTitle,
scenarios: new WinJS.Binding.List(scenarios)
});
})();
|
YUI.add('moodle-mod_quiz-repaginate', function (Y, NAME) {
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Repaginate functionality for a popup in quiz editing page.
*
* @package mod_quiz
* @copyright 2014 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
var CSS = {
REPAGINATECONTAINERCLASS: '.rpcontainerclass',
REPAGINATECOMMAND: '#repaginatecommand'
};
var PARAMS = {
CMID: 'cmid',
HEADER: 'header',
FORM: 'form'
};
var POPUP = function() {
POPUP.superclass.constructor.apply(this, arguments);
};
Y.extend(POPUP, Y.Base, {
header: null,
body: null,
initializer: function() {
var rpcontainerclass = Y.one(CSS.REPAGINATECONTAINERCLASS);
// Set popup header and body.
this.header = rpcontainerclass.getAttribute(PARAMS.HEADER);
this.body = rpcontainerclass.getAttribute(PARAMS.FORM);
Y.one(CSS.REPAGINATECOMMAND).on('click', this.display_dialog, this);
},
display_dialog: function(e) {
e.preventDefault();
// Configure the popup.
var config = {
headerContent: this.header,
bodyContent: this.body,
draggable: true,
modal: true,
zIndex: 1000,
context: [CSS.REPAGINATECOMMAND, 'tr', 'br', ['beforeShow']],
centered: false,
width: '30em',
visible: false,
postmethod: 'form',
footerContent: null
};
var popup = {dialog: null};
popup.dialog = new M.core.dialogue(config);
popup.dialog.show();
}
});
M.mod_quiz = M.mod_quiz || {};
M.mod_quiz.repaginate = M.mod_quiz.repaginate || {};
M.mod_quiz.repaginate.init = function() {
return new POPUP();
};
}, '@VERSION@', {"requires": ["base", "event", "node", "io", "moodle-core-notification-dialogue"]});
|
export default function isPlainFunction(test) {
return typeof test === 'function' && test.PrototypeMixin === undefined;
}
|
videojs.addLanguage("da",{
"Play": "Afspil",
"Pause": "Pause",
"Current Time": "Aktuel tid",
"Duration Time": "Varighed",
"Remaining Time": "Resterende tid",
"Stream Type": "Stream-type",
"LIVE": "LIVE",
"Loaded": "Indlæst",
"Progress": "Status",
"Fullscreen": "Fuldskærm",
"Non-Fullscreen": "Luk fuldskærm",
"Mute": "Uden lyd",
"Unmuted": "Med lyd",
"Playback Rate": "Afspilningsrate",
"Subtitles": "Undertekster",
"subtitles off": "Uden undertekster",
"Captions": "Undertekster for hørehæmmede",
"captions off": "Uden undertekster for hørehæmmede",
"Chapters": "Kapitler",
"You aborted the video playback": "Du afbrød videoafspilningen.",
"A network error caused the video download to fail part-way.": "En netværksfejl fik download af videoen til at fejle.",
"The video could not be loaded, either because the server or network failed or because the format is not supported.": "Videoen kunne ikke indlæses, enten fordi serveren eller netværket fejlede, eller fordi formatet ikke er understøttet.",
"The video playback was aborted due to a corruption problem or because the video used features your browser did not support.": "Videoafspilningen blev afbrudt på grund af ødelagte data eller fordi videoen benyttede faciliteter som din browser ikke understøtter.",
"No compatible source was found for this video.": "Fandt ikke en kompatibel kilde for denne video."
});
|
define([
'jquery', 'underscore', 'common/js/spec_helpers/template_helpers', 'js/spec/edxnotes/helpers',
'js/edxnotes/collections/notes', 'js/edxnotes/collections/tabs',
'js/edxnotes/views/tabs/course_structure', 'js/spec/edxnotes/custom_matchers',
'jasmine-jquery'
], function(
$, _, TemplateHelpers, Helpers, NotesCollection, TabsCollection, CourseStructureView,
customMatchers
) {
'use strict';
describe('EdxNotes CourseStructureView', function() {
var notes = Helpers.getDefaultNotes(),
getView, getText;
getText = function (selector) {
return $(selector).map(function () {
return _.trim($(this).text());
}).toArray();
};
getView = function (collection, tabsCollection, options) {
var view;
options = _.defaults(options || {}, {
el: $('.wrapper-student-notes'),
collection: collection,
tabsCollection: tabsCollection,
});
view = new CourseStructureView(options);
tabsCollection.at(0).activate();
return view;
};
beforeEach(function () {
customMatchers(this);
loadFixtures('js/fixtures/edxnotes/edxnotes.html');
TemplateHelpers.installTemplates([
'templates/edxnotes/note-item', 'templates/edxnotes/tab-item'
]);
this.collection = new NotesCollection(notes);
this.tabsCollection = new TabsCollection();
});
it('displays a tab and content with proper data and order', function () {
var view = getView(this.collection, this.tabsCollection),
chapters = getText('.course-title'),
sections = getText('.course-subtitle'),
notes = getText('.note-excerpt-p');
expect(this.tabsCollection).toHaveLength(1);
expect(this.tabsCollection.at(0).toJSON()).toEqual({
name: 'Location in Course',
identifier: 'view-course-structure',
icon: 'fa fa-list-ul',
is_active: true,
is_closable: false,
view: 'Location in Course'
});
expect(view.$('#structure-panel')).toExist();
expect(chapters).toEqual(['First Chapter', 'Second Chapter']);
expect(sections).toEqual(['First Section', 'Second Section', 'Third Section']);
expect(notes).toEqual(['Note 1', 'Note 2', 'Note 3', 'Note 4', 'Note 5']);
});
});
});
|
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/*
* @package atto_fontcolor
* @copyright 2014 Rossiani Wijaya <rwijaya@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
* @module moodle-atto_align-button
*/
/**
* Atto text editor fontcolor plugin.
*
* @namespace M.atto_fontcolor
* @class button
* @extends M.editor_atto.EditorPlugin
*/
var colors = [
{
name: 'white',
color: '#FFFFFF'
}, {
name: 'red',
color: '#EF4540'
}, {
name: 'yellow',
color: '#FFCF35'
}, {
name: 'green',
color: '#98CA3E'
}, {
name: 'blue',
color: '#7D9FD3'
}, {
name: 'black',
color: '#333333'
}
];
Y.namespace('M.atto_fontcolor').Button = Y.Base.create('button', Y.M.editor_atto.EditorPlugin, [], {
initializer: function() {
var items = [];
Y.Array.each(colors, function(color) {
items.push({
text: '<div style="width: 20px; height: 20px; border: 1px solid #CCC; background-color: ' +
color.color +
'"></div>',
callbackArgs: color.color,
callback: this._changeStyle
});
});
this.addToolbarMenu({
icon: 'e/text_color',
overlayWidth: '4',
menuColor: '#333333',
globalItemConfig: {
callback: this._changeStyle
},
items: items
});
},
/**
* Change the font color to the specified color.
*
* @method _changeStyle
* @param {EventFacade} e
* @param {string} color The new font color
* @private
*/
_changeStyle: function(e, color) {
this.get('host').formatSelectionInlineStyle({
color: color
});
}
});
|
//// Copyright (c) Microsoft Corporation. All rights reserved
(function () {
"use strict";
var page = WinJS.UI.Pages.define("/html/crossfade.html", {
ready: function (element, options) {
runAnimation.addEventListener("click", runCrossfadeAnimation, false);
element2.style.opacity = "0";
}
});
function runCrossfadeAnimation() {
var incoming;
var outgoing;
// Set incoming and outgoing elements
if (element1.style.opacity === "0") {
incoming = element1;
outgoing = element2;
} else {
incoming = element2;
outgoing = element1;
}
// Run crossfade animation
WinJS.UI.Animation.crossFade(incoming, outgoing);
}
})();
|
import "../arrays/map";
import "../core/array";
import "../core/identity";
import "../math/trigonometry";
var d3_ease_default = function() { return d3_identity; };
var d3_ease = d3.map({
linear: d3_ease_default,
poly: d3_ease_poly,
quad: function() { return d3_ease_quad; },
cubic: function() { return d3_ease_cubic; },
sin: function() { return d3_ease_sin; },
exp: function() { return d3_ease_exp; },
circle: function() { return d3_ease_circle; },
elastic: d3_ease_elastic,
back: d3_ease_back,
bounce: function() { return d3_ease_bounce; }
});
var d3_ease_mode = d3.map({
"in": d3_identity,
"out": d3_ease_reverse,
"in-out": d3_ease_reflect,
"out-in": function(f) { return d3_ease_reflect(d3_ease_reverse(f)); }
});
d3.ease = function(name) {
var i = name.indexOf("-"),
t = i >= 0 ? name.slice(0, i) : name,
m = i >= 0 ? name.slice(i + 1) : "in";
t = d3_ease.get(t) || d3_ease_default;
m = d3_ease_mode.get(m) || d3_identity;
return d3_ease_clamp(m(t.apply(null, d3_arraySlice.call(arguments, 1))));
};
function d3_ease_clamp(f) {
return function(t) {
return t <= 0 ? 0 : t >= 1 ? 1 : f(t);
};
}
function d3_ease_reverse(f) {
return function(t) {
return 1 - f(1 - t);
};
}
function d3_ease_reflect(f) {
return function(t) {
return 0.5 * (t < 0.5 ? f(2 * t) : (2 - f(2 - 2 * t)));
};
}
function d3_ease_quad(t) {
return t * t;
}
function d3_ease_cubic(t) {
return t * t * t;
}
// Optimized clamp(reflect(poly(3))).
function d3_ease_cubicInOut(t) {
if (t <= 0) return 0;
if (t >= 1) return 1;
var t2 = t * t, t3 = t2 * t;
return 4 * (t < 0.5 ? t3 : 3 * (t - t2) + t3 - 0.75);
}
function d3_ease_poly(e) {
return function(t) {
return Math.pow(t, e);
};
}
function d3_ease_sin(t) {
return 1 - Math.cos(t * halfπ);
}
function d3_ease_exp(t) {
return Math.pow(2, 10 * (t - 1));
}
function d3_ease_circle(t) {
return 1 - Math.sqrt(1 - t * t);
}
function d3_ease_elastic(a, p) {
var s;
if (arguments.length < 2) p = 0.45;
if (arguments.length) s = p / τ * Math.asin(1 / a);
else a = 1, s = p / 4;
return function(t) {
return 1 + a * Math.pow(2, -10 * t) * Math.sin((t - s) * τ / p);
};
}
function d3_ease_back(s) {
if (!s) s = 1.70158;
return function(t) {
return t * t * ((s + 1) * t - s);
};
}
function d3_ease_bounce(t) {
return t < 1 / 2.75 ? 7.5625 * t * t
: t < 2 / 2.75 ? 7.5625 * (t -= 1.5 / 2.75) * t + 0.75
: t < 2.5 / 2.75 ? 7.5625 * (t -= 2.25 / 2.75) * t + 0.9375
: 7.5625 * (t -= 2.625 / 2.75) * t + 0.984375;
}
|
module.exports = []
|
var mdeps = require('../');
var test = require('tape');
var JSONStream = require('JSONStream');
var packer = require('browser-pack');
var concat = require('concat-stream');
var path = require('path');
test('global transforms', function (t) {
t.plan(1);
var p = mdeps({
transform: [ 'tr-c', 'tr-d' ],
globalTransform: [
path.join(__dirname, '/files/tr_global/node_modules/tr-e'),
path.join(__dirname, '/files/tr_global/node_modules/tr-f')
],
transformKey: [ 'browserify', 'transform' ]
});
p.end(path.join(__dirname, '/files/tr_global/main.js'));
var pack = packer();
p.pipe(JSONStream.stringify()).pipe(pack).pipe(concat(function (src) {
Function(['console'], src)({
log: function (msg) {
t.equal(msg, 111111);
}
});
}));
});
|
'use strict';
angular.module("ngLocale", [], ["$provide", function($provide) {
var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"};
$provide.value("$locale", {
"DATETIME_FORMATS": {
"AMPMS": [
"\u13cc\u13be\u13b4",
"\u13d2\u13af\u13f1\u13a2\u13d7\u13e2"
],
"DAY": [
"\u13a4\u13be\u13d9\u13d3\u13c6\u13cd\u13ac",
"\u13a4\u13be\u13d9\u13d3\u13c9\u13c5\u13af",
"\u13d4\u13b5\u13c1\u13a2\u13a6",
"\u13e6\u13a2\u13c1\u13a2\u13a6",
"\u13c5\u13a9\u13c1\u13a2\u13a6",
"\u13e7\u13be\u13a9\u13b6\u13cd\u13d7",
"\u13a4\u13be\u13d9\u13d3\u13c8\u13d5\u13be"
],
"MONTH": [
"\u13a4\u13c3\u13b8\u13d4\u13c5",
"\u13a7\u13a6\u13b5",
"\u13a0\u13c5\u13f1",
"\u13a7\u13ec\u13c2",
"\u13a0\u13c2\u13cd\u13ac\u13d8",
"\u13d5\u13ad\u13b7\u13f1",
"\u13ab\u13f0\u13c9\u13c2",
"\u13a6\u13b6\u13c2",
"\u13da\u13b5\u13cd\u13d7",
"\u13da\u13c2\u13c5\u13d7",
"\u13c5\u13d3\u13d5\u13c6",
"\u13a5\u13cd\u13a9\u13f1"
],
"SHORTDAY": [
"\u13c6\u13cd\u13ac",
"\u13c9\u13c5\u13af",
"\u13d4\u13b5\u13c1",
"\u13e6\u13a2\u13c1",
"\u13c5\u13a9\u13c1",
"\u13e7\u13be\u13a9",
"\u13c8\u13d5\u13be"
],
"SHORTMONTH": [
"\u13a4\u13c3",
"\u13a7\u13a6",
"\u13a0\u13c5",
"\u13a7\u13ec",
"\u13a0\u13c2",
"\u13d5\u13ad",
"\u13ab\u13f0",
"\u13a6\u13b6",
"\u13da\u13b5",
"\u13da\u13c2",
"\u13c5\u13d3",
"\u13a5\u13cd"
],
"fullDate": "EEEE, MMMM d, y",
"longDate": "MMMM d, y",
"medium": "MMM d, y h:mm:ss a",
"mediumDate": "MMM d, y",
"mediumTime": "h:mm:ss a",
"short": "M/d/yy h:mm a",
"shortDate": "M/d/yy",
"shortTime": "h:mm a"
},
"NUMBER_FORMATS": {
"CURRENCY_SYM": "$",
"DECIMAL_SEP": ".",
"GROUP_SEP": ",",
"PATTERNS": [
{
"gSize": 3,
"lgSize": 3,
"maxFrac": 3,
"minFrac": 0,
"minInt": 1,
"negPre": "-",
"negSuf": "",
"posPre": "",
"posSuf": ""
},
{
"gSize": 3,
"lgSize": 3,
"maxFrac": 2,
"minFrac": 2,
"minInt": 1,
"negPre": "\u00a4-",
"negSuf": "",
"posPre": "\u00a4",
"posSuf": ""
}
]
},
"id": "chr-us",
"pluralCat": function(n, opt_precision) { if (n == 1) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;}
});
}]);
|
var Types = require('../constants/types');
var Charsets = require('../constants/charsets');
var Field = require('./Field');
var IEEE_754_BINARY_64_PRECISION = Math.pow(2, 53);
module.exports = RowDataPacket;
function RowDataPacket() {
}
Object.defineProperty(RowDataPacket.prototype, 'parse', {
configurable : true,
enumerable : false,
value : parse
});
Object.defineProperty(RowDataPacket.prototype, '_typeCast', {
configurable : true,
enumerable : false,
value : typeCast
});
function parse(parser, fieldPackets, typeCast, nestTables, connection) {
var self = this;
var next = function () {
return self._typeCast(fieldPacket, parser, connection.config.timezone, connection.config.supportBigNumbers, connection.config.bigNumberStrings, connection.config.dateStrings);
};
for (var i = 0; i < fieldPackets.length; i++) {
var fieldPacket = fieldPackets[i];
var value;
if (typeof typeCast === 'function') {
value = typeCast.apply(connection, [ new Field({ packet: fieldPacket, parser: parser }), next ]);
} else {
value = (typeCast)
? this._typeCast(fieldPacket, parser, connection.config.timezone, connection.config.supportBigNumbers, connection.config.bigNumberStrings, connection.config.dateStrings)
: ( (fieldPacket.charsetNr === Charsets.BINARY)
? parser.parseLengthCodedBuffer()
: parser.parseLengthCodedString() );
}
if (typeof nestTables === 'string' && nestTables.length) {
this[fieldPacket.table + nestTables + fieldPacket.name] = value;
} else if (nestTables) {
this[fieldPacket.table] = this[fieldPacket.table] || {};
this[fieldPacket.table][fieldPacket.name] = value;
} else {
this[fieldPacket.name] = value;
}
}
}
function typeCast(field, parser, timeZone, supportBigNumbers, bigNumberStrings, dateStrings) {
var numberString;
switch (field.type) {
case Types.TIMESTAMP:
case Types.TIMESTAMP2:
case Types.DATE:
case Types.DATETIME:
case Types.DATETIME2:
case Types.NEWDATE:
var dateString = parser.parseLengthCodedString();
if (typeMatch(field.type, dateStrings)) {
return dateString;
}
if (dateString === null) {
return null;
}
var originalString = dateString;
if (field.type === Types.DATE) {
dateString += ' 00:00:00';
}
if (timeZone !== 'local') {
dateString += ' ' + timeZone;
}
var dt = new Date(dateString);
if (isNaN(dt.getTime())) {
return originalString;
}
return dt;
case Types.TINY:
case Types.SHORT:
case Types.LONG:
case Types.INT24:
case Types.YEAR:
case Types.FLOAT:
case Types.DOUBLE:
numberString = parser.parseLengthCodedString();
return (numberString === null || (field.zeroFill && numberString[0] === '0'))
? numberString : Number(numberString);
case Types.NEWDECIMAL:
case Types.LONGLONG:
numberString = parser.parseLengthCodedString();
return (numberString === null || (field.zeroFill && numberString[0] === '0'))
? numberString
: ((supportBigNumbers && (bigNumberStrings || (Number(numberString) >= IEEE_754_BINARY_64_PRECISION) || Number(numberString) <= -IEEE_754_BINARY_64_PRECISION))
? numberString
: Number(numberString));
case Types.BIT:
return parser.parseLengthCodedBuffer();
case Types.STRING:
case Types.VAR_STRING:
case Types.TINY_BLOB:
case Types.MEDIUM_BLOB:
case Types.LONG_BLOB:
case Types.BLOB:
return (field.charsetNr === Charsets.BINARY)
? parser.parseLengthCodedBuffer()
: parser.parseLengthCodedString();
case Types.GEOMETRY:
return parser.parseGeometryValue();
default:
return parser.parseLengthCodedString();
}
}
function typeMatch(type, list) {
if (Array.isArray(list)) {
for (var i = 0; i < list.length; i++) {
if (Types[list[i]] === type) return true;
}
return false;
} else {
return Boolean(list);
}
}
|
export {foo, bar};
|
var convert = require('./convert');
module.exports = convert('chunk', require('../chunk'));
|
define(
"dojo/cldr/nls/fr/islamic", //begin v1.x content
{
"dateFormatItem-yM": "M/yyyy",
"dateFormatItem-yyyyMMMEd": "E d MMM y G",
"dateFormatItem-yQ": "'T'Q y",
"dateFormatItem-MMMEd": "E d MMM",
"dateFormatItem-hms": "h:mm:ss a",
"dateFormatItem-yQQQ": "QQQ y",
"dateFormatItem-MMdd": "dd/MM",
"days-standAlone-wide": [
"dimanche",
"lundi",
"mardi",
"mercredi",
"jeudi",
"vendredi",
"samedi"
],
"dateFormatItem-MMM": "LLL",
"months-standAlone-narrow": [
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"10",
"11",
"12"
],
"quarters-standAlone-abbr": [
"T1",
"T2",
"T3",
"T4"
],
"dateFormatItem-y": "y",
"dateFormatItem-MMMdd": "dd MMM",
"dateFormatItem-yyyy": "y G",
"months-standAlone-abbr": [
"mouh.",
"saf.",
"rab.aw.",
"rab.th.",
"joum.ou.",
"joum.th.",
"raj.",
"chaa.",
"ram.",
"chaw.",
"dhou.qi.",
"dhou.hi."
],
"dateFormatItem-Ed": "E d",
"dateFormatItem-yMMM": "MMM y",
"days-standAlone-narrow": [
"D",
"L",
"M",
"M",
"J",
"V",
"S"
],
"eraAbbr": [
"AH"
],
"dateFormatItem-yyyyMMMM": "MMMM y G",
"dateFormat-long": "d MMMM y G",
"dateFormatItem-Hm": "HH:mm",
"dateFormatItem-MMd": "d/MM",
"dateFormatItem-yyMM": "MM/y G",
"dateFormat-medium": "d MMM, y G",
"dateFormatItem-Hms": "HH:mm:ss",
"dayPeriods-format-narrow-pm": "p",
"dateFormatItem-yyMMM": "MMM y G",
"dateFormatItem-yyQQQQ": "QQQQ y G",
"dateFormatItem-yMd": "d/M/yyyy",
"quarters-standAlone-wide": [
"1er trimestre",
"2e trimestre",
"3e trimestre",
"4e trimestre"
],
"dateFormatItem-ms": "mm:ss",
"dateFormatItem-yyMMMd": "d MMM y G",
"months-standAlone-wide": [
"mouharram",
"safar",
"rabia al awal",
"rabia ath-thani",
"joumada al oula",
"joumada ath-thania",
"rajab",
"chaabane",
"ramadan",
"chawwal",
"dhou al qi`da",
"dhou al-hijja"
],
"dateFormatItem-yyyyMd": "d/M/y G",
"dateFormatItem-yyyyMMMd": "d MMM y G",
"dateFormatItem-MMMMEd": "E d MMMM",
"dateFormatItem-yyyyMEd": "E d/M/y G",
"dateFormatItem-MMMd": "d MMM",
"dateFormatItem-yyMMMEd": "E d MMM y G",
"dateFormatItem-yyQ": "'T'Q y G",
"months-format-abbr": [
"mouh.",
"saf.",
"rab.aw.",
"rab.th.",
"joum.oul.",
"joum.tha.",
"raj.",
"chaa.",
"ram.",
"chaw.",
"dhou.q.",
"dhou.h."
],
"dateFormatItem-H": "HH",
"quarters-format-abbr": [
"T1",
"T2",
"T3",
"T4"
],
"days-format-abbr": [
"dim.",
"lun.",
"mar.",
"mer.",
"jeu.",
"ven.",
"sam."
],
"dateFormatItem-M": "L",
"days-format-narrow": [
"D",
"L",
"M",
"M",
"J",
"V",
"S"
],
"dateFormatItem-yMMMd": "d MMM y",
"dateFormatItem-MEd": "E d/M",
"dateFormatItem-yyyyQQQ": "QQQ y G",
"months-format-narrow": [
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"10",
"11",
"12"
],
"days-standAlone-short": [
"dim.",
"lun.",
"mar.",
"mer.",
"jeu.",
"ven.",
"sam."
],
"dateFormatItem-hm": "h:mm a",
"days-standAlone-abbr": [
"dim.",
"lun.",
"mar.",
"mer.",
"jeu.",
"ven.",
"sam."
],
"dateFormat-short": "d/M/y G",
"dateFormatItem-yyyyM": "M/y G",
"dateFormatItem-yMMMEd": "E d MMM y",
"dateFormat-full": "EEEE d MMMM y G",
"dateFormatItem-Md": "d/M",
"dateFormatItem-yMEd": "E d/M/yyyy",
"dateFormatItem-yyyyQ": "'T'Q y G",
"months-format-wide": [
"mouharram",
"safar",
"rabia al awal",
"rabia ath-thani",
"joumada al oula",
"joumada ath-thania",
"rajab",
"chaabane",
"ramadan",
"chawwal",
"dhou al qi`da",
"dhou al-hijja"
],
"days-format-short": [
"di",
"lu",
"ma",
"me",
"je",
"ve",
"sa"
],
"dateFormatItem-yyyyMMM": "MMM y G",
"dateFormatItem-d": "d",
"quarters-format-wide": [
"1er trimestre",
"2e trimestre",
"3e trimestre",
"4e trimestre"
],
"days-format-wide": [
"dimanche",
"lundi",
"mardi",
"mercredi",
"jeudi",
"vendredi",
"samedi"
],
"dateFormatItem-h": "h a"
}
//end v1.x content
);
|
/* Slovenian locals for flatpickr */
var flatpickr = flatpickr || { l10ns: {} };
flatpickr.l10ns.sl = {};
flatpickr.l10ns.sl.weekdays = {
shorthand: ["Ned", "Pon", "Tor", "Sre", "Čet", "Pet", "Sob"],
longhand: ["Nedelja", "Ponedeljek", "Torek", "Sreda", "Četrtek", "Petek", "Sobota"]
};
flatpickr.l10ns.sl.months = {
shorthand: ["Jan", "Feb", "Mar", "Apr", "Maj", "Jun", "Jul", "Avg", "Sep", "Okt", "Nov", "Dec"],
longhand: ["Januar", "Februar", "Marec", "April", "Maj", "Junij", "Julij", "Avgust", "September", "Oktober", "November", "December"]
};
flatpickr.l10ns.sl.firstDayOfWeek = 1;
flatpickr.l10ns.sl.rangeSeparator = " do ";
flatpickr.l10ns.sl.ordinal = function () {
return ".";
};
if (typeof module !== "undefined") module.exports = flatpickr.l10ns;
|
;(function($){
/**
* jqGrid Danish Translation
* Aesiras A/S
* http://www.aesiras.dk
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
**/
$.jgrid = $.jgrid || {};
$.extend($.jgrid,{
defaults : {
recordtext: "Vis {0} - {1} of {2}",
emptyrecords: "Ingen linjer fundet",
loadtext: "Henter...",
pgtext : "Side {0} af {1}"
},
search : {
caption: "Søg...",
Find: "Find",
Reset: "Nulstil",
odata: [{ oper:'eq', text:"lig"},{ oper:'ne', text:"forskellige fra"},{ oper:'lt', text:"mindre"},{ oper:'le', text:"mindre eller lig"},{ oper:'gt', text:"større"},{ oper:'ge', text:"større eller lig"},{ oper:'bw', text:"begynder med"},{ oper:'bn', text:"begynder ikke med"},{ oper:'in', text:"findes i"},{ oper:'ni', text:"findes ikke i"},{ oper:'ew', text:"ender med"},{ oper:'en', text:"ender ikke med"},{ oper:'cn', text:"indeholder"},{ oper:'nc', text:"indeholder ikke"},{ oper:'nu', text:'is null'},{ oper:'nn', text:'is not null'}],
groupOps: [ { op: "AND", text: "all" }, { op: "OR", text: "any" } ],
operandTitle : "Click to select search operation.",
resetTitle : "Reset Search Value"
},
edit : {
addCaption: "Tilføj",
editCaption: "Ret",
bSubmit: "Send",
bCancel: "Annuller",
bClose: "Luk",
saveData: "Data er ændret. Gem data?",
bYes : "Ja",
bNo : "Nej",
bExit : "Fortryd",
msg: {
required:"Felt er nødvendigt",
number:"Indtast venligst et validt tal",
minValue:"værdi skal være større end eller lig med",
maxValue:"værdi skal være mindre end eller lig med",
email: "er ikke en gyldig email",
integer: "Indtast venligst et gyldigt heltal",
date: "Indtast venligst en gyldig datoværdi",
url: "er ugyldig URL. Prefix mangler ('http://' or 'https://')",
nodefined : " er ikke defineret!",
novalue : " returværdi kræves!",
customarray : "Custom function should return array!",
customfcheck : "Custom function should be present in case of custom checking!"
}
},
view : {
caption: "Vis linje",
bClose: "Luk"
},
del : {
caption: "Slet",
msg: "Slet valgte linje(r)?",
bSubmit: "Slet",
bCancel: "Fortryd"
},
nav : {
edittext: " ",
edittitle: "Rediger valgte linje",
addtext:" ",
addtitle: "Tilføj ny linje",
deltext: " ",
deltitle: "Slet valgte linje",
searchtext: " ",
searchtitle: "Find linjer",
refreshtext: "",
refreshtitle: "Indlæs igen",
alertcap: "Advarsel",
alerttext: "Vælg venligst linje",
viewtext: "",
viewtitle: "Vis valgte linje"
},
col : {
caption: "Vis/skjul kolonner",
bSubmit: "Opdatere",
bCancel: "Fortryd"
},
errors : {
errcap : "Fejl",
nourl : "Ingen url valgt",
norecords: "Ingen linjer at behandle",
model : "colNames og colModel har ikke samme længde!"
},
formatter : {
integer : {thousandsSeparator: " ", defaultValue: '0'},
number : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0,00'},
currency : {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0,00'},
date : {
dayNames: [
"Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør",
"Søndag", "Mandag", "Tirsdag", "Onsdag", "Torsdag", "Fredag", "Lørdag"
],
monthNames: [
"Jan", "Feb", "Mar", "Apr", "Maj", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dec",
"Januar", "Februar", "Marts", "April", "Maj", "Juni", "Juli", "August", "September", "Oktober", "November", "December"
],
AmPm : ["","","",""],
S: function (j) {return '.'},
srcformat: 'Y-m-d',
newformat: 'd/m/Y',
parseRe : /[#%\\\/:_;.,\t\s-]/,
masks : {
ISO8601Long:"Y-m-d H:i:s",
ISO8601Short:"Y-m-d",
ShortDate: "j/n/Y",
LongDate: "l d. F Y",
FullDateTime: "l d F Y G:i:s",
MonthDay: "d. F",
ShortTime: "G:i",
LongTime: "G:i:s",
SortableDateTime: "Y-m-d\\TH:i:s",
UniversalSortableDateTime: "Y-m-d H:i:sO",
YearMonth: "F Y"
},
reformatAfterEdit : false
},
baseLinkUrl: '',
showAction: '',
target: '',
checkbox : {disabled:true},
idName : 'id'
}
});
// DA
})(jQuery);
|
(function(angular) {
'use strict';
angular.module('nonStringSelect', [])
.run(function($rootScope) {
$rootScope.model = { id: 2 };
})
.directive('convertToNumber', function() {
return {
require: 'ngModel',
link: function(scope, element, attrs, ngModel) {
ngModel.$parsers.push(function(val) {
return parseInt(val, 10);
});
ngModel.$formatters.push(function(val) {
return '' + val;
});
}
};
});
})(window.angular);
|
// FILE H TWO
module.exports = 2
|
var setDesc = require('./$').setDesc
, createDesc = require('./$.property-desc')
, has = require('./$.has')
, FProto = Function.prototype
, nameRE = /^\s*function ([^ (]*)/
, NAME = 'name';
// 19.2.4.2 name
NAME in FProto || require('./$.support-desc') && setDesc(FProto, NAME, {
configurable: true,
get: function(){
var match = ('' + this).match(nameRE)
, name = match ? match[1] : '';
has(this, NAME) || setDesc(this, NAME, createDesc(5, name));
return name;
}
});
|
/**
* 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 PickerIOS
*
* This is a controlled component version of RCTPickerIOS
*/
'use strict';
var NativeMethodsMixin = require('NativeMethodsMixin');
var React = require('React');
var ReactChildren = require('ReactChildren');
var ReactNativeViewAttributes = require('ReactNativeViewAttributes');
var RCTPickerIOSConsts = require('NativeModules').UIManager.RCTPicker.Constants;
var StyleSheet = require('StyleSheet');
var View = require('View');
var requireNativeComponent = require('requireNativeComponent');
var merge = require('merge');
var PICKER = 'picker';
var PickerIOS = React.createClass({
mixins: [NativeMethodsMixin],
propTypes: {
onValueChange: React.PropTypes.func,
selectedValue: React.PropTypes.any, // string or integer basically
},
getInitialState: function() {
return this._stateFromProps(this.props);
},
componentWillReceiveProps: function(nextProps) {
this.setState(this._stateFromProps(nextProps));
},
// Translate PickerIOS prop and children into stuff that RCTPickerIOS understands.
_stateFromProps: function(props) {
var selectedIndex = 0;
var items = [];
ReactChildren.forEach(props.children, function (child, index) {
if (child.props.value === props.selectedValue) {
selectedIndex = index;
}
items.push({value: child.props.value, label: child.props.label});
});
return {selectedIndex, items};
},
render: function() {
return (
<View style={this.props.style}>
<RCTPickerIOS
ref={PICKER}
style={styles.pickerIOS}
items={this.state.items}
selectedIndex={this.state.selectedIndex}
onChange={this._onChange}
/>
</View>
);
},
_onChange: function(event) {
if (this.props.onChange) {
this.props.onChange(event);
}
if (this.props.onValueChange) {
this.props.onValueChange(event.nativeEvent.newValue);
}
// The picker is a controlled component. This means we expect the
// on*Change handlers to be in charge of updating our
// `selectedValue` prop. That way they can also
// disallow/undo/mutate the selection of certain values. In other
// words, the embedder of this component should be the source of
// truth, not the native component.
if (this.state.selectedIndex !== event.nativeEvent.newIndex) {
this.refs[PICKER].setNativeProps({
selectedIndex: this.state.selectedIndex
});
}
},
});
PickerIOS.Item = React.createClass({
propTypes: {
value: React.PropTypes.any, // string or integer basically
label: React.PropTypes.string,
},
render: function() {
// These items don't get rendered directly.
return null;
},
});
var styles = StyleSheet.create({
pickerIOS: {
// The picker will conform to whatever width is given, but we do
// have to set the component's height explicitly on the
// surrounding view to ensure it gets rendered.
height: RCTPickerIOSConsts.ComponentHeight,
},
});
var RCTPickerIOS = requireNativeComponent('RCTPicker', PickerIOS, {
nativeOnly: {
items: true,
onChange: true,
selectedIndex: true,
},
});
module.exports = PickerIOS;
|
'use strict';
/**
* Module dependencies.
*/
var mongoose = require('mongoose'),
Schema = mongoose.Schema;
/**
* <%= model.pascalCaseSingular %> Schema
*/
var <%= model.pascalCaseSingular %>Schema = new Schema({<% model.elements.forEach(function(element) { %>
<% if ( ['Schema.Types.ObjectId', 'File'].indexOf(element.elementtype)>-1 ) { %>
<%= element.elementname %>: <% if (element.isarray === true){%>[<% }%>{type: Schema.Types.ObjectId, ref: '<%= element.schemaobjref %>'}<% if (element.isarray === true){%>]<% } %>,
<% } else if (element.elementtype === 'Nested') { %>
<%= element.elementname %>: <% if (element.isarray === true){%>[<% } %>{
<% element.elements.forEach(function(nestedelement) { %>
<% if ( nestedelement.elementtype === 'Schema.Types.ObjectId' ) { %>
<%= nestedelement.elementname %>:{type: <%= nestedelement.elementtype %>, ref: '<%= nestedelement.schemaobjref %>'},
<% } else { %>
<%= nestedelement.elementname %>: <%= nestedelement.elementtype %>,
<% } %>
<% }); %>
}<% if (element.isarray === true){%>]<% } %>,
<% } else { %>
<%= element.elementname %>: <%= element.elementtype %>,
<% } %><% }); %>
created: {type: Date, default: Date.now},
user: {type: Schema.ObjectId, ref: 'User'}
});
mongoose.model('<%= model.pascalCaseSingular %>', <%= model.pascalCaseSingular %>Schema);
|
import {
Card,
} from '@card-game/core';
class Suits extends Enum {}
Suits.initEnum(['RED', 'GREEN', 'BLUE', 'YELLOW']);
class Ranks extends Enum {}
Ranks.initEnum(['ZERO', 'ONE', 'TWO', 'THREE', 'FOUR', 'FIVE', 'SIX', 'SEVEN', 'EIGHT', 'NINE', 'SKIP', 'DRAW_TWO', 'REVERSE']);
class Wilds extends Enum {}
Wilds.initEnum(['WILD', 'DRAW_FOUR']);
export default class UNOCard extends Card {
static get SUITS() {
return Suits;
}
static get RANKS() {
return Ranks;
}
static get WILDS() {
return Wilds;
}
constructor(suit, rank, owner) {
super({ suit, rank }, owner);
}
}
|
var jfs = require('json-schema-faker');
var mout = require('mout');
var Joi = require('joi');
var bluebird = require('bluebird');
var HapiFaker = function(options) {
if (!(this instanceof HapiFaker))
return new HapiFaker(options);
var result = Joi.validate(options, Joi.object({
schemas: Joi.array().items(Joi.object({
id: Joi.string().required(),
type: Joi.string().required()
}).unknown(true)).optional().default([]),
attachAt: Joi.string().only(['onRequest', 'onPreAuth', 'onPostAuth',
'onPreHandler', 'onPostHandler', 'onPreResponse'
]).default('onPostAuth'),
hooks: Joi.object({
request: Joi.func().optional()
}).optional().default({}),
jfs: Joi.func().optional().default(undefined)
}).optional().default({}));
if (result.error)
throw result.error;
this._options = mout.lang.deepClone(result.value);
if (!this._options.jfs)
this._options.jfs = jfs;
};
HapiFaker.prototype.attach = function(server) {
this._server = server;
// Capture requests to do the default job
server.ext(this._options.attachAt, this._hook, {
bind: this
});
// Add a new handler in case the user want's to
server.handler('faker', this._handler.bind(this));
// Add a new method in the reply interface
server.decorate('reply', 'faker', this._decorator(this));
// Expose our options server wide
server.expose('options', mout.lang.deepClone(this._options));
};
HapiFaker.prototype._hook = function(request, reply) {
var settings = request.route.settings.plugins;
var that = this;
// If this route isn't configured for faker, just ignore
if (!settings || !settings.faker)
return reply.continue();
var req = this._options.hooks.request;
bluebird
.resolve()
.then(req ? req.bind(this, request, reply) : function() {
return true;
})
.then(function(enable) {
if (!enable)
return reply.continue();
return bluebird
.resolve(that._genData(settings.faker))
.then(function(data) {
reply(data);
});
}).catch(function(err) {
// Enable Hapi to handle our errors
process.nextTick(function() {
throw err;
});
});
};
HapiFaker.prototype._handler = function(route, options) {
var that = this;
return function(request, reply) {
reply(that._genData(options));
};
};
HapiFaker.prototype._decorator = function(ctx) {
var that = ctx;
return function(input) {
this(that._genData(input));
};
};
HapiFaker.prototype._genData = function(input) {
var schema = null;
if (typeof input === 'string')
schema = this._options.schemas.filter(function(s) {
return s.id === input;
})[0];
else
schema = input;
if (!schema)
throw new Error('Unknown faker schema with ID ' + input);
// Do not modify the original schema
schema = mout.lang.deepClone(schema);
return this._options.jfs(schema, this._options.schemas);
};
module.exports = HapiFaker;
|
/**
* Created by Guoliang Cui on 2015/5/5.
*/
var utility=require('../lib/utility');
var ConfigInfo=require("../../config/baseConfig")
exports.getVersion=function(req,res){
var params=utility.parseParams(req).query;
var resultObj;
resultObj=utility.jsonResult(false,"OK",{version:ConfigInfo.basicSettings[params.key]});
res.send(resultObj);
}
|
/* eslint-env mocha */
import path from 'path';
import fs from 'fs';
import assert from 'assert';
import {transformFileSync} from 'babel-core';
function trim(str) {
return str.replace(/^\s+|\s+$/, '');
}
describe('Transpile ES7 async/await to vanilla ES6 Promise chains -', function () {
// sometimes 2000 isn't enough when starting up in coverage mode.
this.timeout(5000);
const fixturesDir = path.join(__dirname, 'fixtures');
fs.readdirSync(fixturesDir).forEach(caseName => {
const fixtureDir = path.join(fixturesDir, caseName);
const actualPath = path.join(fixtureDir, 'actual.js');
if (!fs.statSync(fixtureDir).isDirectory()) {
return;
}
it(caseName.split('-').join(' '), () => {
const actual = transformFileSync(actualPath).code;
const expected = fs.readFileSync(
path.join(fixtureDir, 'expected.js')
).toString();
assert.equal(trim(actual), trim(expected));
});
});
});
|
#!/usr/bin/env node
"use strict";
var setupThrobber = require("../../throbber")
, throbber = setupThrobber(process.stdout.write.bind(process.stdout), 200);
process.stdout.write("START");
throbber.start();
setTimeout(throbber.stop, 1100);
|
import { Constants, Feature } from 'alpheios-data-models'
import Morpheme from '@lib/morpheme.js'
import Form from '@lib/form.js'
import Table from '@views/lib/table.js'
import GreekView from '../greek-view.js'
import GroupFeatureType from '../../../lib/group-feature-type.js'
export default class GreekNumeralView extends GreekView {
constructor (homonym, inflectionData) {
super(homonym, inflectionData)
this.id = 'numeralDeclension'
this.name = 'numeral declension'
this.title = 'Numeral declension'
this.partOfSpeech = this.constructor.mainPartOfSpeech
this.lemmaTypeFeature = new Feature(Feature.types.hdwd, this.constructor.dataset.getNumeralGroupingLemmas(), GreekNumeralView.languageID)
this.features.lemmas = new GroupFeatureType(Feature.types.hdwd, this.constructor.languageID, 'Lemma',
this.constructor.dataset.getNumeralGroupingLemmaFeatures())
this.features.genders.getOrderedFeatures = this.constructor.getOrderedGenders
this.features.genders.getTitle = this.constructor.getGenderTitle
this.features.genders.filter = this.constructor.genderFilter
this.features.genders.comparisonType = Morpheme.comparisonTypes.PARTIAL
if (this.isImplemented) {
this.createTable()
}
}
static get viewID () {
return 'greek_numeral_view'
}
static get partsOfSpeech () {
return [Constants.POFS_NUMERAL]
}
static get inflectionType () {
return Form
}
createTable () {
this.table = new Table([this.features.lemmas, this.features.genders, this.features.types, this.features.numbers, this.features.cases])
let features = this.table.features // eslint-disable-line prefer-const
features.columns = [
this.lemmaTypeFeature,
this.constructor.model.typeFeature(Feature.types.gender),
this.constructor.model.typeFeature(Feature.types.type)
]
features.rows = [
this.constructor.model.typeFeature(Feature.types.number),
this.constructor.model.typeFeature(Feature.types.grmCase)
]
features.columnRowTitles = [
this.constructor.model.typeFeature(Feature.types.grmCase)
]
features.fullWidthRowTitles = [this.constructor.model.typeFeature(Feature.types.number)]
}
static getOrderedGenders (ancestorFeatures) {
const lemmaValues = GreekView.dataset.getNumeralGroupingLemmas()
// Items below are lemmas
const ancestorValue = ancestorFeatures[ancestorFeatures.length - 1].value
if (ancestorValue === lemmaValues[1]) {
return [
this.featureMap.get(GreekView.datasetConsts.GEND_MASCULINE_FEMININE_NEUTER)
]
} else if ([lemmaValues[2], lemmaValues[3]].includes(ancestorValue)) {
return [
this.featureMap.get(GreekView.datasetConsts.GEND_MASCULINE_FEMININE),
this.featureMap.get(Constants.GEND_NEUTER)
]
} else {
return [
this.featureMap.get(Constants.GEND_FEMININE),
this.featureMap.get(Constants.GEND_MASCULINE),
this.featureMap.get(Constants.GEND_NEUTER)
]
}
}
static genderFilter (featureValues, suffix) {
// If not an array, convert it to array for uniformity
if (!Array.isArray(featureValues)) {
featureValues = [featureValues]
}
for (const value of featureValues) {
if (suffix.features[this.type] === value) {
return true
}
}
return false
}
static getGenderTitle (featureValue) {
if (featureValue === Constants.GEND_MASCULINE) { return 'm.' }
if (featureValue === Constants.GEND_FEMININE) { return 'f.' }
if (featureValue === Constants.GEND_NEUTER) { return 'n.' }
if (featureValue === GreekView.datasetConsts.GEND_MASCULINE_FEMININE) { return 'f./m.' }
if (featureValue === GreekView.datasetConsts.GEND_MASCULINE_FEMININE_NEUTER) { return 'f./m./n.' }
return featureValue
}
}
|
const Packages = [
{
id: 'book',
title: 'The Book',
price: 1000,
desc: `
- The Book
- 14 chapters
- 100s of examples
- Access to GitHub Repo + Source
`
},
{
id: 'bookAndVideos',
title: 'The Book and Videos',
price: 1000,
desc: `
- The book
- Screencasts on
- Building this site
- Building a TODOMVC React app
- And more!
*Note*: May not be available until launch.
`
},
{
id: 'all',
title: 'All the things!',
price: 1000,
desc: `
- The Book + videos
- Bonus Chapters
- React Native Intro
- Building a Chat App
- Building a Static Blog Site
*Note*: May not be available until launch.
`
}
];
export default Packages;
|
var socket = io()
var app = angular.module('alcohol', ['ui.router', 'ui.router.grant', 'ngStorage'])
app.run(['grant', 'authService', function (grant, authService) {
grant.addTest('auth', function () {
console.log(authService.isLoggedIn())
return authService.isLoggedIn()
})
}])
app.config(['$stateProvider', '$urlRouterProvider', '$locationProvider', function ($stateProvider, $urlRouterProvider, $locationProvider) {
$stateProvider
.state('home', {
url: '/',
controller: 'homeController',
templateUrl: 'templates/home.html'
})
.state('about', {
url: '/about',
templateUrl: 'templates/about.html'
})
.state('profile', {
url: '/profile',
controller: 'profileController',
templateUrl: 'templates/profile.html',
resolve: {
auth: function(grant) {
return grant.only({test: 'auth', state: 'nope'});
}
}
})
.state('party', {
url: '/:id',
controller: 'partyController',
templateUrl: 'templates/party.html',
resolve: {
auth: function(grant) {
return grant.only({test: 'auth', state: 'nope'});
}
}
})
.state('nope', {
url: '/nope',
templateUrl: 'templates/nope.html'
})
.state('invalid', {
url: '/404',
templateUrl: 'templates/404.html'
})
$locationProvider.html5Mode(true)
$urlRouterProvider.otherwise('/404')
}])
app.factory('authService', ['$http', '$window', '$localStorage', function ($http, $window, $localStorage) {
var service = {},
user = {},
isLoggedIn = $localStorage.isLoggedIn || false
$http
.get('http://localhost:8080/api/profile')
.then(function (response) {
user.name = response.data.name
user.email = response.data.email
user.id = response.data.facebookId
})
return {
login: function () {
$localStorage.isLoggedIn = true
$window.location.href = 'http://localhost:8080/auth/facebook'
},
getUser: function () {
return user
},
getId: function () {
return user.id
},
isLoggedIn: function () {
return isLoggedIn
},
logout: function () {
$localStorage.isLoggedIn = false
$window.location.href = 'http://localhost:8080/logout'
}
}
}])
app.factory('streamService', ['$http', 'authService', function ($http, authService) {
var partyId
return {
start: function () {
return new Promise(function (resolve, reject) {
$http
.get('/api/start')
.then(function (response) {
partyId = response.data
resolve(response.data)
}, function () {
reject()
})
})
},
join: function (partyId) {
},
getPartyId: function () {
return partyId
}
}
}])
app.controller('homeController', ['$scope', 'authService', function ($scope, authService) {
$scope.pageName = 'Home'
$scope.login = authService.login
}])
app.controller('partyController', ['$scope', 'streamService', function ($scope, streamService) {
$scope.partyId = streamService.getPartyId()
}])
app.controller('profileController', ['$scope', '$state', 'authService', 'streamService', function($scope, $state, authService, streamService) {
$scope.user = authService.getUser()
$scope.logout = authService.logout
$scope.start = function () {
streamService
.start()
.then(function (partyId) {
$state.transitionTo('party', {
id: partyId
})
})
}
$scope.join = streamService.join
}])
|
version https://git-lfs.github.com/spec/v1
oid sha256:0f37b0ed995928892d2a7c5d05dbecd85b0d4d248931074f5f228f0c14bf5909
size 11378
|
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* @name: S15.10.2.15_A1_T23;
* @section: 15.10.2.15;
* @assertion: The internal helper function CharacterRange takes two CharSet parameters A and B and performs the
* following:
* If A does not contain exactly one character or B does not contain exactly one character then throw
* a SyntaxError exception;
* @description: Checking if execution of "/[b-G\d]/.exec("a")" leads to throwing the correct exception;
*/
//CHECK#1
try {
$ERROR('#1.1: /[b-G\\d]/.exec("a") throw SyntaxError. Actual: ' + (/[b-G\d]/.exec("a")));
} catch (e) {
if((e instanceof SyntaxError) !== true){
$ERROR('#1.2: /[b-G\\d]/.exec("a") throw SyntaxError. Actual: ' + (e));
}
}
|
/* jshint -W030 */
'use strict';
describe('Controller: MainMenuController', function () {
// load the controller's module
beforeEach(module('ftiApp.mainMenu'));
var controller;
var menuEntry = {name: 'test', state: 'test.main'};
var mainMenuMock = {
getMenu: function () {
return [menuEntry]
}
};
var $mdSidenavMock = function () {
return {
open: function () {},
close: function () {}
}
}
// Initialize the controller and a mock scope
beforeEach(inject(function ($controller, $rootScope) {
controller = $controller('MainMenuController', {
mainMenu: mainMenuMock,
$mdSidenav: $mdSidenavMock
});
}));
it('object should exist', function () {
Should.exist(controller);
controller.should.be.an.Object;
});
it('should have an items property', function () {
Should.exist(controller.items);
controller.items.should.be.an.Array;
controller.items.should.eql([menuEntry]);
});
});
|
'use strict';
/* lib/encode.js
* Encode WebSocket message frames.
* * */
|
// Avoid `console` errors in browsers that lack a console.
(function() {
var method;
var noop = function () {};
var methods = [
'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error',
'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log',
'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd',
'timeStamp', 'trace', 'warn'
];
var length = methods.length;
var console = (window.console = window.console || {});
while (length--) {
method = methods[length];
// Only stub undefined methods.
if (!console[method]) {
console[method] = noop;
}
}
}());
// Place any jQuery/helper plugins in here.
$(function(){
//Code for menu collapse button
$('#search_btn').click(function(event){
event.preventDefault();
$('#search_bar').submit();
});
//Code for menu collapse button
$('.collapse-button').click(function(event){
event.preventDefault();
$('.nav-bar').toggleClass('show');
});
//slider functions and operations
var slideCount = $('#slider ul li').length; //count the number of slides in the slider
var sliderVisorWidth = $('#slider').width();
var sliderUlWidth = slideCount * sliderVisorWidth; //total sliders list width.
$('#slider ul li').css({ width: sliderVisorWidth});
$('#slider ul').css({ width: sliderUlWidth, marginLeft: - sliderVisorWidth });
$('#slider ul li:last-child').prependTo('#slider ul');
function moveLeft() {
$('#slider ul').animate({
left: + sliderVisorWidth
}, 200, function () {
$('#slider ul li:last-child').prependTo('#slider ul');
$('#slider ul').css('left', '');
});
};
function moveRight() {
$('#slider ul').animate({
left: - sliderVisorWidth
}, 200, function () {
$('#slider ul li:first-child').appendTo('#slider ul');
$('#slider ul').css('left', '');
});
};
$('a.control_prev').click(function(event) {
event.preventDefault();
moveLeft();
});
$('a.control_next').click(function(event) {
event.preventDefault();
moveRight();
});
//click interactions for menu bar submenus
function hideMenus(){
$(".subMenu1").removeClass('show');
$(".subMenu2").removeClass('show');
$(".subMenu3").removeClass('show');
$(".subMenu4").removeClass('show');
$(".subMenu5").removeClass('show');
$(".subMenu6").removeClass('show');
$(".innerMenu1").removeClass('gray');
$(".innerMenu2").removeClass('gray');
$(".innerMenu3").removeClass('gray');
$(".innerMenu4").removeClass('gray');
$(".innerMenu5").removeClass('gray');
$(".innerMenu6").removeClass('gray');
}
//var menu;
//var sub_menu;
function show_menu(menu, sub_menu){
if ($(sub_menu).css('height') == "0px") {
hideMenus();
$(menu).addClass('gray');
$(sub_menu).addClass('show');
} else{
$(sub_menu).removeClass('show');
$(menu).removeClass('gray');
}
}
$('.innerMenu1').click(function(event){
event.preventDefault();
show_menu(".innerMenu1", ".subMenu1");
});
$('.innerMenu2').click(function(event){
event.preventDefault();
show_menu(".innerMenu2", ".subMenu2");
});
$('.innerMenu3').click(function(event){
event.preventDefault();
show_menu(".innerMenu3", ".subMenu3");
});
$('.innerMenu4').click(function(event){
event.preventDefault();
show_menu(".innerMenu4", ".subMenu4");
});
$('.innerMenu5').click(function(event){
event.preventDefault();
show_menu(".innerMenu5", ".subMenu5");
});
$('.innerMenu6').click(function(event){
event.preventDefault();
show_menu(".innerMenu6", ".subMenu6");
});
//slider autoscrolling
$(document).ready(function() {
setInterval(function() {
moveRight()
}, 5000);
$( window ).resize(function() {
sliderVisorWidth = $('#slider').width();
$('#slider ul li').css({ width: sliderVisorWidth});
sliderUlWidth = slideCount * sliderVisorWidth;
$('#slider ul').css({ width: sliderUlWidth, marginLeft: - sliderVisorWidth });
});
});
});
|
(function () {
'use strict';
angular.module('openSnap')
.constant('CONFIG', {
menuItems: [{
state: 'home',
icon: 'home'
},
{
state: 'codes',
icon: 'code'
},
{
state: 'create',
icon: 'create'
},
{
state: 'info',
icon: 'info'
}
],
backendUrl: ''
})
})();
|
define(function (require) {
'use strict';
/**
* Module dependencies
*/
var defineComponent = require('flight/lib/component');
/**
* Module exports
*/
return defineComponent(switcher);
/**
* Module function
*/
function switcher() {
this.defaultAttrs({
onClass: 'btn-primary'
});
this.turnOn = function() {
// 1) add class `this.attr.onClass`
// 2) trigger 'buttonOn' event
};
this.turnOff = function() {
// 3) remove class `this.attr.onClass`
// 4) trigger 'buttonOff' event
};
this.toggle = function() {
// 5) if `this.attr.onClass` is present call `turnOff` otherwise call `turnOn`
}
this.after('initialize', function () {
// 6) listen for 'click' event and call `this.toggle`
});
}
});
|
const other = {
something: 'here'
};
const other$1 = {
somethingElse: 'here'
};
|
var mongoose = require('mongoose');
var u = require('../utils');
var autorizadaSchema = new mongoose.Schema({
nome: String,
cpf: { type: String, unique: true },
celular: String,
dtInicial: Date,
dtFinal: Date,
autorizador: String,
apto: Number,
bloco: String,
contato: String
});
var A = mongoose.model('Autorizada', autorizadaSchema);
[{
nome: 'Mickey',
cpf: '99933366600',
celular: '11 9 9633-3366',
dtInicial: new Date(2013, 11, 1),
dtFinal: new Date(2015, 0, 1),
autorizador: 'Pateta',
apto: 432,
bloco: 'D',
contato: '11 9 9833-3388'
}].forEach(function(f) {
var model = new A();
u.objetoExtends(model, f);
model.save();
});
module.exports = A;
|
'use strict';
// MODULES //
var ctor = require( './ctor.js' );
// VARIABLES //
var CACHE = require( './cache.js' ).CTORS;
// GET CTOR //
/**
* FUNCTION: getCtor( dtype, ndims )
* Returns an ndarray constructor.
*
* @param {String} dtype - underlying ndarray data type
* @param {Number} ndims - view dimensions
* @returns {ndarray} ndarray constructor
*/
function getCtor( dtype, ndims ) {
var ctors,
len,
i;
ctors = CACHE[ dtype ];
len = ctors.length;
// If the constructor has not already been created, use the opportunity to create it, as well as any lower dimensional constructors of the same data type....
for ( i = len+1; i <= ndims; i++ ) {
ctors.push( ctor( dtype, i ) );
}
return ctors[ ndims-1 ];
} // end FUNCTION getCtor()
// EXPORTS //
module.exports = getCtor;
|
import classnames from 'classnames';
import PropTypes from 'prop-types';
import React, { Component } from 'react';
import telephonyStatuses from 'ringcentral-integration/enums/telephonyStatus';
import callDirections from 'ringcentral-integration/enums/callDirections';
import CloseIcon from '../../assets/images/CloseIcon.svg';
import { Button } from '../Button';
import LogNotification from '../LogNotificationV2';
import styles from './styles.scss';
import i18n from './i18n';
export default class NotificationSection extends Component {
componentWillUpdate(nextProps) {
const {
logNotification,
onCloseNotification,
currentNotificationIdentify,
} = nextProps;
if (currentNotificationIdentify) {
const { call = {} } = logNotification;
const { result } = call;
if (result) {
onCloseNotification();
}
}
}
renderLogSection() {
const {
formatPhone,
currentLocale,
logNotification,
showNotiLogButton,
onCloseNotification,
onSaveNotification,
onExpandNotification,
onDiscardNotification,
currentNotificationIdentify,
currentSession,
onReject,
onHangup,
shrinkNotification,
} = this.props;
const { call } = logNotification;
const { result, telephonyStatus } = call;
const status = result || telephonyStatus;
let statusI18n = null;
const isIncomingCall =
status === telephonyStatuses.ringing &&
call.direction === callDirections.inbound;
if (isIncomingCall) {
statusI18n = i18n.getString('ringing', currentLocale);
} else {
statusI18n = i18n.getString('callConnected', currentLocale);
}
return (
<div className={classnames(styles.root)}>
<div className={styles.notificationModal}>
<div className={styles.modalHeader}>
<div className={styles.modalTitle}>{statusI18n}</div>
<div className={styles.modalCloseBtn}>
<Button dataSign="closeButton" onClick={onCloseNotification}>
<CloseIcon />
</Button>
</div>
</div>
<LogNotification
showEndButton
showLogButton={showNotiLogButton}
currentLocale={currentLocale}
formatPhone={formatPhone}
currentLog={logNotification}
isExpand={logNotification.notificationIsExpand}
onSave={onSaveNotification}
onExpand={onExpandNotification}
onDiscard={onDiscardNotification}
onReject={() => onReject(currentNotificationIdentify)}
onHangup={() => onHangup(currentNotificationIdentify)}
currentSession={currentSession}
shrinkNotification={shrinkNotification}
/>
</div>
</div>
);
}
render() {
return this.renderLogSection();
}
}
NotificationSection.propTypes = {
currentLocale: PropTypes.string.isRequired,
formatPhone: PropTypes.func.isRequired,
// - Notification
logNotification: PropTypes.object,
onCloseNotification: PropTypes.func,
onDiscardNotification: PropTypes.func,
onSaveNotification: PropTypes.func,
onExpandNotification: PropTypes.func,
showNotiLogButton: PropTypes.bool,
currentNotificationIdentify: PropTypes.string,
currentSession: PropTypes.object,
onReject: PropTypes.func.isRequired,
onHangup: PropTypes.func.isRequired,
shrinkNotification: PropTypes.func,
};
NotificationSection.defaultProps = {
// Notification
logNotification: undefined,
onCloseNotification: undefined,
onDiscardNotification: undefined,
onSaveNotification: undefined,
onExpandNotification: undefined,
showNotiLogButton: true,
currentNotificationIdentify: '',
currentSession: undefined,
shrinkNotification: undefined,
};
|
import Resolver from 'ember/resolver';
var resolver = Resolver.create();
resolver.namespace = {
modulePrefix: 'map-app'
};
export default resolver;
|
'use strict';
module.exports = function (t, a) {
var foo = 'raz',
bar = 'dwa',
fn = function fn(a, b) {
return this + a + b + foo + bar;
},
result;
result = t(fn, 3);
a(result.call('marko', 'el', 'fe'), 'markoelferazdwa', "Content");
a(result.length, 3, "Length");
a(result.prototype, fn.prototype, "Prototype");
};
//# sourceMappingURL=_define-length-compiled.js.map
|
var tag, tag_text;
var name, name_jp;
var labeltags = document.getElementsByTagName("label");
for (var i = 0; i < labeltags.length; i++) {
tag = labeltags[i];
tag_text = tag.innerText;
for (var j=0; j<skill_replace_list.length; j++) {
name = skill_replace_list[j]["name"];
name_jp = skill_replace_list[j]["name_jp"];
// replace on exact match only
if (tag_text == name_jp) {
tag.innerText = name;
tag.setAttribute("title", name_jp);
matched = true;
break;
}
}
}
|
(function () {
'use strict';
// Uploadfiles controller
angular
.module('uploadfiles')
.controller('UploadfilesController', UploadfilesController);
UploadfilesController.$inject = ['$scope', '$state', '$window', 'Authentication', 'uploadfileResolve'];
function UploadfilesController ($scope, $state, $window, Authentication, uploadfile) {
var vm = this;
vm.authentication = Authentication;
vm.uploadfile = uploadfile;
vm.error = null;
vm.form = {};
vm.remove = remove;
vm.save = save;
// Remove existing Uploadfile
function remove() {
if ($window.confirm('Are you sure you want to delete?')) {
vm.uploadfile.$remove($state.go('uploadfiles.list'));
}
}
// Save Uploadfile
function save(isValid) {
if (!isValid) {
$scope.$broadcast('show-errors-check-validity', 'vm.form.uploadfileForm');
return false;
}
// TODO: move create/update logic to service
if (vm.uploadfile._id) {
vm.uploadfile.$update(successCallback, errorCallback);
} else {
vm.uploadfile.$save(successCallback, errorCallback);
}
function successCallback(res) {
$state.go('uploadfiles.view', {
uploadfileId: res._id
});
}
function errorCallback(res) {
vm.error = res.data.message;
}
}
}
}());
|
'use strict';
const common = require('../common');
const assert = require('assert');
const URLSearchParams = require('url').URLSearchParams;
const { test, assert_false, assert_true } = require('../common/wpt');
/* The following tests are copied from WPT. Modifications to them should be
upstreamed first. Refs:
https://github.com/w3c/web-platform-tests/blob/8791bed/url/urlsearchparams-has.html
License: http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html
*/
/* eslint-disable */
test(function() {
var params = new URLSearchParams('a=b&c=d');
assert_true(params.has('a'));
assert_true(params.has('c'));
assert_false(params.has('e'));
params = new URLSearchParams('a=b&c=d&a=e');
assert_true(params.has('a'));
params = new URLSearchParams('=b&c=d');
assert_true(params.has(''));
params = new URLSearchParams('null=a');
assert_true(params.has(null));
}, 'Has basics');
test(function() {
var params = new URLSearchParams('a=b&c=d&&');
params.append('first', 1);
params.append('first', 2);
assert_true(params.has('a'), 'Search params object has name "a"');
assert_true(params.has('c'), 'Search params object has name "c"');
assert_true(params.has('first'), 'Search params object has name "first"');
assert_false(params.has('d'), 'Search params object has no name "d"');
params.delete('first');
assert_false(params.has('first'), 'Search params object has no name "first"');
}, 'has() following delete()');
/* eslint-enable */
// Tests below are not from WPT.
{
const params = new URLSearchParams();
common.expectsError(() => {
params.has.call(undefined);
}, {
code: 'ERR_INVALID_THIS',
type: TypeError,
message: 'Value of "this" must be of type URLSearchParams'
});
common.expectsError(() => {
params.has();
}, {
code: 'ERR_MISSING_ARGS',
type: TypeError,
message: 'The "name" argument must be specified'
});
const obj = {
toString() { throw new Error('toString'); },
valueOf() { throw new Error('valueOf'); }
};
const sym = Symbol();
assert.throws(() => params.has(obj), /^Error: toString$/);
assert.throws(() => params.has(sym),
/^TypeError: Cannot convert a Symbol value to a string$/);
}
|
//-----------------------------------------------------------------------------
/**
* The sprite which covers the entire game screen.
*
* @class ScreenSprite
* @constructor
*/
function ScreenSprite() {
this.initialize.apply(this, arguments);
}
ScreenSprite.prototype = Object.create(PIXI.Container.prototype);
ScreenSprite.prototype.constructor = ScreenSprite;
ScreenSprite.prototype.initialize = function () {
PIXI.Container.call(this);
this._graphics = new PIXI.Graphics();
this.addChild(this._graphics);
this.opacity = 0;
this._red = -1;
this._green = -1;
this._blue = -1;
this._colorText = '';
this.setBlack();
};
/**
* The opacity of the sprite (0 to 255).
*
* @property opacity
* @type Number
*/
Object.defineProperty(ScreenSprite.prototype, 'opacity', {
get: function () {
return this.alpha * 255;
},
set: function (value) {
this.alpha = value.clamp(0, 255) / 255;
},
configurable: true
});
ScreenSprite.YEPWarned = false;
ScreenSprite.warnYep = function () {
if (!ScreenSprite.YEPWarned) {
console.log("Deprecation warning. Please update YEP_CoreEngine. ScreenSprite is not a sprite, it has graphics inside.");
ScreenSprite.YEPWarned = true;
}
};
Object.defineProperty(ScreenSprite.prototype, 'anchor', {
get: function () {
ScreenSprite.warnYep();
this.scale.x = 1;
this.scale.y = 1;
return {x: 0, y: 0};
},
set: function (value) {
this.alpha = value.clamp(0, 255) / 255;
},
configurable: true
});
Object.defineProperty(ScreenSprite.prototype, 'blendMode', {
get: function () {
return this._graphics.blendMode;
},
set: function (value) {
this._graphics.blendMode = value;
},
configurable: true
});
/**
* Sets black to the color of the screen sprite.
*
* @method setBlack
*/
ScreenSprite.prototype.setBlack = function () {
this.setColor(0, 0, 0);
};
/**
* Sets white to the color of the screen sprite.
*
* @method setWhite
*/
ScreenSprite.prototype.setWhite = function () {
this.setColor(255, 255, 255);
};
/**
* Sets the color of the screen sprite by values.
*
* @method setColor
* @param {Number} r The red value in the range (0, 255)
* @param {Number} g The green value in the range (0, 255)
* @param {Number} b The blue value in the range (0, 255)
*/
ScreenSprite.prototype.setColor = function (r, g, b) {
if (this._red !== r || this._green !== g || this._blue !== b) {
r = Math.round(r || 0).clamp(0, 255);
g = Math.round(g || 0).clamp(0, 255);
b = Math.round(b || 0).clamp(0, 255);
this._red = r;
this._green = g;
this._blue = b;
this._colorText = Utils.rgbToCssColor(r, g, b);
var graphics = this._graphics;
graphics.clear();
var intColor = (r << 16) | (g << 8) | b;
graphics.beginFill(intColor, 1);
//whole screen with zoom. BWAHAHAHAHA
graphics.drawRect(-Graphics.width * 5, -Graphics.height * 5, Graphics.width * 10, Graphics.height * 10);
}
};
|
var sum_pairs = function (ints, s) {
// your code here
};
module.exports = sum_pairs;
|
window.Rendxx = window.Rendxx || {};
window.Rendxx.Game = window.Rendxx.Game || {};
window.Rendxx.Game.Ghost = window.Rendxx.Game.Ghost || {};
window.Rendxx.Game.Ghost.Renderer2D = window.Rendxx.Game.Ghost.Renderer2D || {};
(function (RENDERER) {
var Data = RENDERER.Data;
var GridSize = Data.grid.size;
var _Data = {
size: 3,
tileSize: 128,
tileDispDuration: 50,
Name: {
'Blood': 0,
'Electric': 1
}
};
var Effort = function (entity) {
// data ----------------------------------------------------------
var that = this,
tex = {},
_scene = entity.env.scene['effort'];
// callback ------------------------------------------------------
// public method -------------------------------------------------
this.update = function (newEffort) {
if (newEffort == null || newEffort.length === 0) return;
for (var i = 0, l = newEffort.length; i < l;i++){
createEffort(newEffort[i]);
}
};
this.render = function (delta) {
};
// private method -------------------------------------------------
var createEffort = function (effort) {
if (effort==null) return;
var effortName = effort[0];
var x = effort[1];
var y = effort[2];
if (!tex.hasOwnProperty(effortName)) return;
var item = new PIXI.extras.MovieClip(tex[effortName]);
item.loop = false;
item.anchor.set(0.5, 0.5);
item.animationSpeed = 0.5;
item.position.set(x * GridSize, y * GridSize);
item.scale.set(_Data.size * GridSize / _Data.tileSize, _Data.size * GridSize / _Data.tileSize);
item.onComplete = function () { _scene.removeChild(this) };
_scene.addChild(item);
item.play();
};
// setup -----------------------------------------------
var _setupTex = function () {
tex = {};
var path = entity.root + Data.files.path[Data.categoryName.sprite];
// texture loader -------------------------------------------------------------------------------------------
PIXI.loader
.add(path + 'effort.blood.json')
.add(path + 'effort.electric.json')
.load(function (loader, resources) {
// blood
var frames = [];
var name = path + 'effort.blood.json';
var _f = resources[name].data.frames;
var i = 0;
while (true) {
var val = i < 10 ? '0' + i : i;
if (!_f.hasOwnProperty('animation00' + val)) break;
frames.push(loader.resources[name].textures['animation00' + val]);
i++;
}
tex[_Data.Name.Blood] = frames;
// electric
var frames = [];
var name = path + 'effort.electric.json';
var _f = resources[name].data.frames;
var i = 0;
while (true) {
var val = i < 10 ? '0' + i : i;
if (!_f.hasOwnProperty('animation00' + val)) break;
frames.push(loader.resources[name].textures['animation00' + val]);
i++;
}
tex[_Data.Name.Electric] = frames;
});
};
var _init = function () {
_setupTex();
};
_init();
};
RENDERER.Effort = Effort;
RENDERER.Effort.Data = _Data;
})(window.Rendxx.Game.Ghost.Renderer2D);
|
'use strict';
angular.module('applicant-test').controller('ApplicantTestController', ['$scope', '$stateParams', '$location', 'Authentication', 'Questions', '$http',
function($scope, $stateParams, $location, Authentication, Questions, $http ) {
$scope.authentication =Authentication;
$scope.find = function(){
var url = '/test/';
$http.get(url).success(function(response) {
$scope.questions = response;
console.log('Questions init');
console.log($scope.questions);
});
};
// $scope.findOne = function() {
// var url = '/test/' + $stateParams.testId;
// console.log('Getting stateParams');
// console.log($stateParams);
// $http.get(url).success(function(response) {
// $scope.questions = response;
// console.log('Questions init');
// console.log($scope.questions);
// });
// // $scope.test = Questions.get({
// // testId: $stateParams.testId
// // });
// };
}]);
|
import SocialShare from './SocialShare'
export default SocialShare
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.