_id
stringlengths 2
6
| title
stringlengths 0
58
| partition
stringclasses 3
values | text
stringlengths 52
373k
| language
stringclasses 1
value | meta_information
dict |
|---|---|---|---|---|---|
q20700
|
convertAndMergeHiddenQueryProps
|
train
|
function convertAndMergeHiddenQueryProps(model, json, omitProps, builder) {
const queryProps = model[QUERY_PROPS_PROPERTY];
if (!queryProps) {
// The model has no query properties.
return json;
}
const modelClass = model.constructor;
const keys = Object.keys(queryProps);
for (let i = 0, l = keys.length; i < l; ++i) {
const key = keys[i];
if (!omitProps || !omitProps.includes(key)) {
const queryProp = queryPropToKnexRaw(queryProps[key], builder);
json[modelClass.propertyNameToColumnName(key)] = queryProp;
}
}
return json;
}
|
javascript
|
{
"resource": ""
}
|
q20701
|
queryPropToKnexRaw
|
train
|
function queryPropToKnexRaw(queryProp, builder) {
if (!queryProp) {
return queryProp;
}
if (queryProp.isObjectionQueryBuilderBase) {
return buildObjectionQueryBuilder(queryProp, builder);
} else if (isKnexRawConvertable(queryProp)) {
return buildKnexRawConvertable(queryProp, builder);
} else {
return queryProp;
}
}
|
javascript
|
{
"resource": ""
}
|
q20702
|
Layer
|
train
|
function Layer(path, methods, middleware, opts) {
this.opts = opts || {};
this.name = this.opts.name || null;
this.methods = [];
this.paramNames = [];
this.stack = Array.isArray(middleware) ? middleware : [middleware];
methods.forEach(function(method) {
var l = this.methods.push(method.toUpperCase());
if (this.methods[l-1] === 'GET') {
this.methods.unshift('HEAD');
}
}, this);
// ensure middleware is a function
this.stack.forEach(function(fn) {
var type = (typeof fn);
if (type !== 'function') {
throw new Error(
methods.toString() + " `" + (this.opts.name || path) +"`: `middleware` "
+ "must be a function, not `" + type + "`"
);
}
}, this);
this.path = path;
this.regexp = pathToRegExp(path, this.paramNames, this.opts);
debug('defined route %s %s', this.methods, this.opts.prefix + this.path);
}
|
javascript
|
{
"resource": ""
}
|
q20703
|
debug
|
train
|
function debug(e, template, line, file) {
file = file || "<template>";
var lines = template.split("\n"),
start = Math.max(line - 3, 0),
end = Math.min(lines.length, line + 3),
context = lines.slice(start, end);
var c;
for (var i = 0, len = context.length; i < len; ++i) {
c = i + start + 1;
context[i] = (c === line ? " >> " : " ") + context[i];
}
e.template = template;
e.line = line;
e.file = file;
e.message = [file + ":" + line, context.join("\n"), "", e.message].join("\n");
return e;
}
|
javascript
|
{
"resource": ""
}
|
q20704
|
lookup
|
train
|
function lookup(name, stack, defaultValue) {
if (name === ".") {
return stack[stack.length - 1];
}
var names = name.split(".");
var lastIndex = names.length - 1;
var target = names[lastIndex];
var value, context, i = stack.length, j, localStack;
while (i) {
localStack = stack.slice(0);
context = stack[--i];
j = 0;
while (j < lastIndex) {
context = context[names[j++]];
if (context == null) {
break;
}
localStack.push(context);
}
if (context && typeof context === "object" && target in context) {
value = context[target];
break;
}
}
// If the value is a function, call it in the current context.
if (typeof value === "function") {
value = value.call(localStack[localStack.length - 1]);
}
if (value == null) {
return defaultValue;
}
return value;
}
|
javascript
|
{
"resource": ""
}
|
q20705
|
_compile
|
train
|
function _compile(template, options) {
var args = "view,partials,stack,lookup,escapeHTML,renderSection,render";
var body = parse(template, options);
var fn = new Function(args, body);
// This anonymous function wraps the generated function so we can do
// argument coercion, setup some variables, and handle any errors
// encountered while executing it.
return function (view, partials) {
partials = partials || {};
var stack = [view]; // context stack
try {
return fn(view, partials, stack, lookup, escapeHTML, renderSection, render);
} catch (e) {
throw debug(e.error, template, e.line, options.file);
}
};
}
|
javascript
|
{
"resource": ""
}
|
q20706
|
addDetected
|
train
|
function addDetected(app, pattern, type, value, key) {
app.detected = true;
// Set confidence level
app.confidence[`${type} ${key ? `${key} ` : ''}${pattern.regex}`] = pattern.confidence === undefined ? 100 : parseInt(pattern.confidence, 10);
// Detect version number
if (pattern.version) {
const versions = [];
const matches = pattern.regex.exec(value);
let { version } = pattern;
if (matches) {
matches.forEach((match, i) => {
// Parse ternary operator
const ternary = new RegExp(`\\\\${i}\\?([^:]+):(.*)$`).exec(version);
if (ternary && ternary.length === 3) {
version = version.replace(ternary[0], match ? ternary[1] : ternary[2]);
}
// Replace back references
version = version.trim().replace(new RegExp(`\\\\${i}`, 'g'), match || '');
});
if (version && versions.indexOf(version) === -1) {
versions.push(version);
}
if (versions.length) {
// Use the longest detected version number
app.version = versions.reduce((a, b) => (a.length > b.length ? a : b));
}
}
}
}
|
javascript
|
{
"resource": ""
}
|
q20707
|
getOption
|
train
|
function getOption(name, defaultValue = null) {
return new Promise(async (resolve, reject) => {
let value = defaultValue;
try {
const option = await browser.storage.local.get(name);
if (option[name] !== undefined) {
value = option[name];
}
} catch (error) {
wappalyzer.log(error.message, 'driver', 'error');
return reject(error.message);
}
return resolve(value);
});
}
|
javascript
|
{
"resource": ""
}
|
q20708
|
setOption
|
train
|
function setOption(name, value) {
return new Promise(async (resolve, reject) => {
try {
await browser.storage.local.set({ [name]: value });
} catch (error) {
wappalyzer.log(error.message, 'driver', 'error');
return reject(error.message);
}
return resolve();
});
}
|
javascript
|
{
"resource": ""
}
|
q20709
|
openTab
|
train
|
function openTab(args) {
browser.tabs.create({
url: args.url,
active: args.background === undefined || !args.background,
});
}
|
javascript
|
{
"resource": ""
}
|
q20710
|
post
|
train
|
async function post(url, body) {
try {
const response = await fetch(url, {
method: 'POST',
body: JSON.stringify(body),
});
wappalyzer.log(`POST ${url}: ${response.status}`, 'driver');
} catch (error) {
wappalyzer.log(`POST ${url}: ${error}`, 'driver', 'error');
}
}
|
javascript
|
{
"resource": ""
}
|
q20711
|
train
|
function (it, S) {
if (!_isObject(it)) return it;
var fn, val;
if (S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) return val;
if (typeof (fn = it.valueOf) == 'function' && !_isObject(val = fn.call(it))) return val;
if (!S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) return val;
throw TypeError("Can't convert object to primitive value");
}
|
javascript
|
{
"resource": ""
}
|
|
q20712
|
isEmpty
|
train
|
function isEmpty(data) {
if (Array.isArray(data)) {
return data.length === 0;
}
return Object.keys(data).length === 0;
}
|
javascript
|
{
"resource": ""
}
|
q20713
|
forOwn
|
train
|
function forOwn(object, iteratee) {
Object.keys(object).forEach(function (key) { return iteratee(object[key], key, object); });
}
|
javascript
|
{
"resource": ""
}
|
q20714
|
map
|
train
|
function map(object, iteratee) {
return Object.keys(object).map(function (key) {
return iteratee(object[key], key, object);
});
}
|
javascript
|
{
"resource": ""
}
|
q20715
|
orderBy
|
train
|
function orderBy(collection, keys, directions) {
var index = -1;
var result = collection.map(function (value) {
var criteria = keys.map(function (key) { return value[key]; });
return { criteria: criteria, index: ++index, value: value };
});
return baseSortBy(result, function (object, other) {
return compareMultiple(object, other, directions);
});
}
|
javascript
|
{
"resource": ""
}
|
q20716
|
groupBy
|
train
|
function groupBy(collection, iteratee) {
return collection.reduce(function (records, record) {
var key = iteratee(record);
if (records[key] === undefined) {
records[key] = [];
}
records[key].push(record);
return records;
}, {});
}
|
javascript
|
{
"resource": ""
}
|
q20717
|
Type
|
train
|
function Type(model, value, mutator) {
var _this = _super.call(this, model) /* istanbul ignore next */ || this;
/**
* Whether if the attribute can accept `null` as a value.
*/
_this.isNullable = false;
_this.value = value;
_this.mutator = mutator;
return _this;
}
|
javascript
|
{
"resource": ""
}
|
q20718
|
Attr
|
train
|
function Attr(model, value, mutator) {
var _this = _super.call(this, model, value, mutator) /* istanbul ignore next */ || this;
_this.value = value;
return _this;
}
|
javascript
|
{
"resource": ""
}
|
q20719
|
HasOne
|
train
|
function HasOne(model, related, foreignKey, localKey) {
var _this = _super.call(this, model) /* istanbul ignore next */ || this;
_this.related = _this.model.relation(related);
_this.foreignKey = foreignKey;
_this.localKey = localKey;
return _this;
}
|
javascript
|
{
"resource": ""
}
|
q20720
|
HasManyBy
|
train
|
function HasManyBy(model, parent, foreignKey, ownerKey) {
var _this = _super.call(this, model) /* istanbul ignore next */ || this;
_this.parent = _this.model.relation(parent);
_this.foreignKey = foreignKey;
_this.ownerKey = ownerKey;
return _this;
}
|
javascript
|
{
"resource": ""
}
|
q20721
|
HasManyThrough
|
train
|
function HasManyThrough(model, related, through, firstKey, secondKey, localKey, secondLocalKey) {
var _this = _super.call(this, model) /* istanbul ignore next */ || this;
_this.related = _this.model.relation(related);
_this.through = _this.model.relation(through);
_this.firstKey = firstKey;
_this.secondKey = secondKey;
_this.localKey = localKey;
_this.secondLocalKey = secondLocalKey;
return _this;
}
|
javascript
|
{
"resource": ""
}
|
q20722
|
MorphTo
|
train
|
function MorphTo(model, id, type) {
var _this = _super.call(this, model) /* istanbul ignore next */ || this;
_this.id = id;
_this.type = type;
return _this;
}
|
javascript
|
{
"resource": ""
}
|
q20723
|
denormalizeImmutable
|
train
|
function denormalizeImmutable(schema, input, unvisit) {
return Object.keys(schema).reduce(function (object, key) {
// Immutable maps cast keys to strings on write so we need to ensure
// we're accessing them using string keys.
var stringKey = '' + key;
if (object.has(stringKey)) {
return object.set(stringKey, unvisit(object.get(stringKey), schema[stringKey]));
} else {
return object;
}
}, input);
}
|
javascript
|
{
"resource": ""
}
|
q20724
|
Query
|
train
|
function Query(state, entity) {
/**
* Primary key ids to filter records by. It is used for filtering records
* direct key lookup when a user is trying to fetch records by its
* primary key.
*
* It should not be used if there is a logic which prevents index usage, for
* example, an "or" condition which already requires a full scan of records.
*/
this.idFilter = null;
/**
* Whether to use `idFilter` key lookup. True if there is a logic which
* prevents index usage, for example, an "or" condition which already
* requires full scan.
*/
this.cancelIdFilter = false;
/**
* Primary key ids to filter joined records. It is used for filtering
* records direct key lookup. It should not be cancelled, because it
* is free from the effects of normal where methods.
*/
this.joinedIdFilter = null;
/**
* The where constraints for the query.
*/
this.wheres = [];
/**
* The has constraints for the query.
*/
this.have = [];
/**
* The orders of the query result.
*/
this.orders = [];
/**
* Number of results to skip.
*/
this.offsetNumber = 0;
/**
* Maximum number of records to return.
*
* We use polyfill of `Number.MAX_SAFE_INTEGER` for IE11 here.
*/
this.limitNumber = Math.pow(2, 53) - 1;
/**
* The relationships that should be eager loaded with the result.
*/
this.load = {};
this.rootState = state;
this.state = state[entity];
this.entity = entity;
this.model = this.getModel(entity);
this.module = this.getModule(entity);
this.hook = new Hook(this);
}
|
javascript
|
{
"resource": ""
}
|
q20725
|
train
|
function (context, payload) {
var state = context.state;
var entity = state.$name;
return context.dispatch(state.$connection + "/insertOrUpdate", __assign({ entity: entity }, payload), { root: true });
}
|
javascript
|
{
"resource": ""
}
|
|
q20726
|
train
|
function (state, payload) {
var entity = payload.entity;
var data = payload.data;
var options = OptionsBuilder.createPersistOptions(payload);
var result = payload.result;
result.data = (new Query(state, entity)).create(data, options);
}
|
javascript
|
{
"resource": ""
}
|
|
q20727
|
Schema
|
train
|
function Schema(model) {
var _this = this;
/**
* List of generated schemas.
*/
this.schemas = {};
this.model = model;
var models = model.database().models();
Object.keys(models).forEach(function (name) { _this.one(models[name]); });
}
|
javascript
|
{
"resource": ""
}
|
q20728
|
encodeEntities
|
train
|
function encodeEntities(value) {
return value.
replace(/&/g, '&').
replace(surrogatePairRegexp, function(value) {
var hi = value.charCodeAt(0),
low = value.charCodeAt(1);
return '&#' + (((hi - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000) + ';';
}).
replace(nonAlphanumericRegexp, function(value) {
return '&#' + value.charCodeAt(0) + ';';
}).
replace(/</g, '<').
replace(/>/g, '>');
}
|
javascript
|
{
"resource": ""
}
|
q20729
|
train
|
function(value, token) {
var score, pos;
if (!value) return 0;
value = String(value || '');
pos = value.search(token.regex);
if (pos === -1) return 0;
score = token.string.length / value.length;
if (pos === 0) score += 0.5;
return score;
}
|
javascript
|
{
"resource": ""
}
|
|
q20730
|
train
|
function(a, b) {
if (typeof a === 'number' && typeof b === 'number') {
return a > b ? 1 : (a < b ? -1 : 0);
}
a = asciifold(String(a || ''));
b = asciifold(String(b || ''));
if (a > b) return 1;
if (b > a) return -1;
return 0;
}
|
javascript
|
{
"resource": ""
}
|
|
q20731
|
train
|
function(self, types, fn) {
var type;
var trigger = self.trigger;
var event_args = {};
// override trigger method
self.trigger = function() {
var type = arguments[0];
if (types.indexOf(type) !== -1) {
event_args[type] = arguments;
} else {
return trigger.apply(self, arguments);
}
};
// invoke provided function
fn.apply(self, []);
self.trigger = trigger;
// trigger queued events
for (type in event_args) {
if (event_args.hasOwnProperty(type)) {
trigger.apply(self, event_args[type]);
}
}
}
|
javascript
|
{
"resource": ""
}
|
|
q20732
|
train
|
function($from, $to, properties) {
var i, n, styles = {};
if (properties) {
for (i = 0, n = properties.length; i < n; i++) {
styles[properties[i]] = $from.css(properties[i]);
}
} else {
styles = $from.css();
}
$to.css(styles);
}
|
javascript
|
{
"resource": ""
}
|
|
q20733
|
train
|
function() {
var self = this;
var field_label = self.settings.labelField;
var field_optgroup = self.settings.optgroupLabelField;
var templates = {
'optgroup': function(data) {
return '<div class="optgroup">' + data.html + '</div>';
},
'optgroup_header': function(data, escape) {
return '<div class="optgroup-header">' + escape(data[field_optgroup]) + '</div>';
},
'option': function(data, escape) {
return '<div class="option">' + escape(data[field_label]) + '</div>';
},
'item': function(data, escape) {
return '<div class="item">' + escape(data[field_label]) + '</div>';
},
'option_create': function(data, escape) {
return '<div class="create">Add <strong>' + escape(data.input) + '</strong>…</div>';
}
};
self.settings.render = $.extend({}, templates, self.settings.render);
}
|
javascript
|
{
"resource": ""
}
|
|
q20734
|
train
|
function() {
var key, fn, callbacks = {
'initialize' : 'onInitialize',
'change' : 'onChange',
'item_add' : 'onItemAdd',
'item_remove' : 'onItemRemove',
'clear' : 'onClear',
'option_add' : 'onOptionAdd',
'option_remove' : 'onOptionRemove',
'option_clear' : 'onOptionClear',
'optgroup_add' : 'onOptionGroupAdd',
'optgroup_remove' : 'onOptionGroupRemove',
'optgroup_clear' : 'onOptionGroupClear',
'dropdown_open' : 'onDropdownOpen',
'dropdown_close' : 'onDropdownClose',
'type' : 'onType',
'load' : 'onLoad',
'focus' : 'onFocus',
'blur' : 'onBlur'
};
for (key in callbacks) {
if (callbacks.hasOwnProperty(key)) {
fn = this.settings[callbacks[key]];
if (fn) this.on(key, fn);
}
}
}
|
javascript
|
{
"resource": ""
}
|
|
q20735
|
train
|
function(e) {
var self = this;
var defaultPrevented = e.isDefaultPrevented();
var $target = $(e.target);
if (self.isFocused) {
// retain focus by preventing native handling. if the
// event target is the input it should not be modified.
// otherwise, text selection within the input won't work.
if (e.target !== self.$control_input[0]) {
if (self.settings.mode === 'single') {
// toggle dropdown
self.isOpen ? self.close() : self.open();
} else if (!defaultPrevented) {
self.setActiveItem(null);
}
return false;
}
} else {
// give control focus
if (!defaultPrevented) {
window.setTimeout(function() {
self.focus();
}, 0);
}
}
}
|
javascript
|
{
"resource": ""
}
|
|
q20736
|
train
|
function(e) {
var value, $target, $option, self = this;
if (e.preventDefault) {
e.preventDefault();
e.stopPropagation();
}
$target = $(e.currentTarget);
if ($target.hasClass('create')) {
self.createItem(null, function() {
if (self.settings.closeAfterSelect) {
self.close();
}
});
} else {
value = $target.attr('data-value');
if (typeof value !== 'undefined') {
self.lastQuery = null;
self.setTextboxValue('');
self.addItem(value);
if (self.settings.closeAfterSelect) {
self.close();
} else if (!self.settings.hideSelected && e.type && /mouse/.test(e.type)) {
self.setActiveOption(self.getOption(value));
}
}
}
}
|
javascript
|
{
"resource": ""
}
|
|
q20737
|
train
|
function(e) {
var self = this;
if (self.isLocked) return;
if (self.settings.mode === 'multi') {
e.preventDefault();
self.setActiveItem(e.currentTarget, e);
}
}
|
javascript
|
{
"resource": ""
}
|
|
q20738
|
train
|
function(value) {
var $input = this.$control_input;
var changed = $input.val() !== value;
if (changed) {
$input.val(value).triggerHandler('update');
this.lastValue = value;
}
}
|
javascript
|
{
"resource": ""
}
|
|
q20739
|
train
|
function(value, silent) {
var events = silent ? [] : ['change'];
debounce_events(this, events, function() {
this.clear();
this.addItems(value, silent);
});
}
|
javascript
|
{
"resource": ""
}
|
|
q20740
|
train
|
function($item, e) {
var self = this;
var eventName;
var i, idx, begin, end, item, swap;
var $last;
if (self.settings.mode === 'single') return;
$item = $($item);
// clear the active selection
if (!$item.length) {
$(self.$activeItems).removeClass('active');
self.$activeItems = [];
if (self.isFocused) {
self.showInput();
}
return;
}
// modify selection
eventName = e && e.type.toLowerCase();
if (eventName === 'mousedown' && self.isShiftDown && self.$activeItems.length) {
$last = self.$control.children('.active:last');
begin = Array.prototype.indexOf.apply(self.$control[0].childNodes, [$last[0]]);
end = Array.prototype.indexOf.apply(self.$control[0].childNodes, [$item[0]]);
if (begin > end) {
swap = begin;
begin = end;
end = swap;
}
for (i = begin; i <= end; i++) {
item = self.$control[0].childNodes[i];
if (self.$activeItems.indexOf(item) === -1) {
$(item).addClass('active');
self.$activeItems.push(item);
}
}
e.preventDefault();
} else if ((eventName === 'mousedown' && self.isCtrlDown) || (eventName === 'keydown' && this.isShiftDown)) {
if ($item.hasClass('active')) {
idx = self.$activeItems.indexOf($item[0]);
self.$activeItems.splice(idx, 1);
$item.removeClass('active');
} else {
self.$activeItems.push($item.addClass('active')[0]);
}
} else {
$(self.$activeItems).removeClass('active');
self.$activeItems = [$item.addClass('active')[0]];
}
// ensure control has focus
self.hideInput();
if (!this.isFocused) {
self.focus();
}
}
|
javascript
|
{
"resource": ""
}
|
|
q20741
|
train
|
function() {
var self = this;
self.setTextboxValue('');
self.$control_input.css({opacity: 0, position: 'absolute', left: self.rtl ? 10000 : -10000});
self.isInputHidden = true;
}
|
javascript
|
{
"resource": ""
}
|
|
q20742
|
train
|
function() {
var self = this;
if (self.isDisabled) return;
self.ignoreFocus = true;
self.$control_input[0].focus();
window.setTimeout(function() {
self.ignoreFocus = false;
self.onFocus();
}, 0);
}
|
javascript
|
{
"resource": ""
}
|
|
q20743
|
train
|
function(query) {
var i, value, score, result, calculateScore;
var self = this;
var settings = self.settings;
var options = this.getSearchOptions();
// validate user-provided result scoring function
if (settings.score) {
calculateScore = self.settings.score.apply(this, [query]);
if (typeof calculateScore !== 'function') {
throw new Error('Selectize "score" setting must be a function that returns a function');
}
}
// perform search
if (query !== self.lastQuery) {
self.lastQuery = query;
result = self.sifter.search(query, $.extend(options, {score: calculateScore}));
self.currentResults = result;
} else {
result = $.extend(true, {}, self.currentResults);
}
// filter out selected items
if (settings.hideSelected) {
for (i = result.items.length - 1; i >= 0; i--) {
if (self.items.indexOf(hash_key(result.items[i].id)) !== -1) {
result.items.splice(i, 1);
}
}
}
return result;
}
|
javascript
|
{
"resource": ""
}
|
|
q20744
|
train
|
function(data) {
var key = hash_key(data[this.settings.optgroupValueField]);
if (!key) return false;
data.$order = data.$order || ++this.order;
this.optgroups[key] = data;
return key;
}
|
javascript
|
{
"resource": ""
}
|
|
q20745
|
train
|
function(id, data) {
data[this.settings.optgroupValueField] = id;
if (id = this.registerOptionGroup(data)) {
this.trigger('optgroup_add', id, data);
}
}
|
javascript
|
{
"resource": ""
}
|
|
q20746
|
train
|
function(value, data) {
var self = this;
var $item, $item_new;
var value_new, index_item, cache_items, cache_options, order_old;
value = hash_key(value);
value_new = hash_key(data[self.settings.valueField]);
// sanity checks
if (value === null) return;
if (!self.options.hasOwnProperty(value)) return;
if (typeof value_new !== 'string') throw new Error('Value must be set in option data');
order_old = self.options[value].$order;
// update references
if (value_new !== value) {
delete self.options[value];
index_item = self.items.indexOf(value);
if (index_item !== -1) {
self.items.splice(index_item, 1, value_new);
}
}
data.$order = data.$order || order_old;
self.options[value_new] = data;
// invalidate render cache
cache_items = self.renderCache['item'];
cache_options = self.renderCache['option'];
if (cache_items) {
delete cache_items[value];
delete cache_items[value_new];
}
if (cache_options) {
delete cache_options[value];
delete cache_options[value_new];
}
// update the item if it's selected
if (self.items.indexOf(value_new) !== -1) {
$item = self.getItem(value);
$item_new = $(self.render('item', data));
if ($item.hasClass('active')) $item_new.addClass('active');
$item.replaceWith($item_new);
}
// invalidate last query because we might have updated the sortField
self.lastQuery = null;
// update dropdown contents
if (self.isOpen) {
self.refreshOptions(false);
}
}
|
javascript
|
{
"resource": ""
}
|
|
q20747
|
train
|
function(value, silent) {
var self = this;
value = hash_key(value);
var cache_items = self.renderCache['item'];
var cache_options = self.renderCache['option'];
if (cache_items) delete cache_items[value];
if (cache_options) delete cache_options[value];
delete self.userOptions[value];
delete self.options[value];
self.lastQuery = null;
self.trigger('option_remove', value);
self.removeItem(value, silent);
}
|
javascript
|
{
"resource": ""
}
|
|
q20748
|
train
|
function() {
var self = this;
self.loadedSearches = {};
self.userOptions = {};
self.renderCache = {};
self.options = self.sifter.items = {};
self.lastQuery = null;
self.trigger('option_clear');
self.clear();
}
|
javascript
|
{
"resource": ""
}
|
|
q20749
|
train
|
function(value, $els) {
value = hash_key(value);
if (typeof value !== 'undefined' && value !== null) {
for (var i = 0, n = $els.length; i < n; i++) {
if ($els[i].getAttribute('data-value') === value) {
return $($els[i]);
}
}
}
return $();
}
|
javascript
|
{
"resource": ""
}
|
|
q20750
|
train
|
function(values, silent) {
var items = $.isArray(values) ? values : [values];
for (var i = 0, n = items.length; i < n; i++) {
this.isPending = (i < n - 1);
this.addItem(items[i], silent);
}
}
|
javascript
|
{
"resource": ""
}
|
|
q20751
|
train
|
function(input, triggerDropdown) {
var self = this;
var caret = self.caretPos;
input = input || $.trim(self.$control_input.val() || '');
var callback = arguments[arguments.length - 1];
if (typeof callback !== 'function') callback = function() {};
if (typeof triggerDropdown !== 'boolean') {
triggerDropdown = true;
}
if (!self.canCreate(input)) {
callback();
return false;
}
self.lock();
var setup = (typeof self.settings.create === 'function') ? this.settings.create : function(input) {
var data = {};
data[self.settings.labelField] = input;
data[self.settings.valueField] = input;
return data;
};
var create = once(function(data) {
self.unlock();
if (!data || typeof data !== 'object') return callback();
var value = hash_key(data[self.settings.valueField]);
if (typeof value !== 'string') return callback();
self.setTextboxValue('');
self.addOption(data);
self.setCaret(caret);
self.addItem(value);
self.refreshOptions(triggerDropdown && self.settings.mode !== 'single');
callback(data);
});
var output = setup.apply(this, [input, create]);
if (typeof output !== 'undefined') {
create(output);
}
return true;
}
|
javascript
|
{
"resource": ""
}
|
|
q20752
|
train
|
function() {
var invalid, self = this;
if (self.isRequired) {
if (self.items.length) self.isInvalid = false;
self.$control_input.prop('required', invalid);
}
self.refreshClasses();
}
|
javascript
|
{
"resource": ""
}
|
|
q20753
|
train
|
function() {
var self = this;
var isFull = self.isFull();
var isLocked = self.isLocked;
self.$wrapper
.toggleClass('rtl', self.rtl);
self.$control
.toggleClass('focus', self.isFocused)
.toggleClass('disabled', self.isDisabled)
.toggleClass('required', self.isRequired)
.toggleClass('invalid', self.isInvalid)
.toggleClass('locked', isLocked)
.toggleClass('full', isFull).toggleClass('not-full', !isFull)
.toggleClass('input-active', self.isFocused && !self.isInputHidden)
.toggleClass('dropdown-active', self.isOpen)
.toggleClass('has-options', !$.isEmptyObject(self.options))
.toggleClass('has-items', self.items.length > 0);
self.$control_input.data('grow', !isFull && !isLocked);
}
|
javascript
|
{
"resource": ""
}
|
|
q20754
|
train
|
function() {
var self = this;
if (self.isLocked || self.isOpen || (self.settings.mode === 'multi' && self.isFull())) return;
self.focus();
self.isOpen = true;
self.refreshState();
self.$dropdown.css({visibility: 'hidden', display: 'block'});
self.positionDropdown();
self.$dropdown.css({visibility: 'visible'});
self.trigger('dropdown_open', self.$dropdown);
}
|
javascript
|
{
"resource": ""
}
|
|
q20755
|
train
|
function() {
var $control = this.$control;
var offset = this.settings.dropdownParent === 'body' ? $control.offset() : $control.position();
offset.top += $control.outerHeight(true);
this.$dropdown.css({
width : $control.outerWidth(),
top : offset.top,
left : offset.left
});
}
|
javascript
|
{
"resource": ""
}
|
|
q20756
|
train
|
function($el) {
var caret = Math.min(this.caretPos, this.items.length);
if (caret === 0) {
this.$control.prepend($el);
} else {
$(this.$control[0].childNodes[caret]).before($el);
}
this.setCaret(caret + 1);
}
|
javascript
|
{
"resource": ""
}
|
|
q20757
|
train
|
function(i) {
var self = this;
if (self.settings.mode === 'single') {
i = self.items.length;
} else {
i = Math.max(0, Math.min(self.items.length, i));
}
if(!self.isPending) {
// the input must be moved by leaving it in place and moving the
// siblings, due to the fact that focus cannot be restored once lost
// on mobile webkit devices
var j, n, fn, $children, $child;
$children = self.$control.children(':not(input)');
for (j = 0, n = $children.length; j < n; j++) {
$child = $($children[j]).detach();
if (j < i) {
self.$control_input.before($child);
} else {
self.$control.append($child);
}
}
}
self.caretPos = i;
}
|
javascript
|
{
"resource": ""
}
|
|
q20758
|
train
|
function() {
var self = this;
self.$input.prop('disabled', true);
self.$control_input.prop('disabled', true).prop('tabindex', -1);
self.isDisabled = true;
self.lock();
}
|
javascript
|
{
"resource": ""
}
|
|
q20759
|
train
|
function() {
var self = this;
self.$input.prop('disabled', false);
self.$control_input.prop('disabled', false).prop('tabindex', self.tabIndex);
self.isDisabled = false;
self.unlock();
}
|
javascript
|
{
"resource": ""
}
|
|
q20760
|
train
|
function() {
var self = this;
var eventNS = self.eventNS;
var revertSettings = self.revertSettings;
self.trigger('destroy');
self.off();
self.$wrapper.remove();
self.$dropdown.remove();
self.$input
.html('')
.append(revertSettings.$children)
.removeAttr('tabindex')
.removeClass('selectized')
.attr({tabindex: revertSettings.tabindex})
.show();
self.$control_input.removeData('grow');
self.$input.removeData('selectize');
$(window).off(eventNS);
$(document).off(eventNS);
$(document.body).off(eventNS);
delete self.$input[0].selectize;
}
|
javascript
|
{
"resource": ""
}
|
|
q20761
|
train
|
function(input) {
var self = this;
if (!self.settings.create) return false;
var filter = self.settings.createFilter;
return input.length
&& (typeof filter !== 'function' || filter.apply(self, [input]))
&& (typeof filter !== 'string' || new RegExp(filter).test(input))
&& (!(filter instanceof RegExp) || filter.test(input));
}
|
javascript
|
{
"resource": ""
}
|
|
q20762
|
train
|
function (e) {
var el = $(e.target);
var date = moment(el.val(), this.format);
if (!date.isValid()) return;
var startDate, endDate;
if (el.attr('name') === 'daterangepicker_start') {
startDate = date;
endDate = this.endDate;
} else {
startDate = this.startDate;
endDate = date;
}
this.setCustomDates(startDate, endDate);
}
|
javascript
|
{
"resource": ""
}
|
|
q20763
|
train
|
function( element, method ) {
return $( element ).data( "msg" + method[ 0 ].toUpperCase() +
method.substring( 1 ).toLowerCase() ) || $( element ).data("msg");
}
|
javascript
|
{
"resource": ""
}
|
|
q20764
|
train
|
function( name, method ) {
var m = this.settings.messages[name];
return m && (m.constructor === String ? m : m[method]);
}
|
javascript
|
{
"resource": ""
}
|
|
q20765
|
compareAscending
|
train
|
function compareAscending(a, b) {
var ac = a.criteria,
bc = b.criteria,
index = -1,
length = ac.length;
while (++index < length) {
var value = ac[index],
other = bc[index];
if (value !== other) {
if (value > other || typeof value == 'undefined') {
return 1;
}
if (value < other || typeof other == 'undefined') {
return -1;
}
}
}
// Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
// that causes it, under certain circumstances, to return the same value for
// `a` and `b`. See https://github.com/jashkenas/underscore/pull/1247
//
// This also ensures a stable sort in V8 and other engines.
// See http://code.google.com/p/v8/issues/detail?id=90
return a.index - b.index;
}
|
javascript
|
{
"resource": ""
}
|
q20766
|
slice
|
train
|
function slice(array, start, end) {
start || (start = 0);
if (typeof end == 'undefined') {
end = array ? array.length : 0;
}
var index = -1,
length = end - start || 0,
result = Array(length < 0 ? 0 : length);
while (++index < length) {
result[index] = array[start + index];
}
return result;
}
|
javascript
|
{
"resource": ""
}
|
q20767
|
createAggregator
|
train
|
function createAggregator(setter) {
return function(collection, callback, thisArg) {
var result = {};
callback = createCallback(callback, thisArg, 3);
var index = -1,
length = collection ? collection.length : 0;
if (typeof length == 'number') {
while (++index < length) {
var value = collection[index];
setter(result, value, callback(value, index, collection), collection);
}
} else {
forOwn(collection, function(value, key, collection) {
setter(result, value, callback(value, key, collection), collection);
});
}
return result;
};
}
|
javascript
|
{
"resource": ""
}
|
q20768
|
invert
|
train
|
function invert(object) {
var index = -1,
props = keys(object),
length = props.length,
result = {};
while (++index < length) {
var key = props[index];
result[object[key]] = key;
}
return result;
}
|
javascript
|
{
"resource": ""
}
|
q20769
|
isBoolean
|
train
|
function isBoolean(value) {
return value === true || value === false ||
value && typeof value == 'object' && toString.call(value) == boolClass || false;
}
|
javascript
|
{
"resource": ""
}
|
q20770
|
isString
|
train
|
function isString(value) {
return typeof value == 'string' ||
value && typeof value == 'object' && toString.call(value) == stringClass || false;
}
|
javascript
|
{
"resource": ""
}
|
q20771
|
values
|
train
|
function values(object) {
var index = -1,
props = keys(object),
length = props.length,
result = Array(length);
while (++index < length) {
result[index] = object[props[index]];
}
return result;
}
|
javascript
|
{
"resource": ""
}
|
q20772
|
where
|
train
|
function where(collection, properties, first) {
return (first && isEmpty(properties))
? undefined
: (first ? find : filter)(collection, properties);
}
|
javascript
|
{
"resource": ""
}
|
q20773
|
defer
|
train
|
function defer(func) {
if (!isFunction(func)) {
throw new TypeError;
}
var args = slice(arguments, 1);
return setTimeout(function() { func.apply(undefined, args); }, 1);
}
|
javascript
|
{
"resource": ""
}
|
q20774
|
result
|
train
|
function result(object, key) {
if (object) {
var value = object[key];
return isFunction(value) ? object[key]() : value;
}
}
|
javascript
|
{
"resource": ""
}
|
q20775
|
template
|
train
|
function template(text, data, options) {
var _ = lodash,
settings = _.templateSettings;
text = String(text || '');
options = defaults({}, options, settings);
var index = 0,
source = "__p += '",
variable = options.variable;
var reDelimiters = RegExp(
(options.escape || reNoMatch).source + '|' +
(options.interpolate || reNoMatch).source + '|' +
(options.evaluate || reNoMatch).source + '|$'
, 'g');
text.replace(reDelimiters, function(match, escapeValue, interpolateValue, evaluateValue, offset) {
source += text.slice(index, offset).replace(reUnescapedString, escapeStringChar);
if (escapeValue) {
source += "' +\n_.escape(" + escapeValue + ") +\n'";
}
if (evaluateValue) {
source += "';\n" + evaluateValue + ";\n__p += '";
}
if (interpolateValue) {
source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
}
index = offset + match.length;
return match;
});
source += "';\n";
if (!variable) {
variable = 'obj';
source = 'with (' + variable + ' || {}) {\n' + source + '\n}\n';
}
source = 'function(' + variable + ') {\n' +
"var __t, __p = '', __j = Array.prototype.join;\n" +
"function print() { __p += __j.call(arguments, '') }\n" +
source +
'return __p\n}';
try {
var result = Function('_', 'return ' + source)(_);
} catch(e) {
e.source = source;
throw e;
}
if (data) {
return result(data);
}
result.source = source;
return result;
}
|
javascript
|
{
"resource": ""
}
|
q20776
|
train
|
function (rowMode, types) {
this.command = null
this.rowCount = null
this.oid = null
this.rows = []
this.fields = []
this._parsers = []
this._types = types
this.RowCtor = null
this.rowAsArray = rowMode === 'array'
if (this.rowAsArray) {
this.parseRow = this._parseRowAsArray
}
}
|
javascript
|
{
"resource": ""
}
|
|
q20777
|
arrayString
|
train
|
function arrayString (val) {
var result = '{'
for (var i = 0; i < val.length; i++) {
if (i > 0) {
result = result + ','
}
if (val[i] === null || typeof val[i] === 'undefined') {
result = result + 'NULL'
} else if (Array.isArray(val[i])) {
result = result + arrayString(val[i])
} else if (val[i] instanceof Buffer) {
result += '\\\\x' + val[i].toString('hex')
} else {
result += escapeElement(prepareValue(val[i]))
}
}
result = result + '}'
return result
}
|
javascript
|
{
"resource": ""
}
|
q20778
|
SanitizeCtx
|
train
|
function SanitizeCtx(ctx) {
let r = {};
for (const key in ctx) {
if (!key.startsWith('_')) {
r[key] = ctx[key];
}
}
return r;
}
|
javascript
|
{
"resource": ""
}
|
q20779
|
Load
|
train
|
function Load(pgn) {
let chess = null;
if (Chess.Chess) {
chess = new Chess.Chess();
} else {
chess = new Chess();
}
chess.load_pgn(pgn);
return chess;
}
|
javascript
|
{
"resource": ""
}
|
q20780
|
doLogin
|
train
|
function doLogin() {
// Request the login page.
let res = http.get(baseURL + "/user/login");
check(res, {
"title is correct": (res) => res.html("title").text() == "User account | David li commerce-test",
});
// TODO: Add attr() to k6/html!
// Extract hidden input fields.
let formBuildID = res.body.match('name="form_build_id" value="(.*)"')[1];
group("login", function() {
// Pick a random set of credentials.
let creds = credentials[Math.floor(Math.random()*credentials.length)];
// Create login request.
let formdata = {
name: creds.username,
pass: creds.password,
form_build_id: formBuildID,
form_id: "user_login",
op: "Log in",
};
let headers = { "Content-Type": "application/x-www-form-urlencoded" };
// Send login request
let res = http.post(baseURL + "/user/login", formdata, { headers: headers });
// Verify that we ended up on the user page
check(res, {
"login succeeded": (res) => res.url == `${baseURL}/users/${creds.username}`,
}) || fail("login failed");
});
}
|
javascript
|
{
"resource": ""
}
|
q20781
|
doCategory
|
train
|
function doCategory(category) {
check(http.get(category.url), {
"title is correct": (res) => res.html("title").text() == category.title,
});
for (prodName in category.products) {
if (Math.random() <= category.products[prodName].chance) {
group(prodName, function() { doProductPage(category.products[prodName]) });
}
}
}
|
javascript
|
{
"resource": ""
}
|
q20782
|
doProductPage
|
train
|
function doProductPage(product) {
let res = http.get(product.url);
check(res, {
"title is correct": (res) => res.html("title").text() == product.title,
});
if (Math.random() <= product.chance) {
let formBuildID = res.body.match('name="form_build_id" value="(.*)"')[1];
let formID = res.body.match('name="form_id" value="(.*)"')[1];
let formToken = res.body.match('name="form_token" value="(.*)"')[1];
let productID = res.body.match('name="product_id" value="(.*)"')[1];
group("add to cart", function() {
addProductToCart(product.url, productID, formID, formBuildID, formToken)
});
}
}
|
javascript
|
{
"resource": ""
}
|
q20783
|
addProductToCart
|
train
|
function addProductToCart(url, productID, formID, formBuildID, formToken) {
let formdata = {
product_id: productID,
form_id: formID,
form_build_id: formBuildID,
form_token: formToken,
quantity: 1,
op: "Add to cart",
};
let headers = { "Content-Type": "application/x-www-form-urlencoded" };
let res = http.post(url, formdata, { headers: headers });
// verify add to cart succeeded
check(res, {
"add to cart succeeded": (res) => res.body.includes('Item successfully added to your cart')
}) || fail("add to cart failed");
}
|
javascript
|
{
"resource": ""
}
|
q20784
|
doLogout
|
train
|
function doLogout() {
check(http.get(baseURL + "/user/logout"), {
"logout succeeded": (res) => res.body.includes('<a href="/user/login">Log in')
}) || fail("logout failed");
}
|
javascript
|
{
"resource": ""
}
|
q20785
|
hashNumber
|
train
|
function hashNumber(n) {
if (n !== n || n === Infinity) {
return 0;
}
let hash = n | 0;
if (hash !== n) {
hash ^= n * 0xffffffff;
}
while (n > 0xffffffff) {
n /= 0xffffffff;
hash ^= n;
}
return smi(hash);
}
|
javascript
|
{
"resource": ""
}
|
q20786
|
getIENodeHash
|
train
|
function getIENodeHash(node) {
if (node && node.nodeType > 0) {
switch (node.nodeType) {
case 1: // Element
return node.uniqueID;
case 9: // Document
return node.documentElement && node.documentElement.uniqueID;
}
}
}
|
javascript
|
{
"resource": ""
}
|
q20787
|
getTypePropMap
|
train
|
function getTypePropMap(def) {
var map = {};
def &&
def.extends &&
def.extends.forEach(e => {
var superModule = defs.Immutable;
e.name.split('.').forEach(part => {
superModule =
superModule && superModule.module && superModule.module[part];
});
var superInterface = superModule && superModule.interface;
if (superInterface) {
var interfaceMap = Seq(superInterface.typeParams)
.toKeyedSeq()
.flip()
.map(i => e.args[i])
.toObject();
Seq(interfaceMap).forEach((v, k) => {
map[e.name + '<' + k] = v;
});
var superMap = getTypePropMap(superInterface);
Seq(superMap).forEach((v, k) => {
map[k] = v.k === TypeKind.Param ? interfaceMap[v.param] : v;
});
}
});
return map;
}
|
javascript
|
{
"resource": ""
}
|
q20788
|
resizeCanvas
|
train
|
function resizeCanvas() {
// When zoomed out to less than 100%, for some very strange reason,
// some browsers report devicePixelRatio as less than 1
// and only part of the canvas is cleared then.
var ratio = Math.max(window.devicePixelRatio || 1, 1);
// This part causes the canvas to be cleared
canvas.width = canvas.offsetWidth * ratio;
canvas.height = canvas.offsetHeight * ratio;
canvas.getContext("2d").scale(ratio, ratio);
// This library does not listen for canvas changes, so after the canvas is automatically
// cleared by the browser, SignaturePad#isEmpty might still return false, even though the
// canvas looks empty, because the internal data of this library wasn't cleared. To make sure
// that the state of this library is consistent with visual state of the canvas, you
// have to clear it manually.
signaturePad.clear();
}
|
javascript
|
{
"resource": ""
}
|
q20789
|
logIOS
|
train
|
async function logIOS() {
const rawDevices = execFileSync(
'xcrun',
['simctl', 'list', 'devices', '--json'],
{encoding: 'utf8'},
);
const {devices} = JSON.parse(rawDevices);
const device = findAvailableDevice(devices);
if (device === undefined) {
logger.error('No active iOS device found');
return;
}
tailDeviceLogs(device.udid);
}
|
javascript
|
{
"resource": ""
}
|
q20790
|
printHelpInformation
|
train
|
function printHelpInformation(examples, pkg) {
let cmdName = this._name;
if (this._alias) {
cmdName = `${cmdName}|${this._alias}`;
}
const sourceInformation = pkg
? [`${chalk.bold('Source:')} ${pkg.name}@${pkg.version}`, '']
: [];
let output = [
chalk.bold(`react-native ${cmdName}`),
this._description ? `\n${this._description}\n` : '',
...sourceInformation,
`${chalk.bold('Options:')}`,
this.optionHelp().replace(/^/gm, ' '),
];
if (examples && examples.length > 0) {
const formattedUsage = examples
.map(example => ` ${example.desc}: \n ${chalk.cyan(example.cmd)}`)
.join('\n\n');
output = output.concat([chalk.bold('\nExample usage:'), formattedUsage]);
}
return output.join('\n').concat('\n');
}
|
javascript
|
{
"resource": ""
}
|
q20791
|
copyBinaryFile
|
train
|
function copyBinaryFile(srcPath, destPath, cb) {
let cbCalled = false;
// const {mode} = fs.statSync(srcPath);
const readStream = fs.createReadStream(srcPath);
const writeStream = fs.createWriteStream(destPath);
readStream.on('error', err => {
done(err);
});
writeStream.on('error', err => {
done(err);
});
readStream.on('close', () => {
done();
// We may revisit setting mode to original later, however this fn is used
// before "replace placeholder in template" step, which expects files to be
// writable.
// fs.chmodSync(destPath, mode);
});
readStream.pipe(writeStream);
function done(err) {
if (!cbCalled) {
cb(err);
cbCalled = true;
}
}
}
|
javascript
|
{
"resource": ""
}
|
q20792
|
copyToClipBoard
|
train
|
function copyToClipBoard(content) {
switch (process.platform) {
case 'darwin': {
const child = spawn('pbcopy', []);
child.stdin.end(Buffer.from(content, 'utf8'));
return true;
}
case 'win32': {
const child = spawn('clip', []);
child.stdin.end(Buffer.from(content, 'utf8'));
return true;
}
case 'linux': {
const child = spawn(xsel, ['--clipboard', '--input']);
child.stdin.end(Buffer.from(content, 'utf8'));
return true;
}
default:
return false;
}
}
|
javascript
|
{
"resource": ""
}
|
q20793
|
upgradeProjectFiles
|
train
|
function upgradeProjectFiles(projectDir, projectName) {
// Just overwrite
copyProjectTemplateAndReplace(
path.dirname(require.resolve('react-native/template')),
projectDir,
projectName,
{upgrade: true},
);
}
|
javascript
|
{
"resource": ""
}
|
q20794
|
styleDocument
|
train
|
function styleDocument () {
var headElement, styleElement, style;
// Bail out if document has already been styled
if (getRemarkStylesheet()) {
return;
}
headElement = document.getElementsByTagName('head')[0];
styleElement = document.createElement('style');
styleElement.type = 'text/css';
// Set title in order to enable lookup
styleElement.title = 'remark';
// Set document styles
styleElement.innerHTML = resources.documentStyles;
// Append highlighting styles
for (style in highlighter.styles) {
if (highlighter.styles.hasOwnProperty(style)) {
styleElement.innerHTML = styleElement.innerHTML +
highlighter.styles[style];
}
}
// Put element first to prevent overriding user styles
headElement.insertBefore(styleElement, headElement.firstChild);
}
|
javascript
|
{
"resource": ""
}
|
q20795
|
getRemarkStylesheet
|
train
|
function getRemarkStylesheet () {
var i, l = document.styleSheets.length;
for (i = 0; i < l; ++i) {
if (document.styleSheets[i].title === 'remark') {
return document.styleSheets[i];
}
}
}
|
javascript
|
{
"resource": ""
}
|
q20796
|
getPageRule
|
train
|
function getPageRule (stylesheet) {
var i, l = stylesheet.cssRules.length;
for (i = 0; i < l; ++i) {
if (stylesheet.cssRules[i] instanceof window.CSSPageRule) {
return stylesheet.cssRules[i];
}
}
}
|
javascript
|
{
"resource": ""
}
|
q20797
|
train
|
function ($node, relation) {
if (!$node || !($node instanceof $) || !$node.is('.node')) {
return $();
}
if (relation === 'parent') {
return $node.closest('.nodes').parent().children(':first').find('.node');
} else if (relation === 'children') {
return $node.closest('tr').siblings('.nodes').children().find('.node:first');
} else if (relation === 'siblings') {
return $node.closest('table').parent().siblings().find('.node:first');
} else {
return $();
}
}
|
javascript
|
{
"resource": ""
}
|
|
q20798
|
train
|
function ($node) {
var $upperLevel = $node.closest('.nodes').siblings();
if ($upperLevel.eq(0).find('.spinner').length) {
$node.closest('.orgchart').data('inAjax', false);
}
// hide the sibling nodes
if (this.getNodeState($node, 'siblings').visible) {
this.hideSiblings($node);
}
// hide the lines
var $lines = $upperLevel.slice(1);
$lines.css('visibility', 'hidden');
// hide the superior nodes with transition
var $parent = $upperLevel.eq(0).find('.node');
if (this.getNodeState($parent).visible) {
$parent.addClass('sliding slide-down').one('transitionend', { 'upperLevel': $upperLevel }, this.hideParentEnd);
}
// if the current node has the parent node, hide it recursively
if (this.getNodeState($parent, 'parent').visible) {
this.hideParent($parent);
}
}
|
javascript
|
{
"resource": ""
}
|
|
q20799
|
train
|
function ($node) {
// just show only one superior level
var $upperLevel = $node.closest('.nodes').siblings().removeClass('hidden');
// just show only one line
$upperLevel.eq(2).children().slice(1, -1).addClass('hidden');
// show parent node with animation
var $parent = $upperLevel.eq(0).find('.node');
this.repaint($parent[0]);
$parent.addClass('sliding').removeClass('slide-down').one('transitionend', { 'node': $node }, this.showParentEnd.bind(this));
}
|
javascript
|
{
"resource": ""
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.