_id
stringlengths 2
6
| title
stringlengths 0
58
| partition
stringclasses 3
values | text
stringlengths 52
373k
| language
stringclasses 1
value | meta_information
dict |
---|---|---|---|---|---|
q61200
|
validation
|
function() {
this.addEvents(
/**
* @event change
* Fires when the value of a field is changed via the {@link #setValue} method.
* @param {Ext.form.field.Field} this
* @param {Object} newValue The new value
* @param {Object} oldValue The original value
*/
'change',
/**
* @event validitychange
* Fires when a change in the field's validity is detected.
* @param {Ext.form.field.Field} this
* @param {Boolean} isValid Whether or not the field is now valid
*/
'validitychange',
/**
* @event dirtychange
* Fires when a change in the field's {@link #isDirty} state is detected.
* @param {Ext.form.field.Field} this
* @param {Boolean} isDirty Whether or not the field is now dirty
*/
'dirtychange'
);
this.initValue();
//<debug>
var badNames = [
'tagName',
'nodeName',
'children',
'childNodes'
], name = this.name;
if (name && Ext.Array.indexOf(badNames, name) > -1) {
Ext.log.warn(
['It is recommended to not use "', name, '" as a field name, because it ',
'can cause naming collisions during form submission.'].join('')
);
}
//</debug>
}
|
javascript
|
{
"resource": ""
}
|
|
q61201
|
munge
|
validation
|
function munge(str, options) {
var aMunged = [];
var aChars, i;
// initialize default options
options = options || {};
if (options.encoding) {
// validate encoding option
if (encoder.TYPES.indexOf(options.encoding) < 0)
throw Error('Invalid encoding option given: ' + options.encoding);
} else
options.encoding = encoder.DEFAULT;
if (str) {
aChars = str.split('');
for (i in aChars)
aMunged[i] = '&#' + encoder[options.encoding](aChars[i]) + ';';
}
return aMunged.join('');
}
|
javascript
|
{
"resource": ""
}
|
q61202
|
validation
|
function() {
var headerFragment = this._parseHeader(), data = {}, nodes, elm, matches, editor = this.editor;
function getAttr(elm, name) {
var value = elm.attr(name);
return value || '';
};
// Default some values
data.fontface = editor.getParam("fullpage_default_fontface", "");
data.fontsize = editor.getParam("fullpage_default_fontsize", "");
// Parse XML PI
elm = headerFragment.firstChild;
if (elm.type == 7) {
data.xml_pi = true;
matches = /encoding="([^"]+)"/.exec(elm.value);
if (matches)
data.docencoding = matches[1];
}
// Parse doctype
elm = headerFragment.getAll('#doctype')[0];
if (elm)
data.doctype = '<!DOCTYPE' + elm.value + ">";
// Parse title element
elm = headerFragment.getAll('title')[0];
if (elm && elm.firstChild) {
data.metatitle = elm.firstChild.value;
}
// Parse meta elements
each(headerFragment.getAll('meta'), function(meta) {
var name = meta.attr('name'), httpEquiv = meta.attr('http-equiv'), matches;
if (name)
data['meta' + name.toLowerCase()] = meta.attr('content');
else if (httpEquiv == "Content-Type") {
matches = /charset\s*=\s*(.*)\s*/gi.exec(meta.attr('content'));
if (matches)
data.docencoding = matches[1];
}
});
// Parse html attribs
elm = headerFragment.getAll('html')[0];
if (elm)
data.langcode = getAttr(elm, 'lang') || getAttr(elm, 'xml:lang');
// Parse stylesheet
elm = headerFragment.getAll('link')[0];
if (elm && elm.attr('rel') == 'stylesheet')
data.stylesheet = elm.attr('href');
// Parse body parts
elm = headerFragment.getAll('body')[0];
if (elm) {
data.langdir = getAttr(elm, 'dir');
data.style = getAttr(elm, 'style');
data.visited_color = getAttr(elm, 'vlink');
data.link_color = getAttr(elm, 'link');
data.active_color = getAttr(elm, 'alink');
}
return data;
}
|
javascript
|
{
"resource": ""
}
|
|
q61203
|
validation
|
function() {
var me = this,
menuTrigger = me.menuTrigger,
names = me.layout.names;
// The rendering flag is set when getRenderTree is called which we do when returning markup string for the owning layout's "suffix"
if (menuTrigger.rendering) {
menuTrigger.finishRender();
me.triggerTotalWidth = menuTrigger[names.getWidth]() + menuTrigger.el.getMargin(names.parallelMargins);
}
}
|
javascript
|
{
"resource": ""
}
|
|
q61204
|
validation
|
function(width, height) {
var me = this;
me.target.setSize(width, height);
me.fireEvent('resize', me, width, height, null);
}
|
javascript
|
{
"resource": ""
}
|
|
q61205
|
validation
|
function(date, format) {
var formatFunctions = utilDate.formatFunctions;
if (!Ext.isDate(date)) {
return '';
}
if (formatFunctions[format] == null) {
utilDate.createFormat(format);
}
return formatFunctions[format].call(date) + '';
}
|
javascript
|
{
"resource": ""
}
|
|
q61206
|
validation
|
function(date) {
var num = 0,
d = Ext.Date.clone(date),
m = date.getMonth(),
i;
for (i = 0, d.setDate(1), d.setMonth(0); i < m; d.setMonth(++i)) {
num += utilDate.getDaysInMonth(d);
}
return num + date.getDate() - 1;
}
|
javascript
|
{
"resource": ""
}
|
|
q61207
|
validation
|
function() {
var nativeDate = window.Date,
p,
statics = ['useStrict', 'formatCodeToRegex', 'parseFunctions', 'parseRegexes', 'formatFunctions', 'y2kYear', 'MILLI', 'SECOND', 'MINUTE', 'HOUR', 'DAY', 'MONTH', 'YEAR', 'defaults', 'dayNames', 'monthNames', 'monthNumbers', 'getShortMonthName', 'getShortDayName', 'getMonthNumber', 'formatCodes', 'isValid', 'parseDate', 'getFormatCode', 'createFormat', 'createParser', 'parseCodes'],
proto = ['dateFormat', 'format', 'getTimezone', 'getGMTOffset', 'getDayOfYear', 'getWeekOfYear', 'isLeapYear', 'getFirstDayOfMonth', 'getLastDayOfMonth', 'getDaysInMonth', 'getSuffix', 'clone', 'isDST', 'clearTime', 'add', 'between'],
sLen = statics.length,
pLen = proto.length,
stat, prot, s;
//Append statics
for (s = 0; s < sLen; s++) {
stat = statics[s];
nativeDate[stat] = utilDate[stat];
}
//Append to prototype
for (p = 0; p < pLen; p++) {
prot = proto[p];
nativeDate.prototype[prot] = function() {
var args = Array.prototype.slice.call(arguments);
args.unshift(this);
return utilDate[prot].apply(utilDate, args);
};
}
}
|
javascript
|
{
"resource": ""
}
|
|
q61208
|
readSync
|
validation
|
function readSync() {
const TLS_CERT = process.env.TLS_CERT;
const TLS_KEY = process.env.TLS_KEY;
const TLS_CA = process.env.TLS_CA;
const tls_cert = readOpt("--tls-cert");
const tls_key = readOpt("--tls-key");
const tls_ca = readOpt("--tls-ca");
const result = {
secureOptions: constants.SSL_OP_NO_TLSv1
};
if (tls_cert) {
if (tls_key) {
result.cert = fs.readFileSync(tls_cert);
result.key = fs.readFileSync(tls_key);
if (tls_ca) {
result.ca = fs.readFileSync(tls_ca);
}
} else {
result.pfx = fs.readFileSync(tls_cert);
}
} else if (TLS_CERT) {
if (TLS_KEY) {
result.cert = fs.readFileSync(TLS_CERT);
result.key = fs.readFileSync(TLS_KEY);
if (TLS_CA) {
result.ca = fs.readFileSync(TLS_CA);
}
} else {
result.pfx = fs.readFileSync(TLS_CERT);
}
}
return result;
}
|
javascript
|
{
"resource": ""
}
|
q61209
|
read
|
validation
|
function read() {
const TLS_CERT = process.env.TLS_CERT;
const TLS_KEY = process.env.TLS_KEY;
const TLS_CA = process.env.TLS_CA;
const tls_cert = readOpt("--tls-cert");
const tls_key = readOpt("--tls-key");
const tls_ca = readOpt("--tls-ca");
const result = {};
if (tls_cert) {
if (tls_key) {
result.cert = readFile(tls_cert);
result.key = readFile(tls_key);
if (tls_ca) {
result.ca = readFile(tls_ca);
}
} else {
result.pfx = readFile(tls_cert);
}
} else if (TLS_CERT) {
if (TLS_KEY) {
result.cert = readFile(TLS_CERT);
result.key = readFile(TLS_KEY);
if (TLS_CA) {
result.ca = readFile(TLS_CA);
}
} else {
result.pfx = readFile(TLS_CERT);
}
}
return Promise.all(keys(result).map(key => result[key].then(data => {
return result[key] = data;
}))).then(() => result);
}
|
javascript
|
{
"resource": ""
}
|
q61210
|
readOpt
|
validation
|
function readOpt(option) {
const prefix = `${option}=`;
for (let i = 0, len = process.argv.length, arg; i < len; i++) {
arg = process.argv[i];
if (arg === option) {
return process.argv[i+1];
} else if (arg.indexOf(prefix) === 0) {
return arg.substr(prefix.length);
}
}
}
|
javascript
|
{
"resource": ""
}
|
q61211
|
validation
|
function(target) {
var me = this,
anims = [],
timeline = me.timeline,
ln = timeline.length,
anim, easing, damper, attrs, i;
if (me.fireEvent('beforeanimate', me) !== false) {
for (i = 0; i < ln; i++) {
anim = timeline[i];
attrs = anim.attrs;
easing = attrs.easing || me.easing;
damper = attrs.damper || me.damper;
delete attrs.easing;
delete attrs.damper;
anim = new Ext.fx.Anim({
target: target,
easing: easing,
damper: damper,
duration: anim.duration,
paused: true,
to: attrs
});
anims.push(anim);
}
me.animations = anims;
me.target = anim.target;
for (i = 0; i < ln - 1; i++) {
anim = anims[i];
anim.nextAnim = anims[i + 1];
anim.on('afteranimate', function() {
this.nextAnim.paused = false;
});
anim.on('afteranimate', function() {
this.fireEvent('keyframe', this, ++this.keyframeStep);
}, me);
}
anims[ln - 1].on('afteranimate', function() {
this.lastFrame();
}, me);
}
}
|
javascript
|
{
"resource": ""
}
|
|
q61212
|
validation
|
function() {
var me = this,
chart = me.chart,
store = chart.getChartStore(),
data = store.data.items,
count = me.getRecordCount(),
i, ln, record,
min, max,
xField = me.xField,
xValue;
if (count > 0) {
min = Infinity;
max = -min;
for (i = 0, ln = data.length; i < ln; i++) {
record = data[i];
xValue = record.get(xField);
if (xValue > max) {
max = xValue;
}
if (xValue < min) {
min = xValue;
}
}
// If we made no progress, treat it like a category axis
if (min == Infinity) {
min = 0;
}
if (max == -Infinity) {
max = count - 1;
}
} else {
min = max = 0;
}
return [min, max];
}
|
javascript
|
{
"resource": ""
}
|
|
q61213
|
validation
|
function(title) {
var me = this,
titleCmp = me.titleCmp;
me.title = title;
if (titleCmp.rendered) {
titleCmp.textEl.update(me.title || ' ');
titleCmp.updateLayout();
} else {
me.titleCmp.on({
render: function() {
me.setTitle(title);
},
single: true
});
}
}
|
javascript
|
{
"resource": ""
}
|
|
q61214
|
validation
|
function(cls) {
var me = this,
isEmpty = !cls || !cls.length,
iconCmp = me.iconCmp;
me.iconCls = cls;
if (!me.iconCmp && !isEmpty) {
me.initIconCmp();
me.insert(0, me.iconCmp);
} else if (iconCmp) {
if (isEmpty) {
me.iconCmp.destroy();
delete me.iconCmp;
} else {
iconCmp.removeCls(iconCmp.iconCls);
iconCmp.addCls(cls);
iconCmp.iconCls = cls;
}
}
}
|
javascript
|
{
"resource": ""
}
|
|
q61215
|
validation
|
function(icon) {
var me = this,
isEmpty = !icon || !icon.length,
iconCmp = me.iconCmp;
me.icon = icon;
if (!me.iconCmp && !isEmpty) {
me.initIconCmp();
me.insert(0, me.iconCmp);
} else if (iconCmp) {
if (isEmpty) {
me.iconCmp.destroy();
delete me.iconCmp;
} else {
iconCmp.setSrc(me.icon);
}
}
}
|
javascript
|
{
"resource": ""
}
|
|
q61216
|
validation
|
function(glyph) {
var me = this,
iconCmp = me.iconCmp;
if (!me.iconCmp) {
me.initIconCmp();
me.insert(0, me.iconCmp);
} else if (iconCmp) {
if (glyph) {
me.iconCmp.setGlyph(glyph);
} else {
me.iconCmp.destroy();
delete me.iconCmp;
}
}
}
|
javascript
|
{
"resource": ""
}
|
|
q61217
|
validation
|
function (item, checked) {
var value = [];
this.items.each(function(item){
if (item.checked) {
value.push(item.value);
}
});
this.selected = value;
this.fireEvent('checkchange', item, checked);
}
|
javascript
|
{
"resource": ""
}
|
|
q61218
|
isType
|
validation
|
function isType (type, val) {
return (type == Any)
|| (type == Object && is.object(val))
|| (type == Function && is.function(val))
|| (type == String && is.string(val))
|| (type == Error && is.error(val))
|| (type == Number && is.number(val))
|| (type == Array && is.array(val))
|| (type == Boolean && is.boolean(val))
|| (type == RegExp && is.regExp(val))
|| (type == Date && is.date(val))
|| (type == null && is.nullOrUndefined(val))
|| (val instanceof type)
}
|
javascript
|
{
"resource": ""
}
|
q61219
|
findMorph
|
validation
|
function findMorph (args, morphs) {
for (var i = 0; i < morphs.length; i++) {
var sig = morphs[i].sig
if (args.length == sig.length) {
var matched = true
for (var j = 0; j < sig.length; j++) {
if (!isType(sig[j], args[j])) {
matched = false
break
}
}
if (matched) {
return morphs[i]
}
}
}
throw new Error('No matching function signature')
}
|
javascript
|
{
"resource": ""
}
|
q61220
|
generateAssignStateOutOfFinally
|
validation
|
function generateAssignStateOutOfFinally(enclosingFinally, destination) {
var finallyState = enclosingFinally.finallyState;
// $ctx.state = finallyState;
// $fallThrough = destination;
return createStatementList(
createAssignStateStatement(finallyState),
parseStatement `$ctx.finallyFallThrough = ${destination}`);
}
|
javascript
|
{
"resource": ""
}
|
q61221
|
directory_path
|
validation
|
function directory_path () {
pending++
readdir(entry, (err, children) => {
if (err) return done(err)
// Push children into pipeline, order is not important
for (var i = children.length; i--;) {
if (path !== null && base !== null) {
files.push({ base, path: join(path, children[i]) })
} else if (path !== null) {
files.push({ base: null, path: join(path, children[i]) })
} else {
files.push({ base, path: children[i] })
}
}
// Filter directory out of pipeline after adding children files
pending--
done(null, null)
})
}
|
javascript
|
{
"resource": ""
}
|
q61222
|
file_path
|
validation
|
function file_path () {
pending++
for (var i = globs.length; i--;) {
const glob = globs[i]
const glob_full = glob.glob
const glob_base = glob.base
const glob_negated = glob.negated
const glob_pattern = glob.pattern
if (entry === glob_full || mm.isMatch(entry, glob_pattern, ALLOW)) {
return done(null, file)
}
}
// Did not match globs
pending--
done(null, null)
}
|
javascript
|
{
"resource": ""
}
|
q61223
|
extend
|
validation
|
function extend(a, b, noClone) { // A extends B
a = a || {};
if(typeof a !== 'object' || typeof a.length !== 'undefined'){
return b;
}
if(typeof b !== 'object'){
return b;
}
if(!noClone){
a = clone(a);
}
var bk = Object.keys(b);
for(var i = 0, c = bk.length; i < c; i++){
var key = bk[i];
if (!a.hasOwnProperty(key) || !(typeof b[key] === 'object' && typeof b[key].length === 'undefined') && typeof b[key] !== 'function') { // Simple types
a[key] = b[key];
} else { // Complex types
a[key] = extend(a[key], b[key]);
}
}
return a;
}
|
javascript
|
{
"resource": ""
}
|
q61224
|
clone
|
validation
|
function clone(o){
var c = {};
var h = Object.keys(o);
for(var i = 0, co = h.length; i < co; i++){
c[h[i]] = o[h[i]];
}
return c;
}
|
javascript
|
{
"resource": ""
}
|
q61225
|
fixPath
|
validation
|
function fixPath(string){
if(string.length < 1){
return string;
}
if(string.charAt(string.length-1) !== path.sep){
string += path.sep;
}
return string;
}
|
javascript
|
{
"resource": ""
}
|
q61226
|
stringify
|
validation
|
function stringify(string, params, noError) {
var arr = string.split(':');
var param;
for(var i = 0, c = arr.length; i < c; i++) {
param = arr[i];
if(i % 2){
if(!(typeof params[param] === 'string' || typeof params[param] === 'number')){
if(!noError){
throw new Error('Variable ' + param + ' not defined');
}
} else {
arr[i] = params[param];
}
}
}
return arr.join('');
}
|
javascript
|
{
"resource": ""
}
|
q61227
|
cleanCallback
|
validation
|
function cleanCallback(errorCallback, callback){
var self = this || {};
if(!callback){
return function(err){ // remove other variables
if(err && self.log){
self.log('error',err);
}
errorCallback(err);
}
}
return function(err){
if(err){
if(self.log){
self.log('error',err);
}
errorCallback(err);
return;
}
callback.apply(callback, Array.prototype.slice.call(arguments,1));
}
}
|
javascript
|
{
"resource": ""
}
|
q61228
|
iterateElements
|
validation
|
function iterateElements(array) {
var index = 0;
var rv = {};
rv[Symbol.iterator] = {
next() {
if (index < array.length)
return {value: array[index++], done: false};
return {done: true};
}
}
}
|
javascript
|
{
"resource": ""
}
|
q61229
|
validation
|
function(fo,clear)
{
this.filters = fo;
if(this.filters && this.filterFields)
{
//Delete filters that doesn't match with any field
for(var fn in this.filters)
{
if(!this.filterFields[fn])
delete this.filters[fn];
}
for(var fn in this.filterFields)
{
var field = this.filterFields[fn];
var value = this.filters[field.filterName];
if(Ext.isEmpty(value))
{
if(clear)
this.setFieldValue(field, '');
}
else
this.setFieldValue(field, value);
}
}
}
|
javascript
|
{
"resource": ""
}
|
|
q61230
|
GedcomXDate
|
validation
|
function GedcomXDate(str) {
if(str == '') {
throw new Error('Invalid Date');
}
if(str.charAt(0) == 'R') {
return new Recurring(str);
} else if(/\//.test(str)) {
return new Range(str);
} else if(str.charAt(0) == 'A') {
return new Approximate(str);
} else {
return new Simple(str);
}
}
|
javascript
|
{
"resource": ""
}
|
q61231
|
validation
|
function(toClose) {
var me = this;
if (toClose.active && me.items.getCount() > 1) {
return (me.previousTab && me.previousTab !== toClose && !me.previousTab.disabled) ? me.previousTab : (toClose.next('tab[disabled=false]') || toClose.prev('tab[disabled=false]'));
}
}
|
javascript
|
{
"resource": ""
}
|
|
q61232
|
validation
|
function (autoRender, config) {
if (!tip) {
if (!Ext.isReady) {
Ext.onReady(function(){
Ext.tip.QuickTipManager.init(autoRender, config);
});
return;
}
var tipConfig = Ext.apply({ disabled: disabled, id: 'ext-quicktips-tip' }, config),
className = tipConfig.className,
xtype = tipConfig.xtype;
if (className) {
delete tipConfig.className;
} else if (xtype) {
className = 'widget.' + xtype;
delete tipConfig.xtype;
}
if (autoRender !== false) {
tipConfig.renderTo = document.body;
//<debug>
if (tipConfig.renderTo.tagName.toUpperCase() != 'BODY') { // e.g., == 'FRAMESET'
Ext.Error.raise({
sourceClass: 'Ext.tip.QuickTipManager',
sourceMethod: 'init',
msg: 'Cannot init QuickTipManager: no document body'
});
}
//</debug>
}
tip = Ext.create(className || 'Ext.tip.QuickTip', tipConfig);
// private.
// Need a globally accessble way of testing whether QuickTipsManager is both loaded AND initialized.
Ext.quickTipsActive = true;
}
}
|
javascript
|
{
"resource": ""
}
|
|
q61233
|
validation
|
function(el, id) {
var me = this,
childEls = me.getChildEls(),
baseId, childName, i, selector, value;
baseId = (id || me.id) + '-';
for (i = childEls.length; i--; ) {
childName = childEls[i];
if (typeof childName == 'string') {
// We don't use Ext.get because that is 3x (or more) slower on IE6-8. Since
// we know the el's are children of our el we use getById instead:
value = el.getById(baseId + childName);
} else {
if ((selector = childName.select)) {
value = Ext.select(selector, true, el.dom); // a CompositeElement
} else if ((selector = childName.selectNode)) {
value = Ext.get(Ext.DomQuery.selectNode(selector, el.dom));
} else {
// see above re:getById...
value = el.getById(childName.id || (baseId + childName.itemId));
}
childName = childName.name;
}
me[childName] = value;
}
}
|
javascript
|
{
"resource": ""
}
|
|
q61234
|
validation
|
function (testFn) {
var me = this,
old = me.getChildEls(),
keepers = (me.childEls = []),
n, i, cel;
for (i = 0, n = old.length; i < n; ++i) {
cel = old[i];
if (!testFn(cel)) {
keepers.push(cel);
}
}
}
|
javascript
|
{
"resource": ""
}
|
|
q61235
|
multiFieldSort
|
validation
|
function multiFieldSort(array, sortBy) {
array.sort((a, b) => {
for (let field of sortBy) {
let reverse = field[0] === '-';
if (reverse) {
field = field.slice(1);
}
let valueA = getPath(a, field);
let valueB = getPath(b, field);
if (reverse) {
if (valueA > valueB) return -1;
else if (valueA < valueB) return 1;
} else {
if (valueA > valueB) return 1;
else if (valueA < valueB) return -1;
}
}
return 0;
});
return array;
}
|
javascript
|
{
"resource": ""
}
|
q61236
|
protect_split
|
validation
|
function protect_split(separator, str) {
var sep = '######';
var string = false;
var nb_brackets = 0;
var new_str = "";
for (var i = 0 ; i < str.length ; i++) {
if (!string && /['"`]/.test(str[i])) string = str[i];
else if (string && str[i] == string) string = false;
else if (!string && str[i] == '(') nb_brackets ++;
else if (!string && str[i] == ')') nb_brackets --;
if (str[i] == separator && (nb_brackets > 0 || string)) new_str += sep;
else new_str += str[i];
}
str = new_str;
str = str.split(separator);
str = str.map(function (item) {
return trim(item.replace(new RegExp(sep, 'g'), separator));
});
return str;
}
|
javascript
|
{
"resource": ""
}
|
q61237
|
validation
|
function () {
if (/\w/.test(this.currentChar)) return this.readWord();
if (/["'`]/.test(this.currentChar)) return this.readString();
if (/[()]/.test(this.currentChar)) return this.readGroupSymbol();
if (/[!=<>]/.test(this.currentChar)) return this.readOperator();
if (this.currentChar === "") return {type: 'eot', value: ''};
else {
this.readNextChar();
return {type: 'empty', value: ''};
}
}
|
javascript
|
{
"resource": ""
}
|
|
q61238
|
validation
|
function () {
var astNode = "";
// If this is a word/string, return its value
if (this.currentToken.type == 'word' || this.currentToken.type == 'string') {
astNode = this.currentToken.value;
this.readNextToken();
}
// If this is a group, skip brackets and parse the inside
else if (this.currentToken.type == 'group') {
this.readNextToken();
astNode = this.parseExpressionsRecursively();
this.readNextToken();
}
return astNode;
}
|
javascript
|
{
"resource": ""
}
|
|
q61239
|
diffText
|
validation
|
function diffText(a,b){
var changes = []
var text = a
while(text !== b){
var c = partiallyDiffText(text,b)
if(c.type === 'add'){
text = text.substr(0,c.index)+c.value+text.substr(c.index)
}else{
text = text.substr(0,c.index)+text.substr(c.index+c.many)
}
changes.push(c)
}
return changes
}
|
javascript
|
{
"resource": ""
}
|
q61240
|
validation
|
function(store, initial){
var me = this;
me.mixins.bindable.bindStore.apply(me, arguments);
if(me.store && !initial) {
me.refresh();
}
}
|
javascript
|
{
"resource": ""
}
|
|
q61241
|
validation
|
function(suppressEvent) {
var me = this,
selections = me.store.getRange(),
i = 0,
len = selections.length,
start = me.getSelection().length;
me.bulkChange = true;
for (; i < len; i++) {
me.doSelect(selections[i], true, suppressEvent);
}
delete me.bulkChange;
// fire selection change only if the number of selections differs
me.maybeFireSelectionChange(me.getSelection().length !== start);
}
|
javascript
|
{
"resource": ""
}
|
|
q61242
|
validation
|
function(record, e, keepExisting) {
var me = this,
isSelected = me.isSelected(record);
switch (me.selectionMode) {
case 'MULTI':
if (e.shiftKey && me.selectionStart) {
me.selectRange(me.selectionStart, record, e.ctrlKey);
} else if (e.ctrlKey && isSelected) {
me.doDeselect(record, false);
} else if (e.ctrlKey) {
me.doSelect(record, true, false);
} else if (isSelected && !e.shiftKey && !e.ctrlKey && me.selected.getCount() > 1) {
me.doSelect(record, keepExisting, false);
} else if (!isSelected) {
me.doSelect(record, false);
}
break;
case 'SIMPLE':
if (isSelected) {
me.doDeselect(record);
} else {
me.doSelect(record, true);
}
break;
case 'SINGLE':
// if allowDeselect is on and this record isSelected, deselect it
if (me.allowDeselect && isSelected) {
me.doDeselect(record);
// select the record and do NOT maintain existing selections
} else {
me.doSelect(record, false);
}
break;
}
// selectionStart is a start point for shift/mousedown to create a range from.
// If the mousedowned record was not already selected, then it becomes the
// start of any range created from now on.
// If we drop to no records selected, then there is no range start any more.
if (!e.shiftKey) {
if (me.isSelected(record)) {
me.selectionStart = record;
} else {
me.selectionStart = null;
}
}
}
|
javascript
|
{
"resource": ""
}
|
|
q61243
|
validation
|
function(e, record) {
var me = this,
recIdx,
fromIdx,
isSelected = me.isSelected(record),
from = (me.selectionStart && me.isSelected(me.lastFocused)) ? me.selectionStart : (me.selectionStart = me.lastFocused),
key = e.getCharCode(),
isSpace = key === e.SPACE,
direction = key === e.UP || key === e.PAGE_UP ? 'up' : (key === e.DOWN || key === e.DOWN ? 'down' : null);
switch (me.selectionMode) {
case 'MULTI':
if (isSpace) {
// SHIFT+SPACE, select range
if (e.shiftKey) {
me.selectRange(from, record, e.ctrlKey);
} else {
// SPACE pessed on a selected item: deselect but leave it focused.
// e.ctrlKey means "keep existing"
if (isSelected) {
me.doDeselect(record, e.ctrlKey);
// This record is already focused. To get the focus effect put on it (as opposed to selected)
// we have to focus null first.
me.setLastFocused(null);
me.setLastFocused(record);
}
// SPACE on an unselected item: select it
else {
me.doSelect(record, e.ctrlKey);
}
}
}
// SHIFT-navigate selects intervening rows from the last selected (or last focused) item and target item
else if (e.shiftKey && from) {
// If we are going back *into* the selected range, we deselect.
fromIdx = me.store.indexOf(from);
recIdx = me.store.indexOf(record);
// If we are heading back TOWARDS the start rec - deselect skipped range...
if (direction === 'up' && fromIdx <= recIdx) {
me.deselectRange(me.lastFocused, recIdx + 1);
}
else if (direction === 'down' && fromIdx >= recIdx) {
me.deselectRange(me.lastFocused, recIdx - 1);
}
// If we are heading AWAY from start point, or no CTRL key, so just select the range and let the CTRL control "keepExisting"...
else if (from !== record) {
me.selectRange(from, record, e.ctrlKey);
}
me.lastSelected = record;
me.setLastFocused(record);
}
// CTRL-navigate onto a selected item just focuses it
else if (e.ctrlKey && isSelected) {
me.setLastFocused(record);
}
// CTRL-navigate, just move focus
else if (e.ctrlKey) {
me.setLastFocused(record);
}
// Just navigation - select the target
else {
me.doSelect(record, false);
}
break;
case 'SIMPLE':
if (isSelected) {
me.doDeselect(record);
} else {
me.doSelect(record, true);
}
break;
case 'SINGLE':
// Space hit
if (isSpace) {
if (isSelected) {
me.doDeselect(record);
me.setLastFocused(record);
} else {
me.doSelect(record);
}
}
// CTRL-navigation: just move focus
else if (e.ctrlKey) {
me.setLastFocused(record);
}
// if allowDeselect is on and this record isSelected, deselect it
else if (me.allowDeselect && isSelected) {
me.doDeselect(record);
}
// select the record and do NOT maintain existing selections
else {
me.doSelect(record, false);
}
break;
}
// selectionStart is a start point for shift/mousedown to create a range from.
// If the mousedowned record was not already selected, then it becomes the
// start of any range created from now on.
// If we drop to no records selected, then there is no range start any more.
if (!e.shiftKey) {
if (me.isSelected(record)) {
me.selectionStart = record;
}
}
}
|
javascript
|
{
"resource": ""
}
|
|
q61244
|
validation
|
function(fireEvent) {
var me = this;
if (fireEvent && !me.bulkChange) {
me.fireEvent('selectionchange', me, me.getSelection());
}
}
|
javascript
|
{
"resource": ""
}
|
|
q61245
|
validation
|
function(record) {
record = Ext.isNumber(record) ? this.store.getAt(record) : record;
return this.selected.contains(record);
}
|
javascript
|
{
"resource": ""
}
|
|
q61246
|
validation
|
function(store, records, indexes, isMove) {
var me = this;
// If the selection start point is among records being removed, we no longer have a selection start point.
if (me.selectionStart && Ext.Array.contains(records, me.selectionStart)) {
me.selectionStart = null;
}
if (isMove || me.locked || !me.pruneRemoved) {
return;
}
me.deselectDeletedRecords(records);
}
|
javascript
|
{
"resource": ""
}
|
|
q61247
|
deployRules
|
validation
|
function deployRules({client, rules, secret}) {
const lastRequest = rulesRequests.get(client.projectId);
return Promise.resolve(lastRequest).then(oldRulesHash => {
const newRuleHash = hash(rules);
if (oldRulesHash === newRuleHash) {
return oldRulesHash;
}
const request = client.rules({rules, secret});
rulesRequests.set(client.projectId, request.then(
() => newRuleHash,
() => oldRulesHash
));
return request;
});
}
|
javascript
|
{
"resource": ""
}
|
q61248
|
lock
|
validation
|
function lock(client, sequence) {
const lastSequence = sequences.get(client.projectId);
return Promise.resolve(lastSequence).then(() => {
const result = sequence();
sequences.set(client.projectId, result.then(noop, noop));
return result;
});
}
|
javascript
|
{
"resource": ""
}
|
q61249
|
validation
|
function () {
var renderData = this.callParent();
if (this.owner.getHierarchyState().rtl) {
renderData.innerCtCls =
(renderData.innerCtCls || '') + ' ' + Ext.baseCSSPrefix + 'rtl';
}
return renderData;
}
|
javascript
|
{
"resource": ""
}
|
|
q61250
|
validation
|
function(o) {
var me = this;
o.un({
scope: me,
mousedown: me.onMouseDown,
mouseup: me.onMouseUp,
mouseover: me.onMouseOver,
mouseout: me.onMouseOut,
click: me.onClick
});
return me.callParent(arguments);
}
|
javascript
|
{
"resource": ""
}
|
|
q61251
|
validation
|
function(redraw) {
var i = 0,
items = this.items,
len = this.length;
for (; i < len; i++) {
items[i].hide(redraw);
}
return this;
}
|
javascript
|
{
"resource": ""
}
|
|
q61252
|
validation
|
function(redraw) {
var i = 0,
items = this.items,
len = this.length;
for (; i < len; i++) {
items[i].show(redraw);
}
return this;
}
|
javascript
|
{
"resource": ""
}
|
|
q61253
|
validation
|
function() {
var me = this,
i = 0,
items = me.items,
surface = me.getSurface(),
len = me.length;
if (surface) {
for (; i < len; i++) {
surface.renderItem(items[i]);
}
}
return me;
}
|
javascript
|
{
"resource": ""
}
|
|
q61254
|
validation
|
function(obj) {
var i = 0,
items = this.items,
len = this.length,
item, el;
for (; i < len; i++) {
item = items[i];
el = item.el;
if (el) {
el.setStyle(obj);
}
}
}
|
javascript
|
{
"resource": ""
}
|
|
q61255
|
validation
|
function(obj) {
var i = 0,
items = this.items,
surface = this.getSurface(),
len = this.length;
if (surface) {
for (; i < len; i++) {
surface.addCls(items[i], obj);
}
}
}
|
javascript
|
{
"resource": ""
}
|
|
q61256
|
validation
|
function(obj) {
var i = 0,
items = this.items,
surface = this.getSurface(),
len = this.length;
if (surface) {
for (; i < len; i++) {
surface.removeCls(items[i], obj);
}
}
}
|
javascript
|
{
"resource": ""
}
|
|
q61257
|
validation
|
function(){
var me = this,
surface = me.getSurface(),
destroySprites = me.autoDestroy,
item;
if (surface) {
while (me.getCount() > 0) {
item = me.first();
me.remove(item);
surface.remove(item, destroySprites);
}
}
me.clearListeners();
}
|
javascript
|
{
"resource": ""
}
|
|
q61258
|
validation
|
function(config){
var me = this,
o, key, value;
me.copyLegacyObject(config, me.customRenderers, 'renderer');
me.copyLegacyObject(config, me.customEditors, 'editor');
me.copyLegacyObject(config, me.propertyNames, 'displayName');
//<debug>
// exclude types since it's new
if (me.customRenderers || me.customEditors || me.propertyNames) {
if (Ext.global.console && Ext.global.console.warn) {
Ext.global.console.warn(this.$className, 'customRenderers, customEditors & propertyNames have been consolidated into a new config, see "sourceConfig". These configurations will be deprecated.');
}
}
//</debug>
}
|
javascript
|
{
"resource": ""
}
|
|
q61259
|
validation
|
function(pos, direction, e, preventWrap, verifierFn, scope) {
if (direction == 'left') {
direction = 'up';
} else if (direction == 'right') {
direction = 'down';
}
pos = Ext.view.Table.prototype.walkCells.call(this, pos, direction, e, preventWrap, verifierFn, scope);
if (pos && !pos.column) {
pos.column = 1;
}
return pos;
}
|
javascript
|
{
"resource": ""
}
|
|
q61260
|
init
|
validation
|
function init() {
tinyMCEPopup.resizeToInnerSize();
var inst = tinyMCEPopup.editor;
var dom = inst.dom;
var elm = inst.selection.getNode();
var f = document.forms[0];
var onclick = dom.getAttrib(elm, 'onclick');
setFormValue('title', dom.getAttrib(elm, 'title'));
setFormValue('id', dom.getAttrib(elm, 'id'));
setFormValue('style', dom.getAttrib(elm, "style"));
setFormValue('dir', dom.getAttrib(elm, 'dir'));
setFormValue('lang', dom.getAttrib(elm, 'lang'));
setFormValue('tabindex', dom.getAttrib(elm, 'tabindex', typeof(elm.tabindex) != "undefined" ? elm.tabindex : ""));
setFormValue('accesskey', dom.getAttrib(elm, 'accesskey', typeof(elm.accesskey) != "undefined" ? elm.accesskey : ""));
setFormValue('onfocus', dom.getAttrib(elm, 'onfocus'));
setFormValue('onblur', dom.getAttrib(elm, 'onblur'));
setFormValue('onclick', onclick);
setFormValue('ondblclick', dom.getAttrib(elm, 'ondblclick'));
setFormValue('onmousedown', dom.getAttrib(elm, 'onmousedown'));
setFormValue('onmouseup', dom.getAttrib(elm, 'onmouseup'));
setFormValue('onmouseover', dom.getAttrib(elm, 'onmouseover'));
setFormValue('onmousemove', dom.getAttrib(elm, 'onmousemove'));
setFormValue('onmouseout', dom.getAttrib(elm, 'onmouseout'));
setFormValue('onkeypress', dom.getAttrib(elm, 'onkeypress'));
setFormValue('onkeydown', dom.getAttrib(elm, 'onkeydown'));
setFormValue('onkeyup', dom.getAttrib(elm, 'onkeyup'));
className = dom.getAttrib(elm, 'class');
addClassesToList('classlist', 'advlink_styles');
selectByValue(f, 'classlist', className, true);
TinyMCE_EditableSelects.init();
}
|
javascript
|
{
"resource": ""
}
|
q61261
|
validation
|
function(columns) {
var i,
len = columns.length,
column;
for (i = 0; i < len; i++) {
column = columns[i];
if (!column.processed && column.locked) {
return true;
}
}
}
|
javascript
|
{
"resource": ""
}
|
|
q61262
|
validation
|
function(headerCt, header, colsToMove, fromIdx, toIdx) {
var me = this;
// If there are Features or Plugins which create DOM which must match column order, they set the optimizedColumnMove flag to false.
// In this case we must refresh the view on column move.
if (me.optimizedColumnMove === false) {
me.view.refresh();
}
// Simplest case for default DOM structure is just to swap the columns round in the view.
else {
me.view.moveColumn(fromIdx, toIdx, colsToMove);
}
me.delayScroll();
}
|
javascript
|
{
"resource": ""
}
|
|
q61263
|
validation
|
function() {
var me = this;
return me.lhsMarker || (me.lhsMarker = Ext.DomHelper.append(me.el, {
cls: me.resizeMarkerCls
}, true));
}
|
javascript
|
{
"resource": ""
}
|
|
q61264
|
validation
|
function() {
var animateWithClass = this.animateClearButton && this.animateWithCss3;
this.clearButtonEl = this.textField.bodyEl.createChild({
tag: 'div',
cls: this.clearButtonCls
});
if(this.animateClearButton) {
this.animateWithCss3 = this.supportsCssTransition(this.clearButtonEl);
}
if(this.animateWithCss3) {
this.clearButtonEl.addCls(this.clearButtonCls + '-off');
}
else {
this.clearButtonEl.setStyle('visibility', 'hidden');
}
}
|
javascript
|
{
"resource": ""
}
|
|
q61265
|
validation
|
function(el) {
var styles = ['transitionProperty', 'WebkitTransitionProperty', 'MozTransitionProperty',
'OTransitionProperty', 'msTransitionProperty', 'KhtmlTransitionProperty'];
var style = el.dom.style;
for(var i = 0, length = styles.length; i < length; ++i) {
if(style[styles[i]] !== 'undefined') {
// Supported property will result in empty string
return true;
}
}
return false;
}
|
javascript
|
{
"resource": ""
}
|
|
q61266
|
validation
|
function() {
if (!this.clearOnEscape) {
return;
}
// Using a KeyMap did not work: ESC is swallowed by combo box and date field before it reaches our own KeyMap
this.textField.inputEl.on('keydown',
function(e) {
if (e.getKey() == Ext.EventObject.ESC) {
if (this.textField.isExpanded) {
// Let combo box or date field first remove the popup
return;
}
// No idea why the defer is necessary, but otherwise the call to setValue('') is ignored
// 2011-11-30 Ing. Leonardo D'Onofrio leonardo_donofrio at hotmail.com
if (this.textField.clearValue) {
Ext.Function.defer(this.textField.clearValue, 1, this.textField);
} else {
Ext.Function.defer(this.textField.setValue, 1, this.textField, ['']);
}
// end Ing. Leonardo D'Onofrio
e.stopEvent();
}
},
this);
}
|
javascript
|
{
"resource": ""
}
|
|
q61267
|
validation
|
function() {
var clearButtonEl = this.clearButtonEl;
if (!clearButtonEl) {
return;
}
var right = 0;
if (this.fieldHasScrollBar()) {
right += Ext.getScrollBarWidth();
}
if (this.textField.triggerWrap) {
right += this.textField.getTriggerWidth();
}
clearButtonEl.alignTo(this.textField.bodyEl, 'tr-tr', [-1 * (right + 3), 5]);
}
|
javascript
|
{
"resource": ""
}
|
|
q61268
|
validation
|
function() {
if (!this.isTextArea) {
return false;
}
var inputEl = this.textField.inputEl;
var overflowY = inputEl.getStyle('overflow-y');
if (overflowY == 'hidden' || overflowY == 'visible') {
return false;
}
if (overflowY == 'scroll') {
return true;
}
//noinspection RedundantIfStatementJS
if (inputEl.dom.scrollHeight <= inputEl.dom.clientHeight) {
return false;
}
return true;
}
|
javascript
|
{
"resource": ""
}
|
|
q61269
|
validation
|
function() {
if (this.hideClearButtonWhenEmpty && Ext.isEmpty(this.textField.getValue())) {
return false;
}
var clearButtonEl = this.clearButtonEl;
//noinspection RedundantIfStatementJS
if (this.hideClearButtonWhenMouseOut
&& !clearButtonEl.hasCls(this.clearButtonCls + '-mouse-over-button')
&& !clearButtonEl.hasCls(this.clearButtonCls + '-mouse-over-input')) {
return false;
}
return true;
}
|
javascript
|
{
"resource": ""
}
|
|
q61270
|
validation
|
function() {
var oldVisible = this.isButtonCurrentlyVisible();
var newVisible = this.shouldButtonBeVisible();
var clearButtonEl = this.clearButtonEl;
if (oldVisible != newVisible) {
if(this.animateClearButton && this.animateWithCss3) {
this.clearButtonEl.removeCls(this.clearButtonCls + (oldVisible ? '-on' : '-off'));
clearButtonEl.addCls(this.clearButtonCls + (newVisible ? '-on' : '-off'));
}
else {
clearButtonEl.stopAnimation();
clearButtonEl.setVisible(newVisible, this.animateClearButton);
}
// Set background-color of clearButton to same as field's background-color (for those browsers/cases
// where the padding-right (see below) does not work)
clearButtonEl.setStyle('background-color', this.textField.inputEl.getStyle('background-color'));
// Adjust padding-right of the input tag to make room for the button
// IE (up to v9) just ignores this and Gecko handles padding incorrectly with textarea scrollbars
if (!(this.isTextArea && Ext.isGecko) && !Ext.isIE) {
// See https://bugzilla.mozilla.org/show_bug.cgi?id=157846
var deltaPaddingRight = clearButtonEl.getWidth() - this.clearButtonEl.getMargin('l');
var currentPaddingRight = this.textField.inputEl.getPadding('r');
var factor = (newVisible ? +1 : -1);
this.textField.inputEl.dom.style.paddingRight = (currentPaddingRight + factor * deltaPaddingRight) + 'px';
}
}
}
|
javascript
|
{
"resource": ""
}
|
|
q61271
|
quit
|
validation
|
function quit(message, line, chr) {
var percentage = Math.floor((line / lines.length) * 100);
throw {
name: 'JSHintError',
line: line,
character: chr,
message: message + " (" + percentage + "% scanned).",
raw: message
};
}
|
javascript
|
{
"resource": ""
}
|
q61272
|
saveProperty
|
validation
|
function saveProperty(name, token) {
if (props[name] && is_own(props, name))
warning("Duplicate member '{a}'.", nexttoken, i);
else
props[name] = {};
props[name].basic = true;
props[name].basicToken = token;
}
|
javascript
|
{
"resource": ""
}
|
q61273
|
makePow
|
validation
|
function makePow(left, prev) {
if (left.isEmpty()) {
return prev;
}
const elem = left.first();
return makePow(
left.remove(elem),
prev.union(prev.map(e => e.add(elem)))
);
}
|
javascript
|
{
"resource": ""
}
|
q61274
|
validation
|
function(s) {
s = tinymce.trim(s);
function rep(re, str) {
s = s.replace(re, str);
};
// example: <strong> to [b]
rep(/<a.*?href=\"(.*?)\".*?>(.*?)<\/a>/gi,"[url=$1]$2[/url]");
rep(/<font.*?color=\"(.*?)\".*?class=\"codeStyle\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]");
rep(/<font.*?color=\"(.*?)\".*?class=\"quoteStyle\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]");
rep(/<font.*?class=\"codeStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]");
rep(/<font.*?class=\"quoteStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]");
rep(/<span style=\"color: ?(.*?);\">(.*?)<\/span>/gi,"[color=$1]$2[/color]");
rep(/<font.*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[color=$1]$2[/color]");
rep(/<span style=\"font-size:(.*?);\">(.*?)<\/span>/gi,"[size=$1]$2[/size]");
rep(/<font>(.*?)<\/font>/gi,"$1");
rep(/<img.*?src=\"(.*?)\".*?\/>/gi,"[img]$1[/img]");
rep(/<span class=\"codeStyle\">(.*?)<\/span>/gi,"[code]$1[/code]");
rep(/<span class=\"quoteStyle\">(.*?)<\/span>/gi,"[quote]$1[/quote]");
rep(/<strong class=\"codeStyle\">(.*?)<\/strong>/gi,"[code][b]$1[/b][/code]");
rep(/<strong class=\"quoteStyle\">(.*?)<\/strong>/gi,"[quote][b]$1[/b][/quote]");
rep(/<em class=\"codeStyle\">(.*?)<\/em>/gi,"[code][i]$1[/i][/code]");
rep(/<em class=\"quoteStyle\">(.*?)<\/em>/gi,"[quote][i]$1[/i][/quote]");
rep(/<u class=\"codeStyle\">(.*?)<\/u>/gi,"[code][u]$1[/u][/code]");
rep(/<u class=\"quoteStyle\">(.*?)<\/u>/gi,"[quote][u]$1[/u][/quote]");
rep(/<\/(strong|b)>/gi,"[/b]");
rep(/<(strong|b)>/gi,"[b]");
rep(/<\/(em|i)>/gi,"[/i]");
rep(/<(em|i)>/gi,"[i]");
rep(/<\/u>/gi,"[/u]");
rep(/<span style=\"text-decoration: ?underline;\">(.*?)<\/span>/gi,"[u]$1[/u]");
rep(/<u>/gi,"[u]");
rep(/<blockquote[^>]*>/gi,"[quote]");
rep(/<\/blockquote>/gi,"[/quote]");
rep(/<br \/>/gi,"\n");
rep(/<br\/>/gi,"\n");
rep(/<br>/gi,"\n");
rep(/<p>/gi,"");
rep(/<\/p>/gi,"\n");
rep(/ |\u00a0/gi," ");
rep(/"/gi,"\"");
rep(/</gi,"<");
rep(/>/gi,">");
rep(/&/gi,"&");
return s;
}
|
javascript
|
{
"resource": ""
}
|
|
q61275
|
validation
|
function(s) {
s = tinymce.trim(s);
function rep(re, str) {
s = s.replace(re, str);
};
// example: [b] to <strong>
rep(/\n/gi,"<br />");
rep(/\[b\]/gi,"<strong>");
rep(/\[\/b\]/gi,"</strong>");
rep(/\[i\]/gi,"<em>");
rep(/\[\/i\]/gi,"</em>");
rep(/\[u\]/gi,"<u>");
rep(/\[\/u\]/gi,"</u>");
rep(/\[url=([^\]]+)\](.*?)\[\/url\]/gi,"<a href=\"$1\">$2</a>");
rep(/\[url\](.*?)\[\/url\]/gi,"<a href=\"$1\">$1</a>");
rep(/\[img\](.*?)\[\/img\]/gi,"<img src=\"$1\" />");
rep(/\[color=(.*?)\](.*?)\[\/color\]/gi,"<font color=\"$1\">$2</font>");
rep(/\[code\](.*?)\[\/code\]/gi,"<span class=\"codeStyle\">$1</span> ");
rep(/\[quote.*?\](.*?)\[\/quote\]/gi,"<span class=\"quoteStyle\">$1</span> ");
return s;
}
|
javascript
|
{
"resource": ""
}
|
|
q61276
|
validation
|
function (childContext, axis) {
var collapseTarget = childContext.collapseTarget,
setSizeMethod = 'set' + axis.sizePropCap,
sizeProp = axis.sizeProp,
childMarginSize = childContext.getMarginInfo()[sizeProp],
region, isBegin, flex, pos, size;
if (collapseTarget) { // if (splitter)
region = collapseTarget.region;
} else {
region = childContext.region;
flex = childContext.flex;
}
isBegin = region == axis.borderBegin;
if (!isBegin && region != axis.borderEnd) {
// a north/south region on the horizontal axis or an east/west region on the
// vertical axis: stretch to fill remaining space:
childContext[setSizeMethod](axis.end - axis.begin - childMarginSize);
pos = axis.begin;
} else {
if (flex) {
size = Math.ceil(axis.flexSpace * (flex / axis.totalFlex));
size = childContext[setSizeMethod](size);
} else if (childContext.percentage) {
// Like getProp but without registering a dependency - we calculated the size, we don't depend on it
size = childContext.peek(sizeProp);
} else {
size = childContext.getProp(sizeProp);
}
size += childMarginSize;
if (isBegin) {
pos = axis.begin;
axis.begin += size;
} else {
axis.end = pos = axis.end - size;
}
}
childContext.layoutPos[axis.posProp] = pos;
}
|
javascript
|
{
"resource": ""
}
|
|
q61277
|
validation
|
function (ownerContext, axis) {
var size = axis.end - axis.begin,
center = ownerContext.centerRegion;
if (center) {
center['set' + axis.sizePropCap](size - center.getMarginInfo()[axis.sizeProp]);
center.layoutPos[axis.posProp] = axis.begin;
}
return Ext.isNumber(size) ? 1 : 0;
}
|
javascript
|
{
"resource": ""
}
|
|
q61278
|
validation
|
function (childItems) {
var length = childItems.length,
index, childContext;
for (index = 0; index < length; ++index) {
childContext = childItems[index];
childContext.setProp('x', childContext.layoutPos.x + childContext.marginInfo.left);
childContext.setProp('y', childContext.layoutPos.y + childContext.marginInfo.top);
}
}
|
javascript
|
{
"resource": ""
}
|
|
q61279
|
Duration
|
validation
|
function Duration(str) {
// There must be at least a P
if(str.length < 1 || str.charAt(0) != 'P') {
throw new Error('Invalid Duration');
}
var duration = str.substr(1);
if(duration.length < 1) {
throw new Error('Invalid Duration');
}
// 5.3.2 allows for NON normalized durations
// We assume that if there is a space, it is non-normalized
if(/\s/.test(duration)) {
throw new Error('Non normalized durations not implemented');
//this._parseNonNormalized(duration);
} else {
this._parseNormalized(duration);
}
}
|
javascript
|
{
"resource": ""
}
|
q61280
|
validation
|
function () {
var result = {},
fields = this.fields,
key, field;
for (key in fields) {
if (fields.hasOwnProperty(key)) {
field = fields[key];
if (field.isValid() && field.getValue() !== null) {
result[key] = field.getValue();
}
}
}
return result;
}
|
javascript
|
{
"resource": ""
}
|
|
q61281
|
validation
|
function (data) {
var me = this,
fields = me.fields,
key,
field;
for (key in fields) {
if (fields.hasOwnProperty(key)) {
// Prevent field's change event from tiggering a Store filter. The final upate event will do that
field =fields[key];
field.suspendEvents();
field.setValue(key in data ? data[key] : '');
field.resumeEvents();
}
}
// Trigger the filering of the Store
me.fireEvent('update', me);
}
|
javascript
|
{
"resource": ""
}
|
|
q61282
|
ensureDefault
|
validation
|
function ensureDefault(val, def) {
if ((util_1.isNullOrUndefined(val) || val === '') && !chek_1.isUndefined(def))
return def;
return val;
}
|
javascript
|
{
"resource": ""
}
|
q61283
|
isLikeNumber
|
validation
|
function isLikeNumber(val) {
return constants_1.LIKE_HEX_NUMBER.test(val) ||
constants_1.LIKE_NUMBER.test(val);
}
|
javascript
|
{
"resource": ""
}
|
q61284
|
validation
|
function (val) {
val = ensureDefault(val, constants_1.DEFAULT_TYPE_VALUES.boolean);
return Boolean(/^false$/i.test(val) ? false : val);
}
|
javascript
|
{
"resource": ""
}
|
|
q61285
|
validation
|
function (val) {
val = ensureDefault(val, constants_1.DEFAULT_TYPE_VALUES.array);
if (!Array.isArray(val))
val = [val];
return val;
}
|
javascript
|
{
"resource": ""
}
|
|
q61286
|
toCamelcase
|
validation
|
function toCamelcase(val, strict) {
if (strict === void 0) { strict = true; }
if (!strict || !/\S+\.[^\.]\S+/.test(val))
return chek_1.camelcase(val);
return val;
}
|
javascript
|
{
"resource": ""
}
|
q61287
|
expandArgs
|
validation
|
function expandArgs(val, match, safe) {
if (Array.isArray(val))
return val.slice(0); // always slice to clone.
match = match || ['"', "'"];
safe = safe || ['[', ']', '<', '>'];
function replacer(p, c) {
p.a[p.a.length - 1] += c.replace(/\\(.)/, '$1');
}
var all = safe.concat(match);
var result = val.match(/\\?.|^$/g).reduce(function (p, c) {
if (~all.indexOf(c)) {
p.quote ^= 1;
if (~safe.indexOf(c))
replacer(p, c);
}
else if (!p.quote && c === ' ')
p.a.push('');
else
replacer(p, c);
return p;
}, { a: [''], e: false }).a;
return result;
}
|
javascript
|
{
"resource": ""
}
|
q61288
|
expandOptions
|
validation
|
function expandOptions(val, allowValues) {
val = val || [];
var trail = [];
return val.reduce(function (a, c) {
if (!constants_1.FLAG_SHORT.test(c) || constants_1.FLAG_COUNT.test(c))
return a.concat(c);
var split = c.slice(1).split('').map(function (n) { return "-" + n; });
if (allowValues)
return a.concat(split);
trail = trail.concat(split); // shift to end can't have values.
return a;
}, []).concat(trail);
}
|
javascript
|
{
"resource": ""
}
|
q61289
|
isNegateFlag
|
validation
|
function isNegateFlag(val, negate) {
negate = escape(negate || constants_1.NEGATE_CHAR);
return (new RegExp('^--' + negate)).test(val);
}
|
javascript
|
{
"resource": ""
}
|
q61290
|
isArgVariadic
|
validation
|
function isArgVariadic(val, variadic) {
variadic = variadic || constants_1.VARIADIC_CHAR;
return isArg(val)
&& (val.endsWith(variadic + ']')
|| val.endsWith(variadic + '>'));
}
|
javascript
|
{
"resource": ""
}
|
q61291
|
isArgVariadicRequired
|
validation
|
function isArgVariadicRequired(val, variadic) {
variadic = variadic || constants_1.VARIADIC_CHAR;
return isArgRequired(val) && val.endsWith(variadic + '>');
}
|
javascript
|
{
"resource": ""
}
|
q61292
|
stripFlag
|
validation
|
function stripFlag(val, negate) {
negate = escape(negate || constants_1.NEGATE_CHAR);
return (val || '').replace(new RegExp('^--?(' + negate + ')?'), '');
}
|
javascript
|
{
"resource": ""
}
|
q61293
|
stripNegate
|
validation
|
function stripNegate(val, negate) {
negate = escape(negate || constants_1.NEGATE_CHAR);
var exp = new RegExp('^' + negate);
return val.replace(exp, '');
}
|
javascript
|
{
"resource": ""
}
|
q61294
|
stripVariadic
|
validation
|
function stripVariadic(val, variadic) {
variadic = escape(variadic || constants_1.VARIADIC_CHAR);
var exp = new RegExp(variadic + '$');
return val.replace(exp, '');
}
|
javascript
|
{
"resource": ""
}
|
q61295
|
stripTokens
|
validation
|
function stripTokens(val, negate, variadic) {
variadic = escape(variadic || constants_1.VARIADIC_CHAR);
negate = escape(negate || constants_1.NEGATE_CHAR);
var argExp = new RegExp(['<', '>', '\\[', '\\]'].join('|'), 'g');
var noExp = new RegExp('^' + negate);
var variExp = new RegExp(variadic + '$');
return expandArgs(val)
.map(function (v) {
v = v
.replace(constants_1.FLAG_EXP, '')
.replace(noExp, '')
.replace(argExp, '')
.replace(variExp, '');
return v;
}).join(' ');
}
|
javascript
|
{
"resource": ""
}
|
q61296
|
validation
|
function(item) {
if (!item) {
return;
}
var me = this,
sprite = item.sprite,
opts = Ext.merge({}, me.highlightCfg, me.highlight),
surface = me.chart.surface,
animate = me.chart.animate,
p, from, to, pi;
if (!me.highlight || !sprite || sprite._highlighted) {
return;
}
if (sprite._anim) {
sprite._anim.paused = true;
}
sprite._highlighted = true;
if (!sprite._defaults) {
sprite._defaults = Ext.apply({}, sprite.attr);
from = {};
to = {};
// TODO: Clean up code below.
for (p in opts) {
if (! (p in sprite._defaults)) {
sprite._defaults[p] = surface.availableAttrs[p];
}
from[p] = sprite._defaults[p];
to[p] = opts[p];
if (Ext.isObject(opts[p])) {
from[p] = {};
to[p] = {};
Ext.apply(sprite._defaults[p], sprite.attr[p]);
Ext.apply(from[p], sprite._defaults[p]);
for (pi in sprite._defaults[p]) {
if (! (pi in opts[p])) {
to[p][pi] = from[p][pi];
} else {
to[p][pi] = opts[p][pi];
}
}
for (pi in opts[p]) {
if (! (pi in to[p])) {
to[p][pi] = opts[p][pi];
}
}
}
}
sprite._from = from;
sprite._to = to;
sprite._endStyle = to;
}
if (animate) {
sprite._anim = new Ext.fx.Anim({
target: sprite,
from: sprite._from,
to: sprite._to,
duration: 150
});
} else {
sprite.setAttributes(sprite._to, true);
}
}
|
javascript
|
{
"resource": ""
}
|
|
q61297
|
validation
|
function() {
if (!this.highlight || !this.items) {
return;
}
var me = this,
items = me.items,
len = items.length,
opts = Ext.merge({}, me.highlightCfg, me.highlight),
animate = me.chart.animate,
i = 0,
obj, p, sprite;
for (; i < len; i++) {
if (!items[i]) {
continue;
}
sprite = items[i].sprite;
if (sprite && sprite._highlighted) {
if (sprite._anim) {
sprite._anim.paused = true;
}
obj = {};
for (p in opts) {
if (Ext.isObject(sprite._defaults[p])) {
obj[p] = Ext.apply({}, sprite._defaults[p]);
}
else {
obj[p] = sprite._defaults[p];
}
}
if (animate) {
//sprite._to = obj;
sprite._endStyle = obj;
sprite._anim = new Ext.fx.Anim({
target: sprite,
to: obj,
duration: 150
});
}
else {
sprite.setAttributes(obj, true);
}
delete sprite._highlighted;
//delete sprite._defaults;
}
}
}
|
javascript
|
{
"resource": ""
}
|
|
q61298
|
validation
|
function(component, selector) {
if (!selector) {
return true;
}
var selectors = selector.split(','),
length = selectors.length,
i = 0,
query;
for (; i < length; i++) {
selector = Ext.String.trim(selectors[i]);
query = this.cache[selector] || (this.cache[selector] = this.parse(selector));
if (query.is(component)) {
return true;
}
}
return false;
}
|
javascript
|
{
"resource": ""
}
|
|
q61299
|
getVinylFile
|
validation
|
async function getVinylFile(filePath, options) {
if (!isString(filePath)) {
if (!options.lookup.has(filePath.path)) options.lookup.set(filePath.path, filePath);
return filePath;
}
if (options.lookup.has(filePath)) return options.lookup.get(filePath);
return createVinylFile(filePath, options);
}
|
javascript
|
{
"resource": ""
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.