_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3
values | text stringlengths 52 373k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q21600 | processIssueHtml | train | function processIssueHtml(element) {
let outerHTML = null;
let innerHTML = null;
if (!element.outerHTML) {
return outerHTML;
}
outerHTML = element.outerHTML;
if (element.innerHTML.length > 31) {
innerHTML = `${element.innerHTML.substr(0, 31)}...`;
outerHTML = outerHTML.replace(element.inne... | javascript | {
"resource": ""
} |
q21601 | getCssSelectorForElement | train | function getCssSelectorForElement(element, selectorParts = []) {
if (isElementNode(element)) {
const identifier = buildElementIdentifier(element);
selectorParts.unshift(identifier);
if (!element.id && element.parentNode) {
return getCssSelectorForElement(element.parentNode, selectorParts);
}
... | javascript | {
"resource": ""
} |
q21602 | buildElementIdentifier | train | function buildElementIdentifier(element) {
if (element.id) {
return `#${element.id}`;
}
let identifier = element.tagName.toLowerCase();
if (!element.parentNode) {
return identifier;
}
const siblings = getSiblings(element);
const childIndex = siblings.indexOf(element);
if (!isOnlySiblingO... | javascript | {
"resource": ""
} |
q21603 | isOnlySiblingOfType | train | function isOnlySiblingOfType(element, siblings) {
const siblingsOfType = siblings.filter(sibling => {
return (sibling.tagName === element.tagName);
});
return (siblingsOfType.length <= 1);
} | javascript | {
"resource": ""
} |
q21604 | isIssueNotIgnored | train | function isIssueNotIgnored(issue) {
if (options.ignore.indexOf(issue.code.toLowerCase()) !== -1) {
return false;
}
if (options.ignore.indexOf(issue.type) !== -1) {
return false;
}
return true;
} | javascript | {
"resource": ""
} |
q21605 | isElementOutsideHiddenArea | train | function isElementOutsideHiddenArea(issue) {
const hiddenElements = [...window.document.querySelectorAll(options.hideElements)];
return !hiddenElements.some(hiddenElement => {
return hiddenElement.contains(issue.element);
});
} | javascript | {
"resource": ""
} |
q21606 | generate | train | function generate() {
store.generate(req);
originalId = req.sessionID;
originalHash = hash(req.session);
wrapmethods(req.session);
} | javascript | {
"resource": ""
} |
q21607 | inflate | train | function inflate (req, sess) {
store.createSession(req, sess)
originalId = req.sessionID
originalHash = hash(sess)
if (!resaveSession) {
savedHash = originalHash
}
wrapmethods(req.session)
} | javascript | {
"resource": ""
} |
q21608 | shouldSave | train | function shouldSave(req) {
// cannot set cookie without a session ID
if (typeof req.sessionID !== 'string') {
debug('session ignored because of bogus req.sessionID %o', req.sessionID);
return false;
}
return !saveUninitializedSession && cookieId !== req.sessionID
? isMod... | javascript | {
"resource": ""
} |
q21609 | shouldTouch | train | function shouldTouch(req) {
// cannot set cookie without a session ID
if (typeof req.sessionID !== 'string') {
debug('session ignored because of bogus req.sessionID %o', req.sessionID);
return false;
}
return cookieId === req.sessionID && !shouldSave(req);
} | javascript | {
"resource": ""
} |
q21610 | shouldSetCookie | train | function shouldSetCookie(req) {
// cannot set cookie without a session ID
if (typeof req.sessionID !== 'string') {
return false;
}
return cookieId !== req.sessionID
? saveUninitializedSession || isModified(req.session)
: rollingSessions || req.session.cookie.expires != n... | javascript | {
"resource": ""
} |
q21611 | hash | train | function hash(sess) {
// serialize
var str = JSON.stringify(sess, function (key, val) {
// ignore sess.cookie property
if (this === sess && key === 'cookie') {
return
}
return val
})
// hash
return crypto
.createHash('sha1')
.update(str, 'utf8')
.digest('hex')
} | javascript | {
"resource": ""
} |
q21612 | issecure | train | function issecure(req, trustProxy) {
// socket is https server
if (req.connection && req.connection.encrypted) {
return true;
}
// do not trust proxy
if (trustProxy === false) {
return false;
}
// no explicit trust; try req.secure from express
if (trustProxy !== true) {
return req.secure =... | javascript | {
"resource": ""
} |
q21613 | unsigncookie | train | function unsigncookie(val, secrets) {
for (var i = 0; i < secrets.length; i++) {
var result = signature.unsign(val, secrets[i]);
if (result !== false) {
return result;
}
}
return false;
} | javascript | {
"resource": ""
} |
q21614 | Session | train | function Session(req, data) {
Object.defineProperty(this, 'req', { value: req });
Object.defineProperty(this, 'id', { value: req.sessionID });
if (typeof data === 'object' && data !== null) {
// merge data into this, ignoring prototype properties
for (var prop in data) {
if (!(prop in this)) {
... | javascript | {
"resource": ""
} |
q21615 | fix_and_export | train | function fix_and_export(class_name) {
var Src = window.bigdecimal[class_name];
var Fixed = Src;
if(Src.__init__) {
Fixed = function wrap_constructor() {
var args = Array.prototype.slice.call(arguments);
return Src.__init__(args);
};
Fixed.prototype = Src.prototype;
for (var a in Src)... | javascript | {
"resource": ""
} |
q21616 | multiply | train | function multiply(x, k, base) {
var m, temp, xlo, xhi,
carry = 0,
i = x.length,
klo = k % SQRT_BASE,
khi = k / SQRT_BASE | 0;
for (x = x.slice(); i--;) {
xlo = x[i] % SQRT_BASE;
xhi = x[i] / SQRT_BASE | 0;
m = khi * xlo + xhi * klo;
... | javascript | {
"resource": ""
} |
q21617 | isOdd | train | function isOdd(n) {
var k = n.c.length - 1;
return bitFloor(n.e / LOG_BASE) == k && n.c[k] % 2 != 0;
} | javascript | {
"resource": ""
} |
q21618 | Deflate | train | function Deflate(options) {
if (!(this instanceof Deflate)) return new Deflate(options);
this.options = utils.assign({
level: Z_DEFAULT_COMPRESSION,
method: Z_DEFLATED,
chunkSize: 16384,
windowBits: 15,
memLevel: 8,
strategy: Z_DEFAULT_STRATEGY,
to: ''
}, options || {});
var opt = ... | javascript | {
"resource": ""
} |
q21619 | Inflate | train | function Inflate(options) {
if (!(this instanceof Inflate)) return new Inflate(options);
this.options = utils.assign({
chunkSize: 16384,
windowBits: 0,
to: ''
}, options || {});
var opt = this.options;
// Force window size for `raw` data, if not set directly,
// because we have no header for ... | javascript | {
"resource": ""
} |
q21620 | filterDepWithoutEntryPoints | train | function filterDepWithoutEntryPoints(dep) {
// Return true if we want to add a dependency to externals
try {
// If the root of the dependency has an index.js, return true
if (fs.existsSync(path.join(__dirname, `node_modules/${dep}/index.js`))) {
return false;
}
const pgkString = fs
.read... | javascript | {
"resource": ""
} |
q21621 | createDebug | train | function createDebug(namespace) {
let prevTime;
function debug(...args) {
// Disabled?
if (!debug.enabled) {
return;
}
const self = debug;
// Set `diff` timestamp
const curr = Number(new Date());
const ms = curr - (prevTime || curr);
self.diff = ms;
self.prev = prevTime;
self.cu... | javascript | {
"resource": ""
} |
q21622 | disable | train | function disable() {
const namespaces = [
...createDebug.names.map(toNamespace),
...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)
].join(',');
createDebug.enable('');
return namespaces;
} | javascript | {
"resource": ""
} |
q21623 | enabled | train | function enabled(name) {
if (name[name.length - 1] === '*') {
return true;
}
let i;
let len;
for (i = 0, len = createDebug.skips.length; i < len; i++) {
if (createDebug.skips[i].test(name)) {
return false;
}
}
for (i = 0, len = createDebug.names.length; i < len; i++) {
if (createDebug.n... | javascript | {
"resource": ""
} |
q21624 | load | train | function load() {
let r;
try {
r = exports.storage.getItem('debug');
} catch (error) {
// Swallow
// XXX (@Qix-) should we be logging these?
}
// If debug isn't set in LS, and we're in Electron, try to load $DEBUG
if (!r && typeof process !== 'undefined' && 'env' in process) {
r = process.env.DEBUG;
}
... | javascript | {
"resource": ""
} |
q21625 | useColors | train | function useColors() {
return 'colors' in exports.inspectOpts ?
Boolean(exports.inspectOpts.colors) :
tty.isatty(process.stderr.fd);
} | javascript | {
"resource": ""
} |
q21626 | formatArgs | train | function formatArgs(args) {
const {namespace: name, useColors} = this;
if (useColors) {
const c = this.color;
const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c);
const prefix = ` ${colorCode};1m${name} \u001B[0m`;
args[0] = prefix + args[0].split('\n').join('\n' + prefix);
args.push(colorCode + 'm+'... | javascript | {
"resource": ""
} |
q21627 | init | train | function init(debug) {
debug.inspectOpts = {};
const keys = Object.keys(exports.inspectOpts);
for (let i = 0; i < keys.length; i++) {
debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
}
} | javascript | {
"resource": ""
} |
q21628 | train | function(Jupyter, kernel) {
if (kernel.comm_manager && kernel.widget_manager === undefined) {
// Clear any old widget manager
if (Jupyter.WidgetManager) {
Jupyter.WidgetManager._managers[0].clear_state();
}
// Create a new widget manager instance. Use the global
... | javascript | {
"resource": ""
} | |
q21629 | render | train | function render(output, data, node) {
// data is a model id
var manager = Jupyter.notebook && Jupyter.notebook.kernel && Jupyter.notebook.kernel.widget_manager;
if (!manager) {
node.textContent = "Error rendering Jupyter widget: missing widget manager";
return;
}
... | javascript | {
"resource": ""
} |
q21630 | train | function(json, md, element) {
var toinsert = this.create_output_subarea(md, CLASS_NAME, MIME_TYPE);
this.keyboard_manager.register_events(toinsert);
render(this, json, toinsert[0]);
element.append(toinsert);
return toinsert;
} | javascript | {
"resource": ""
} | |
q21631 | createWidget | train | function createWidget(widgetType, value, description) {
// Create the widget model.
return manager.new_model({
model_module: '@jupyter-widgets/controls',
model_name: widgetType + 'Model',
model_id: 'widget-1'
// Create a view for the model.
}).then(fu... | javascript | {
"resource": ""
} |
q21632 | getImports | train | function getImports(sourceFile) {
var imports = [];
handleNode(sourceFile);
function handleNode(node) {
switch (node.kind) {
case ts.SyntaxKind.ImportDeclaration:
imports.push(node.moduleSpecifier.text);
break;
case ts.SyntaxKind.ImportEqualsD... | javascript | {
"resource": ""
} |
q21633 | validate | train | function validate(dname) {
var filenames = glob.sync(dname + '/src/*.ts*');
filenames = filenames.concat(glob.sync(dname + '/src/**/*.ts*'));
if (filenames.length == 0) {
return [];
}
var imports = [];
try {
var pkg = require(path.resolve(dname) + '/package.json');
} catch... | javascript | {
"resource": ""
} |
q21634 | handlePackage | train | function handlePackage(packagePath) {
// Read in the package.json.
var packagePath = path.join(packagePath, 'package.json');
try {
var package = require(packagePath);
} catch (e) {
console.log('Skipping package ' + packagePath);
return;
}
// Update dependencies as appropriate.
if (package.dep... | javascript | {
"resource": ""
} |
q21635 | train | function( name, constructor ) {
if( typeof constructor !== 'function' ) {
throw new Error( 'Please register a constructor function' );
}
if( this._components[ name ] !== undefined ) {
throw new Error( 'Component ' + name + ' is already registered' );
}
this._components[ name ] = constructor;
} | javascript | {
"resource": ""
} | |
q21636 | train | function() {
var config = $.extend( true, {}, this.config );
config.content = [];
var next = function( configNode, item ) {
var key, i;
for( key in item.config ) {
if( key !== 'content' ) {
configNode[ key ] = item.config[ key ];
}
}
if( item.contentItems.length ) {
configNode.co... | javascript | {
"resource": ""
} | |
q21637 | train | function( name ) {
if( this._components[ name ] === undefined ) {
throw new lm.errors.ConfigurationError( 'Unknown component ' + name );
}
return this._components[ name ];
} | javascript | {
"resource": ""
} | |
q21638 | train | function() {
if( document.readyState === 'loading' || document.body === null ) {
$(document).ready( lm.utils.fnBind( this.init, this ));
return;
}
this._setContainer();
this.dropTargetIndicator = new lm.controls.DropTargetIndicator( this.container );
this.transitionIndicator = new lm.controls.Transiti... | javascript | {
"resource": ""
} | |
q21639 | train | function( config, parent ) {
var typeErrorMsg, contentItem;
if( typeof config.type !== 'string' ) {
throw new lm.errors.ConfigurationError( 'Missing parameter \'type\'', config );
}
if( !this._typeToItem[ config.type ] ) {
typeErrorMsg = 'Unknown type \'' + config.type + '\'. ' +
'Valid types are ' ... | javascript | {
"resource": ""
} | |
q21640 | train | function( contentItem, index ) {
var tab = new lm.controls.Tab( this, contentItem );
if( this.tabs.length === 0 ) {
this.tabs.push( tab );
this.tabsContainer.append( tab.element );
return;
}
if( index === undefined ) {
index = this.tabs.length;
}
if( index > 0 ) {
this.tabs[ index - 1 ... | javascript | {
"resource": ""
} | |
q21641 | train | function( contentItem ) {
for( var i = 0; i < this.tabs.length; i++ ) {
if( this.tabs[ i ].contentItem === contentItem ) {
this.tabs[ i ]._$destroy();
this.tabs.splice( i, 1 );
return;
}
}
throw new Error( 'contentItem is not controlled by this header' );
} | javascript | {
"resource": ""
} | |
q21642 | train | function() {
var availableWidth = this.element.outerWidth() - this.controlsContainer.outerWidth(),
totalTabWidth = 0,
tabElement,
i,
marginLeft,
gap;
for( i = 0; i < this.tabs.length; i++ ) {
tabElement = this.tabs[ i ].element;
/*
* In order to show every tab's close icon, decrement the ... | javascript | {
"resource": ""
} | |
q21643 | train | function( functionName, functionArguments, bottomUp, skipSelf ) {
var i;
if( bottomUp !== true && skipSelf !== true ) {
this[ functionName ].apply( this, functionArguments || [] );
}
for( i = 0; i < this.contentItems.length; i++ ) {
this.contentItems[ i ].callDownwards( functionName, functionArguments, b... | javascript | {
"resource": ""
} | |
q21644 | train | function( element ) {
element = element || this.element;
var offset = element.offset(),
width = element.width(),
height = element.height();
return {
x1: offset.left,
y1: offset.top,
x2: offset.left + width,
y2: offset.top + height,
surface: width * height,
contentItem: this
};
} | javascript | {
"resource": ""
} | |
q21645 | train | function( name, event ) {
if( event instanceof lm.utils.BubblingEvent &&
event.isPropagationStopped === false &&
this.isInitialised === true ) {
/**
* In some cases (e.g. if an element is created from a DragSource) it
* doesn't have a parent and is not below root. If that's the case
* propaga... | javascript | {
"resource": ""
} | |
q21646 | train | function( name, event ) {
if( lm.utils.indexOf( name, this._throttledEvents ) === -1 ) {
this.layoutManager.emit( name, event.origin );
} else {
if( this._pendingEventPropagations[ name ] !== true ) {
this._pendingEventPropagations[ name ] = true;
lm.utils.animFrame( lm.utils.fnBind( this._propagateEv... | javascript | {
"resource": ""
} | |
q21647 | train | function( oldChild, newChild ) {
var size = oldChild.config[ this._dimension ];
lm.items.AbstractContentItem.prototype.replaceChild.call( this, oldChild, newChild );
newChild.config[ this._dimension ] = size;
this.callDownwards( 'setSize' );
this.emitBubblingEvent( 'stateChanged' );
} | javascript | {
"resource": ""
} | |
q21648 | train | function() {
if( this.isInitialised === true ) return;
var i;
lm.items.AbstractContentItem.prototype._$init.call( this );
for( i = 0; i < this.contentItems.length - 1; i++ ) {
this.contentItems[ i ].element.after( this._createSplitter( i ).element );
}
} | javascript | {
"resource": ""
} | |
q21649 | train | function( splitter ) {
var index = lm.utils.indexOf( splitter, this._splitter );
return {
before: this.contentItems[ index ],
after: this.contentItems[ index + 1 ]
};
} | javascript | {
"resource": ""
} | |
q21650 | train | function( splitter, offsetX, offsetY ) {
var offset = this._isColumn ? offsetY : offsetX;
if( offset > this._splitterMinPosition && offset < this._splitterMaxPosition ) {
this._splitterPosition = offset;
splitter.element.css( this._isColumn ? 'top' : 'left', offset );
}
} | javascript | {
"resource": ""
} | |
q21651 | train | function( splitter ) {
var items = this._getItemsForSplitter( splitter ),
sizeBefore = items.before.element[ this._dimension ](),
sizeAfter = items.after.element[ this._dimension ](),
splitterPositionInRange = ( this._splitterPosition + sizeBefore ) / ( sizeBefore + sizeAfter ),
totalRelativeSize = items... | javascript | {
"resource": ""
} | |
q21652 | train | function( root ) {
var config, next, i;
if( this.isInitialised === false ) {
throw new Error( 'Can\'t create config, layout not yet initialised' );
}
if( root && !( root instanceof lm.items.AbstractContentItem ) ) {
throw new Error( 'Root must be a ContentItem' );
}
/*
* settings & labels
*/
... | javascript | {
"resource": ""
} | |
q21653 | train | function() {
/**
* Create the popout windows straight away. If popouts are blocked
* an error is thrown on the same 'thread' rather than a timeout and can
* be caught. This also prevents any further initilisation from taking place.
*/
if( this._subWindowsCreated === false ) {
this._createSubWindows(... | javascript | {
"resource": ""
} | |
q21654 | train | function( config, parent ) {
var typeErrorMsg, contentItem;
if( typeof config.type !== 'string' ) {
throw new lm.errors.ConfigurationError( 'Missing parameter \'type\'', config );
}
if( config.type === 'react-component' ) {
config.type = 'component';
config.componentName = 'lm-react-component';
}
... | javascript | {
"resource": ""
} | |
q21655 | train | function( configOrContentItem, dimensions, parentId, indexInParent ) {
var config = configOrContentItem,
isItem = configOrContentItem instanceof lm.items.AbstractContentItem,
self = this,
windowLeft,
windowTop,
offset,
parent,
child,
browserPopout;
parentId = parentId || null;
if( isItem... | javascript | {
"resource": ""
} | |
q21656 | train | function( contentItemOrConfig, parent ) {
if( !contentItemOrConfig ) {
throw new Error( 'No content item defined' );
}
if( lm.utils.isFunction( contentItemOrConfig ) ) {
contentItemOrConfig = contentItemOrConfig();
}
if( contentItemOrConfig instanceof lm.items.AbstractContentItem ) {
return content... | javascript | {
"resource": ""
} | |
q21657 | train | function() {
var popInButton = $( '<div class="lm_popin" title="' + this.config.labels.popin + '">' +
'<div class="lm_icon"></div>' +
'<div class="lm_bg"></div>' +
'</div>' );
popInButton.on( 'click', lm.utils.fnBind( function() {
this.emit( 'popIn' );
}, this ) );
document.title = lm.utils.stripT... | javascript | {
"resource": ""
} | |
q21658 | train | function() {
if( this.config.settings.closePopoutsOnUnload === true ) {
for( var i = 0; i < this.openPopouts.length; i++ ) {
this.openPopouts[ i ].close();
}
}
} | javascript | {
"resource": ""
} | |
q21659 | train | function() {
// If there is no min width set, or not content items, do nothing.
if( !this._useResponsiveLayout() || this._updatingColumnsResponsive || !this.config.dimensions || !this.config.dimensions.minItemWidth || this.root.contentItems.length === 0 || !this.root.contentItems[ 0 ].isRow ) {
this._firstLoad ... | javascript | {
"resource": ""
} | |
q21660 | train | function( container, node ) {
if( node.type === 'stack' ) {
node.contentItems.forEach( function( item ) {
container.addChild( item );
node.removeChild( item, true );
} );
}
else {
node.contentItems.forEach( lm.utils.fnBind( function( item ) {
this._addChildContentItemsToContainer( container, ... | javascript | {
"resource": ""
} | |
q21661 | train | function( stackContainers, node ) {
node.contentItems.forEach( lm.utils.fnBind( function( item ) {
if( item.type == 'stack' ) {
stackContainers.push( item );
}
else if( !item.isComponent ) {
this._findAllStackContainersRecursive( stackContainers, item );
}
}, this ) );
} | javascript | {
"resource": ""
} | |
q21662 | train | function() {
var contentItem,
isClosable,
len,
i;
isClosable = this.header._isClosable();
for( i = 0, len = this.contentItems.length; i < len; i++ ) {
if( !isClosable ) {
break;
}
isClosable = this.contentItems[ i ].config.isClosable;
}
this.header._$setClosable( isClosable );
} | javascript | {
"resource": ""
} | |
q21663 | train | function( x, y ) {
var segment, area;
for( segment in this._contentAreaDimensions ) {
area = this._contentAreaDimensions[ segment ].hoverArea;
if( area.x1 < x && area.x2 > x && area.y1 < y && area.y2 > y ) {
if( segment === 'header' ) {
this._dropSegment = 'header';
this._highlightHeaderDropZ... | javascript | {
"resource": ""
} | |
q21664 | train | function( e ) {
e && e.preventDefault();
if( this.isMaximised === true ) {
this.layoutManager._$minimiseItem( this );
} else {
this.layoutManager._$maximiseItem( this );
}
this.isMaximised = !this.isMaximised;
this.emitBubblingEvent( 'stateChanged' );
} | javascript | {
"resource": ""
} | |
q21665 | train | function( id ) {
if( !this.config.id ) {
return false;
} else if( typeof this.config.id === 'string' ) {
return this.config.id === id;
} else if( this.config.id instanceof Array ) {
return lm.utils.indexOf( id, this.config.id ) !== -1;
}
} | javascript | {
"resource": ""
} | |
q21666 | train | function( id ) {
if( !this.hasId( id ) ) {
throw new Error( 'Id not found' );
}
if( typeof this.config.id === 'string' ) {
delete this.config.id;
} else if( this.config.id instanceof Array ) {
var index = lm.utils.indexOf( id, this.config.id );
this.config.id.splice( index, 1 );
}
} | javascript | {
"resource": ""
} | |
q21667 | train | function() {
var childConfig,
parentItem,
index = this._indexInParent;
if( this._parentId ) {
/*
* The $.extend call seems a bit pointless, but it's crucial to
* copy the config returned by this.getGlInstance().toConfig()
* onto a new object. Internet Explorer keeps the references
* to ob... | javascript | {
"resource": ""
} | |
q21668 | train | function() {
var checkReadyInterval,
url = this._createUrl(),
/**
* Bogus title to prevent re-usage of existing window with the
* same title. The actual title will be set by the new window's
* GoldenLayout instance if it detects that it is in subWindowMode
*/
title = Math.floor( Math.random(... | javascript | {
"resource": ""
} | |
q21669 | train | function() {
var config = { content: this._config },
storageKey = 'gl-window-config-' + lm.utils.getUniqueId(),
urlParts;
config = ( new lm.utils.ConfigMinifier() ).minifyConfig( config );
try {
localStorage.setItem( storageKey, JSON.stringify( config ) );
} catch( e ) {
throw new Error( 'Error wh... | javascript | {
"resource": ""
} | |
q21670 | train | function( form ) {
var inputGroups = form.find( '.inputGroup' ),
isValid = true,
inputGroup,
i;
for( i = 0; i < inputGroups.length; i++ ) {
inputGroup = $( inputGroups[ i ] );
if( $.trim( inputGroup.find( 'input' ).val() ).length === 0 ) {
inputGroup.addClass( 'error' );
isValid = fals... | javascript | {
"resource": ""
} | |
q21671 | train | function( offsetX, offsetY, event ) {
event = event.originalEvent && event.originalEvent.touches ? event.originalEvent.touches[ 0 ] : event;
var x = event.pageX,
y = event.pageY,
isWithinContainer = x > this._minX && x < this._maxX && y > this._minY && y < this._maxY;
if( !isWithinContainer && this._layo... | javascript | {
"resource": ""
} | |
q21672 | train | function( x, y ) {
this.element.css( { left: x, top: y } );
this._area = this._layoutManager._$getArea( x, y );
if( this._area !== null ) {
this._lastValidArea = this._area;
this._area.contentItem._$highlightDropZone( x, y, this._area );
}
} | javascript | {
"resource": ""
} | |
q21673 | train | function() {
var dimensions = this._layoutManager.config.dimensions,
width = dimensions.dragProxyWidth,
height = dimensions.dragProxyHeight;
this.element.width( width );
this.element.height( height );
width -= ( this._sided ? dimensions.headerHeight : 0 );
height -= ( !this._sided ? dimensions.headerHe... | javascript | {
"resource": ""
} | |
q21674 | train | function( position ) {
var previous = this.parent._header.show;
if( this.parent._docker && this.parent._docker.docked )
throw new Error( 'Can\'t change header position in docked stack' );
if( previous && !this.parent._side )
previous = 'top';
if( position !== undefined && this.parent._header.show != posit... | javascript | {
"resource": ""
} | |
q21675 | train | function( isClosable ) {
this._canDestroy = isClosable || this.tabs.length > 1;
if( this.closeButton && this._isClosable() ) {
this.closeButton.element[ isClosable ? "show" : "hide" ]();
return true;
}
return false;
} | javascript | {
"resource": ""
} | |
q21676 | train | function( isDockable ) {
if ( this.dockButton && this.parent._header && this.parent._header.dock ) {
this.dockButton.element.toggle( !!isDockable );
return true;
}
return false;
} | javascript | {
"resource": ""
} | |
q21677 | train | function() {
ReactDOM.unmountComponentAtNode( this._container.getElement()[ 0 ] );
this._container.off( 'open', this._render, this );
this._container.off( 'destroy', this._destroy, this );
} | javascript | {
"resource": ""
} | |
q21678 | train | function( nextProps, nextState ) {
this._container.setState( nextState );
this._originalComponentWillUpdate.call( this._reactComponent, nextProps, nextState );
} | javascript | {
"resource": ""
} | |
q21679 | train | function() {
var componentName = this._container._config.component;
var reactClass;
if( !componentName ) {
throw new Error( 'No react component name. type: react-component needs a field `component`' );
}
reactClass = this._container.layoutManager.getComponent( componentName );
if( !reactClass ) {
t... | javascript | {
"resource": ""
} | |
q21680 | train | function() {
var defaultProps = {
glEventHub: this._container.layoutManager.eventHub,
glContainer: this._container,
ref: this._gotReactComponent.bind( this )
};
var props = $.extend( defaultProps, this._container._config.props );
return React.createElement( this._reactClass, props );
} | javascript | {
"resource": ""
} | |
q21681 | train | function( contentItem, index, _$suspendResize ) {
var newItemSize, itemSize, i, splitterElement;
contentItem = this.layoutManager._$normalizeContentItem( contentItem, this );
if( index === undefined ) {
index = this.contentItems.length;
}
if( this.contentItems.length > 0 ) {
splitterElement = this._... | javascript | {
"resource": ""
} | |
q21682 | train | function() {
if( this.isInitialised === true ) return;
var i;
lm.items.AbstractContentItem.prototype._$init.call( this );
for( i = 0; i < this.contentItems.length - 1; i++ ) {
this.contentItems[ i ].element.after( this._createSplitter( i ).element );
}
for( i = 0; i < this.contentItems.length; i++ ) {... | javascript | {
"resource": ""
} | |
q21683 | train | function() {
var i,
totalSplitterSize = (this.contentItems.length - 1) * this._splitterSize,
headerSize = this.layoutManager.config.dimensions.headerHeight,
totalWidth = this.element.width(),
totalHeight = this.element.height(),
totalAssigned = 0,
additionalPixel,
itemSize,
itemSizes = [];
... | javascript | {
"resource": ""
} | |
q21684 | train | function() {
var minItemWidth = this.layoutManager.config.dimensions ? (this.layoutManager.config.dimensions.minItemWidth || 0) : 0,
sizeData = null,
entriesOverMin = [],
totalOverMin = 0,
totalUnderMin = 0,
remainingWidth = 0,
itemSize = 0,
contentItem = null,
reducePercent,
reducedWidth,
... | javascript | {
"resource": ""
} | |
q21685 | train | function( index ) {
var splitter;
splitter = new lm.controls.Splitter( this._isColumn, this._splitterSize, this._splitterGrabSize );
splitter.on( 'drag', lm.utils.fnBind( this._onSplitterDrag, this, [ splitter ] ), this );
splitter.on( 'dragStop', lm.utils.fnBind( this._onSplitterDragStop, this, [ splitter ] ),... | javascript | {
"resource": ""
} | |
q21686 | train | function ( index ) {
if ( typeof index == 'undefined' ) {
var count = 0;
for (var i = 0; i < this.contentItems.length; ++i)
if ( this._isDocked( i ) )
count++;
return count;
}
if ( index < this.contentItems.length )
return this.contentItems[ index ]._docker && this.contentItems[ index ]._dock... | javascript | {
"resource": ""
} | |
q21687 | train | function ( that ) {
that = that || this;
var can = that.contentItems.length - that._isDocked() > 1;
for (var i = 0; i < that.contentItems.length; ++i )
if ( that.contentItems[ i ] instanceof lm.items.Stack ) {
that.contentItems[ i ].header._setDockable( that._isDocked( i ) || can );
that.contentItems[ ... | javascript | {
"resource": ""
} | |
q21688 | train | function( arr ) {
var minWidth = 0, minHeight = 0;
for( var i = 0; i < arr.length; ++i ) {
minWidth = Math.max( arr[ i ].minWidth || 0, minWidth );
minHeight = Math.max( arr[ i ].minHeight || 0, minHeight );
}
return { horizontal: minWidth, vertical: minHeight };
} | javascript | {
"resource": ""
} | |
q21689 | train | function() {
this.element.off( 'mousedown touchstart', this._onTabClickFn );
this.closeElement.off( 'click touchstart', this._onCloseClickFn );
if( this._dragListener ) {
this.contentItem.off( 'destroy', this._dragListener.destroy, this._dragListener );
this._dragListener.off( 'dragStart', this._onDragStart... | javascript | {
"resource": ""
} | |
q21690 | train | function( x, y ) {
if( !this.header._canDestroy )
return null;
if( this.contentItem.parent.isMaximised === true ) {
this.contentItem.parent.toggleMaximise();
}
new lm.controls.DragProxy(
x,
y,
this._dragListener,
this._layoutManager,
this.contentItem,
this.header.parent
);
} | javascript | {
"resource": ""
} | |
q21691 | train | function( event ) {
// left mouse button or tap
if( event.button === 0 || event.type === 'touchstart' ) {
this.header.parent.setActiveContentItem( this.contentItem );
// middle mouse button
} else if( event.button === 1 && this.contentItem.config.isClosable ) {
this._onCloseClick( event );
}
} | javascript | {
"resource": ""
} | |
q21692 | updateStepAboveIO | train | function updateStepAboveIO() {
io.stepAbove = stepEl.map((el, i) => {
const marginTop = -offsetMargin + stepOffsetHeight[i];
const marginBottom = offsetMargin - viewH;
const rootMargin = `${marginTop}px 0px ${marginBottom}px 0px`;
const options = { rootMargin };
// console.log(options)... | javascript | {
"resource": ""
} |
q21693 | updateStepProgressIO | train | function updateStepProgressIO() {
io.stepProgress = stepEl.map((el, i) => {
const marginTop = stepOffsetHeight[i] - offsetMargin;
const marginBottom = -viewH + offsetMargin;
const rootMargin = `${marginTop}px 0px ${marginBottom}px 0px`;
const threshold = createThreshold(stepOffsetHeight[i]);... | javascript | {
"resource": ""
} |
q21694 | train | function(model) {
this.localStorage().setItem(this.name+"-"+model.id, JSON.stringify(model));
if (!_.include(this.records, model.id.toString()))
this.records.push(model.id.toString()); this.save();
return this.find(model);
} | javascript | {
"resource": ""
} | |
q21695 | train | function() {
return _(this.records).chain()
.map(function(id){
return this.jsonData(this.localStorage().getItem(this.name+"-"+id));
}, this)
.compact()
.value();
} | javascript | {
"resource": ""
} | |
q21696 | train | function(model) {
if (model.isNew())
return false
this.localStorage().removeItem(this.name+"-"+model.id);
this.records = _.reject(this.records, function(id){
return id === model.id.toString();
});
this.save();
return model;
} | javascript | {
"resource": ""
} | |
q21697 | train | function (name, data, o) {
// be sure sub folders exist
var parent = parentFolder(name), dataType = JSZip.utils.getTypeOf(data);
if (parent) {
folderAdd.call(this, parent);
}
o = prepareFileAttrs(o);
if (o.dir || data === null || typeof data === "undefined") {
o.b... | javascript | {
"resource": ""
} | |
q21698 | train | function (file, compression) {
var result = new JSZip.CompressedObject(), content;
// the data has not been decompressed, we might reuse things !
if (file._data instanceof JSZip.CompressedObject) {
result.uncompressedSize = file._data.uncompressedSize;
result.crc32 = file._data.crc3... | javascript | {
"resource": ""
} | |
q21699 | train | function(name, file, compressedObject, offset) {
var data = compressedObject.compressedContent,
utfEncodedFileName = this.utf8encode(file.name),
useUTF8 = utfEncodedFileName !== file.name,
o = file.options,
dosTime,
dosDate;
// date
// @see http... | javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.