_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3
values | text stringlengths 52 373k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q25600 | train | function (serviceAddress, coverageName, wcsVersion) {
if (!serviceAddress || (serviceAddress.length === 0)) {
throw new ArgumentError(
Logger.logMessage(Logger.LEVEL_SEVERE, "WcsTileUrlBuilder", "constructor",
"The WCS service address is missing.")... | javascript | {
"resource": ""
} | |
q25601 | train | function (position, attributes) {
if (!position) {
throw new ArgumentError(
Logger.logMessage(Logger.LEVEL_SEVERE, "Annotation", "constructor", "missingPosition"));
}
Renderable.call(this);
/**
* This annotation's geogra... | javascript | {
"resource": ""
} | |
q25602 | train | function (center, width, height, heading, attributes) {
if (!center) {
throw new ArgumentError(
Logger.logMessage(Logger.LEVEL_SEVERE, "SurfaceRectangle", "constructor", "missingLocation"));
}
if (width < 0 || height < 0) {
throw n... | javascript | {
"resource": ""
} | |
q25603 | train | function (m11, m12, m13,
m21, m22, m23,
m31, m32, m33) {
this[0] = m11;
this[1] = m12;
this[2] = m13;
this[3] = m21;
this[4] = m22;
this[5] = m23;
this[6] = m31;
... | javascript | {
"resource": ""
} | |
q25604 | train | function (message) {
AbstractError.call(this, "UnsupportedOperationError", message);
var stack;
try {
//noinspection ExceptionCaughtLocallyJS
throw new Error();
} catch (e) {
stack = e.stack;
}
this.... | javascript | {
"resource": ""
} | |
q25605 | train | function (sector, level, row, column) {
Tile.call(this, sector, level, row, column); // args are checked in the superclass' constructor
/**
* The transformation matrix that maps tile local coordinates to model coordinates.
* @type {Matrix}
*/
t... | javascript | {
"resource": ""
} | |
q25606 | train | function (serverAddress, pathToData, displayName, configuration) {
var cachePath = WWUtil.urlPath(serverAddress + "/" + pathToData);
TiledImageLayer.call(this,
(configuration && configuration.sector) || Sector.FULL_SPHERE,
(configuration && configuration.levelZer... | javascript | {
"resource": ""
} | |
q25607 | train | function (coverageId, webCoverageService) {
if (!coverageId) {
throw new ArgumentError(
Logger.logMessage(Logger.LEVEL_SEVERE, "WcsCoverage", "constructor", "missingId"));
}
if (!webCoverageService) {
throw new ArgumentError(
... | javascript | {
"resource": ""
} | |
q25608 | train | function (serverAddress, pathToData, displayName, initialTime) {
Layer.call(this, displayName || "Blue Marble time series");
/**
* A value indicating the month to display. The nearest month to the specified time is displayed.
* @type {Date}
* @default Janu... | javascript | {
"resource": ""
} | |
q25609 | train | function () {
var result = {};
var queryString = window.location.href.split("?");
if (queryString && queryString.length > 1) {
var args = queryString[1].split("&");
for (var a = 0; a < args.length; a++) {
var arg = args[a].split("... | javascript | {
"resource": ""
} | |
q25610 | train | function (drawContext) {
if (!drawContext) {
throw new ArgumentError(Logger.logMessage(Logger.LEVEL_SEVERE, "TextRenderer", "constructor",
"missingDc"));
}
// Internal use only. Intentionally not documented.
this.canvas2D = document.cr... | javascript | {
"resource": ""
} | |
q25611 | train | function (worldWindow) {
var thisGoToBox = this;
this.wwd = worldWindow;
$("#searchBox").find("button").on("click", function (e) {
thisGoToBox.onSearchButton(e);
});
this.geocoder = new WorldWind.NominatimGeocoder();
$("#searchText").on("keypress", function ... | javascript | {
"resource": ""
} | |
q25612 | train | function (xmlDom) {
// Create a WmsCapabilities object from the XML DOM
var wms = new WorldWind.WmsCapabilities(xmlDom);
// Retrieve a WmsLayerCapabilities object by the desired layer name
var wmsLayerCapabilities = wms.getNamedLayer(layerName);
// Form a conf... | javascript | {
"resource": ""
} | |
q25613 | train | function(options) {
if(!options.ajax && !options.zip) {
throw new ArgumentError(
Logger.logMessage(Logger.LEVEL_SEVERE, "RemoteDocument", "constructor",
"Invalid option for retrieval specified. Use either ajax or zip option.")
);
}
thi... | javascript | {
"resource": ""
} | |
q25614 | train | function (center, majorRadius, minorRadius, heading, attributes) {
if (!center) {
throw new ArgumentError(
Logger.logMessage(Logger.LEVEL_SEVERE, "SurfaceEllipse", "constructor", "missingLocation"));
}
if (majorRadius < 0 || minorRadius < 0) {
... | javascript | {
"resource": ""
} | |
q25615 | train | function (layerElement, parentNode) {
if (!layerElement) {
throw new ArgumentError(
Logger.logMessage(Logger.LEVEL_SEVERE, "WmsLayerCapabilities", "constructor",
"Layer element is null or undefined."));
}
/**
*... | javascript | {
"resource": ""
} | |
q25616 | train | function (position, eyeDistanceScaling, attributes) {
if (!position) {
throw new ArgumentError(
Logger.logMessage(Logger.LEVEL_SEVERE, "Placemark", "constructor", "missingPosition"));
}
Renderable.call(this);
/**
* The pl... | javascript | {
"resource": ""
} | |
q25617 | train | function (sector, attributes) {
if (!sector) {
throw new ArgumentError(
Logger.logMessage(Logger.LEVEL_SEVERE, "SurfaceSector", "constructor", "missingSector"));
}
SurfaceShape.call(this, attributes);
/**
* This shape's s... | javascript | {
"resource": ""
} | |
q25618 | train | function (config, timeString) {
if (!config) {
throw new ArgumentError(
Logger.logMessage(Logger.LEVEL_SEVERE, "WmsLayer", "constructor", "No configuration specified."));
}
var cachePath = config.service + config.layerNames + config.styleNames;
... | javascript | {
"resource": ""
} | |
q25619 | train | function () {
/**
* The box's center point.
* @type {Vec3}
* @default (0, 0, 0)
*/
this.center = new Vec3(0, 0, 0);
/**
* The center point of the box's bottom. (The origin of the R axis.)
* @type {Vec3}
... | javascript | {
"resource": ""
} | |
q25620 | train | function (config) {
if (!config) {
throw new ArgumentError(
Logger.logMessage(Logger.LEVEL_SEVERE, "TiledElevationCoverage", "constructor", "missingConfig"));
}
if (!config.coverageSector) {
throw new ArgumentError(
... | javascript | {
"resource": ""
} | |
q25621 | train | function (sector, tileMatrix, row, column, imagePath) {
this.sector = sector;
this.tileMatrix = tileMatrix;
this.row = row;
this.column = column;
this.imagePath = imagePath;
this.texelSize = (sector.deltaLatitude() * Angle.DEGREES_TO_RADIANS) / ti... | javascript | {
"resource": ""
} | |
q25622 | train | function (sector, level, row, column, cacheKey) {
if (!cacheKey || (cacheKey.length < 1)) {
throw new ArgumentError(
Logger.logMessage(Logger.LEVEL_SEVERE, "FramebufferTile", "constructor",
"The specified cache name is null, undefined or zero lengt... | javascript | {
"resource": ""
} | |
q25623 | doCalc | train | function doCalc() {
var distance = lengthMeasurer.getLength(pathPositions, false, WorldWind.GREAT_CIRCLE);
var terrainDistance = lengthMeasurer.getLength(pathPositions, true, WorldWind.GREAT_CIRCLE);
var geographicDistance = lengthMeasurer.getGeographicDistance(pathPositions, WorldWi... | javascript | {
"resource": ""
} |
q25624 | train | function(callback) {
this.factory.running = false;
this._clearInterval(callback);
this.callback(this.callbacks.stop);
this.callback(callback);
} | javascript | {
"resource": ""
} | |
q25625 | train | function(callback) {
var t = this;
t._interval(callback);
t.timer = setInterval(function() {
t._interval(callback);
}, this.interval);
} | javascript | {
"resource": ""
} | |
q25626 | train | function(digit) {
var obj = this.createList(digit, {
classes: {
active: this.factory.classes.active,
before: this.factory.classes.before,
flip: this.factory.classes.flip
}
});
this.appendDigitToClock(obj);
} | javascript | {
"resource": ""
} | |
q25627 | train | function(name) {
var lang;
if(FlipClock.Lang[name.ucfirst()]) {
lang = FlipClock.Lang[name.ucfirst()];
}
else if(FlipClock.Lang[name]) {
lang = FlipClock.Lang[name];
}
else {
lang = FlipClock.Lang[this.defaultLanguage];
}
return this.lang = lang;
} | javascript | {
"resource": ""
} | |
q25628 | train | function(callback) {
var t = this;
if(!t.running && (!t.countdown || t.countdown && t.time.time > 0)) {
t.face.start(t.time);
t.timer.start(function() {
t.flip();
if(typeof callback === "function") {
callback();
}
});
}
else {
t.log('Trying to start timer when co... | javascript | {
"resource": ""
} | |
q25629 | train | function(_default, options) {
if(typeof _default !== "object") {
_default = {};
}
if(typeof options !== "object") {
options = {};
}
this.setOptions($.extend(true, {}, _default, options));
} | javascript | {
"resource": ""
} | |
q25630 | train | function(method) {
if(typeof method === "function") {
var args = [];
for(var x = 1; x <= arguments.length; x++) {
if(arguments[x]) {
args.push(arguments[x]);
}
}
method.apply(this, args);
}
} | javascript | {
"resource": ""
} | |
q25631 | train | function(str) {
var data = [];
str = str.toString();
for(var x = 0;x < str.length; x++) {
if(str[x].match(/^\d*$/g)) {
data.push(str[x]);
}
}
return data;
} | javascript | {
"resource": ""
} | |
q25632 | train | function(i) {
var timeStr = this.toString();
var length = timeStr.length;
if(timeStr[length - i]) {
return timeStr[length - i];
}
return false;
} | javascript | {
"resource": ""
} | |
q25633 | train | function(obj) {
var data = [];
$.each(obj, function(i, value) {
value = value.toString();
if(value.length == 1) {
value = '0'+value;
}
for(var x = 0; x < value.length; x++) {
data.push(value.charAt(x));
}
});
if(data.length > this.minimumDigits) {
this.minim... | javascript | {
"resource": ""
} | |
q25634 | train | function(includeSeconds) {
var digits = [
this.getDays(),
this.getHours(true),
this.getMinutes(true)
];
if(includeSeconds) {
digits.push(this.getSeconds(true));
}
return this.digitize(digits);
} | javascript | {
"resource": ""
} | |
q25635 | train | function(date) {
if(!date) {
date = new Date();
}
if (this.time instanceof Date) {
if (this.factory.countdown) {
return Math.max(this.time.getTime()/1000 - date.getTime()/1000,0);
} else {
return date.getTime()/1000 - this.time.getTime()/1000 ;
}
} else {
return this.time;
... | javascript | {
"resource": ""
} | |
q25636 | train | function(totalDigits, digits) {
var total = 0;
var newArray = [];
$.each(digits, function(i, digit) {
if(i < totalDigits) {
total += parseInt(digits[i], 10);
}
else {
newArray.push(digits[i]);
}
});
if(total === 0) {
return newArray;
}
return digits;
} | javascript | {
"resource": ""
} | |
q25637 | train | function(x) {
if(this.time instanceof Date) {
this.time.setSeconds(this.time.getSeconds() + x);
}
else {
this.time += x;
}
} | javascript | {
"resource": ""
} | |
q25638 | createRedisClient | train | function createRedisClient(clientConfig, callback) {
let c = require('config');
let client = null;
let conId = null;
let redisOpts = {
//showFriendlyErrorStack: true,
db: clientConfig.dbIndex,
password: clientConfig.password,
connectionName: clientConfig.connectionName || c.get('redis.connectio... | javascript | {
"resource": ""
} |
q25639 | parseRedisSentinel | train | function parseRedisSentinel(key, sentinelsString) {
if (!sentinelsString) return [];
// convert array entries from string to object if needed
if (Array.isArray(sentinelsString)) {
sentinelsString.forEach(function(entry, index) {
if (typeof entry === 'string') {
let tmp = entry.trim().split(':')... | javascript | {
"resource": ""
} |
q25640 | enableJsonValidationCheck | train | function enableJsonValidationCheck(value, isJsonCheckBox) {
try {
JSON.parse(value);
// if this is valid json and is array or object assume we want validation active
if (value.match(/^\s*[{\[]/)) {
$(isJsonCheckBox).click();
}
}
catch (ex) {
// do nothing
}
} | javascript | {
"resource": ""
} |
q25641 | addInputValidator | train | function addInputValidator(inputId, format, currentState) {
var input;
if (typeof inputId === 'string') {
input = $('#' + inputId)
}
else if (typeof inputId === 'object') {
input = inputId;
}
if (!input){
console.log('Invalid html id given to validate format: ', inputId);
return;
}
swi... | javascript | {
"resource": ""
} |
q25642 | validateInputAsJson | train | function validateInputAsJson() {
if (this.value) {
try {
JSON.parse(this.value);
setValidationClasses(this, true);
}
catch(e) {
setValidationClasses(this, false);
}
}
else {
setValidationClasses(this, false)
}
} | javascript | {
"resource": ""
} |
q25643 | setValidationClasses | train | function setValidationClasses(element, success) {
var add = (success ? 'validate-positive' : 'validate-negative');
var remove = (success ? 'validate-negative' : 'validate-positive');
if (element.className.indexOf(add) < 0) {
$(element).removeClass(remove).addClass(add);
}
} | javascript | {
"resource": ""
} |
q25644 | renderEjs | train | function renderEjs(filename, data, element, callback) {
$.get(filename)
.done(function(htmlTmpl) {
element.html(ejs.render(htmlTmpl, data));
})
.fail(function(error) {
console.log('failed to get html template ' + filename + ': ' + JSON.stringify(error));
alert('failed to fetch html templ... | javascript | {
"resource": ""
} |
q25645 | getConnection | train | function getConnection (req, res, next, connectionId) {
let con = req.app.locals.redisConnections.find(function(connection) {
return (connection.options.connectionId === connectionId);
});
if (con) {
res.locals.connection = con;
res.locals.connectionId = connectionId;
}
else {
console.error('C... | javascript | {
"resource": ""
} |
q25646 | postExec | train | function postExec (req, res) {
let cmd = req.body.cmd;
let connection = res.locals.connection;
let parts = myutil.split(cmd);
parts[0] = parts[0].toLowerCase();
let commandName = parts[0].toLowerCase();
// must be in our white list to be allowed in read only mode
if (req.app.locals.redisReadOnly) {
i... | javascript | {
"resource": ""
} |
q25647 | train | function(options, callback) {
return AuthenticationRequest.builder()
.withPath('/api/token')
.withBodyParameters({
grant_type: 'client_credentials'
})
.withBodyParameters(options)
.withHeaders({
Authorization:
'Basic ' +
new Buffer(
this.... | javascript | {
"resource": ""
} | |
q25648 | train | function(code, callback) {
return AuthenticationRequest.builder()
.withPath('/api/token')
.withBodyParameters({
grant_type: 'authorization_code',
redirect_uri: this.getRedirectURI(),
code: code,
client_id: this.getClientId(),
client_secret: this.getClientSecret()
... | javascript | {
"resource": ""
} | |
q25649 | train | function(trackId, options, callback) {
// In case someone is using a version where options parameter did not exist.
var actualCallback, actualOptions;
if (typeof options === 'function' && !callback) {
actualCallback = options;
actualOptions = {};
} else {
actualCallback = callback;
... | javascript | {
"resource": ""
} | |
q25650 | train | function(trackIds, options, callback) {
// In case someone is using a version where options parameter did not exist.
var actualCallback, actualOptions;
if (typeof options === 'function' && !callback) {
actualCallback = options;
actualOptions = {};
} else {
actualCallback = callback;
... | javascript | {
"resource": ""
} | |
q25651 | train | function(query, types, options, callback) {
return WebApiRequest.builder(this.getAccessToken())
.withPath('/v1/search/')
.withQueryParameters(
{
type: types.join(','),
q: query
},
options
)
.build()
.execute(HttpManager.get, callback);
} | javascript | {
"resource": ""
} | |
q25652 | train | function(userId, options, callback) {
var path;
if (typeof userId === 'string') {
path = '/v1/users/' + encodeURIComponent(userId) + '/playlists';
} else if (typeof userId === 'object') {
callback = options;
options = userId;
path = '/v1/me/playlists';
} /* undefined */ else {
... | javascript | {
"resource": ""
} | |
q25653 | train | function(userId, playlistName, options, callback) {
// In case someone is using a version where options parameter did not exist.
var actualCallback;
if (typeof options === 'function' && !callback) {
actualCallback = options;
} else {
actualCallback = callback;
}
var actualOptions = ... | javascript | {
"resource": ""
} | |
q25654 | train | function(playlistId, options, callback) {
return WebApiRequest.builder(this.getAccessToken())
.withPath('/v1/playlists/' + playlistId + '/followers')
.withHeaders({ 'Content-Type': 'application/json' })
.withBodyParameters(options)
.build()
.execute(HttpManager.put, callback);
} | javascript | {
"resource": ""
} | |
q25655 | train | function(playlistId, callback) {
return WebApiRequest.builder(this.getAccessToken())
.withPath('/v1/playlists/' + playlistId + '/followers')
.withHeaders({ 'Content-Type': 'application/json' })
.build()
.execute(HttpManager.del, callback);
} | javascript | {
"resource": ""
} | |
q25656 | train | function(playlistId, tracks, options, callback) {
return WebApiRequest.builder(this.getAccessToken())
.withPath('/v1/playlists/' + playlistId + '/tracks')
.withHeaders({ 'Content-Type': 'application/json' })
.withQueryParameters(options)
.withBodyParameters({
uris: tracks
})
... | javascript | {
"resource": ""
} | |
q25657 | train | function(
playlistId,
positions,
snapshotId,
callback
) {
return WebApiRequest.builder(this.getAccessToken())
.withPath('/v1/playlists/' + playlistId + '/tracks')
.withHeaders({ 'Content-Type': 'application/json' })
.withBodyParameters({
positions: positions,
snap... | javascript | {
"resource": ""
} | |
q25658 | train | function(
playlistId,
rangeStart,
insertBefore,
options,
callback
) {
return WebApiRequest.builder(this.getAccessToken())
.withPath('/v1/playlists/' + playlistId + '/tracks')
.withHeaders({ 'Content-Type': 'application/json' })
.withBodyParameters(
{
range_s... | javascript | {
"resource": ""
} | |
q25659 | train | function(options, callback) {
var _opts = {};
var optionsOfTypeArray = ['seed_artists', 'seed_genres', 'seed_tracks'];
for (var option in options) {
if (options.hasOwnProperty(option)) {
if (
optionsOfTypeArray.indexOf(option) !== -1 &&
Object.prototype.toString.call(option... | javascript | {
"resource": ""
} | |
q25660 | train | function(scopes, state, showDialog) {
return AuthenticationRequest.builder()
.withPath('/authorize')
.withQueryParameters({
client_id: this.getClientId(),
response_type: 'code',
redirect_uri: this.getRedirectURI(),
scope: scopes.join('%20'),
state: state,
... | javascript | {
"resource": ""
} | |
q25661 | train | function(trackIds, callback) {
return WebApiRequest.builder(this.getAccessToken())
.withPath('/v1/me/tracks')
.withHeaders({ 'Content-Type': 'application/json' })
.withBodyParameters({ ids: trackIds })
.build()
.execute(HttpManager.del, callback);
} | javascript | {
"resource": ""
} | |
q25662 | train | function(albumIds, callback) {
return WebApiRequest.builder(this.getAccessToken())
.withPath('/v1/me/albums')
.withHeaders({ 'Content-Type': 'application/json' })
.withBodyParameters(albumIds)
.build()
.execute(HttpManager.del, callback);
} | javascript | {
"resource": ""
} | |
q25663 | train | function(options, callback) {
return WebApiRequest.builder(this.getAccessToken())
.withPath('/v1/me/player')
.withHeaders({ 'Content-Type': 'application/json' })
.withBodyParameters({
device_ids: options.deviceIds,
play: !!options.play
})
.build()
.execute(HttpMan... | javascript | {
"resource": ""
} | |
q25664 | train | function(options, callback) {
/*jshint camelcase: false */
var _options = options || {};
var queryParams = _options.device_id
? { device_id: _options.device_id }
: null;
var postData = {};
['context_uri', 'uris', 'offset'].forEach(function(field) {
if (field in _options) {
... | javascript | {
"resource": ""
} | |
q25665 | train | function(options, callback) {
return (
WebApiRequest.builder(this.getAccessToken())
.withPath('/v1/me/player/pause')
/*jshint camelcase: false */
.withQueryParameters(
options && options.device_id ? { device_id: options.device_id } : null
)
.withHeaders({ 'Con... | javascript | {
"resource": ""
} | |
q25666 | train | function(callback) {
return WebApiRequest.builder(this.getAccessToken())
.withPath('/v1/me/player/previous')
.withHeaders({ 'Content-Type': 'application/json' })
.build()
.execute(HttpManager.post, callback);
} | javascript | {
"resource": ""
} | |
q25667 | train | function(options, callback) {
return WebApiRequest.builder(this.getAccessToken())
.withPath('/v1/me/player/repeat')
.withQueryParameters({
state: options.state || 'off'
})
.build()
.execute(HttpManager.put, callback);
} | javascript | {
"resource": ""
} | |
q25668 | train | function(userIds, callback) {
return WebApiRequest.builder(this.getAccessToken())
.withPath('/v1/me/following')
.withQueryParameters({
ids: userIds.join(','),
type: 'user'
})
.build()
.execute(HttpManager.del, callback);
} | javascript | {
"resource": ""
} | |
q25669 | train | function(options, callback) {
return WebApiRequest.builder(this.getAccessToken())
.withPath('/v1/me/following')
.withHeaders({ 'Content-Type': 'application/json' })
.withQueryParameters(
{
type: 'artist'
},
options
)
.build()
.execute(HttpManager... | javascript | {
"resource": ""
} | |
q25670 | train | function(userId, playlistId, followerIds, callback) {
return WebApiRequest.builder(this.getAccessToken())
.withPath(
'/v1/users/' +
encodeURIComponent(userId) +
'/playlists/' +
playlistId +
'/followers/contains'
)
.withQueryParameters({
ids: ... | javascript | {
"resource": ""
} | |
q25671 | isValidState | train | function isValidState(state, isBee) {
const validStates = isBee ? BEE_STATES : BULL_STATES;
return _.includes(validStates, state);
} | javascript | {
"resource": ""
} |
q25672 | _json | train | async function _json(req, res) {
const { queueName, queueHost, state } = req.params;
const {Queues} = req.app.locals;
const queue = await Queues.get(queueName, queueHost);
if (!queue) return res.status(404).json({ message: 'Queue not found' });
if (!isValidState(state, queue.IS_BEE)) return res.status(400).j... | javascript | {
"resource": ""
} |
q25673 | _html | train | async function _html(req, res) {
const { queueName, queueHost, state } = req.params;
const {Queues} = req.app.locals;
const queue = await Queues.get(queueName, queueHost);
const basePath = req.baseUrl;
if (!queue) return res.status(404).render('dashboard/templates/queueNotFound', {basePath, queueName, queueHo... | javascript | {
"resource": ""
} |
q25674 | toPersianNumber | train | function toPersianNumber(number) {
// List of standard persian numbers from 0 to 9
const persianDigits = ['۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹'];
return number
.toString()
.replace(/\d/g, x => persianDigits[x]);
} | javascript | {
"resource": ""
} |
q25675 | _subclassObject | train | function _subclassObject(tree, base, extension, extName) {
// $.ui.fancytree.debug("_subclassObject", tree, base, extension, extName);
for (var attrName in extension) {
if (typeof extension[attrName] === "function") {
if (typeof tree[attrName] === "function") {
// override existing method
tree[attr... | javascript | {
"resource": ""
} |
q25676 | train | function(node, mode) {
var i, n;
mode = mode || "child";
if (node === false) {
for (i = this.children.length - 1; i >= 0; i--) {
n = this.children[i];
if (n.statusNodeType === "paging") {
this.removeChild(n);
}
}
this.partload = false;
return;
}
node = $.extend(
... | javascript | {
"resource": ""
} | |
q25677 | train | function(patch) {
// patch [key, null] means 'remove'
if (patch === null) {
this.remove();
return _getResolvedPromise(this);
}
// TODO: make sure that root node is not collapsed or modified
// copy (most) attributes to node.ATTR or node.data.ATTR
var name,
promise,
v,
IGNORE_MAP = ... | javascript | {
"resource": ""
} | |
q25678 | train | function(deep) {
var cl = this.children,
i,
l,
n;
if (!cl) {
return 0;
}
n = cl.length;
if (deep !== false) {
for (i = 0, l = n; i < l; i++) {
n += cl[i].countChildren();
}
}
return n;
} | javascript | {
"resource": ""
} | |
q25679 | train | function() {
if (this.lazy) {
if (this.children == null) {
// null or undefined: Not yet loaded
return undefined;
} else if (this.children.length === 0) {
// Loaded, but response was empty
return false;
} else if (
this.children.length === 1 &&
this.children[0].isStatusNode(... | javascript | {
"resource": ""
} | |
q25680 | train | function(opts) {
var i,
that = this,
deferreds = [],
dfd = new $.Deferred(),
parents = this.getParentList(false, false),
len = parents.length,
effects = !(opts && opts.noAnimation === true),
scroll = !(opts && opts.scrollIntoView === false);
// Expand bottom-up, so only the top node i... | javascript | {
"resource": ""
} | |
q25681 | _goto | train | function _goto(n) {
if (n) {
// setFocus/setActive will scroll later (if autoScroll is specified)
try {
n.makeVisible({ scrollIntoView: false });
} catch (e) {} // #272
// Node may still be hidden by a filter
if (!$(n.span).is(":visible")) {
n.debug("Navigate: skipping hidden no... | javascript | {
"resource": ""
} |
q25682 | train | function(cmp, deep) {
var i,
l,
cl = this.children;
if (!cl) {
return;
}
cmp =
cmp ||
function(a, b) {
var x = a.title.toLowerCase(),
y = b.title.toLowerCase();
return x === y ? 0 : x > y ? 1 : -1;
};
cl.sort(cmp);
if (deep) {
for (i = 0, l = cl.length; i <... | javascript | {
"resource": ""
} | |
q25683 | train | function(value, flag) {
var className,
hasClass,
rnotwhite = /\S+/g,
classNames = value.match(rnotwhite) || [],
i = 0,
wasAdded = false,
statusElem = this[this.tree.statusClassPropName],
curClasses = " " + (this.extraClasses || "") + " ";
// this.info("toggleClass('" + value + "', " +... | javascript | {
"resource": ""
} | |
q25684 | train | function(operation, childNode, extra) {
var data,
modifyChild = this.tree.options.modifyChild;
if (modifyChild) {
if (childNode && childNode.parent !== this) {
$.error(
"childNode " + childNode + " is not a child of " + this
);
}
data = {
node: this,
tree: this.tree,
... | javascript | {
"resource": ""
} | |
q25685 | train | function(flag) {
flag = flag !== false; // Confusing use of '!'
/*jshint -W018 */ if (!!this._enableUpdate === !!flag) {
return flag;
}
/*jshint +W018 */
this._enableUpdate = flag;
if (flag) {
this.debug("enableUpdate(true): redraw "); //, this._dirtyRoots);
this.render();
} else {
... | javascript | {
"resource": ""
} | |
q25686 | train | function(match, startNode, visibleOnly) {
match =
typeof match === "string"
? _makeNodeTitleStartMatcher(match)
: match;
startNode = startNode || this.getFirstChild();
var stopNode = null,
parentChildren = startNode.parent.children,
matchingNode = null,
walkVisible = function(parent,... | javascript | {
"resource": ""
} | |
q25687 | train | function(key, searchRoot) {
// Search the DOM by element ID (assuming this is faster than traversing all nodes).
var el, match;
// TODO: use tree.keyMap if available
// TODO: check opts.generateIds === true
if (!searchRoot) {
el = document.getElementById(this.options.idPrefix + key);
if (el) {
... | javascript | {
"resource": ""
} | |
q25688 | train | function(ctx, callOpts) {
// TODO: return promise?
var ac,
i,
l,
node = ctx.node;
if (node.parent) {
ac = node.parent.children;
for (i = 0, l = ac.length; i < l; i++) {
if (ac[i] !== node && ac[i].expanded) {
this._callHook(
"nodeSetExpanded",
ac[i],
... | javascript | {
"resource": ""
} | |
q25689 | train | function(ctx) {
var node = ctx.node;
// FT.debug("nodeRemoveMarkup()", node.toString());
// TODO: Unlink attr.ftnode to support GC
if (node.li) {
$(node.li).remove();
node.li = null;
}
this.nodeRemoveChildMarkup(ctx);
} | javascript | {
"resource": ""
} | |
q25690 | train | function(ctx, flag) {
// ctx.node.debug("nodeSetFocus(" + flag + ")");
var ctx2,
tree = ctx.tree,
node = ctx.node,
opts = tree.options,
// et = ctx.originalEvent && ctx.originalEvent.type,
isInput = ctx.originalEvent
? $(ctx.originalEvent.target).is(":input")
: false;
f... | javascript | {
"resource": ""
} | |
q25691 | train | function(ctx) {
var tree = ctx.tree;
tree.activeNode = null;
tree.focusNode = null;
tree.$div.find(">ul.fancytree-container").empty();
// TODO: call destructors and remove reference loops
tree.rootNode.children = null;
} | javascript | {
"resource": ""
} | |
q25692 | train | function(el) {
var widget;
if (el instanceof Fancytree) {
return el; // el already was a Fancytree
}
if (el === undefined) {
el = 0; // get first tree
}
if (typeof el === "number") {
el = $(".fancytree-container").eq(el); // el was an integer: return nth instance
} else if (t... | javascript | {
"resource": ""
} | |
q25693 | train | function(
optionName,
node,
nodeObject,
treeOptions,
defaultValue
) {
var ctx,
res,
tree = node.tree,
treeOpt = treeOptions[optionName],
nodeOpt = nodeObject[optionName];
if ($.isFunction(treeOpt)) {
ctx = {
node: node,
tree: tree,
widget: tree.... | javascript | {
"resource": ""
} | |
q25694 | train | function(span, baseClass, icon) {
var $span = $(span);
if (typeof icon === "string") {
$span.attr("class", baseClass + " " + icon);
} else {
// support object syntax: { text: ligature, addClasse: classname }
if (icon.text) {
$span.text("" + icon.text);
} else if (icon.html) {
... | javascript | {
"resource": ""
} | |
q25695 | train | function(event) {
// Poor-man's hotkeys. See here for a complete implementation:
// https://github.com/jeresig/jquery.hotkeys
var which = event.which,
et = event.type,
s = [];
if (event.altKey) {
s.push("alt");
}
if (event.ctrlKey) {
s.push("ctrl");
}
if (event.met... | javascript | {
"resource": ""
} | |
q25696 | train | function(instance, methodName, handler, context) {
var prevSuper,
_super = instance[methodName] || $.noop;
instance[methodName] = function() {
var self = context || this;
try {
prevSuper = self._super;
self._super = _super;
return handler.apply(self, arguments);
} finally... | javascript | {
"resource": ""
} | |
q25697 | train | function(definition) {
_assert(
definition.name != null,
"extensions must have a `name` property."
);
_assert(
definition.version != null,
"extensions must have a `version` property."
);
$.ui.fancytree._extensions[definition.name] = definition;
} | javascript | {
"resource": ""
} | |
q25698 | train | function() {
var level = 0;
var levels = [0,0,0,0,0,0,0];
var hLevelText = '';
var prependText = '';
var prevLevel = 0;
var n = 0;
self.children('*:header:visible').each(function(index, heading) {
log('Processing heading %o', heading);
level = parseInt(heading.tagName.su... | javascript | {
"resource": ""
} | |
q25699 | train | function() {
if (!config.debug) {
return;
}
try {
console.log.apply(console, arguments);
} catch(e) {
try {
opera.postError.apply(opera, arguments);
} catch(e){}
}
} | javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.