repo stringclasses 192 values | path stringlengths 4 115 | func_name stringlengths 0 45 | original_string stringlengths 74 24k | language stringclasses 1 value | code stringlengths 74 24k | code_tokens listlengths 23 4.2k | docstring stringlengths 2 23.7k | docstring_tokens listlengths 1 810 | sha stringclasses 192 values | url stringlengths 90 200 | partition stringclasses 1 value | summary stringlengths 6 313 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
firebase/firebase-js-sdk | packages/auth/demo/public/script.js | onPopupRedirectGenericProviderClick | function onPopupRedirectGenericProviderClick() {
var providerId = $('#popup-redirect-generic-providerid').val();
var provider = new firebase.auth.OAuthProvider(providerId);
signInWithPopupRedirect(provider);
} | javascript | function onPopupRedirectGenericProviderClick() {
var providerId = $('#popup-redirect-generic-providerid').val();
var provider = new firebase.auth.OAuthProvider(providerId);
signInWithPopupRedirect(provider);
} | [
"function",
"onPopupRedirectGenericProviderClick",
"(",
")",
"{",
"var",
"providerId",
"=",
"$",
"(",
"'#popup-redirect-generic-providerid'",
")",
".",
"val",
"(",
")",
";",
"var",
"provider",
"=",
"new",
"firebase",
".",
"auth",
".",
"OAuthProvider",
"(",
"prov... | Performs the corresponding popup/redirect action for a generic provider. | [
"Performs",
"the",
"corresponding",
"popup",
"/",
"redirect",
"action",
"for",
"a",
"generic",
"provider",
"."
] | 491598a499813dacc23724de5e237ec220cc560e | https://github.com/firebase/firebase-js-sdk/blob/491598a499813dacc23724de5e237ec220cc560e/packages/auth/demo/public/script.js#L918-L922 | train | Popup redirect generic provider click handler. | [
30522,
3853,
2006,
16340,
6279,
5596,
7442,
6593,
6914,
22420,
21572,
17258,
2121,
20464,
6799,
1006,
1007,
1063,
13075,
10802,
3593,
1027,
1002,
1006,
1005,
1001,
3769,
6279,
1011,
2417,
7442,
6593,
1011,
12391,
1011,
10802,
3593,
1005,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/incubator-echarts | src/visual/VisualMapping.js | function () {
var thisOption = this.option;
return zrUtil.bind(
thisOption.mappingMethod === 'category'
? function (value, isNormalized) {
!isNormalized && (value = this._normalizeData(value));
return doMapCategory.call(this, value);
}
: function (value, isNormalized, out) {
// If output rgb array
// which will be much faster and useful in pixel manipulation
var returnRGBArray = !!out;
!isNormalized && (value = this._normalizeData(value));
out = zrColor.fastLerp(value, thisOption.parsedVisual, out);
return returnRGBArray ? out : zrColor.stringify(out, 'rgba');
},
this
);
} | javascript | function () {
var thisOption = this.option;
return zrUtil.bind(
thisOption.mappingMethod === 'category'
? function (value, isNormalized) {
!isNormalized && (value = this._normalizeData(value));
return doMapCategory.call(this, value);
}
: function (value, isNormalized, out) {
// If output rgb array
// which will be much faster and useful in pixel manipulation
var returnRGBArray = !!out;
!isNormalized && (value = this._normalizeData(value));
out = zrColor.fastLerp(value, thisOption.parsedVisual, out);
return returnRGBArray ? out : zrColor.stringify(out, 'rgba');
},
this
);
} | [
"function",
"(",
")",
"{",
"var",
"thisOption",
"=",
"this",
".",
"option",
";",
"return",
"zrUtil",
".",
"bind",
"(",
"thisOption",
".",
"mappingMethod",
"===",
"'category'",
"?",
"function",
"(",
"value",
",",
"isNormalized",
")",
"{",
"!",
"isNormalized... | Create a mapper function
@return {Function} | [
"Create",
"a",
"mapper",
"function"
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/visual/VisualMapping.js#L146-L165 | train | Returns a function that will be called when the data is not already in the cache | [
30522,
3853,
1006,
1007,
1063,
13075,
2023,
7361,
3508,
1027,
2023,
1012,
5724,
1025,
2709,
1062,
22134,
4014,
1012,
14187,
1006,
2023,
7361,
3508,
1012,
12375,
11368,
6806,
2094,
1027,
1027,
1027,
1005,
4696,
1005,
1029,
3853,
1006,
3643,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.table/src/sap/ui/table/TableGrouping.js | function(oTable, oRef, bExpand) {
var $Ref = jQuery(oRef);
var $GroupRef;
if ($Ref.hasClass("sapUiTableTreeIcon") || (TableGrouping.isTreeMode(oTable) && $Ref.hasClass("sapUiTableCellFirst"))) {
$GroupRef = $Ref.closest("tr", oTable.getDomRef());
} else {
$GroupRef = $Ref.closest(".sapUiTableGroupHeader", oTable.getDomRef());
}
var oBinding = oTable.getBinding("rows");
if ($GroupRef.length > 0 && oBinding) {
var iGroupHeaderRowIndex = +$GroupRef.attr("data-sap-ui-rowindex");
var oRow = oTable.getRows()[iGroupHeaderRowIndex];
if (oRow) {
var iAbsoluteRowIndex = oRow.getIndex();
var bIsExpanded = TableGrouping.toggleGroupHeader(oTable, iAbsoluteRowIndex, bExpand);
var bChanged = bIsExpanded === true || bIsExpanded === false;
if (bChanged && oTable._onGroupHeaderChanged) {
oTable._onGroupHeaderChanged(iAbsoluteRowIndex, bIsExpanded);
}
return bChanged;
}
}
return false;
} | javascript | function(oTable, oRef, bExpand) {
var $Ref = jQuery(oRef);
var $GroupRef;
if ($Ref.hasClass("sapUiTableTreeIcon") || (TableGrouping.isTreeMode(oTable) && $Ref.hasClass("sapUiTableCellFirst"))) {
$GroupRef = $Ref.closest("tr", oTable.getDomRef());
} else {
$GroupRef = $Ref.closest(".sapUiTableGroupHeader", oTable.getDomRef());
}
var oBinding = oTable.getBinding("rows");
if ($GroupRef.length > 0 && oBinding) {
var iGroupHeaderRowIndex = +$GroupRef.attr("data-sap-ui-rowindex");
var oRow = oTable.getRows()[iGroupHeaderRowIndex];
if (oRow) {
var iAbsoluteRowIndex = oRow.getIndex();
var bIsExpanded = TableGrouping.toggleGroupHeader(oTable, iAbsoluteRowIndex, bExpand);
var bChanged = bIsExpanded === true || bIsExpanded === false;
if (bChanged && oTable._onGroupHeaderChanged) {
oTable._onGroupHeaderChanged(iAbsoluteRowIndex, bIsExpanded);
}
return bChanged;
}
}
return false;
} | [
"function",
"(",
"oTable",
",",
"oRef",
",",
"bExpand",
")",
"{",
"var",
"$Ref",
"=",
"jQuery",
"(",
"oRef",
")",
";",
"var",
"$GroupRef",
";",
"if",
"(",
"$Ref",
".",
"hasClass",
"(",
"\"sapUiTableTreeIcon\"",
")",
"||",
"(",
"TableGrouping",
".",
"is... | Toggles the expand / collapse state of the group which contains the given DOM element.
@param {sap.ui.table.Table} oTable Instance of the table.
@param {Object} oRef DOM reference of an element within the table group header
@param {boolean} [bExpand] If defined instead of toggling the desired state is set.
@returns {boolean} Whether the operation was performed. | [
"Toggles",
"the",
"expand",
"/",
"collapse",
"state",
"of",
"the",
"group",
"which",
"contains",
"the",
"given",
"DOM",
"element",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableGrouping.js#L194-L223 | train | Toggle the group header of the table. | [
30522,
3853,
1006,
27178,
3085,
1010,
10848,
2546,
1010,
2022,
2595,
9739,
2094,
1007,
1063,
13075,
1002,
25416,
1027,
1046,
4226,
2854,
1006,
10848,
2546,
1007,
1025,
13075,
1002,
2177,
2890,
2546,
1025,
2065,
1006,
1002,
25416,
1012,
2038... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | lib/jsdoc/ui5/template/publish.js | createNamespaceTree | function createNamespaceTree() {
info("create namespace tree (" + __db().count() + " symbols)");
var aRootNamespaces = [];
var aTypes = __db(function() { return isFirstClassSymbol(this); }).get();
for (var i = 0; i < aTypes.length; i++) { // loop with a for-loop as it can handle concurrent modifications
var symbol = aTypes[i];
if ( symbol.memberof ) {
var parent = lookup(symbol.memberof);
if ( !parent ) {
warning("create missing namespace '" + symbol.memberof + "' (referenced by " + symbol.longname + ")");
parent = makeNamespace(symbol.memberof);
__longnames[symbol.memberof] = parent;
__db.insert(parent);
aTypes.push(parent); // concurrent modification: parent will be processed later in this loop
}
symbol.__ui5.parent = parent;
parent.__ui5.children = parent.__ui5.children || [];
parent.__ui5.children.push(symbol);
} else if ( symbol.longname !== ANONYMOUS_LONGNAME ) {
aRootNamespaces.push(symbol);
}
}
return aRootNamespaces;
} | javascript | function createNamespaceTree() {
info("create namespace tree (" + __db().count() + " symbols)");
var aRootNamespaces = [];
var aTypes = __db(function() { return isFirstClassSymbol(this); }).get();
for (var i = 0; i < aTypes.length; i++) { // loop with a for-loop as it can handle concurrent modifications
var symbol = aTypes[i];
if ( symbol.memberof ) {
var parent = lookup(symbol.memberof);
if ( !parent ) {
warning("create missing namespace '" + symbol.memberof + "' (referenced by " + symbol.longname + ")");
parent = makeNamespace(symbol.memberof);
__longnames[symbol.memberof] = parent;
__db.insert(parent);
aTypes.push(parent); // concurrent modification: parent will be processed later in this loop
}
symbol.__ui5.parent = parent;
parent.__ui5.children = parent.__ui5.children || [];
parent.__ui5.children.push(symbol);
} else if ( symbol.longname !== ANONYMOUS_LONGNAME ) {
aRootNamespaces.push(symbol);
}
}
return aRootNamespaces;
} | [
"function",
"createNamespaceTree",
"(",
")",
"{",
"info",
"(",
"\"create namespace tree (\"",
"+",
"__db",
"(",
")",
".",
"count",
"(",
")",
"+",
"\" symbols)\"",
")",
";",
"var",
"aRootNamespaces",
"=",
"[",
"]",
";",
"var",
"aTypes",
"=",
"__db",
"(",
... | ---- namespace tree -------------------------------------------------------------------------------- /*
Completes the tree of namespaces. Namespaces for which content is available
but which have not been documented are created as dummy without documentation. | [
"----",
"namespace",
"tree",
"--------------------------------------------------------------------------------",
"/",
"*",
"Completes",
"the",
"tree",
"of",
"namespaces",
".",
"Namespaces",
"for",
"which",
"content",
"is",
"available",
"but",
"which",
"have",
"not",
"been... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/jsdoc/ui5/template/publish.js#L650-L682 | train | Creates a namespace tree for the class | [
30522,
3853,
3443,
18442,
23058,
13334,
1006,
1007,
1063,
18558,
1006,
1000,
3443,
3415,
15327,
3392,
1006,
1000,
1009,
1035,
1035,
16962,
1006,
1007,
1012,
4175,
1006,
1007,
1009,
1000,
9255,
1007,
1000,
1007,
1025,
13075,
12098,
17206,
18... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js | createContextInterface | function createContextInterface(oWithControl, mSettings, i, vBindingOrContext) {
/*
* Returns the single binding or model context related to the current formatter call.
*
* @param {number} [iPart]
* index of part in case of the root formatter of a composite binding
* @returns {sap.ui.model.Binding|sap.ui.model.Context}
* single binding or model context
*/
function getBindingOrContext(iPart) {
if (!vBindingOrContext) {
// lazy initialization
// BEWARE: this is not yet defined when createContextInterface() is called!
vBindingOrContext = oWithControl.getBinding("any");
if (vBindingOrContext instanceof CompositeBinding) {
vBindingOrContext = vBindingOrContext.getBindings();
if (i !== undefined) { // not a root formatter
vBindingOrContext = vBindingOrContext[i];
}
}
}
return Array.isArray(vBindingOrContext)
? vBindingOrContext[iPart]
: vBindingOrContext;
}
/**
* Returns the resolved path for the given single binding or model context.
*
* @param {sap.ui.model.Binding|sap.ui.model.Context} oBindingOrContext
* single binding or model context
* @returns {string}
* the resolved path
*/
function getPath(oBindingOrContext) {
return oBindingOrContext instanceof Context
? oBindingOrContext.getPath()
: oBindingOrContext.getModel().resolve(
oBindingOrContext.getPath(), oBindingOrContext.getContext());
}
/**
* Context interface provided by XML template processing as an additional first argument to
* any formatter function which opts in to this mechanism. Candidates for such formatter
* functions are all those used in binding expressions which are evaluated during XML
* template processing, including those used inside template instructions like
* <code><template:if></code>. The formatter function needs to be marked with a property
* <code>requiresIContext = true</code> to express that it requires this extended signature
* (compared to ordinary formatter functions). The usual arguments are provided after the
* first one (currently: the raw value from the model).
*
* This interface provides callback functions to access the model and path which are needed
* to process OData V4 annotations. It initially offers a subset of methods from
* {@link sap.ui.model.Context} so that formatters might also be called with a context
* object for convenience, e.g. outside of XML template processing (see below for an
* exception to this rule).
*
* <b>Example:</b> Suppose you have a formatter function called "foo" like below and it is
* used within an XML template like
* <code><template:if test="{path: '...', formatter: 'foo'}"></code>.
* In this case <code>foo</code> is called with arguments <code>oInterface, vRawValue</code>
* such that
* <code>oInterface.getModel().getObject(oInterface.getPath()) === vRawValue</code> holds.
* <pre>
* window.foo = function (oInterface, vRawValue) {
* //TODO ...
* };
* window.foo.requiresIContext = true;
* </pre>
*
* <b>Composite Binding Examples:</b> Suppose you have the same formatter function and it is
* used in a composite binding like <code><Text text="{path: 'Label', formatter: 'foo'}:
* {path: 'Value', formatter: 'foo'}"/></code>.
* In this case <code>oInterface.getPath()</code> refers to ".../Label" in the 1st call and
* ".../Value" in the 2nd call. This means each formatter call knows which part of the
* composite binding it belongs to and behaves just as if it was an ordinary binding.
*
* Suppose your formatter is not used within a part of the composite binding, but at the
* root of the composite binding in order to aggregate all parts like <code>
* <Text text="{parts: [{path: 'Label'}, {path: 'Value'}], formatter: 'foo'}"/></code>.
* In this case <code>oInterface.getPath(0)</code> refers to ".../Label" and
* <code>oInterface.getPath(1)</code> refers to ".../Value". This means, the root formatter
* can access the ith part of the composite binding at will (since 1.31.0); see also
* {@link #.getInterface getInterface}.
* The function <code>foo</code> is called with arguments such that <code>
* oInterface.getModel(i).getObject(oInterface.getPath(i)) === arguments[i + 1]</code>
* holds.
* This use is not supported within an expression binding, that is, <code><Text
* text="{= ${parts: [{path: 'Label'}, {path: 'Value'}], formatter: 'foo'} }"/></code>
* does not work as expected because the property <code>requiresIContext = true</code> is
* ignored.
*
* To distinguish those two use cases, just check whether <code>oInterface.getModel() ===
* undefined</code>, in which case the formatter is called on root level of a composite
* binding. To find out the number of parts, probe for the smallest non-negative integer
* where <code>oInterface.getModel(i) === undefined</code>.
* This additional functionality is, of course, not available from
* {@link sap.ui.model.Context}, i.e. such formatters MUST be called with an instance of
* this context interface.
*
* @interface
* @name sap.ui.core.util.XMLPreprocessor.IContext
* @public
* @since 1.27.1
*/
return /** @lends sap.ui.core.util.XMLPreprocessor.IContext */ {
/**
* Returns a context interface for the indicated part in case of the root formatter of a
* composite binding. The new interface provides access to the original settings, but
* only to the model and path of the indicated part:
* <pre>
* this.getInterface(i).getSetting(sName) === this.getSetting(sName);
* this.getInterface(i).getModel() === this.getModel(i);
* this.getInterface(i).getPath() === this.getPath(i);
* </pre>
*
* If a path is given, the new interface points to the resolved path as follows:
* <pre>
* this.getInterface(i, "foo/bar").getPath() === this.getPath(i) + "/foo/bar";
* this.getInterface(i, "/absolute/path").getPath() === "/absolute/path";
* </pre>
* A formatter which is not at the root level of a composite binding can also provide a
* path, but must not provide an index:
* <pre>
* this.getInterface("foo/bar").getPath() === this.getPath() + "/foo/bar";
* this.getInterface("/absolute/path").getPath() === "/absolute/path";
* </pre>
* Note that at least one argument must be present.
*
* @param {number} [iPart]
* index of part in case of the root formatter of a composite binding
* @param {string} [sPath]
* a path, interpreted relative to <code>this.getPath(iPart)</code>
* @returns {sap.ui.core.util.XMLPreprocessor.IContext}
* the context interface related to the indicated part
* @throws {Error}
* In case an index is given but the current interface does not belong to the root
* formatter of a composite binding, or in case the given index is invalid (e.g.
* missing or out of range), or in case a path is missing because no index is given,
* or in case a path is given but the model cannot not create a binding context
* synchronously
* @public
* @since 1.31.0
*/
getInterface : function (iPart, sPath) {
var oBaseContext, oBindingOrContext, oModel;
if (typeof iPart === "string") {
sPath = iPart;
iPart = undefined;
}
getBindingOrContext(); // initialize vBindingOrContext
if (Array.isArray(vBindingOrContext)) {
if (iPart >= 0 && iPart < vBindingOrContext.length) {
oBindingOrContext = vBindingOrContext[iPart];
} else {
throw new Error("Invalid index of part: " + iPart);
}
} else if (iPart !== undefined) {
throw new Error("Not the root formatter of a composite binding");
} else if (sPath) {
oBindingOrContext = vBindingOrContext;
} else {
throw new Error("Missing path");
}
if (sPath) {
oModel = oBindingOrContext.getModel();
if (sPath.charAt(0) !== '/') { // relative path needs a base context
oBaseContext = oBindingOrContext instanceof Context
? oBindingOrContext
: oModel.createBindingContext(oBindingOrContext.getPath(),
oBindingOrContext.getContext());
}
oBindingOrContext = oModel.createBindingContext(sPath, oBaseContext);
if (!oBindingOrContext) {
throw new Error(
"Model could not create binding context synchronously: " + oModel);
}
}
return createContextInterface(null, mSettings, undefined, oBindingOrContext);
},
/**
* Returns the model related to the current formatter call.
*
* @param {number} [iPart]
* index of part in case of the root formatter of a composite binding
* (since 1.31.0)
* @returns {sap.ui.model.Model}
* the model related to the current formatter call, or (since 1.31.0)
* <code>undefined</code> in case of a root formatter if no <code>iPart</code> is
* given or if <code>iPart</code> is out of range
* @public
*/
getModel : function (iPart) {
var oBindingOrContext = getBindingOrContext(iPart);
return oBindingOrContext && oBindingOrContext.getModel();
},
/**
* Returns the absolute path related to the current formatter call.
*
* @param {number} [iPart]
* index of part in case of the root formatter of a composite binding (since 1.31.0)
* @returns {string}
* the absolute path related to the current formatter call, or (since 1.31.0)
* <code>undefined</code> in case of a root formatter if no <code>iPart</code> is
* given or if <code>iPart</code> is out of range
* @public
*/
getPath : function (iPart) {
var oBindingOrContext = getBindingOrContext(iPart);
return oBindingOrContext && getPath(oBindingOrContext);
},
/**
* Returns the value of the setting with the given name which was provided to the XML
* template processing.
*
* @param {string} sName
* the name of the setting
* @returns {any}
* the value of the setting
* @throws {Error}
* if the name is one of the reserved names: "bindingContexts", "models"
* @public
*/
getSetting : function (sName) {
if (sName === "bindingContexts" || sName === "models") {
throw new Error("Illegal argument: " + sName);
}
return mSettings[sName];
}
};
} | javascript | function createContextInterface(oWithControl, mSettings, i, vBindingOrContext) {
/*
* Returns the single binding or model context related to the current formatter call.
*
* @param {number} [iPart]
* index of part in case of the root formatter of a composite binding
* @returns {sap.ui.model.Binding|sap.ui.model.Context}
* single binding or model context
*/
function getBindingOrContext(iPart) {
if (!vBindingOrContext) {
// lazy initialization
// BEWARE: this is not yet defined when createContextInterface() is called!
vBindingOrContext = oWithControl.getBinding("any");
if (vBindingOrContext instanceof CompositeBinding) {
vBindingOrContext = vBindingOrContext.getBindings();
if (i !== undefined) { // not a root formatter
vBindingOrContext = vBindingOrContext[i];
}
}
}
return Array.isArray(vBindingOrContext)
? vBindingOrContext[iPart]
: vBindingOrContext;
}
/**
* Returns the resolved path for the given single binding or model context.
*
* @param {sap.ui.model.Binding|sap.ui.model.Context} oBindingOrContext
* single binding or model context
* @returns {string}
* the resolved path
*/
function getPath(oBindingOrContext) {
return oBindingOrContext instanceof Context
? oBindingOrContext.getPath()
: oBindingOrContext.getModel().resolve(
oBindingOrContext.getPath(), oBindingOrContext.getContext());
}
/**
* Context interface provided by XML template processing as an additional first argument to
* any formatter function which opts in to this mechanism. Candidates for such formatter
* functions are all those used in binding expressions which are evaluated during XML
* template processing, including those used inside template instructions like
* <code><template:if></code>. The formatter function needs to be marked with a property
* <code>requiresIContext = true</code> to express that it requires this extended signature
* (compared to ordinary formatter functions). The usual arguments are provided after the
* first one (currently: the raw value from the model).
*
* This interface provides callback functions to access the model and path which are needed
* to process OData V4 annotations. It initially offers a subset of methods from
* {@link sap.ui.model.Context} so that formatters might also be called with a context
* object for convenience, e.g. outside of XML template processing (see below for an
* exception to this rule).
*
* <b>Example:</b> Suppose you have a formatter function called "foo" like below and it is
* used within an XML template like
* <code><template:if test="{path: '...', formatter: 'foo'}"></code>.
* In this case <code>foo</code> is called with arguments <code>oInterface, vRawValue</code>
* such that
* <code>oInterface.getModel().getObject(oInterface.getPath()) === vRawValue</code> holds.
* <pre>
* window.foo = function (oInterface, vRawValue) {
* //TODO ...
* };
* window.foo.requiresIContext = true;
* </pre>
*
* <b>Composite Binding Examples:</b> Suppose you have the same formatter function and it is
* used in a composite binding like <code><Text text="{path: 'Label', formatter: 'foo'}:
* {path: 'Value', formatter: 'foo'}"/></code>.
* In this case <code>oInterface.getPath()</code> refers to ".../Label" in the 1st call and
* ".../Value" in the 2nd call. This means each formatter call knows which part of the
* composite binding it belongs to and behaves just as if it was an ordinary binding.
*
* Suppose your formatter is not used within a part of the composite binding, but at the
* root of the composite binding in order to aggregate all parts like <code>
* <Text text="{parts: [{path: 'Label'}, {path: 'Value'}], formatter: 'foo'}"/></code>.
* In this case <code>oInterface.getPath(0)</code> refers to ".../Label" and
* <code>oInterface.getPath(1)</code> refers to ".../Value". This means, the root formatter
* can access the ith part of the composite binding at will (since 1.31.0); see also
* {@link #.getInterface getInterface}.
* The function <code>foo</code> is called with arguments such that <code>
* oInterface.getModel(i).getObject(oInterface.getPath(i)) === arguments[i + 1]</code>
* holds.
* This use is not supported within an expression binding, that is, <code><Text
* text="{= ${parts: [{path: 'Label'}, {path: 'Value'}], formatter: 'foo'} }"/></code>
* does not work as expected because the property <code>requiresIContext = true</code> is
* ignored.
*
* To distinguish those two use cases, just check whether <code>oInterface.getModel() ===
* undefined</code>, in which case the formatter is called on root level of a composite
* binding. To find out the number of parts, probe for the smallest non-negative integer
* where <code>oInterface.getModel(i) === undefined</code>.
* This additional functionality is, of course, not available from
* {@link sap.ui.model.Context}, i.e. such formatters MUST be called with an instance of
* this context interface.
*
* @interface
* @name sap.ui.core.util.XMLPreprocessor.IContext
* @public
* @since 1.27.1
*/
return /** @lends sap.ui.core.util.XMLPreprocessor.IContext */ {
/**
* Returns a context interface for the indicated part in case of the root formatter of a
* composite binding. The new interface provides access to the original settings, but
* only to the model and path of the indicated part:
* <pre>
* this.getInterface(i).getSetting(sName) === this.getSetting(sName);
* this.getInterface(i).getModel() === this.getModel(i);
* this.getInterface(i).getPath() === this.getPath(i);
* </pre>
*
* If a path is given, the new interface points to the resolved path as follows:
* <pre>
* this.getInterface(i, "foo/bar").getPath() === this.getPath(i) + "/foo/bar";
* this.getInterface(i, "/absolute/path").getPath() === "/absolute/path";
* </pre>
* A formatter which is not at the root level of a composite binding can also provide a
* path, but must not provide an index:
* <pre>
* this.getInterface("foo/bar").getPath() === this.getPath() + "/foo/bar";
* this.getInterface("/absolute/path").getPath() === "/absolute/path";
* </pre>
* Note that at least one argument must be present.
*
* @param {number} [iPart]
* index of part in case of the root formatter of a composite binding
* @param {string} [sPath]
* a path, interpreted relative to <code>this.getPath(iPart)</code>
* @returns {sap.ui.core.util.XMLPreprocessor.IContext}
* the context interface related to the indicated part
* @throws {Error}
* In case an index is given but the current interface does not belong to the root
* formatter of a composite binding, or in case the given index is invalid (e.g.
* missing or out of range), or in case a path is missing because no index is given,
* or in case a path is given but the model cannot not create a binding context
* synchronously
* @public
* @since 1.31.0
*/
getInterface : function (iPart, sPath) {
var oBaseContext, oBindingOrContext, oModel;
if (typeof iPart === "string") {
sPath = iPart;
iPart = undefined;
}
getBindingOrContext(); // initialize vBindingOrContext
if (Array.isArray(vBindingOrContext)) {
if (iPart >= 0 && iPart < vBindingOrContext.length) {
oBindingOrContext = vBindingOrContext[iPart];
} else {
throw new Error("Invalid index of part: " + iPart);
}
} else if (iPart !== undefined) {
throw new Error("Not the root formatter of a composite binding");
} else if (sPath) {
oBindingOrContext = vBindingOrContext;
} else {
throw new Error("Missing path");
}
if (sPath) {
oModel = oBindingOrContext.getModel();
if (sPath.charAt(0) !== '/') { // relative path needs a base context
oBaseContext = oBindingOrContext instanceof Context
? oBindingOrContext
: oModel.createBindingContext(oBindingOrContext.getPath(),
oBindingOrContext.getContext());
}
oBindingOrContext = oModel.createBindingContext(sPath, oBaseContext);
if (!oBindingOrContext) {
throw new Error(
"Model could not create binding context synchronously: " + oModel);
}
}
return createContextInterface(null, mSettings, undefined, oBindingOrContext);
},
/**
* Returns the model related to the current formatter call.
*
* @param {number} [iPart]
* index of part in case of the root formatter of a composite binding
* (since 1.31.0)
* @returns {sap.ui.model.Model}
* the model related to the current formatter call, or (since 1.31.0)
* <code>undefined</code> in case of a root formatter if no <code>iPart</code> is
* given or if <code>iPart</code> is out of range
* @public
*/
getModel : function (iPart) {
var oBindingOrContext = getBindingOrContext(iPart);
return oBindingOrContext && oBindingOrContext.getModel();
},
/**
* Returns the absolute path related to the current formatter call.
*
* @param {number} [iPart]
* index of part in case of the root formatter of a composite binding (since 1.31.0)
* @returns {string}
* the absolute path related to the current formatter call, or (since 1.31.0)
* <code>undefined</code> in case of a root formatter if no <code>iPart</code> is
* given or if <code>iPart</code> is out of range
* @public
*/
getPath : function (iPart) {
var oBindingOrContext = getBindingOrContext(iPart);
return oBindingOrContext && getPath(oBindingOrContext);
},
/**
* Returns the value of the setting with the given name which was provided to the XML
* template processing.
*
* @param {string} sName
* the name of the setting
* @returns {any}
* the value of the setting
* @throws {Error}
* if the name is one of the reserved names: "bindingContexts", "models"
* @public
*/
getSetting : function (sName) {
if (sName === "bindingContexts" || sName === "models") {
throw new Error("Illegal argument: " + sName);
}
return mSettings[sName];
}
};
} | [
"function",
"createContextInterface",
"(",
"oWithControl",
",",
"mSettings",
",",
"i",
",",
"vBindingOrContext",
")",
"{",
"/*\n\t\t * Returns the single binding or model context related to the current formatter call.\n\t\t *\n\t\t * @param {number} [iPart]\n\t\t * index of part in case of... | Creates the context interface for a call to the given control's formatter of the binding part
with given index.
@param {sap.ui.core.util._with} oWithControl
the "with" control
@param {object} mSettings
map/JSON-object with initial property values, etc.
@param {number} [i]
index of part inside a composite binding
@param {sap.ui.model.Binding|sap.ui.model.Binding[]|sap.ui.model.Context}
[vBindingOrContext]
single binding or model context or array of parts; if this parameter is given,
"oWithControl" and "i" are ignored, else it is lazily computed from those two
@returns {sap.ui.core.util.XMLPreprocessor.IContext}
the callback interface | [
"Creates",
"the",
"context",
"interface",
"for",
"a",
"call",
"to",
"the",
"given",
"control",
"s",
"formatter",
"of",
"the",
"binding",
"part",
"with",
"given",
"index",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js#L86-L326 | train | Creates anContextInterface for the given control. | [
30522,
3853,
3443,
8663,
18209,
18447,
2121,
12172,
1006,
27593,
8939,
8663,
13181,
2140,
1010,
5796,
18319,
3070,
2015,
1010,
1045,
1010,
1058,
8428,
4667,
2953,
8663,
18209,
1007,
1063,
1013,
1008,
1008,
5651,
1996,
2309,
8031,
2030,
2944... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/events/TouchToMouseMapping.js | function(oEvent) {
var oTouches = oEvent.touches,
oTouch;
bHandleEvent = (oTouches.length == 1 && !isInputField(oEvent));
bIsMoved = false;
if (bHandleEvent) {
oTouch = oTouches[0];
// As we are only interested in the first touch target, we remember it
oTarget = oTouch.target;
if (oTarget.nodeType === 3) {
// no text node
oTarget = oTarget.parentNode;
}
// Remember the start position of the first touch to determine if a click was performed or not.
iStartX = oTouch.clientX;
iStartY = oTouch.clientY;
fireMouseEvent("mousedown", oEvent);
}
} | javascript | function(oEvent) {
var oTouches = oEvent.touches,
oTouch;
bHandleEvent = (oTouches.length == 1 && !isInputField(oEvent));
bIsMoved = false;
if (bHandleEvent) {
oTouch = oTouches[0];
// As we are only interested in the first touch target, we remember it
oTarget = oTouch.target;
if (oTarget.nodeType === 3) {
// no text node
oTarget = oTarget.parentNode;
}
// Remember the start position of the first touch to determine if a click was performed or not.
iStartX = oTouch.clientX;
iStartY = oTouch.clientY;
fireMouseEvent("mousedown", oEvent);
}
} | [
"function",
"(",
"oEvent",
")",
"{",
"var",
"oTouches",
"=",
"oEvent",
".",
"touches",
",",
"oTouch",
";",
"bHandleEvent",
"=",
"(",
"oTouches",
".",
"length",
"==",
"1",
"&&",
"!",
"isInputField",
"(",
"oEvent",
")",
")",
";",
"bIsMoved",
"=",
"false"... | Touch start event handler. Called whenever a finger is added to the surface. Fires mouse start event.
@param {jQuery.Event} oEvent the event object
@private | [
"Touch",
"start",
"event",
"handler",
".",
"Called",
"whenever",
"a",
"finger",
"is",
"added",
"to",
"the",
"surface",
".",
"Fires",
"mouse",
"start",
"event",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/events/TouchToMouseMapping.js#L86-L109 | train | Handles the touch event | [
30522,
3853,
30524,
1006,
1051,
18697,
3372,
1007,
1007,
1025,
20377,
5302,
7178,
1027,
6270,
1025,
2065,
1006,
1038,
11774,
10559,
15338,
1007,
1063,
27178,
7140,
2818,
1027,
27178,
7140,
8376,
1031,
1014,
1033,
1025,
1013,
1013,
2004,
205... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | function() {
var vals = [],
max = arr.length,
idx = 0;
while (idx < max) {
if (!wysihtml5.lang.array(vals).contains(arr[idx])) {
vals.push(arr[idx]);
}
idx++;
}
return vals;
} | javascript | function() {
var vals = [],
max = arr.length,
idx = 0;
while (idx < max) {
if (!wysihtml5.lang.array(vals).contains(arr[idx])) {
vals.push(arr[idx]);
}
idx++;
}
return vals;
} | [
"function",
"(",
")",
"{",
"var",
"vals",
"=",
"[",
"]",
",",
"max",
"=",
"arr",
".",
"length",
",",
"idx",
"=",
"0",
";",
"while",
"(",
"idx",
"<",
"max",
")",
"{",
"if",
"(",
"!",
"wysihtml5",
".",
"lang",
".",
"array",
"(",
"vals",
")",
... | /* ReturnS new array without duplicate entries
@example
var uniq = wysihtml5.lang.array([1,2,3,2,1,4]).unique();
// => [1,2,3,4] | [
"/",
"*",
"ReturnS",
"new",
"array",
"without",
"duplicate",
"entries"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L4687-L4699 | train | returns an array of the unique elements | [
30522,
3853,
1006,
1007,
1063,
13075,
11748,
2015,
1027,
1031,
1033,
1010,
4098,
1027,
12098,
2099,
1012,
3091,
1010,
8909,
2595,
1027,
1014,
1025,
2096,
1006,
8909,
2595,
1026,
4098,
1007,
1063,
2065,
1006,
999,
1059,
7274,
19190,
21246,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/thirdparty/jszip.js | function(expectedSignature) {
var signature = this.reader.readString(4);
if (signature !== expectedSignature) {
throw new Error("Corrupted zip or bug : unexpected signature " + "(" + utils.pretty(signature) + ", expected " + utils.pretty(expectedSignature) + ")");
}
} | javascript | function(expectedSignature) {
var signature = this.reader.readString(4);
if (signature !== expectedSignature) {
throw new Error("Corrupted zip or bug : unexpected signature " + "(" + utils.pretty(signature) + ", expected " + utils.pretty(expectedSignature) + ")");
}
} | [
"function",
"(",
"expectedSignature",
")",
"{",
"var",
"signature",
"=",
"this",
".",
"reader",
".",
"readString",
"(",
"4",
")",
";",
"if",
"(",
"signature",
"!==",
"expectedSignature",
")",
"{",
"throw",
"new",
"Error",
"(",
"\"Corrupted zip or bug : unexpec... | Check that the reader is on the speficied signature.
@param {string} expectedSignature the expected signature.
@throws {Error} if it is an other signature. | [
"Check",
"that",
"the",
"reader",
"is",
"on",
"the",
"speficied",
"signature",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/jszip.js#L1713-L1718 | train | Check the signature of the archive | [
30522,
3853,
1006,
3517,
5332,
16989,
11244,
1007,
1063,
13075,
8085,
1027,
2023,
1012,
8068,
1012,
9631,
18886,
3070,
1006,
1018,
1007,
1025,
2065,
1006,
8085,
999,
1027,
1027,
3517,
5332,
16989,
11244,
1007,
1063,
5466,
2047,
7561,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
adobe/brackets | src/extensions/default/CodeFolding/Prefs.js | simplify | function simplify(folds) {
if (!folds) {
return;
}
var res = {}, range;
Object.keys(folds).forEach(function (line) {
range = folds[line];
res[line] = Array.isArray(range) ? range : [[range.from.line, range.from.ch], [range.to.line, range.to.ch]];
});
return res;
} | javascript | function simplify(folds) {
if (!folds) {
return;
}
var res = {}, range;
Object.keys(folds).forEach(function (line) {
range = folds[line];
res[line] = Array.isArray(range) ? range : [[range.from.line, range.from.ch], [range.to.line, range.to.ch]];
});
return res;
} | [
"function",
"simplify",
"(",
"folds",
")",
"{",
"if",
"(",
"!",
"folds",
")",
"{",
"return",
";",
"}",
"var",
"res",
"=",
"{",
"}",
",",
"range",
";",
"Object",
".",
"keys",
"(",
"folds",
")",
".",
"forEach",
"(",
"function",
"(",
"line",
")",
... | Simplifies the fold ranges into an array of pairs of numbers.
@param {!Object} folds the raw fold ranges indexed by line numbers
@return {Object} an object whose keys are line numbers and the values are array
of two 2-element arrays. First array contains [from.line, from.ch] and the second contains [to.line, to.ch] | [
"Simplifies",
"the",
"fold",
"ranges",
"into",
"an",
"array",
"of",
"pairs",
"of",
"numbers",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensions/default/CodeFolding/Prefs.js#L49-L59 | train | Simplifies the folds into a single object | [
30522,
3853,
21934,
28250,
1006,
15439,
1007,
1063,
2065,
1006,
999,
15439,
1007,
1063,
2709,
1025,
1065,
13075,
24501,
1027,
1063,
1065,
1010,
2846,
1025,
4874,
1012,
6309,
1006,
15439,
1007,
1012,
18921,
6776,
1006,
3853,
1006,
2240,
1007... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
dcloudio/mui | examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js | function (elem)
{
if (this._sasl_data["server-signature"]) {
var serverSignature;
var success = Base64.decode(Strophe.getText(elem));
var attribMatch = /([a-z]+)=([^,]+)(,|$)/;
var matches = success.match(attribMatch);
if (matches[1] == "v") {
serverSignature = matches[2];
}
if (serverSignature != this._sasl_data["server-signature"]) {
// remove old handlers
this.deleteHandler(this._sasl_failure_handler);
this._sasl_failure_handler = null;
if (this._sasl_challenge_handler) {
this.deleteHandler(this._sasl_challenge_handler);
this._sasl_challenge_handler = null;
}
this._sasl_data = {};
return this._sasl_failure_cb(null);
}
}
Strophe.info("SASL authentication succeeded.");
if(this._sasl_mechanism)
this._sasl_mechanism.onSuccess();
// remove old handlers
this.deleteHandler(this._sasl_failure_handler);
this._sasl_failure_handler = null;
if (this._sasl_challenge_handler) {
this.deleteHandler(this._sasl_challenge_handler);
this._sasl_challenge_handler = null;
}
var streamfeature_handlers = [];
var wrapper = function(handlers, elem) {
while (handlers.length) {
this.deleteHandler(handlers.pop());
}
this._sasl_auth1_cb.bind(this)(elem);
return false;
};
streamfeature_handlers.push(this._addSysHandler(function(elem) {
wrapper.bind(this)(streamfeature_handlers, elem);
}.bind(this), null, "stream:features", null, null));
streamfeature_handlers.push(this._addSysHandler(function(elem) {
wrapper.bind(this)(streamfeature_handlers, elem);
}.bind(this), Strophe.NS.STREAM, "features", null, null));
// we must send an xmpp:restart now
this._sendRestart();
return false;
} | javascript | function (elem)
{
if (this._sasl_data["server-signature"]) {
var serverSignature;
var success = Base64.decode(Strophe.getText(elem));
var attribMatch = /([a-z]+)=([^,]+)(,|$)/;
var matches = success.match(attribMatch);
if (matches[1] == "v") {
serverSignature = matches[2];
}
if (serverSignature != this._sasl_data["server-signature"]) {
// remove old handlers
this.deleteHandler(this._sasl_failure_handler);
this._sasl_failure_handler = null;
if (this._sasl_challenge_handler) {
this.deleteHandler(this._sasl_challenge_handler);
this._sasl_challenge_handler = null;
}
this._sasl_data = {};
return this._sasl_failure_cb(null);
}
}
Strophe.info("SASL authentication succeeded.");
if(this._sasl_mechanism)
this._sasl_mechanism.onSuccess();
// remove old handlers
this.deleteHandler(this._sasl_failure_handler);
this._sasl_failure_handler = null;
if (this._sasl_challenge_handler) {
this.deleteHandler(this._sasl_challenge_handler);
this._sasl_challenge_handler = null;
}
var streamfeature_handlers = [];
var wrapper = function(handlers, elem) {
while (handlers.length) {
this.deleteHandler(handlers.pop());
}
this._sasl_auth1_cb.bind(this)(elem);
return false;
};
streamfeature_handlers.push(this._addSysHandler(function(elem) {
wrapper.bind(this)(streamfeature_handlers, elem);
}.bind(this), null, "stream:features", null, null));
streamfeature_handlers.push(this._addSysHandler(function(elem) {
wrapper.bind(this)(streamfeature_handlers, elem);
}.bind(this), Strophe.NS.STREAM, "features", null, null));
// we must send an xmpp:restart now
this._sendRestart();
return false;
} | [
"function",
"(",
"elem",
")",
"{",
"if",
"(",
"this",
".",
"_sasl_data",
"[",
"\"server-signature\"",
"]",
")",
"{",
"var",
"serverSignature",
";",
"var",
"success",
"=",
"Base64",
".",
"decode",
"(",
"Strophe",
".",
"getText",
"(",
"elem",
")",
")",
"... | /* jshint unused:true PrivateFunction: _sasl_success_cb
_Private_ handler for succesful SASL authentication.
Parameters:
(XMLElement) elem - The matching stanza.
Returns:
false to remove the handler. | [
"/",
"*",
"jshint",
"unused",
":",
"true",
"PrivateFunction",
":",
"_sasl_success_cb",
"_Private_",
"handler",
"for",
"succesful",
"SASL",
"authentication",
"."
] | ff74c90a1671a552f3604b1288bf38a4126312d0 | https://github.com/dcloudio/mui/blob/ff74c90a1671a552f3604b1288bf38a4126312d0/examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js#L3135-L3192 | train | SASL authentication succeeded. | [
30522,
3853,
1006,
3449,
6633,
1007,
1063,
2065,
1006,
2023,
1012,
1035,
21871,
2140,
1035,
2951,
1031,
1000,
8241,
1011,
8085,
1000,
1033,
1007,
1063,
13075,
14903,
23773,
4017,
5397,
1025,
13075,
3112,
1027,
2918,
21084,
1012,
21933,
3207... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
adobe/brackets | src/utils/Resizer.js | makeResizable | function makeResizable(element, direction, position, minSize, collapsible, forceLeft, createdByWorkspaceManager, usePercentages, _attachToParent) {
var $resizer = $('<div class="' + direction + '-resizer"></div>'),
$element = $(element),
$parent = $element.parent(),
$resizableElement = $($element.find(".resizable-content:first")[0]),
$body = $(window.document.body),
elementID = $element.attr("id"),
elementPrefs = PreferencesManager.getViewState(elementID) || {},
animationRequest = null,
directionProperty = direction === DIRECTION_HORIZONTAL ? "clientX" : "clientY",
directionIncrement = (position === POSITION_TOP || position === POSITION_LEFT) ? 1 : -1,
parentSizeFunction = direction === DIRECTION_HORIZONTAL ? $parent.innerWidth : $parent.innerHeight,
elementSizeFunction = function (newSize) {
if (!newSize) {
// calling the function as a getter
if (direction === DIRECTION_HORIZONTAL) {
return this.width();
} else {
return this.height();
}
} else if (!usePercentages) {
if (direction === DIRECTION_HORIZONTAL) {
return this.width(newSize);
} else {
return this.height(newSize);
}
} else {
// calling the function as a setter
var parentSize = parentSizeFunction.apply($parent),
percentage,
prop;
if (direction === DIRECTION_HORIZONTAL) {
prop = "width";
} else {
prop = "height";
}
percentage = newSize / parentSize;
this.css(prop, (percentage * 100) + "%");
return this; // chainable
}
},
resizerCSSPosition = direction === DIRECTION_HORIZONTAL ? "left" : "top",
contentSizeFunction = direction === DIRECTION_HORIZONTAL ? $resizableElement.width : $resizableElement.height;
if (PreferencesManager.get(PREFS_PURE_CODE) &&
($element.hasClass("bottom-panel") || $element.hasClass("sidebar"))) {
elementPrefs.visible = false;
}
if (!elementID) {
console.error("Resizable panels must have a DOM id to use as a preferences key:", element);
return;
}
// Detect legacy cases where panels in the editor area are created without using WorkspaceManager APIs
if ($parent[0] && $parent.is(".content") && !createdByWorkspaceManager) {
console.error("Resizable panels within the editor area should be created via WorkspaceManager.createBottomPanel(). \nElement:", element);
return;
}
if (minSize === undefined) {
minSize = DEFAULT_MIN_SIZE;
}
collapsible = collapsible || false;
if (_attachToParent) {
$parent.prepend($resizer);
} else {
$element.prepend($resizer);
}
// Important so min/max sizes behave predictably
$element.css("box-sizing", "border-box");
function adjustSibling(size) {
if (forceLeft !== undefined) {
$(forceLeft, $parent).css("left", size);
}
}
function resizeElement(elementSize, contentSize) {
elementSizeFunction.apply($element, [elementSize]);
if ($resizableElement.length) {
contentSizeFunction.apply($resizableElement, [contentSize]);
}
}
// If the resizer is positioned right or bottom of the panel, we need to listen to
// reposition it if the element size changes externally
function repositionResizer(elementSize) {
var resizerPosition = elementSize || 1;
if (position === POSITION_RIGHT || position === POSITION_BOTTOM) {
$resizer.css(resizerCSSPosition, resizerPosition);
}
}
$element.data("removeSizable", function () {
$resizer.off(".resizer");
$element.removeData("show");
$element.removeData("hide");
$element.removeData("resyncSizer");
$element.removeData("removeSizable");
$resizer.remove();
});
$element.data("resyncSizer", function () {
repositionResizer(elementSizeFunction.apply($element));
});
$element.data("show", function () {
var elementOffset = $element.offset(),
elementSize = elementSizeFunction.apply($element) || elementPrefs.size,
contentSize = contentSizeFunction.apply($resizableElement) || elementPrefs.contentSize;
// Resize the element before showing it again. If the panel was collapsed by dragging
// the resizer, the size of the element should be 0, so we restore size in preferences
resizeElement(elementSize, contentSize);
$element.show();
elementPrefs.visible = true;
if (collapsible) {
if (_attachToParent) {
$parent.prepend($resizer);
} else {
$element.prepend($resizer);
}
if (position === POSITION_TOP) {
$resizer.css(resizerCSSPosition, "");
} else if (position === POSITION_RIGHT) {
$resizer.css(resizerCSSPosition, elementOffset[resizerCSSPosition] + elementSize);
}
}
adjustSibling(elementSize);
$element.trigger("panelExpanded", [elementSize]);
PreferencesManager.setViewState(elementID, elementPrefs, null, isResizing);
});
$element.data("hide", function () {
var elementOffset = $element.offset(),
elementSize = elementSizeFunction.apply($element),
resizerSize = elementSizeFunction.apply($resizer);
$element.hide();
elementPrefs.visible = false;
if (collapsible) {
$resizer.insertBefore($element);
if (position === POSITION_RIGHT) {
$resizer.css(resizerCSSPosition, "");
} else if (position === POSITION_TOP) {
$resizer.css(resizerCSSPosition, elementOffset[resizerCSSPosition] + elementSize - resizerSize);
}
}
adjustSibling(0);
$element.trigger("panelCollapsed", [elementSize]);
PreferencesManager.setViewState(elementID, elementPrefs, null, isResizing);
});
$resizer.on("mousedown.resizer", function (e) {
var $resizeShield = $("<div class='resizing-container " + direction + "-resizing' />"),
startPosition = e[directionProperty],
startSize = $element.is(":visible") ? elementSizeFunction.apply($element) : 0,
newSize = startSize,
previousSize = startSize,
baseSize = 0,
resizeStarted = false;
isResizing = true;
$body.append($resizeShield);
if ($resizableElement.length) {
$element.children().not(".horz-resizer, .vert-resizer, .resizable-content").each(function (index, child) {
if (direction === DIRECTION_HORIZONTAL) {
baseSize += $(child).outerWidth();
} else {
baseSize += $(child).outerHeight();
}
});
}
function doRedraw() {
// only run this if the mouse is down so we don't constantly loop even
// after we're done resizing.
if (!isResizing) {
return;
}
// Check for real size changes to avoid unnecessary resizing and events
if (newSize !== previousSize) {
previousSize = newSize;
if ($element.is(":visible")) {
if (newSize < 10) {
toggle($element);
elementSizeFunction.apply($element, [0]);
} else {
// Trigger resizeStarted just before the first successful resize update
if (!resizeStarted) {
resizeStarted = true;
$element.trigger("panelResizeStart", newSize);
}
// Resize the main element to the new size. If there is a content element,
// its size is the new size minus the size of the non-resizable elements
resizeElement(newSize, (newSize - baseSize));
adjustSibling(newSize);
$element.trigger("panelResizeUpdate", [newSize]);
}
} else if (newSize > 10) {
elementSizeFunction.apply($element, [newSize]);
toggle($element);
// Trigger resizeStarted after expanding the element if it was previously collapsed
if (!resizeStarted) {
resizeStarted = true;
$element.trigger("panelResizeStart", newSize);
}
}
}
animationRequest = window.requestAnimationFrame(doRedraw);
}
function onMouseMove(e) {
// calculate newSize adding to startSize the difference
// between starting and current position, capped at minSize
newSize = Math.max(startSize + directionIncrement * (startPosition - e[directionProperty]), minSize);
// respect max size if one provided (e.g. by WorkspaceManager)
var maxSize = $element.data("maxsize");
if (maxSize !== undefined) {
// if provided as percentage size convert it to a pixel size
if (_isPercentage(maxSize)) {
maxSize = _percentageToPixels(maxSize, _sideBarMaxSize());
}
newSize = Math.min(newSize, maxSize);
}
e.preventDefault();
if (animationRequest === null) {
animationRequest = window.requestAnimationFrame(doRedraw);
}
}
$(window.document).on("mousemove", onMouseMove);
// If the element is marked as collapsible, check for double click
// to toggle the element visibility
if (collapsible) {
$resizeShield.on("mousedown", function (e) {
$(window.document).off("mousemove", onMouseMove);
$resizeShield.off("mousedown");
$resizeShield.remove();
animationRequest = null;
toggle($element);
});
}
function endResize(e) {
if (isResizing) {
var elementSize = elementSizeFunction.apply($element);
if ($element.is(":visible")) {
elementPrefs.size = elementSize;
if ($resizableElement.length) {
elementPrefs.contentSize = contentSizeFunction.apply($resizableElement);
}
PreferencesManager.setViewState(elementID, elementPrefs);
repositionResizer(elementSize);
}
isResizing = false;
if (resizeStarted) {
$element.trigger("panelResizeEnd", [elementSize]);
}
// We wait 300ms to remove the resizer container to capture a mousedown
// on the container that would account for double click
window.setTimeout(function () {
$(window.document).off("mousemove", onMouseMove);
$resizeShield.off("mousedown");
$resizeShield.remove();
animationRequest = null;
}, 300);
}
}
$(window.document).one("mouseup", endResize);
e.preventDefault();
});
// Panel preferences initialization
if (elementPrefs) {
if (elementPrefs.size !== undefined) {
elementSizeFunction.apply($element, [elementPrefs.size]);
}
if (elementPrefs.contentSize !== undefined) {
contentSizeFunction.apply($resizableElement, [elementPrefs.contentSize]);
}
if (elementPrefs.visible !== undefined && !elementPrefs.visible) {
hide($element);
} else {
adjustSibling(elementSizeFunction.apply($element));
repositionResizer(elementSizeFunction.apply($element));
}
}
} | javascript | function makeResizable(element, direction, position, minSize, collapsible, forceLeft, createdByWorkspaceManager, usePercentages, _attachToParent) {
var $resizer = $('<div class="' + direction + '-resizer"></div>'),
$element = $(element),
$parent = $element.parent(),
$resizableElement = $($element.find(".resizable-content:first")[0]),
$body = $(window.document.body),
elementID = $element.attr("id"),
elementPrefs = PreferencesManager.getViewState(elementID) || {},
animationRequest = null,
directionProperty = direction === DIRECTION_HORIZONTAL ? "clientX" : "clientY",
directionIncrement = (position === POSITION_TOP || position === POSITION_LEFT) ? 1 : -1,
parentSizeFunction = direction === DIRECTION_HORIZONTAL ? $parent.innerWidth : $parent.innerHeight,
elementSizeFunction = function (newSize) {
if (!newSize) {
// calling the function as a getter
if (direction === DIRECTION_HORIZONTAL) {
return this.width();
} else {
return this.height();
}
} else if (!usePercentages) {
if (direction === DIRECTION_HORIZONTAL) {
return this.width(newSize);
} else {
return this.height(newSize);
}
} else {
// calling the function as a setter
var parentSize = parentSizeFunction.apply($parent),
percentage,
prop;
if (direction === DIRECTION_HORIZONTAL) {
prop = "width";
} else {
prop = "height";
}
percentage = newSize / parentSize;
this.css(prop, (percentage * 100) + "%");
return this; // chainable
}
},
resizerCSSPosition = direction === DIRECTION_HORIZONTAL ? "left" : "top",
contentSizeFunction = direction === DIRECTION_HORIZONTAL ? $resizableElement.width : $resizableElement.height;
if (PreferencesManager.get(PREFS_PURE_CODE) &&
($element.hasClass("bottom-panel") || $element.hasClass("sidebar"))) {
elementPrefs.visible = false;
}
if (!elementID) {
console.error("Resizable panels must have a DOM id to use as a preferences key:", element);
return;
}
// Detect legacy cases where panels in the editor area are created without using WorkspaceManager APIs
if ($parent[0] && $parent.is(".content") && !createdByWorkspaceManager) {
console.error("Resizable panels within the editor area should be created via WorkspaceManager.createBottomPanel(). \nElement:", element);
return;
}
if (minSize === undefined) {
minSize = DEFAULT_MIN_SIZE;
}
collapsible = collapsible || false;
if (_attachToParent) {
$parent.prepend($resizer);
} else {
$element.prepend($resizer);
}
// Important so min/max sizes behave predictably
$element.css("box-sizing", "border-box");
function adjustSibling(size) {
if (forceLeft !== undefined) {
$(forceLeft, $parent).css("left", size);
}
}
function resizeElement(elementSize, contentSize) {
elementSizeFunction.apply($element, [elementSize]);
if ($resizableElement.length) {
contentSizeFunction.apply($resizableElement, [contentSize]);
}
}
// If the resizer is positioned right or bottom of the panel, we need to listen to
// reposition it if the element size changes externally
function repositionResizer(elementSize) {
var resizerPosition = elementSize || 1;
if (position === POSITION_RIGHT || position === POSITION_BOTTOM) {
$resizer.css(resizerCSSPosition, resizerPosition);
}
}
$element.data("removeSizable", function () {
$resizer.off(".resizer");
$element.removeData("show");
$element.removeData("hide");
$element.removeData("resyncSizer");
$element.removeData("removeSizable");
$resizer.remove();
});
$element.data("resyncSizer", function () {
repositionResizer(elementSizeFunction.apply($element));
});
$element.data("show", function () {
var elementOffset = $element.offset(),
elementSize = elementSizeFunction.apply($element) || elementPrefs.size,
contentSize = contentSizeFunction.apply($resizableElement) || elementPrefs.contentSize;
// Resize the element before showing it again. If the panel was collapsed by dragging
// the resizer, the size of the element should be 0, so we restore size in preferences
resizeElement(elementSize, contentSize);
$element.show();
elementPrefs.visible = true;
if (collapsible) {
if (_attachToParent) {
$parent.prepend($resizer);
} else {
$element.prepend($resizer);
}
if (position === POSITION_TOP) {
$resizer.css(resizerCSSPosition, "");
} else if (position === POSITION_RIGHT) {
$resizer.css(resizerCSSPosition, elementOffset[resizerCSSPosition] + elementSize);
}
}
adjustSibling(elementSize);
$element.trigger("panelExpanded", [elementSize]);
PreferencesManager.setViewState(elementID, elementPrefs, null, isResizing);
});
$element.data("hide", function () {
var elementOffset = $element.offset(),
elementSize = elementSizeFunction.apply($element),
resizerSize = elementSizeFunction.apply($resizer);
$element.hide();
elementPrefs.visible = false;
if (collapsible) {
$resizer.insertBefore($element);
if (position === POSITION_RIGHT) {
$resizer.css(resizerCSSPosition, "");
} else if (position === POSITION_TOP) {
$resizer.css(resizerCSSPosition, elementOffset[resizerCSSPosition] + elementSize - resizerSize);
}
}
adjustSibling(0);
$element.trigger("panelCollapsed", [elementSize]);
PreferencesManager.setViewState(elementID, elementPrefs, null, isResizing);
});
$resizer.on("mousedown.resizer", function (e) {
var $resizeShield = $("<div class='resizing-container " + direction + "-resizing' />"),
startPosition = e[directionProperty],
startSize = $element.is(":visible") ? elementSizeFunction.apply($element) : 0,
newSize = startSize,
previousSize = startSize,
baseSize = 0,
resizeStarted = false;
isResizing = true;
$body.append($resizeShield);
if ($resizableElement.length) {
$element.children().not(".horz-resizer, .vert-resizer, .resizable-content").each(function (index, child) {
if (direction === DIRECTION_HORIZONTAL) {
baseSize += $(child).outerWidth();
} else {
baseSize += $(child).outerHeight();
}
});
}
function doRedraw() {
// only run this if the mouse is down so we don't constantly loop even
// after we're done resizing.
if (!isResizing) {
return;
}
// Check for real size changes to avoid unnecessary resizing and events
if (newSize !== previousSize) {
previousSize = newSize;
if ($element.is(":visible")) {
if (newSize < 10) {
toggle($element);
elementSizeFunction.apply($element, [0]);
} else {
// Trigger resizeStarted just before the first successful resize update
if (!resizeStarted) {
resizeStarted = true;
$element.trigger("panelResizeStart", newSize);
}
// Resize the main element to the new size. If there is a content element,
// its size is the new size minus the size of the non-resizable elements
resizeElement(newSize, (newSize - baseSize));
adjustSibling(newSize);
$element.trigger("panelResizeUpdate", [newSize]);
}
} else if (newSize > 10) {
elementSizeFunction.apply($element, [newSize]);
toggle($element);
// Trigger resizeStarted after expanding the element if it was previously collapsed
if (!resizeStarted) {
resizeStarted = true;
$element.trigger("panelResizeStart", newSize);
}
}
}
animationRequest = window.requestAnimationFrame(doRedraw);
}
function onMouseMove(e) {
// calculate newSize adding to startSize the difference
// between starting and current position, capped at minSize
newSize = Math.max(startSize + directionIncrement * (startPosition - e[directionProperty]), minSize);
// respect max size if one provided (e.g. by WorkspaceManager)
var maxSize = $element.data("maxsize");
if (maxSize !== undefined) {
// if provided as percentage size convert it to a pixel size
if (_isPercentage(maxSize)) {
maxSize = _percentageToPixels(maxSize, _sideBarMaxSize());
}
newSize = Math.min(newSize, maxSize);
}
e.preventDefault();
if (animationRequest === null) {
animationRequest = window.requestAnimationFrame(doRedraw);
}
}
$(window.document).on("mousemove", onMouseMove);
// If the element is marked as collapsible, check for double click
// to toggle the element visibility
if (collapsible) {
$resizeShield.on("mousedown", function (e) {
$(window.document).off("mousemove", onMouseMove);
$resizeShield.off("mousedown");
$resizeShield.remove();
animationRequest = null;
toggle($element);
});
}
function endResize(e) {
if (isResizing) {
var elementSize = elementSizeFunction.apply($element);
if ($element.is(":visible")) {
elementPrefs.size = elementSize;
if ($resizableElement.length) {
elementPrefs.contentSize = contentSizeFunction.apply($resizableElement);
}
PreferencesManager.setViewState(elementID, elementPrefs);
repositionResizer(elementSize);
}
isResizing = false;
if (resizeStarted) {
$element.trigger("panelResizeEnd", [elementSize]);
}
// We wait 300ms to remove the resizer container to capture a mousedown
// on the container that would account for double click
window.setTimeout(function () {
$(window.document).off("mousemove", onMouseMove);
$resizeShield.off("mousedown");
$resizeShield.remove();
animationRequest = null;
}, 300);
}
}
$(window.document).one("mouseup", endResize);
e.preventDefault();
});
// Panel preferences initialization
if (elementPrefs) {
if (elementPrefs.size !== undefined) {
elementSizeFunction.apply($element, [elementPrefs.size]);
}
if (elementPrefs.contentSize !== undefined) {
contentSizeFunction.apply($resizableElement, [elementPrefs.contentSize]);
}
if (elementPrefs.visible !== undefined && !elementPrefs.visible) {
hide($element);
} else {
adjustSibling(elementSizeFunction.apply($element));
repositionResizer(elementSizeFunction.apply($element));
}
}
} | [
"function",
"makeResizable",
"(",
"element",
",",
"direction",
",",
"position",
",",
"minSize",
",",
"collapsible",
",",
"forceLeft",
",",
"createdByWorkspaceManager",
",",
"usePercentages",
",",
"_attachToParent",
")",
"{",
"var",
"$resizer",
"=",
"$",
"(",
"'<... | Adds resizing and (optionally) expand/collapse capabilities to a given html element. The element's size
& visibility are automatically saved & restored as a view-state preference.
Resizing can be configured in two directions:
- Vertical ("vert"): Resizes the height of the element
- Horizontal ("horz"): Resizes the width of the element
Resizer handlers can be positioned on the element at:
- Top ("top") or bottom ("bottom") for vertical resizing
- Left ("left") or right ("right") for horizontal resizing
A resizable element triggers the following events while resizing:
- panelResizeStart: When the resize starts. Passed the new size.
- panelResizeUpdate: When the resize gets updated. Passed the new size.
- panelResizeEnd: When the resize ends. Passed the final size.
- panelCollapsed: When the panel gets collapsed (or hidden). Passed the last size
before collapse. May occur without any resize events.
- panelExpanded: When the panel gets expanded (or shown). Passed the initial size.
May occur without any resize events.
@param {!DOMNode} element DOM element which should be made resizable. Must have an id attribute, for
use as a preferences key.
@param {!string} direction Direction of the resize action: one of the DIRECTION_* constants.
@param {!string} position Which side of the element can be dragged: one of the POSITION_* constants
(TOP/BOTTOM for vertical resizing or LEFT/RIGHT for horizontal).
@param {?number} minSize Minimum size (width or height) of the element's outer dimensions, including
border & padding. Defaults to DEFAULT_MIN_SIZE.
@param {?boolean} collapsible Indicates the panel is collapsible on double click on the
resizer. Defaults to false.
@param {?string} forceLeft CSS selector indicating element whose 'left' should be locked to the
the resizable element's size (useful for siblings laid out to the right of
the element). Must lie in element's parent's subtree.
@param {?boolean} createdByWorkspaceManager For internal use only
@param {?boolean} usePercentages Maintain the size of the element as a percentage of its parent
the default is to maintain the size of the element in pixels
@param {?boolean} _attachToParent Attaches the resizer element to parent of the element rather than
to element itself. Attach the resizer to the parent *ONLY* if element has the
same offset as parent otherwise the resizer will be incorrectly positioned.
FOR INTERNAL USE ONLY | [
"Adds",
"resizing",
"and",
"(",
"optionally",
")",
"expand",
"/",
"collapse",
"capabilities",
"to",
"a",
"given",
"html",
"element",
".",
"The",
"element",
"s",
"size",
"&",
"visibility",
"are",
"automatically",
"saved",
"&",
"restored",
"as",
"a",
"view",
... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/utils/Resizer.js#L198-L522 | train | Creates a resizable element | [
30522,
3853,
9338,
2229,
21335,
3468,
1006,
5783,
1010,
3257,
1010,
2597,
1010,
8117,
5332,
4371,
1010,
8902,
2721,
4523,
7028,
1010,
2486,
2571,
6199,
1010,
2580,
3762,
9316,
15327,
24805,
4590,
1010,
2224,
4842,
13013,
13923,
1010,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/JSUtils/ScopeManager.js | isFileBeingEdited | function isFileBeingEdited(filePath) {
var currentEditor = EditorManager.getActiveEditor(),
currentDoc = currentEditor && currentEditor.document;
return (currentDoc && currentDoc.file.fullPath === filePath);
} | javascript | function isFileBeingEdited(filePath) {
var currentEditor = EditorManager.getActiveEditor(),
currentDoc = currentEditor && currentEditor.document;
return (currentDoc && currentDoc.file.fullPath === filePath);
} | [
"function",
"isFileBeingEdited",
"(",
"filePath",
")",
"{",
"var",
"currentEditor",
"=",
"EditorManager",
".",
"getActiveEditor",
"(",
")",
",",
"currentDoc",
"=",
"currentEditor",
"&&",
"currentEditor",
".",
"document",
";",
"return",
"(",
"currentDoc",
"&&",
"... | Test if the file path is in current editor
@param {string} filePath file path to test for exclusion.
@return {boolean} true if in editor, false otherwise. | [
"Test",
"if",
"the",
"file",
"path",
"is",
"in",
"current",
"editor"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/JSUtils/ScopeManager.js#L217-L222 | train | Check if the file is being edited | [
30522,
3853,
2003,
8873,
2571,
19205,
21558,
17572,
1006,
5371,
15069,
1007,
1063,
13075,
2783,
2098,
15660,
1027,
3559,
24805,
4590,
1012,
2131,
19620,
2098,
15660,
1006,
1007,
1010,
2783,
3527,
2278,
1027,
2783,
2098,
15660,
1004,
1004,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/v4/ODataParentBinding.js | merge | function merge(mAggregatedQueryOptions, mQueryOptions, bInsideExpand) {
var mExpandValue,
aSelectValue;
/*
* Recursively merges the expand path into the aggregated query options.
*
* @param {string} sExpandPath The expand path
* @returns {boolean} Whether the query options could be merged
*/
function mergeExpandPath(sExpandPath) {
if (mAggregatedQueryOptions.$expand[sExpandPath]) {
return merge(mAggregatedQueryOptions.$expand[sExpandPath],
mQueryOptions.$expand[sExpandPath], true);
}
if (bCacheImmutable) {
return false;
}
mAggregatedQueryOptions.$expand[sExpandPath] = mExpandValue[sExpandPath];
return true;
}
/*
* Merges the select path into the aggregated query options.
*
* @param {string} sSelectPath The select path
* @returns {boolean} Whether the query options could be merged
*/
function mergeSelectPath(sSelectPath) {
if (mAggregatedQueryOptions.$select.indexOf(sSelectPath) < 0) {
if (bCacheImmutable) {
return false;
}
mAggregatedQueryOptions.$select.push(sSelectPath);
}
return true;
}
mExpandValue = mQueryOptions.$expand;
if (mExpandValue) {
mAggregatedQueryOptions.$expand = mAggregatedQueryOptions.$expand || {};
if (!Object.keys(mExpandValue).every(mergeExpandPath)) {
return false;
}
}
aSelectValue = mQueryOptions.$select;
if (aSelectValue) {
mAggregatedQueryOptions.$select = mAggregatedQueryOptions.$select || [];
if (!aSelectValue.every(mergeSelectPath)) {
return false;
}
}
if (mQueryOptions.$count) {
mAggregatedQueryOptions.$count = true;
}
return Object.keys(mQueryOptions).concat(Object.keys(mAggregatedQueryOptions))
.every(function (sName) {
if (sName === "$count" || sName === "$expand" || sName === "$select"
|| !bInsideExpand && !(sName in mQueryOptions)) {
return true;
}
return mQueryOptions[sName] === mAggregatedQueryOptions[sName];
});
} | javascript | function merge(mAggregatedQueryOptions, mQueryOptions, bInsideExpand) {
var mExpandValue,
aSelectValue;
/*
* Recursively merges the expand path into the aggregated query options.
*
* @param {string} sExpandPath The expand path
* @returns {boolean} Whether the query options could be merged
*/
function mergeExpandPath(sExpandPath) {
if (mAggregatedQueryOptions.$expand[sExpandPath]) {
return merge(mAggregatedQueryOptions.$expand[sExpandPath],
mQueryOptions.$expand[sExpandPath], true);
}
if (bCacheImmutable) {
return false;
}
mAggregatedQueryOptions.$expand[sExpandPath] = mExpandValue[sExpandPath];
return true;
}
/*
* Merges the select path into the aggregated query options.
*
* @param {string} sSelectPath The select path
* @returns {boolean} Whether the query options could be merged
*/
function mergeSelectPath(sSelectPath) {
if (mAggregatedQueryOptions.$select.indexOf(sSelectPath) < 0) {
if (bCacheImmutable) {
return false;
}
mAggregatedQueryOptions.$select.push(sSelectPath);
}
return true;
}
mExpandValue = mQueryOptions.$expand;
if (mExpandValue) {
mAggregatedQueryOptions.$expand = mAggregatedQueryOptions.$expand || {};
if (!Object.keys(mExpandValue).every(mergeExpandPath)) {
return false;
}
}
aSelectValue = mQueryOptions.$select;
if (aSelectValue) {
mAggregatedQueryOptions.$select = mAggregatedQueryOptions.$select || [];
if (!aSelectValue.every(mergeSelectPath)) {
return false;
}
}
if (mQueryOptions.$count) {
mAggregatedQueryOptions.$count = true;
}
return Object.keys(mQueryOptions).concat(Object.keys(mAggregatedQueryOptions))
.every(function (sName) {
if (sName === "$count" || sName === "$expand" || sName === "$select"
|| !bInsideExpand && !(sName in mQueryOptions)) {
return true;
}
return mQueryOptions[sName] === mAggregatedQueryOptions[sName];
});
} | [
"function",
"merge",
"(",
"mAggregatedQueryOptions",
",",
"mQueryOptions",
",",
"bInsideExpand",
")",
"{",
"var",
"mExpandValue",
",",
"aSelectValue",
";",
"/*\n\t\t\t * Recursively merges the expand path into the aggregated query options.\n\t\t\t *\n\t\t\t * @param {string} sExpandPat... | /*
Recursively merges the given query options into the given aggregated query options.
@param {object} mAggregatedQueryOptions The aggregated query options
@param {object} mQueryOptions The query options to merge into the aggregated query
options
@param {boolean} bInsideExpand Whether the given query options are inside a $expand
@returns {boolean} Whether the query options could be merged | [
"/",
"*",
"Recursively",
"merges",
"the",
"given",
"query",
"options",
"into",
"the",
"given",
"aggregated",
"query",
"options",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/ODataParentBinding.js#L159-L222 | train | Merge the query options into the aggregated query options. | [
30522,
3853,
13590,
1006,
23848,
17603,
11644,
4226,
2854,
7361,
9285,
1010,
1049,
4226,
2854,
7361,
9285,
1010,
8026,
7363,
10288,
9739,
2094,
1007,
1063,
13075,
2033,
2595,
9739,
2094,
10175,
5657,
1010,
2004,
12260,
6593,
10175,
5657,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
juliangarnier/anime | lib/anime.js | spring | function spring(string, duration) {
var params = parseEasingParameters(string);
var mass = minMax(is.und(params[0]) ? 1 : params[0], .1, 100);
var stiffness = minMax(is.und(params[1]) ? 100 : params[1], .1, 100);
var damping = minMax(is.und(params[2]) ? 10 : params[2], .1, 100);
var velocity = minMax(is.und(params[3]) ? 0 : params[3], .1, 100);
var w0 = Math.sqrt(stiffness / mass);
var zeta = damping / (2 * Math.sqrt(stiffness * mass));
var wd = zeta < 1 ? w0 * Math.sqrt(1 - zeta * zeta) : 0;
var a = 1;
var b = zeta < 1 ? (zeta * w0 + -velocity) / wd : -velocity + w0;
function solver(t) {
var progress = duration ? (duration * t) / 1000 : t;
if (zeta < 1) {
progress = Math.exp(-progress * zeta * w0) * (a * Math.cos(wd * progress) + b * Math.sin(wd * progress));
} else {
progress = (a + b * progress) * Math.exp(-progress * w0);
}
if (t === 0 || t === 1) { return t; }
return 1 - progress;
}
function getDuration() {
var cached = cache.springs[string];
if (cached) { return cached; }
var frame = 1/6;
var elapsed = 0;
var rest = 0;
while(true) {
elapsed += frame;
if (solver(elapsed) === 1) {
rest++;
if (rest >= 16) { break; }
} else {
rest = 0;
}
}
var duration = elapsed * frame * 1000;
cache.springs[string] = duration;
return duration;
}
return duration ? solver : getDuration;
} | javascript | function spring(string, duration) {
var params = parseEasingParameters(string);
var mass = minMax(is.und(params[0]) ? 1 : params[0], .1, 100);
var stiffness = minMax(is.und(params[1]) ? 100 : params[1], .1, 100);
var damping = minMax(is.und(params[2]) ? 10 : params[2], .1, 100);
var velocity = minMax(is.und(params[3]) ? 0 : params[3], .1, 100);
var w0 = Math.sqrt(stiffness / mass);
var zeta = damping / (2 * Math.sqrt(stiffness * mass));
var wd = zeta < 1 ? w0 * Math.sqrt(1 - zeta * zeta) : 0;
var a = 1;
var b = zeta < 1 ? (zeta * w0 + -velocity) / wd : -velocity + w0;
function solver(t) {
var progress = duration ? (duration * t) / 1000 : t;
if (zeta < 1) {
progress = Math.exp(-progress * zeta * w0) * (a * Math.cos(wd * progress) + b * Math.sin(wd * progress));
} else {
progress = (a + b * progress) * Math.exp(-progress * w0);
}
if (t === 0 || t === 1) { return t; }
return 1 - progress;
}
function getDuration() {
var cached = cache.springs[string];
if (cached) { return cached; }
var frame = 1/6;
var elapsed = 0;
var rest = 0;
while(true) {
elapsed += frame;
if (solver(elapsed) === 1) {
rest++;
if (rest >= 16) { break; }
} else {
rest = 0;
}
}
var duration = elapsed * frame * 1000;
cache.springs[string] = duration;
return duration;
}
return duration ? solver : getDuration;
} | [
"function",
"spring",
"(",
"string",
",",
"duration",
")",
"{",
"var",
"params",
"=",
"parseEasingParameters",
"(",
"string",
")",
";",
"var",
"mass",
"=",
"minMax",
"(",
"is",
".",
"und",
"(",
"params",
"[",
"0",
"]",
")",
"?",
"1",
":",
"params",
... | Spring solver inspired by Webkit Copyright © 2016 Apple Inc. All rights reserved. https://webkit.org/demos/spring/spring.js | [
"Spring",
"solver",
"inspired",
"by",
"Webkit",
"Copyright",
"©",
"2016",
"Apple",
"Inc",
".",
"All",
"rights",
"reserved",
".",
"https",
":",
"//",
"webkit",
".",
"org",
"/",
"demos",
"/",
"spring",
"/",
"spring",
".",
"js"
] | 875a3d6745d4bff2e4c6ffe0e2d24aac3bf8a45a | https://github.com/juliangarnier/anime/blob/875a3d6745d4bff2e4c6ffe0e2d24aac3bf8a45a/lib/anime.js#L84-L130 | train | Spring function | [
30522,
3853,
3500,
1006,
5164,
1010,
9367,
1007,
1063,
13075,
11498,
5244,
1027,
11968,
19763,
21369,
3070,
28689,
22828,
2015,
1006,
5164,
1007,
1025,
13075,
3742,
1027,
8117,
17848,
1006,
2003,
1012,
6151,
1006,
11498,
5244,
1031,
1014,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.suite/src/sap/ui/suite/QuickViewUtils.js | function(sServiceUrl, sCollection, sType, mProperties, iSizeLimit) {
var oModel = new sap.ui.model.odata.ODataModel(sServiceUrl,false);
if (iSizeLimit) {
oModel.setSizeLimit(iSizeLimit);
}
var oQV = new sap.ui.ux3.QuickView({type:sType, showActionBar:false});
oQV.setModel(oModel);
oQV.addContent(this._createDSContent(oQV,sCollection,mProperties));
return oQV;
} | javascript | function(sServiceUrl, sCollection, sType, mProperties, iSizeLimit) {
var oModel = new sap.ui.model.odata.ODataModel(sServiceUrl,false);
if (iSizeLimit) {
oModel.setSizeLimit(iSizeLimit);
}
var oQV = new sap.ui.ux3.QuickView({type:sType, showActionBar:false});
oQV.setModel(oModel);
oQV.addContent(this._createDSContent(oQV,sCollection,mProperties));
return oQV;
} | [
"function",
"(",
"sServiceUrl",
",",
"sCollection",
",",
"sType",
",",
"mProperties",
",",
"iSizeLimit",
")",
"{",
"var",
"oModel",
"=",
"new",
"sap",
".",
"ui",
".",
"model",
".",
"odata",
".",
"ODataModel",
"(",
"sServiceUrl",
",",
"false",
")",
";",
... | /* create a QV instance with dataset content | [
"/",
"*",
"create",
"a",
"QV",
"instance",
"with",
"dataset",
"content"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.suite/src/sap/ui/suite/QuickViewUtils.js#L57-L66 | train | Creates a QuickView instance | [
30522,
3853,
1006,
7020,
2121,
7903,
11236,
2140,
1010,
8040,
14511,
18491,
1010,
2358,
18863,
1010,
6131,
18981,
8743,
3111,
1010,
2003,
4697,
17960,
4183,
1007,
1063,
13075,
18168,
10244,
2140,
1027,
2047,
20066,
1012,
21318,
1012,
2944,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
nhn/tui.editor | src/js/extensions/table/table.js | _snatchWysiwygCommand | function _snatchWysiwygCommand(commandWrapper) {
const {command} = commandWrapper;
if (!command.isWWType()) {
return;
}
switch (command.getName()) {
case 'AddRow':
commandWrapper.command = wwAddRow;
break;
case 'AddCol':
commandWrapper.command = wwAddCol;
break;
case 'RemoveRow':
commandWrapper.command = wwRemoveRow;
break;
case 'RemoveCol':
commandWrapper.command = wwRemoveCol;
break;
case 'AlignCol':
commandWrapper.command = wwAlignCol;
break;
default:
}
} | javascript | function _snatchWysiwygCommand(commandWrapper) {
const {command} = commandWrapper;
if (!command.isWWType()) {
return;
}
switch (command.getName()) {
case 'AddRow':
commandWrapper.command = wwAddRow;
break;
case 'AddCol':
commandWrapper.command = wwAddCol;
break;
case 'RemoveRow':
commandWrapper.command = wwRemoveRow;
break;
case 'RemoveCol':
commandWrapper.command = wwRemoveCol;
break;
case 'AlignCol':
commandWrapper.command = wwAlignCol;
break;
default:
}
} | [
"function",
"_snatchWysiwygCommand",
"(",
"commandWrapper",
")",
"{",
"const",
"{",
"command",
"}",
"=",
"commandWrapper",
";",
"if",
"(",
"!",
"command",
".",
"isWWType",
"(",
")",
")",
"{",
"return",
";",
"}",
"switch",
"(",
"command",
".",
"getName",
... | Snatch wysiwyg command.
@param {{command: object}} commandWrapper - wysiwyg command wrapper
@private | [
"Snatch",
"wysiwyg",
"command",
"."
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/table/table.js#L102-L127 | train | snatch WYE command | [
30522,
3853,
1035,
23365,
18418,
5332,
18418,
18195,
5358,
2386,
2094,
1006,
3094,
13088,
29098,
2121,
1007,
1063,
9530,
3367,
1063,
3094,
1065,
1027,
3094,
13088,
29098,
2121,
1025,
2065,
1006,
999,
3094,
1012,
2003,
2860,
26677,
18863,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/utils/PerfUtils.js | markStart | function markStart(name) {
if (!enabled) {
return;
}
var time = brackets.app.getElapsedMilliseconds();
var id = _generatePerfMeasurements(name);
var i;
for (i = 0; i < id.length; i++) {
_markStart(id[i], time);
}
return id.length > 1 ? id : id[0];
} | javascript | function markStart(name) {
if (!enabled) {
return;
}
var time = brackets.app.getElapsedMilliseconds();
var id = _generatePerfMeasurements(name);
var i;
for (i = 0; i < id.length; i++) {
_markStart(id[i], time);
}
return id.length > 1 ? id : id[0];
} | [
"function",
"markStart",
"(",
"name",
")",
"{",
"if",
"(",
"!",
"enabled",
")",
"{",
"return",
";",
"}",
"var",
"time",
"=",
"brackets",
".",
"app",
".",
"getElapsedMilliseconds",
"(",
")",
";",
"var",
"id",
"=",
"_generatePerfMeasurements",
"(",
"name",... | Start a new named timer. The name should be as descriptive as possible, since
this name will appear as an entry in the performance report.
For example: "Open file: /Users/brackets/src/ProjectManager.js"
Multiple timers can be opened simultaneously.
Returns an opaque set of timer ids which can be stored and used for calling
addMeasurement(). Since name is often creating via concatenating strings this
return value allows clients to construct the name once.
@param {(string|Array.<string>)} name Single name or an Array of names.
@return {(Object|Array.<Object>)} Opaque timer id or array of timer ids. | [
"Start",
"a",
"new",
"named",
"timer",
".",
"The",
"name",
"should",
"be",
"as",
"descriptive",
"as",
"possible",
"since",
"this",
"name",
"will",
"appear",
"as",
"an",
"entry",
"in",
"the",
"performance",
"report",
".",
"For",
"example",
":",
"Open",
"f... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/utils/PerfUtils.js#L161-L174 | train | Mark start of a new app | [
30522,
3853,
6017,
7559,
2102,
1006,
2171,
1007,
1063,
2065,
1006,
999,
9124,
1007,
1063,
2709,
1025,
1065,
13075,
2051,
1027,
19719,
1012,
10439,
1012,
2131,
10581,
29251,
22117,
8591,
5562,
8663,
5104,
1006,
1007,
1025,
13075,
8909,
1027,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | third_party/js/mozmill/shared-modules/software-update.js | softwareUpdate_waitForDialogOpen | function softwareUpdate_waitForDialogOpen(browserController) {
this._controller = utils.handleWindow("type", "Update:Wizard",
null, true);
this._wizard = this.getElement({type: "wizard"});
this._controller.waitFor(function() {
return this.currentPage != WIZARD_PAGES.dummy;
}, "Dummy wizard page has been made invisible.", undefined, undefined, this);
this._controller.window.focus();
} | javascript | function softwareUpdate_waitForDialogOpen(browserController) {
this._controller = utils.handleWindow("type", "Update:Wizard",
null, true);
this._wizard = this.getElement({type: "wizard"});
this._controller.waitFor(function() {
return this.currentPage != WIZARD_PAGES.dummy;
}, "Dummy wizard page has been made invisible.", undefined, undefined, this);
this._controller.window.focus();
} | [
"function",
"softwareUpdate_waitForDialogOpen",
"(",
"browserController",
")",
"{",
"this",
".",
"_controller",
"=",
"utils",
".",
"handleWindow",
"(",
"\"type\"",
",",
"\"Update:Wizard\"",
",",
"null",
",",
"true",
")",
";",
"this",
".",
"_wizard",
"=",
"this",... | Wait for the software update dialog
@param {MozMillController} browserController
Mozmill controller of the browser window | [
"Wait",
"for",
"the",
"software",
"update",
"dialog"
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/software-update.js#L460-L470 | train | Wait for the wizard to open | [
30522,
3853,
4007,
6279,
13701,
1035,
3524,
3877,
4818,
22844,
11837,
1006,
16602,
8663,
13181,
10820,
1007,
1063,
2023,
1012,
1035,
11486,
1027,
21183,
12146,
1012,
5047,
11101,
5004,
1006,
1000,
2828,
1000,
1010,
1000,
10651,
1024,
10276,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
firebase/firebase-js-sdk | scripts/docgen/generate-docs.js | writeGeneratedFileList | function writeGeneratedFileList(htmlFiles) {
const fileList = htmlFiles.map(filename => {
return {
title: filename,
path: `${devsitePath}${filename}`
};
});
const generatedTocYAML = yaml.safeDump({ toc: fileList });
return fs
.writeFile(`${docPath}/_toc_autogenerated.yaml`, generatedTocYAML)
.then(() => htmlFiles);
} | javascript | function writeGeneratedFileList(htmlFiles) {
const fileList = htmlFiles.map(filename => {
return {
title: filename,
path: `${devsitePath}${filename}`
};
});
const generatedTocYAML = yaml.safeDump({ toc: fileList });
return fs
.writeFile(`${docPath}/_toc_autogenerated.yaml`, generatedTocYAML)
.then(() => htmlFiles);
} | [
"function",
"writeGeneratedFileList",
"(",
"htmlFiles",
")",
"{",
"const",
"fileList",
"=",
"htmlFiles",
".",
"map",
"(",
"filename",
"=>",
"{",
"return",
"{",
"title",
":",
"filename",
",",
"path",
":",
"`",
"${",
"devsitePath",
"}",
"${",
"filename",
"}"... | Writes a _toc_autogenerated.yaml as a record of all files that were
autogenerated. Helpful to tech writers.
@param {Array} htmlFiles List of html files found in generated dir. | [
"Writes",
"a",
"_toc_autogenerated",
".",
"yaml",
"as",
"a",
"record",
"of",
"all",
"files",
"that",
"were",
"autogenerated",
".",
"Helpful",
"to",
"tech",
"writers",
"."
] | 491598a499813dacc23724de5e237ec220cc560e | https://github.com/firebase/firebase-js-sdk/blob/491598a499813dacc23724de5e237ec220cc560e/scripts/docgen/generate-docs.js#L218-L229 | train | Write generated toc file | [
30522,
3853,
4339,
6914,
16848,
8873,
2571,
9863,
1006,
16129,
8873,
4244,
1007,
1063,
9530,
3367,
5371,
9863,
1027,
16129,
8873,
4244,
1012,
4949,
1006,
5371,
18442,
1027,
1028,
1063,
2709,
1063,
2516,
1024,
5371,
18442,
1010,
4130,
1024,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/LiveDevelopment/Agents/DOMHelpers.js | _find | function _find(src, match, skip, quotes, comments) {
if (typeof match === "string") {
match = [match, match.length];
}
if (skip === undefined) {
skip = 0;
}
var i, activeQuote, isComment = false;
for (i = skip; i < src.length; i++) {
if (quotes && _isQuote(src[i], src[i - 1], activeQuote)) {
// starting quote
activeQuote = activeQuote ? undefined : src[i];
} else if (!activeQuote) {
if (comments && !isComment && src.substr(i, comments[0].length) === comments[0]) {
// opening comment
isComment = true;
i += comments[0].length - 1;
} else if (isComment) {
// we are commented
if (src.substr(i, comments[1].length) === comments[1]) {
isComment = false;
i += comments[1].length - 1;
}
} else if (src.substr(i, match[1]).search(match[0]) === 0) {
// match
return i;
}
}
}
return -1;
} | javascript | function _find(src, match, skip, quotes, comments) {
if (typeof match === "string") {
match = [match, match.length];
}
if (skip === undefined) {
skip = 0;
}
var i, activeQuote, isComment = false;
for (i = skip; i < src.length; i++) {
if (quotes && _isQuote(src[i], src[i - 1], activeQuote)) {
// starting quote
activeQuote = activeQuote ? undefined : src[i];
} else if (!activeQuote) {
if (comments && !isComment && src.substr(i, comments[0].length) === comments[0]) {
// opening comment
isComment = true;
i += comments[0].length - 1;
} else if (isComment) {
// we are commented
if (src.substr(i, comments[1].length) === comments[1]) {
isComment = false;
i += comments[1].length - 1;
}
} else if (src.substr(i, match[1]).search(match[0]) === 0) {
// match
return i;
}
}
}
return -1;
} | [
"function",
"_find",
"(",
"src",
",",
"match",
",",
"skip",
",",
"quotes",
",",
"comments",
")",
"{",
"if",
"(",
"typeof",
"match",
"===",
"\"string\"",
")",
"{",
"match",
"=",
"[",
"match",
",",
"match",
".",
"length",
"]",
";",
"}",
"if",
"(",
... | Find the next match using several constraints
@param {string} source string
@param {string} or [{regex}, {length}] the match definition
@param {integer} ignore characters before this offset
@param {boolean} watch for quotes
@param [{string},{string}] watch for comments | [
"Find",
"the",
"next",
"match",
"using",
"several",
"constraints"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/Agents/DOMHelpers.js#L66-L96 | train | Find the first match in the source string | [
30522,
3853,
1035,
2424,
1006,
5034,
2278,
1010,
2674,
1010,
13558,
1010,
16614,
1010,
7928,
1007,
1063,
2065,
1006,
2828,
11253,
2674,
1027,
1027,
1027,
1000,
5164,
1000,
1007,
1063,
2674,
1027,
1031,
2674,
1010,
2674,
1012,
3091,
1033,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
dequelabs/axe-core | lib/core/utils/dq-element.js | DqElement | function DqElement(element, options, spec) {
this._fromFrame = !!spec;
this.spec = spec || {};
if (options && options.absolutePaths) {
this._options = { toRoot: true };
}
/**
* The generated HTML source code of the element
* @type {String}
*/
this.source =
this.spec.source !== undefined ? this.spec.source : getSource(element);
/**
* The element which this object is based off or the containing frame, used for sorting.
* Excluded in toJSON method.
* @type {HTMLElement}
*/
this._element = element;
} | javascript | function DqElement(element, options, spec) {
this._fromFrame = !!spec;
this.spec = spec || {};
if (options && options.absolutePaths) {
this._options = { toRoot: true };
}
/**
* The generated HTML source code of the element
* @type {String}
*/
this.source =
this.spec.source !== undefined ? this.spec.source : getSource(element);
/**
* The element which this object is based off or the containing frame, used for sorting.
* Excluded in toJSON method.
* @type {HTMLElement}
*/
this._element = element;
} | [
"function",
"DqElement",
"(",
"element",
",",
"options",
",",
"spec",
")",
"{",
"this",
".",
"_fromFrame",
"=",
"!",
"!",
"spec",
";",
"this",
".",
"spec",
"=",
"spec",
"||",
"{",
"}",
";",
"if",
"(",
"options",
"&&",
"options",
".",
"absolutePaths",... | "Serialized" `HTMLElement`. It will calculate the CSS selector,
grab the source (outerHTML) and offer an array for storing frame paths
@param {HTMLElement} element The element to serialize
@param {Object} spec Properties to use in place of the element when instantiated on Elements from other frames | [
"Serialized",
"HTMLElement",
".",
"It",
"will",
"calculate",
"the",
"CSS",
"selector",
"grab",
"the",
"source",
"(",
"outerHTML",
")",
"and",
"offer",
"an",
"array",
"for",
"storing",
"frame",
"paths"
] | 727323c07980e2291575f545444d389fb942906f | https://github.com/dequelabs/axe-core/blob/727323c07980e2291575f545444d389fb942906f/lib/core/utils/dq-element.js#L28-L49 | train | DqElement constructor. | [
30522,
3853,
25410,
12260,
3672,
1006,
5783,
1010,
7047,
1010,
28699,
1007,
1063,
2023,
1012,
1035,
2013,
15643,
1027,
999,
999,
28699,
1025,
2023,
1012,
28699,
1027,
28699,
1064,
1064,
1063,
1065,
1025,
2065,
1006,
7047,
1004,
1004,
7047,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/thirdparty/signals.js | function (paramsArr) {
var handlerReturn, params;
if (this.active && !!this._listener) {
params = this.params? this.params.concat(paramsArr) : paramsArr;
handlerReturn = this._listener.apply(this.context, params);
if (this._isOnce) {
this.detach();
}
}
return handlerReturn;
} | javascript | function (paramsArr) {
var handlerReturn, params;
if (this.active && !!this._listener) {
params = this.params? this.params.concat(paramsArr) : paramsArr;
handlerReturn = this._listener.apply(this.context, params);
if (this._isOnce) {
this.detach();
}
}
return handlerReturn;
} | [
"function",
"(",
"paramsArr",
")",
"{",
"var",
"handlerReturn",
",",
"params",
";",
"if",
"(",
"this",
".",
"active",
"&&",
"!",
"!",
"this",
".",
"_listener",
")",
"{",
"params",
"=",
"this",
".",
"params",
"?",
"this",
".",
"params",
".",
"concat",... | Call listener passing arbitrary parameters.
<p>If binding was added using `Signal.addOnce()` it will be automatically removed from signal dispatch queue, this method is used internally for the signal dispatch.</p>
@param {Array} [paramsArr] Array of parameters that should be passed to the listener
@return {*} Value returned by the listener. | [
"Call",
"listener",
"passing",
"arbitrary",
"parameters",
".",
"<p",
">",
"If",
"binding",
"was",
"added",
"using",
"Signal",
".",
"addOnce",
"()",
"it",
"will",
"be",
"automatically",
"removed",
"from",
"signal",
"dispatch",
"queue",
"this",
"method",
"is",
... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/signals.js#L89-L99 | train | call listener | [
30522,
3853,
1006,
11498,
5244,
2906,
2099,
1007,
1063,
13075,
28213,
13465,
14287,
1010,
11498,
5244,
1025,
2065,
1006,
2023,
1012,
3161,
1004,
1004,
999,
999,
2023,
1012,
1035,
19373,
1007,
1063,
11498,
5244,
1027,
2023,
1012,
11498,
5244... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
uikit/uikit | build/scss.js | getVariablesFromFile | function getVariablesFromFile(file, data) {
const regex = /(\$[\w-]*)\s*:\s*(.*);/g;
let match = regex.exec(data);
while (match) {
/* check if variable is an background icon, if so replace it directly by the SVG */
if (match[0].indexOf('../../images/backgrounds') >= 0) {
const iconregex = /(\$[\w-]+)\s*:\s*"\.\.\/\.\.\/images\/backgrounds\/([\w./-]+)" !default;/g;
const iconmatch = iconregex.exec(match[0]);
let svg = fs.readFileSync(`src/images/backgrounds/${iconmatch[2]}`).toString();
svg = `"${svg.replace(/\r?\n|\r/g, '%0A')
.replace(/"/g, '\'')
.replace(/\s/g, '%20')
.replace(/</g, '%3C')
.replace(/=/g, '%3D')
.replace(/'/g, '%22')
.replace(/:/g, '%3A')
.replace(/\//g, '%2F')
.replace(/>/g, '%3E')
.replace(/%3Csvg/, 'data:image/svg+xml;charset=UTF-8,%3Csvg')}"`;
/* add SVG to the coreVar and themeVar only if it is a theme file and make it optional */
if (file.indexOf('theme/') < 0) {
coreVar[iconmatch[1]] = {value: `${svg} !default;`, dependencies: []};
}
themeVar[iconmatch[1]] = {value: `${svg} !default;`, dependencies: []};
/* add SVG to the variable within the file itself as well */
const inlineSVG = `${iconmatch[1]}: ${svg} !default;`;
data = data.replace(match[0], inlineSVG);
/* when it is not an SVG add the variable and search for its dependencies */
} else {
const variablesRegex = /(\$[\w-]+)/g;
let variablesMatch = variablesRegex.exec(match[2]);
const dependencies = [];
while (variablesMatch) {
dependencies.push(variablesMatch[1]);
variablesMatch = variablesRegex.exec(match[2]);
}
/* add variables only to the core Variables if it is not a theme file */
if (file.indexOf('theme/') < 0) {
coreVar[match[1]] = {value: `${match[2]};`, dependencies: Array.from(dependencies)};
}
themeVar[match[1]] = {value: `${match[2]};`, dependencies: Array.from(dependencies)};
}
match = regex.exec(data);
}
return data;
} | javascript | function getVariablesFromFile(file, data) {
const regex = /(\$[\w-]*)\s*:\s*(.*);/g;
let match = regex.exec(data);
while (match) {
/* check if variable is an background icon, if so replace it directly by the SVG */
if (match[0].indexOf('../../images/backgrounds') >= 0) {
const iconregex = /(\$[\w-]+)\s*:\s*"\.\.\/\.\.\/images\/backgrounds\/([\w./-]+)" !default;/g;
const iconmatch = iconregex.exec(match[0]);
let svg = fs.readFileSync(`src/images/backgrounds/${iconmatch[2]}`).toString();
svg = `"${svg.replace(/\r?\n|\r/g, '%0A')
.replace(/"/g, '\'')
.replace(/\s/g, '%20')
.replace(/</g, '%3C')
.replace(/=/g, '%3D')
.replace(/'/g, '%22')
.replace(/:/g, '%3A')
.replace(/\//g, '%2F')
.replace(/>/g, '%3E')
.replace(/%3Csvg/, 'data:image/svg+xml;charset=UTF-8,%3Csvg')}"`;
/* add SVG to the coreVar and themeVar only if it is a theme file and make it optional */
if (file.indexOf('theme/') < 0) {
coreVar[iconmatch[1]] = {value: `${svg} !default;`, dependencies: []};
}
themeVar[iconmatch[1]] = {value: `${svg} !default;`, dependencies: []};
/* add SVG to the variable within the file itself as well */
const inlineSVG = `${iconmatch[1]}: ${svg} !default;`;
data = data.replace(match[0], inlineSVG);
/* when it is not an SVG add the variable and search for its dependencies */
} else {
const variablesRegex = /(\$[\w-]+)/g;
let variablesMatch = variablesRegex.exec(match[2]);
const dependencies = [];
while (variablesMatch) {
dependencies.push(variablesMatch[1]);
variablesMatch = variablesRegex.exec(match[2]);
}
/* add variables only to the core Variables if it is not a theme file */
if (file.indexOf('theme/') < 0) {
coreVar[match[1]] = {value: `${match[2]};`, dependencies: Array.from(dependencies)};
}
themeVar[match[1]] = {value: `${match[2]};`, dependencies: Array.from(dependencies)};
}
match = regex.exec(data);
}
return data;
} | [
"function",
"getVariablesFromFile",
"(",
"file",
",",
"data",
")",
"{",
"const",
"regex",
"=",
"/",
"(\\$[\\w-]*)\\s*:\\s*(.*);",
"/",
"g",
";",
"let",
"match",
"=",
"regex",
".",
"exec",
"(",
"data",
")",
";",
"while",
"(",
"match",
")",
"{",
"/* check ... | /*
function to extract all the variables from a given file with its data.
@return an updated data where the icons have been replaced by the actual SVG data. | [
"/",
"*",
"function",
"to",
"extract",
"all",
"the",
"variables",
"from",
"a",
"given",
"file",
"with",
"its",
"data",
"."
] | b7760008135313b6a81f645c750db6f285a89488 | https://github.com/uikit/uikit/blob/b7760008135313b6a81f645c750db6f285a89488/build/scss.js#L231-L289 | train | get variables from file | [
30522,
3853,
2131,
10755,
19210,
22747,
21716,
8873,
2571,
1006,
5371,
1010,
2951,
1007,
1063,
9530,
3367,
19723,
10288,
1027,
1013,
1006,
1032,
1002,
1031,
1032,
1059,
1011,
1033,
1008,
1007,
1032,
1055,
1008,
1024,
1032,
1055,
1008,
1006,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jgraph/mxgraph | javascript/mxClient.js | function(url, params, doc, target)
{
return new mxXmlRequest(url, params).simulate(doc, target);
} | javascript | function(url, params, doc, target)
{
return new mxXmlRequest(url, params).simulate(doc, target);
} | [
"function",
"(",
"url",
",",
"params",
",",
"doc",
",",
"target",
")",
"{",
"return",
"new",
"mxXmlRequest",
"(",
"url",
",",
"params",
")",
".",
"simulate",
"(",
"doc",
",",
"target",
")",
";",
"}"
] | Function: submit
Submits the given parameters to the specified URL using
<mxXmlRequest.simulate> and returns the <mxXmlRequest>.
Make sure to use encodeURIComponent for the parameter
values.
Parameters:
url - URL to get the data from.
params - Parameters for the form.
doc - Document to create the form in.
target - Target to send the form result to. | [
"Function",
":",
"submit"
] | 33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44 | https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L3723-L3726 | train | Simulates a request to the mxnet server | [
30522,
3853,
1006,
24471,
2140,
1010,
11498,
5244,
1010,
9986,
1010,
4539,
1007,
1063,
2709,
2047,
25630,
2595,
19968,
2890,
15500,
1006,
24471,
2140,
1010,
11498,
5244,
1007,
1012,
26633,
1006,
9986,
1010,
4539,
1007,
1025,
1065,
102,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
graphql/graphiql | resources/mocha-bootload.js | propagateToGlobal | function propagateToGlobal(window) {
for (var key in window) {
if (!window.hasOwnProperty(key)) {
continue;
}
if (key in global) {
continue;
}
global[key] = window[key];
}
} | javascript | function propagateToGlobal(window) {
for (var key in window) {
if (!window.hasOwnProperty(key)) {
continue;
}
if (key in global) {
continue;
}
global[key] = window[key];
}
} | [
"function",
"propagateToGlobal",
"(",
"window",
")",
"{",
"for",
"(",
"var",
"key",
"in",
"window",
")",
"{",
"if",
"(",
"!",
"window",
".",
"hasOwnProperty",
"(",
"key",
")",
")",
"{",
"continue",
";",
"}",
"if",
"(",
"key",
"in",
"global",
")",
"... | from mocha-jsdom https://github.com/rstacruz/mocha-jsdom/blob/master/index.js#L80 | [
"from",
"mocha",
"-",
"jsdom",
"https",
":",
"//",
"github",
".",
"com",
"/",
"rstacruz",
"/",
"mocha",
"-",
"jsdom",
"/",
"blob",
"/",
"master",
"/",
"index",
".",
"js#L80"
] | 5d0f31d6059edc5f816edba3962c3b57fdabd478 | https://github.com/graphql/graphiql/blob/5d0f31d6059edc5f816edba3962c3b57fdabd478/resources/mocha-bootload.js#L38-L48 | train | Propagate the window object to global | [
30522,
3853,
17678,
16098,
22513,
8649,
4135,
10264,
1006,
3332,
1007,
1063,
2005,
1006,
13075,
3145,
1999,
3332,
1007,
1063,
2065,
1006,
999,
3332,
1012,
2038,
12384,
21572,
4842,
3723,
1006,
3145,
1007,
1007,
1063,
3613,
1025,
1065,
2065,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
goldfire/howler.js | examples/3d/js/player.js | function(dist) {
var dx = Math.cos(this.dir) * dist;
var dy = Math.sin(this.dir) * dist;
// Move the player if they can walk here.
this.x += (game.map.check(this.x + dx, this.y) <= 0) ? dx : 0;
this.y += (game.map.check(this.x, this.y + dy) <= 0) ? dy : 0;
this.steps += dist;
// Update the position of the audio listener.
Howler.pos(this.x, this.y, -0.5);
} | javascript | function(dist) {
var dx = Math.cos(this.dir) * dist;
var dy = Math.sin(this.dir) * dist;
// Move the player if they can walk here.
this.x += (game.map.check(this.x + dx, this.y) <= 0) ? dx : 0;
this.y += (game.map.check(this.x, this.y + dy) <= 0) ? dy : 0;
this.steps += dist;
// Update the position of the audio listener.
Howler.pos(this.x, this.y, -0.5);
} | [
"function",
"(",
"dist",
")",
"{",
"var",
"dx",
"=",
"Math",
".",
"cos",
"(",
"this",
".",
"dir",
")",
"*",
"dist",
";",
"var",
"dy",
"=",
"Math",
".",
"sin",
"(",
"this",
".",
"dir",
")",
"*",
"dist",
";",
"// Move the player if they can walk here."... | Handle walking based on the state of inputs.
@param {Number} dist Distance to walk based on time elapsed. | [
"Handle",
"walking",
"based",
"on",
"the",
"state",
"of",
"inputs",
"."
] | 030db918dd8ce640afd57e172418472497e8f113 | https://github.com/goldfire/howler.js/blob/030db918dd8ce640afd57e172418472497e8f113/examples/3d/js/player.js#L53-L65 | train | Move the player to the next step | [
30522,
3853,
1006,
4487,
3367,
1007,
1063,
13075,
1040,
2595,
1027,
8785,
1012,
2522,
2015,
1006,
2023,
1012,
16101,
1007,
1008,
4487,
3367,
1025,
13075,
1040,
2100,
1027,
8785,
1012,
8254,
1006,
2023,
1012,
16101,
1007,
1008,
4487,
3367,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
apache/incubator-echarts | src/chart/treemap/treemapLayout.js | worst | function worst(row, rowFixedLength, ratio) {
var areaMax = 0;
var areaMin = Infinity;
for (var i = 0, area, len = row.length; i < len; i++) {
area = row[i].getLayout().area;
if (area) {
area < areaMin && (areaMin = area);
area > areaMax && (areaMax = area);
}
}
var squareArea = row.area * row.area;
var f = rowFixedLength * rowFixedLength * ratio;
return squareArea
? mathMax(
(f * areaMax) / squareArea,
squareArea / (f * areaMin)
)
: Infinity;
} | javascript | function worst(row, rowFixedLength, ratio) {
var areaMax = 0;
var areaMin = Infinity;
for (var i = 0, area, len = row.length; i < len; i++) {
area = row[i].getLayout().area;
if (area) {
area < areaMin && (areaMin = area);
area > areaMax && (areaMax = area);
}
}
var squareArea = row.area * row.area;
var f = rowFixedLength * rowFixedLength * ratio;
return squareArea
? mathMax(
(f * areaMax) / squareArea,
squareArea / (f * areaMin)
)
: Infinity;
} | [
"function",
"worst",
"(",
"row",
",",
"rowFixedLength",
",",
"ratio",
")",
"{",
"var",
"areaMax",
"=",
"0",
";",
"var",
"areaMin",
"=",
"Infinity",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"area",
",",
"len",
"=",
"row",
".",
"length",
";",
"i... | Computes the score for the specified row,
as the worst aspect ratio. | [
"Computes",
"the",
"score",
"for",
"the",
"specified",
"row",
"as",
"the",
"worst",
"aspect",
"ratio",
"."
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/chart/treemap/treemapLayout.js#L405-L426 | train | Returns the worst area of a row | [
30522,
3853,
5409,
1006,
5216,
1010,
5216,
23901,
7770,
13512,
2232,
1010,
6463,
1007,
1063,
13075,
2181,
17848,
1027,
1014,
1025,
13075,
2181,
10020,
1027,
15579,
1025,
2005,
1006,
13075,
1045,
1027,
1014,
1010,
2181,
1010,
18798,
1027,
52... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js | function (aChildren, aAncestors, mChildren) {
if (aAncestors.length) {
aChildren.forEach(function (sPath) {
var aSegments;
if (aAncestors.indexOf(sPath) >= 0) {
mChildren[sPath] = true;
return;
}
aSegments = sPath.split("/");
aSegments.pop();
while (aSegments.length) {
if (aAncestors.indexOf(aSegments.join("/")) >= 0) {
mChildren[sPath] = true;
break;
}
aSegments.pop();
}
});
}
} | javascript | function (aChildren, aAncestors, mChildren) {
if (aAncestors.length) {
aChildren.forEach(function (sPath) {
var aSegments;
if (aAncestors.indexOf(sPath) >= 0) {
mChildren[sPath] = true;
return;
}
aSegments = sPath.split("/");
aSegments.pop();
while (aSegments.length) {
if (aAncestors.indexOf(aSegments.join("/")) >= 0) {
mChildren[sPath] = true;
break;
}
aSegments.pop();
}
});
}
} | [
"function",
"(",
"aChildren",
",",
"aAncestors",
",",
"mChildren",
")",
"{",
"if",
"(",
"aAncestors",
".",
"length",
")",
"{",
"aChildren",
".",
"forEach",
"(",
"function",
"(",
"sPath",
")",
"{",
"var",
"aSegments",
";",
"if",
"(",
"aAncestors",
".",
... | Adds all given children to the given hash set which either appear in the given list or
have some ancestor in it.
Note: "a/b/c" is deemed a child of the ancestors "a/b" and "a", but not "b" or "a/b/c/d".
@param {string[]} aChildren - List of non-empty child paths (unmodified)
@param {string[]} aAncestors - List of ancestor paths (unmodified)
@param {object} mChildren - Hash set of child paths, maps string to <code>true</code>;
is modified | [
"Adds",
"all",
"given",
"children",
"to",
"the",
"given",
"hash",
"set",
"which",
"either",
"appear",
"in",
"the",
"given",
"list",
"or",
"have",
"some",
"ancestor",
"in",
"it",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_Helper.js#L58-L79 | train | This function is called to determine if the children of the node are in the hierarchy of the node | [
30522,
3853,
1006,
9353,
19466,
16200,
2078,
1010,
9779,
5897,
23809,
2015,
1010,
11338,
19466,
16200,
2078,
1007,
1063,
2065,
1006,
9779,
5897,
23809,
2015,
1012,
3091,
1007,
1063,
9353,
19466,
16200,
2078,
1012,
18921,
6776,
1006,
3853,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
adobe/brackets | src/document/DocumentCommandHandlers.js | handleCurrentFileChange | function handleCurrentFileChange() {
var newFile = MainViewManager.getCurrentlyViewedFile(MainViewManager.ACTIVE_PANE);
if (newFile) {
var newDocument = DocumentManager.getOpenDocumentForPath(newFile.fullPath);
if (newDocument) {
_currentTitlePath = _shortTitleForDocument(newDocument);
} else {
_currentTitlePath = ProjectManager.makeProjectRelativeIfPossible(newFile.fullPath);
}
} else {
_currentTitlePath = null;
}
// Update title text & "dirty dot" display
_updateTitle();
} | javascript | function handleCurrentFileChange() {
var newFile = MainViewManager.getCurrentlyViewedFile(MainViewManager.ACTIVE_PANE);
if (newFile) {
var newDocument = DocumentManager.getOpenDocumentForPath(newFile.fullPath);
if (newDocument) {
_currentTitlePath = _shortTitleForDocument(newDocument);
} else {
_currentTitlePath = ProjectManager.makeProjectRelativeIfPossible(newFile.fullPath);
}
} else {
_currentTitlePath = null;
}
// Update title text & "dirty dot" display
_updateTitle();
} | [
"function",
"handleCurrentFileChange",
"(",
")",
"{",
"var",
"newFile",
"=",
"MainViewManager",
".",
"getCurrentlyViewedFile",
"(",
"MainViewManager",
".",
"ACTIVE_PANE",
")",
";",
"if",
"(",
"newFile",
")",
"{",
"var",
"newDocument",
"=",
"DocumentManager",
".",
... | Handles currentFileChange and filenameChanged events and updates the titlebar | [
"Handles",
"currentFileChange",
"and",
"filenameChanged",
"events",
"and",
"updates",
"the",
"titlebar"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/document/DocumentCommandHandlers.js#L237-L254 | train | Handle current file change | [
30522,
3853,
5047,
10841,
14343,
3372,
8873,
2571,
22305,
2063,
1006,
1007,
1063,
13075,
2047,
8873,
2571,
1027,
2364,
8584,
24805,
4590,
1012,
2131,
10841,
14343,
20630,
8584,
2098,
8873,
2571,
1006,
2364,
8584,
24805,
4590,
1012,
3161,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.documentation/src/sap/ui/documentation/sdk/util/LiveEditorOutput.js | preloadModules | function preloadModules (oData) {
// prealod the modules from the live-edited src
sap.ui.require.preload(oData.src);
// require the init module
sap.ui.require([oData.moduleNameToRequire]);
} | javascript | function preloadModules (oData) {
// prealod the modules from the live-edited src
sap.ui.require.preload(oData.src);
// require the init module
sap.ui.require([oData.moduleNameToRequire]);
} | [
"function",
"preloadModules",
"(",
"oData",
")",
"{",
"// prealod the modules from the live-edited src",
"sap",
".",
"ui",
".",
"require",
".",
"preload",
"(",
"oData",
".",
"src",
")",
";",
"// require the init module",
"sap",
".",
"ui",
".",
"require",
"(",
"[... | Preload the modules of the live-edited sample so that
the framework obtains the module content from the editor-supplied src,
insted of making a network request to obtain them
@param oData the editor-supplied src | [
"Preload",
"the",
"modules",
"of",
"the",
"live",
"-",
"edited",
"sample",
"so",
"that",
"the",
"framework",
"obtains",
"the",
"module",
"content",
"from",
"the",
"editor",
"-",
"supplied",
"src",
"insted",
"of",
"making",
"a",
"network",
"request",
"to",
... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/util/LiveEditorOutput.js#L38-L45 | train | preload the modules from the live - edited src | [
30522,
3853,
3653,
11066,
5302,
8566,
4244,
1006,
1051,
2850,
2696,
1007,
1063,
1013,
1013,
3653,
23067,
2094,
1996,
14184,
2013,
1996,
2444,
1011,
5493,
5034,
2278,
20066,
1012,
21318,
1012,
5478,
1012,
3653,
11066,
1006,
1051,
2850,
2696,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | third_party/js/mozmill/shared-modules/sessionstore.js | aboutSessionRestore_toggleRestoreState | function aboutSessionRestore_toggleRestoreState(element) {
var state = this.getRestoreState(element);
widgets.clickTreeCell(this._controller, this.tabList, element.listIndex, 0, {});
this._controller.sleep(0);
this._controller.assertJS("subject.newState != subject.oldState",
{newState : this.getRestoreState(element), oldState : state});
} | javascript | function aboutSessionRestore_toggleRestoreState(element) {
var state = this.getRestoreState(element);
widgets.clickTreeCell(this._controller, this.tabList, element.listIndex, 0, {});
this._controller.sleep(0);
this._controller.assertJS("subject.newState != subject.oldState",
{newState : this.getRestoreState(element), oldState : state});
} | [
"function",
"aboutSessionRestore_toggleRestoreState",
"(",
"element",
")",
"{",
"var",
"state",
"=",
"this",
".",
"getRestoreState",
"(",
"element",
")",
";",
"widgets",
".",
"clickTreeCell",
"(",
"this",
".",
"_controller",
",",
"this",
".",
"tabList",
",",
"... | Toggles the restore state for the element
@param {object} element
Specifies the element which restore state should be toggled | [
"Toggles",
"the",
"restore",
"state",
"for",
"the",
"element"
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/sessionstore.js#L219-L227 | train | Toggle restore state | [
30522,
3853,
2055,
8583,
10992,
28533,
5686,
1035,
2000,
24679,
28533,
16610,
12259,
1006,
5783,
1007,
1063,
13075,
2110,
1027,
2023,
1012,
2131,
28533,
16610,
12259,
1006,
5783,
1007,
1025,
15536,
28682,
1012,
11562,
13334,
29109,
2140,
1006... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
eslint/eslint | lib/rules/padding-line-between-statements.js | isDirective | function isDirective(node, sourceCode) {
return (
node.type === "ExpressionStatement" &&
(
node.parent.type === "Program" ||
(
node.parent.type === "BlockStatement" &&
astUtils.isFunction(node.parent.parent)
)
) &&
node.expression.type === "Literal" &&
typeof node.expression.value === "string" &&
!astUtils.isParenthesised(sourceCode, node.expression)
);
} | javascript | function isDirective(node, sourceCode) {
return (
node.type === "ExpressionStatement" &&
(
node.parent.type === "Program" ||
(
node.parent.type === "BlockStatement" &&
astUtils.isFunction(node.parent.parent)
)
) &&
node.expression.type === "Literal" &&
typeof node.expression.value === "string" &&
!astUtils.isParenthesised(sourceCode, node.expression)
);
} | [
"function",
"isDirective",
"(",
"node",
",",
"sourceCode",
")",
"{",
"return",
"(",
"node",
".",
"type",
"===",
"\"ExpressionStatement\"",
"&&",
"(",
"node",
".",
"parent",
".",
"type",
"===",
"\"Program\"",
"||",
"(",
"node",
".",
"parent",
".",
"type",
... | Check whether the given node is a directive or not.
@param {ASTNode} node The node to check.
@param {SourceCode} sourceCode The source code object to get tokens.
@returns {boolean} `true` if the node is a directive. | [
"Check",
"whether",
"the",
"given",
"node",
"is",
"a",
"directive",
"or",
"not",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/padding-line-between-statements.js#L145-L159 | train | Check if a node is a directive | [
30522,
3853,
2003,
4305,
2890,
15277,
1006,
13045,
1010,
3120,
16044,
1007,
1063,
2709,
1006,
13045,
1012,
2828,
1027,
1027,
1027,
1000,
11423,
12259,
3672,
1000,
1004,
1004,
1006,
13045,
1012,
6687,
1012,
2828,
1027,
1027,
1027,
1000,
2565... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
vuejs/vue-devtools | src/devtools/index.js | initApp | function initApp (shell) {
shell.connect(bridge => {
window.bridge = bridge
if (Vue.prototype.hasOwnProperty('$shared')) {
destroySharedData()
} else {
Object.defineProperty(Vue.prototype, '$shared', {
get: () => SharedData
})
}
initSharedData({
bridge,
Vue,
persist: true
})
if (SharedData.logDetected) {
bridge.send('log-detected-vue')
}
bridge.once('ready', version => {
store.commit(
'SHOW_MESSAGE',
'Ready. Detected Vue ' + version + '.'
)
bridge.send('events:toggle-recording', store.state.events.enabled)
if (isChrome) {
chrome.runtime.sendMessage('vue-panel-load')
}
})
bridge.once('proxy-fail', () => {
store.commit(
'SHOW_MESSAGE',
'Proxy injection failed.'
)
})
bridge.on('flush', payload => {
store.commit('components/FLUSH', parse(payload))
})
bridge.on('instance-details', details => {
store.commit('components/RECEIVE_INSTANCE_DETAILS', parse(details))
})
bridge.on('toggle-instance', payload => {
store.commit('components/TOGGLE_INSTANCE', parse(payload))
})
bridge.on('vuex:init', () => {
store.commit('vuex/INIT')
})
bridge.on('vuex:mutation', payload => {
store.commit('vuex/RECEIVE_MUTATION', payload)
})
bridge.on('vuex:inspected-state', ({ index, snapshot }) => {
store.commit('vuex/RECEIVE_STATE', { index, snapshot })
if (index === -1) {
store.commit('vuex/UPDATE_BASE_STATE', snapshot)
} else if (store.getters['vuex/absoluteInspectedIndex'] === index) {
store.commit('vuex/UPDATE_INSPECTED_STATE', snapshot)
}
if (VuexResolve.travel) {
VuexResolve.travel(snapshot)
}
requestAnimationFrame(() => {
SharedData.snapshotLoading = false
})
})
bridge.on('event:triggered', payload => {
store.commit('events/RECEIVE_EVENT', parse(payload))
if (router.currentRoute.name !== 'events') {
store.commit('events/INCREASE_NEW_EVENT_COUNT')
}
})
bridge.on('router:init', payload => {
store.commit('router/INIT', parse(payload))
})
bridge.on('router:changed', payload => {
store.commit('router/CHANGED', parse(payload))
})
bridge.on('routes:init', payload => {
store.commit('routes/INIT', parse(payload))
})
bridge.on('routes:changed', payload => {
store.commit('routes/CHANGED', parse(payload))
})
// register filters
Vue.filter('formatTime', function (timestamp) {
return (new Date(timestamp)).toString().match(/\d\d:\d\d:\d\d/)[0]
})
bridge.on('events:reset', () => {
store.commit('events/RESET')
})
bridge.on('inspect-instance', id => {
ensurePaneShown(() => {
inspectInstance(id)
})
})
bridge.on('perf:add-metric', data => {
store.commit('perf/ADD_METRIC', data)
})
bridge.on('perf:upsert-metric', ({ type, data }) => {
store.commit('perf/UPSERT_METRIC', { type, data })
})
initEnv(Vue)
app = new Vue({
extends: App,
router,
store,
data: {
isBeta
},
watch: {
'$shared.theme': {
handler (value) {
if (value === 'dark' || (value === 'auto' && chromeTheme === 'dark')) {
document.body.classList.add('vue-ui-dark-mode')
} else {
document.body.classList.remove('vue-ui-dark-mode')
}
},
immediate: true
}
}
}).$mount('#app')
})
} | javascript | function initApp (shell) {
shell.connect(bridge => {
window.bridge = bridge
if (Vue.prototype.hasOwnProperty('$shared')) {
destroySharedData()
} else {
Object.defineProperty(Vue.prototype, '$shared', {
get: () => SharedData
})
}
initSharedData({
bridge,
Vue,
persist: true
})
if (SharedData.logDetected) {
bridge.send('log-detected-vue')
}
bridge.once('ready', version => {
store.commit(
'SHOW_MESSAGE',
'Ready. Detected Vue ' + version + '.'
)
bridge.send('events:toggle-recording', store.state.events.enabled)
if (isChrome) {
chrome.runtime.sendMessage('vue-panel-load')
}
})
bridge.once('proxy-fail', () => {
store.commit(
'SHOW_MESSAGE',
'Proxy injection failed.'
)
})
bridge.on('flush', payload => {
store.commit('components/FLUSH', parse(payload))
})
bridge.on('instance-details', details => {
store.commit('components/RECEIVE_INSTANCE_DETAILS', parse(details))
})
bridge.on('toggle-instance', payload => {
store.commit('components/TOGGLE_INSTANCE', parse(payload))
})
bridge.on('vuex:init', () => {
store.commit('vuex/INIT')
})
bridge.on('vuex:mutation', payload => {
store.commit('vuex/RECEIVE_MUTATION', payload)
})
bridge.on('vuex:inspected-state', ({ index, snapshot }) => {
store.commit('vuex/RECEIVE_STATE', { index, snapshot })
if (index === -1) {
store.commit('vuex/UPDATE_BASE_STATE', snapshot)
} else if (store.getters['vuex/absoluteInspectedIndex'] === index) {
store.commit('vuex/UPDATE_INSPECTED_STATE', snapshot)
}
if (VuexResolve.travel) {
VuexResolve.travel(snapshot)
}
requestAnimationFrame(() => {
SharedData.snapshotLoading = false
})
})
bridge.on('event:triggered', payload => {
store.commit('events/RECEIVE_EVENT', parse(payload))
if (router.currentRoute.name !== 'events') {
store.commit('events/INCREASE_NEW_EVENT_COUNT')
}
})
bridge.on('router:init', payload => {
store.commit('router/INIT', parse(payload))
})
bridge.on('router:changed', payload => {
store.commit('router/CHANGED', parse(payload))
})
bridge.on('routes:init', payload => {
store.commit('routes/INIT', parse(payload))
})
bridge.on('routes:changed', payload => {
store.commit('routes/CHANGED', parse(payload))
})
// register filters
Vue.filter('formatTime', function (timestamp) {
return (new Date(timestamp)).toString().match(/\d\d:\d\d:\d\d/)[0]
})
bridge.on('events:reset', () => {
store.commit('events/RESET')
})
bridge.on('inspect-instance', id => {
ensurePaneShown(() => {
inspectInstance(id)
})
})
bridge.on('perf:add-metric', data => {
store.commit('perf/ADD_METRIC', data)
})
bridge.on('perf:upsert-metric', ({ type, data }) => {
store.commit('perf/UPSERT_METRIC', { type, data })
})
initEnv(Vue)
app = new Vue({
extends: App,
router,
store,
data: {
isBeta
},
watch: {
'$shared.theme': {
handler (value) {
if (value === 'dark' || (value === 'auto' && chromeTheme === 'dark')) {
document.body.classList.add('vue-ui-dark-mode')
} else {
document.body.classList.remove('vue-ui-dark-mode')
}
},
immediate: true
}
}
}).$mount('#app')
})
} | [
"function",
"initApp",
"(",
"shell",
")",
"{",
"shell",
".",
"connect",
"(",
"bridge",
"=>",
"{",
"window",
".",
"bridge",
"=",
"bridge",
"if",
"(",
"Vue",
".",
"prototype",
".",
"hasOwnProperty",
"(",
"'$shared'",
")",
")",
"{",
"destroySharedData",
"("... | Connect then init the app. We need to reconnect on every reload, because a
new backend will be injected.
@param {Object} shell | [
"Connect",
"then",
"init",
"the",
"app",
".",
"We",
"need",
"to",
"reconnect",
"on",
"every",
"reload",
"because",
"a",
"new",
"backend",
"will",
"be",
"injected",
"."
] | 4de4b86388453cd07f0c1bf967d43a4dd4b011c9 | https://github.com/vuejs/vue-devtools/blob/4de4b86388453cd07f0c1bf967d43a4dd4b011c9/src/devtools/index.js#L87-L237 | train | Initialize the app | [
30522,
3853,
1999,
6590,
9397,
1006,
5806,
1007,
1063,
5806,
1012,
7532,
1006,
2958,
1027,
1028,
1063,
3332,
1012,
2958,
1027,
2958,
2065,
1006,
24728,
2063,
1012,
8773,
1012,
2038,
12384,
21572,
4842,
3723,
1006,
1005,
1002,
4207,
1005,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
openlayers/openlayers | examples/webpack/example-builder.js | getJsSource | function getJsSource(chunk, jsName) {
let jsSource;
for (let i = 0, ii = chunk.modules.length; i < ii; ++i) {
const module = chunk.modules[i];
if (module.modules) {
jsSource = getJsSource(module, jsName);
if (jsSource) {
return jsSource;
}
}
if (module.identifier.endsWith(jsName) && module.source) {
return module.source;
}
}
} | javascript | function getJsSource(chunk, jsName) {
let jsSource;
for (let i = 0, ii = chunk.modules.length; i < ii; ++i) {
const module = chunk.modules[i];
if (module.modules) {
jsSource = getJsSource(module, jsName);
if (jsSource) {
return jsSource;
}
}
if (module.identifier.endsWith(jsName) && module.source) {
return module.source;
}
}
} | [
"function",
"getJsSource",
"(",
"chunk",
",",
"jsName",
")",
"{",
"let",
"jsSource",
";",
"for",
"(",
"let",
"i",
"=",
"0",
",",
"ii",
"=",
"chunk",
".",
"modules",
".",
"length",
";",
"i",
"<",
"ii",
";",
"++",
"i",
")",
"{",
"const",
"module",
... | Gets the source for the chunk that matches the jsPath
@param {Object} chunk Chunk.
@param {string} jsName Name of the file.
@return {string} The source. | [
"Gets",
"the",
"source",
"for",
"the",
"chunk",
"that",
"matches",
"the",
"jsPath"
] | f366eaea522388fb575b11010e69d309164baca7 | https://github.com/openlayers/openlayers/blob/f366eaea522388fb575b11010e69d309164baca7/examples/webpack/example-builder.js#L71-L85 | train | Get the source of a module | [
30522,
3853,
2131,
22578,
6499,
3126,
3401,
1006,
20000,
1010,
1046,
2015,
18442,
1007,
1063,
2292,
1046,
24137,
3126,
3401,
1025,
2005,
1006,
2292,
1045,
1027,
1014,
1010,
2462,
1027,
20000,
1012,
14184,
1012,
3091,
1025,
1045,
1026,
2462,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
angular/material | src/core/util/util.js | function(template, values, pattern) {
pattern = pattern || /\{([^{}]*)\}/g;
return template.replace(pattern, function(a, b) {
var p = b.split('.'),
r = values;
try {
for (var s in p) {
if (p.hasOwnProperty(s)) {
r = r[p[s]];
}
}
} catch (e) {
r = a;
}
return (typeof r === 'string' || typeof r === 'number') ? r : a;
});
} | javascript | function(template, values, pattern) {
pattern = pattern || /\{([^{}]*)\}/g;
return template.replace(pattern, function(a, b) {
var p = b.split('.'),
r = values;
try {
for (var s in p) {
if (p.hasOwnProperty(s)) {
r = r[p[s]];
}
}
} catch (e) {
r = a;
}
return (typeof r === 'string' || typeof r === 'number') ? r : a;
});
} | [
"function",
"(",
"template",
",",
"values",
",",
"pattern",
")",
"{",
"pattern",
"=",
"pattern",
"||",
"/",
"\\{([^{}]*)\\}",
"/",
"g",
";",
"return",
"template",
".",
"replace",
"(",
"pattern",
",",
"function",
"(",
"a",
",",
"b",
")",
"{",
"var",
"... | supplant() method from Crockford's `Remedial Javascript`
Equivalent to use of $interpolate; without dependency on
interpolation symbols and scope. Note: the '{<token>}' can
be property names, property chains, or array indices. | [
"supplant",
"()",
"method",
"from",
"Crockford",
"s",
"Remedial",
"Javascript",
"Equivalent",
"to",
"use",
"of",
"$interpolate",
";",
"without",
"dependency",
"on",
"interpolation",
"symbols",
"and",
"scope",
".",
"Note",
":",
"the",
"{",
"<token",
">",
"}",
... | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/util/util.js#L383-L399 | train | Returns a new template string with the values of the specified parameters | [
30522,
3853,
1006,
23561,
1010,
5300,
1010,
5418,
1007,
1063,
5418,
1027,
5418,
1064,
1064,
1013,
1032,
1063,
1006,
1031,
1034,
1063,
1065,
1033,
1008,
1007,
1032,
1065,
1013,
1043,
1025,
2709,
23561,
1012,
5672,
1006,
5418,
1010,
3853,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SheetJS/js-xlsx | xlsx.js | parse_PtgArea3d | function parse_PtgArea3d(blob, length, opts) {
var type = (blob[blob.l++] & 0x60) >> 5;
var ixti = blob.read_shift(2, 'i');
var w = 8;
if(opts) switch(opts.biff) {
case 5: blob.l += 12; w = 6; break;
case 12: w = 12; break;
}
var area = parse_RgceArea(blob, w, opts);
return [type, ixti, area];
} | javascript | function parse_PtgArea3d(blob, length, opts) {
var type = (blob[blob.l++] & 0x60) >> 5;
var ixti = blob.read_shift(2, 'i');
var w = 8;
if(opts) switch(opts.biff) {
case 5: blob.l += 12; w = 6; break;
case 12: w = 12; break;
}
var area = parse_RgceArea(blob, w, opts);
return [type, ixti, area];
} | [
"function",
"parse_PtgArea3d",
"(",
"blob",
",",
"length",
",",
"opts",
")",
"{",
"var",
"type",
"=",
"(",
"blob",
"[",
"blob",
".",
"l",
"++",
"]",
"&",
"0x60",
")",
">>",
"5",
";",
"var",
"ixti",
"=",
"blob",
".",
"read_shift",
"(",
"2",
",",
... | /* [MS-XLS] 2.5.198.28 ; [MS-XLSB] 2.5.97.19 | [
"/",
"*",
"[",
"MS",
"-",
"XLS",
"]",
"2",
".",
"5",
".",
"198",
".",
"28",
";",
"[",
"MS",
"-",
"XLSB",
"]",
"2",
".",
"5",
".",
"97",
".",
"19"
] | 9a6d8a1d3d80c78dad5201fb389316f935279cdc | https://github.com/SheetJS/js-xlsx/blob/9a6d8a1d3d80c78dad5201fb389316f935279cdc/xlsx.js#L10312-L10322 | train | Parse an area3d from a blob | [
30522,
3853,
11968,
3366,
1035,
13866,
6843,
5243,
29097,
1006,
1038,
4135,
2497,
1010,
3091,
1010,
23569,
2015,
1007,
1063,
13075,
2828,
1027,
1006,
1038,
4135,
2497,
1031,
1038,
4135,
2497,
1012,
1048,
1009,
1009,
1033,
1004,
1014,
2595,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
lynckia/licode | erizo_controller/erizoClient/src/utils/L.Resizer.js | extractQuery | function extractQuery(originalCss) {
let match;
const css = originalCss.replace(/'/g, '"');
while ((match = regex.exec(css)) !== null) {
if (match.length > 5) {
queueQuery(match[1] || match[5], match[2], match[3], match[4]);
}
}
} | javascript | function extractQuery(originalCss) {
let match;
const css = originalCss.replace(/'/g, '"');
while ((match = regex.exec(css)) !== null) {
if (match.length > 5) {
queueQuery(match[1] || match[5], match[2], match[3], match[4]);
}
}
} | [
"function",
"extractQuery",
"(",
"originalCss",
")",
"{",
"let",
"match",
";",
"const",
"css",
"=",
"originalCss",
".",
"replace",
"(",
"/",
"'",
"/",
"g",
",",
"'\"'",
")",
";",
"while",
"(",
"(",
"match",
"=",
"regex",
".",
"exec",
"(",
"css",
")... | jshint ignore:line
@param {String} css | [
"jshint",
"ignore",
":",
"line"
] | ce1f09ae30054f677fc25f2011b0e5072fa6f71f | https://github.com/lynckia/licode/blob/ce1f09ae30054f677fc25f2011b0e5072fa6f71f/erizo_controller/erizoClient/src/utils/L.Resizer.js#L204-L212 | train | Extract query from a CSS string | [
30522,
3853,
14817,
4226,
2854,
1006,
2434,
6169,
2015,
1007,
1063,
2292,
2674,
1025,
9530,
3367,
20116,
2015,
1027,
2434,
6169,
2015,
1012,
5672,
1006,
1013,
1005,
1013,
1043,
1010,
1005,
1000,
1005,
1007,
1025,
2096,
1006,
1006,
2674,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/document/DocumentCommandHandlers.js | browserReload | function browserReload(href) {
if (_isReloading) {
return;
}
_isReloading = true;
return CommandManager.execute(Commands.FILE_CLOSE_ALL, { promptOnly: true }).done(function () {
// Give everyone a chance to save their state - but don't let any problems block
// us from quitting
try {
ProjectManager.trigger("beforeAppClose");
} catch (ex) {
console.error(ex);
}
// Disable the cache to make reloads work
_disableCache().always(function () {
// Remove all menus to assure every part of Brackets is reloaded
_.forEach(Menus.getAllMenus(), function (value, key) {
Menus.removeMenu(key);
});
// If there's a fragment in both URLs, setting location.href won't actually reload
var fragment = href.indexOf("#");
if (fragment !== -1) {
href = href.substr(0, fragment);
}
// Defer for a more successful reload - issue #11539
setTimeout(function () {
window.location.href = href;
}, 1000);
});
}).fail(function () {
_isReloading = false;
});
} | javascript | function browserReload(href) {
if (_isReloading) {
return;
}
_isReloading = true;
return CommandManager.execute(Commands.FILE_CLOSE_ALL, { promptOnly: true }).done(function () {
// Give everyone a chance to save their state - but don't let any problems block
// us from quitting
try {
ProjectManager.trigger("beforeAppClose");
} catch (ex) {
console.error(ex);
}
// Disable the cache to make reloads work
_disableCache().always(function () {
// Remove all menus to assure every part of Brackets is reloaded
_.forEach(Menus.getAllMenus(), function (value, key) {
Menus.removeMenu(key);
});
// If there's a fragment in both URLs, setting location.href won't actually reload
var fragment = href.indexOf("#");
if (fragment !== -1) {
href = href.substr(0, fragment);
}
// Defer for a more successful reload - issue #11539
setTimeout(function () {
window.location.href = href;
}, 1000);
});
}).fail(function () {
_isReloading = false;
});
} | [
"function",
"browserReload",
"(",
"href",
")",
"{",
"if",
"(",
"_isReloading",
")",
"{",
"return",
";",
"}",
"_isReloading",
"=",
"true",
";",
"return",
"CommandManager",
".",
"execute",
"(",
"Commands",
".",
"FILE_CLOSE_ALL",
",",
"{",
"promptOnly",
":",
... | Does a full reload of the browser window
@param {string} href The url to reload into the window | [
"Does",
"a",
"full",
"reload",
"of",
"the",
"browser",
"window"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/document/DocumentCommandHandlers.js#L1676-L1713 | train | Reloads the browser | [
30522,
3853,
16602,
16570,
10441,
2094,
1006,
17850,
12879,
1007,
1063,
2065,
1006,
1035,
2003,
16570,
10441,
4667,
1007,
1063,
2709,
1025,
1065,
1035,
2003,
16570,
10441,
4667,
1027,
2995,
1025,
2709,
3094,
24805,
4590,
1012,
15389,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
dequelabs/axe-core | lib/core/utils/preload-cssom.js | getStylesheetsFromDocument | function getStylesheetsFromDocument(rootNode) {
return Array.from(rootNode.styleSheets).filter(sheet =>
filterMediaIsPrint(sheet.media.mediaText)
);
} | javascript | function getStylesheetsFromDocument(rootNode) {
return Array.from(rootNode.styleSheets).filter(sheet =>
filterMediaIsPrint(sheet.media.mediaText)
);
} | [
"function",
"getStylesheetsFromDocument",
"(",
"rootNode",
")",
"{",
"return",
"Array",
".",
"from",
"(",
"rootNode",
".",
"styleSheets",
")",
".",
"filter",
"(",
"sheet",
"=>",
"filterMediaIsPrint",
"(",
"sheet",
".",
"media",
".",
"mediaText",
")",
")",
";... | Get stylesheets from `document`
-> filter out stylesheet that are `media=print`
@param {Object} rootNode `document`
@returns {Array<Object>} | [
"Get",
"stylesheets",
"from",
"document",
"-",
">",
"filter",
"out",
"stylesheet",
"that",
"are",
"media",
"=",
"print"
] | 727323c07980e2291575f545444d389fb942906f | https://github.com/dequelabs/axe-core/blob/727323c07980e2291575f545444d389fb942906f/lib/core/utils/preload-cssom.js#L396-L400 | train | Get all stylesheets from a document | [
30522,
3853,
4152,
27983,
4095,
15558,
22747,
21716,
3527,
24894,
4765,
1006,
7117,
3630,
3207,
1007,
1063,
2709,
9140,
1012,
2013,
1006,
7117,
3630,
3207,
1012,
6782,
21030,
3215,
1007,
1012,
11307,
1006,
7123,
1027,
1028,
11307,
16969,
24... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/v4/ODataMetaModel.js | prepareKeyPredicate | function prepareKeyPredicate(sSegment) {
aEditUrl.push({path : sInstancePath, prefix : sSegment, type : oType});
} | javascript | function prepareKeyPredicate(sSegment) {
aEditUrl.push({path : sInstancePath, prefix : sSegment, type : oType});
} | [
"function",
"prepareKeyPredicate",
"(",
"sSegment",
")",
"{",
"aEditUrl",
".",
"push",
"(",
"{",
"path",
":",
"sInstancePath",
",",
"prefix",
":",
"sSegment",
",",
"type",
":",
"oType",
"}",
")",
";",
"}"
] | Pushes a request to append the key predicate for oType and the instance at sInstancePath. Does not calculate it yet, because it might be replaced again later. | [
"Pushes",
"a",
"request",
"to",
"append",
"the",
"key",
"predicate",
"for",
"oType",
"and",
"the",
"instance",
"at",
"sInstancePath",
".",
"Does",
"not",
"calculate",
"it",
"yet",
"because",
"it",
"might",
"be",
"replaced",
"again",
"later",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/ODataMetaModel.js#L1557-L1559 | train | Adds a key predicate to the edit URL | [
30522,
3853,
7374,
14839,
28139,
16467,
1006,
7020,
13910,
3672,
1007,
1063,
29347,
23194,
3126,
2140,
1012,
5245,
1006,
1063,
4130,
1024,
15516,
26897,
15069,
1010,
17576,
1024,
7020,
13910,
3672,
1010,
2828,
1024,
27178,
18863,
1065,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/v4/ODataParentBinding.js | mergeSelectPath | function mergeSelectPath(sSelectPath) {
if (mAggregatedQueryOptions.$select.indexOf(sSelectPath) < 0) {
if (bCacheImmutable) {
return false;
}
mAggregatedQueryOptions.$select.push(sSelectPath);
}
return true;
} | javascript | function mergeSelectPath(sSelectPath) {
if (mAggregatedQueryOptions.$select.indexOf(sSelectPath) < 0) {
if (bCacheImmutable) {
return false;
}
mAggregatedQueryOptions.$select.push(sSelectPath);
}
return true;
} | [
"function",
"mergeSelectPath",
"(",
"sSelectPath",
")",
"{",
"if",
"(",
"mAggregatedQueryOptions",
".",
"$select",
".",
"indexOf",
"(",
"sSelectPath",
")",
"<",
"0",
")",
"{",
"if",
"(",
"bCacheImmutable",
")",
"{",
"return",
"false",
";",
"}",
"mAggregatedQ... | /*
Merges the select path into the aggregated query options.
@param {string} sSelectPath The select path
@returns {boolean} Whether the query options could be merged | [
"/",
"*",
"Merges",
"the",
"select",
"path",
"into",
"the",
"aggregated",
"query",
"options",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/ODataParentBinding.js#L187-L195 | train | Merge a select path into the select path | [
30522,
3853,
13590,
11246,
22471,
15069,
1006,
7020,
12260,
6593,
15069,
1007,
1063,
2065,
1006,
23848,
17603,
11644,
4226,
2854,
7361,
9285,
1012,
1002,
7276,
1012,
5950,
11253,
1006,
7020,
12260,
6593,
15069,
1007,
1026,
1014,
1007,
1063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.commons/src/sap/ui/commons/MessageBox.js | button | function button(sAction) {
var sText = rb && rb.getText("MSGBOX_" + sAction),
oButton = new Button({
id: sDialogId + "--btn-" + sAction,
text: sText || sAction,
press: function () {
oResult = sAction;
oDialog.close();
}
});
if (sAction === oDefaultAction) {
oDefaultButton = oButton;
}
return oButton;
} | javascript | function button(sAction) {
var sText = rb && rb.getText("MSGBOX_" + sAction),
oButton = new Button({
id: sDialogId + "--btn-" + sAction,
text: sText || sAction,
press: function () {
oResult = sAction;
oDialog.close();
}
});
if (sAction === oDefaultAction) {
oDefaultButton = oButton;
}
return oButton;
} | [
"function",
"button",
"(",
"sAction",
")",
"{",
"var",
"sText",
"=",
"rb",
"&&",
"rb",
".",
"getText",
"(",
"\"MSGBOX_\"",
"+",
"sAction",
")",
",",
"oButton",
"=",
"new",
"Button",
"(",
"{",
"id",
":",
"sDialogId",
"+",
"\"--btn-\"",
"+",
"sAction",
... | creates a button for the given action | [
"creates",
"a",
"button",
"for",
"the",
"given",
"action"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.commons/src/sap/ui/commons/MessageBox.js#L217-L231 | train | Creates a button for the given action | [
30522,
3853,
6462,
1006,
17266,
3508,
1007,
1063,
13075,
26261,
18413,
1027,
21144,
1004,
1004,
21144,
1012,
2131,
18209,
1006,
1000,
5796,
18259,
11636,
1035,
1000,
1009,
17266,
3508,
1007,
1010,
27885,
4904,
2669,
1027,
2047,
6462,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js | resolveAttributeBinding | function resolveAttributeBinding(oElement, oAttribute, oWithControl) {
var oPromise = getResolvedBinding(oAttribute.value, oElement, oWithControl, false);
if (!oPromise) {
debug(oElement, 'Binding not ready for attribute', oAttribute.name);
return oSyncPromiseResolved;
}
return oPromise.then(function (vValue) {
if (vValue === undefined) {
// if the formatter returns null, the value becomes undefined
// (the default value of _With.any)
debug(oElement, "Removed attribute", oAttribute.name);
oElement.removeAttributeNode(oAttribute);
} else if (vValue !== oAttribute.value) {
switch (typeof vValue) {
case "boolean":
case "number":
case "string":
debug(oElement, oAttribute.name, "=", vValue);
oAttribute.value = vValue;
break;
default: // e.g. "function" or "object"; "undefined": see above
debug(oElement, "Ignoring", fnToString.call(vValue),
"value for attribute", oAttribute.name);
}
}
}, function (oError) {
// just don't replace XML attribute value
debug(oElement, "Error in formatter of attribute", oAttribute.name, oError);
});
} | javascript | function resolveAttributeBinding(oElement, oAttribute, oWithControl) {
var oPromise = getResolvedBinding(oAttribute.value, oElement, oWithControl, false);
if (!oPromise) {
debug(oElement, 'Binding not ready for attribute', oAttribute.name);
return oSyncPromiseResolved;
}
return oPromise.then(function (vValue) {
if (vValue === undefined) {
// if the formatter returns null, the value becomes undefined
// (the default value of _With.any)
debug(oElement, "Removed attribute", oAttribute.name);
oElement.removeAttributeNode(oAttribute);
} else if (vValue !== oAttribute.value) {
switch (typeof vValue) {
case "boolean":
case "number":
case "string":
debug(oElement, oAttribute.name, "=", vValue);
oAttribute.value = vValue;
break;
default: // e.g. "function" or "object"; "undefined": see above
debug(oElement, "Ignoring", fnToString.call(vValue),
"value for attribute", oAttribute.name);
}
}
}, function (oError) {
// just don't replace XML attribute value
debug(oElement, "Error in formatter of attribute", oAttribute.name, oError);
});
} | [
"function",
"resolveAttributeBinding",
"(",
"oElement",
",",
"oAttribute",
",",
"oWithControl",
")",
"{",
"var",
"oPromise",
"=",
"getResolvedBinding",
"(",
"oAttribute",
".",
"value",
",",
"oElement",
",",
"oWithControl",
",",
"false",
")",
";",
"if",
"(",
"!... | Visit the given XML DOM attribute which represents any attribute of any element
(other than template instructions). If the attribute value represents a binding
expression, we try to resolve it using the "with" control instance.
@param {Element} oElement
the owning XML DOM element
@param {Attr} oAttribute
any XML DOM attribute node
@param {sap.ui.core.util._with} oWithControl the "with" control
@returns {sap.ui.base.SyncPromise}
A sync promise which resolves with <code>undefined</code> as soon as the binding
has been resolved, or is rejected with a corresponding error if getting the
binding's value fails. | [
"Visit",
"the",
"given",
"XML",
"DOM",
"attribute",
"which",
"represents",
"any",
"attribute",
"of",
"any",
"element",
"(",
"other",
"than",
"template",
"instructions",
")",
".",
"If",
"the",
"attribute",
"value",
"represents",
"a",
"binding",
"expression",
"w... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/util/XMLPreprocessor.js#L1332-L1363 | train | Resolves the binding of an attribute | [
30522,
3853,
10663,
19321,
3089,
8569,
2618,
8428,
4667,
1006,
1051,
12260,
3672,
1010,
1051,
19321,
3089,
8569,
2618,
1010,
27593,
8939,
8663,
13181,
2140,
1007,
1063,
13075,
6728,
21716,
5562,
1027,
2131,
6072,
16116,
8428,
4667,
1006,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/preferences/PreferencesBase.js | function (data, id, context) {
if (!data || !context.language) {
return;
}
if (data[context.language] && (data[context.language][id] !== undefined)) {
return data[context.language][id];
}
return;
} | javascript | function (data, id, context) {
if (!data || !context.language) {
return;
}
if (data[context.language] && (data[context.language][id] !== undefined)) {
return data[context.language][id];
}
return;
} | [
"function",
"(",
"data",
",",
"id",
",",
"context",
")",
"{",
"if",
"(",
"!",
"data",
"||",
"!",
"context",
".",
"language",
")",
"{",
"return",
";",
"}",
"if",
"(",
"data",
"[",
"context",
".",
"language",
"]",
"&&",
"(",
"data",
"[",
"context",... | Retrieve the current value based on the specified context. If the context
does contain language field, undefined is returned.
@param {Object} data the preference data from the Scope
@param {string} id preference ID to look up
@param {{language: string}} context Context to operate with
@return {*|undefined} property value | [
"Retrieve",
"the",
"current",
"value",
"based",
"on",
"the",
"specified",
"context",
".",
"If",
"the",
"context",
"does",
"contain",
"language",
"field",
"undefined",
"is",
"returned",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/preferences/PreferencesBase.js#L725-L734 | train | get the language | [
30522,
3853,
1006,
2951,
1010,
8909,
1010,
6123,
1007,
1063,
2065,
1006,
999,
2951,
1064,
1064,
999,
6123,
1012,
2653,
1007,
1063,
2709,
1025,
1065,
2065,
1006,
2951,
1031,
6123,
1012,
2653,
1033,
1004,
1004,
1006,
2951,
1031,
6123,
1012,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
openlayers/openlayers | src/ol/format/MVT.js | layersPBFReader | function layersPBFReader(tag, layers, pbf) {
if (tag === 3) {
const layer = {
keys: [],
values: [],
features: []
};
const end = pbf.readVarint() + pbf.pos;
pbf.readFields(layerPBFReader, layer, end);
layer.length = layer.features.length;
if (layer.length) {
layers[layer.name] = layer;
}
}
} | javascript | function layersPBFReader(tag, layers, pbf) {
if (tag === 3) {
const layer = {
keys: [],
values: [],
features: []
};
const end = pbf.readVarint() + pbf.pos;
pbf.readFields(layerPBFReader, layer, end);
layer.length = layer.features.length;
if (layer.length) {
layers[layer.name] = layer;
}
}
} | [
"function",
"layersPBFReader",
"(",
"tag",
",",
"layers",
",",
"pbf",
")",
"{",
"if",
"(",
"tag",
"===",
"3",
")",
"{",
"const",
"layer",
"=",
"{",
"keys",
":",
"[",
"]",
",",
"values",
":",
"[",
"]",
",",
"features",
":",
"[",
"]",
"}",
";",
... | Reader callback for parsing layers.
@param {number} tag The tag.
@param {Object} layers The layers object.
@param {PBF} pbf The PBF. | [
"Reader",
"callback",
"for",
"parsing",
"layers",
"."
] | f366eaea522388fb575b11010e69d309164baca7 | https://github.com/openlayers/openlayers/blob/f366eaea522388fb575b11010e69d309164baca7/src/ol/format/MVT.js#L290-L304 | train | Read the layers from a PBF | [
30522,
3853,
9014,
2361,
29292,
16416,
4063,
1006,
6415,
1010,
9014,
1010,
1052,
29292,
1007,
1063,
2065,
1006,
6415,
1027,
1027,
1027,
1017,
1007,
1063,
9530,
3367,
6741,
1027,
1063,
6309,
1024,
1031,
1033,
1010,
5300,
1024,
1031,
1033,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/LiveDevelopment/MultiBrowserImpl/language/HTMLInstrumentation.js | scanDocument | function scanDocument(doc) {
if (!_cachedValues.hasOwnProperty(doc.file.fullPath)) {
// TODO: this doesn't seem to be correct any more. The DOM should never be "dirty" (i.e., out of sync
// with the editor) unless the doc is invalid.
// $(doc).on("change.htmlInstrumentation", function () {
// if (_cachedValues[doc.file.fullPath]) {
// _cachedValues[doc.file.fullPath].dirty = true;
// }
// });
// Assign to cache, but don't set a value yet
_cachedValues[doc.file.fullPath] = null;
}
var cachedValue = _cachedValues[doc.file.fullPath];
// TODO: No longer look at doc or cached value "dirty" settings, because even if the doc is dirty, the dom
// should generally be up to date unless the HTML is invalid. (However, the node offsets will be dirty of
// the dom was incrementally updated - we should note that somewhere.)
if (cachedValue && !cachedValue.invalid && cachedValue.timestamp === doc.diskTimestamp) {
return cachedValue.dom;
}
var text = doc.getText(),
dom = HTMLSimpleDOM.build(text);
if (dom) {
// Cache results
_cachedValues[doc.file.fullPath] = {
timestamp: doc.diskTimestamp,
dom: dom,
dirty: false
};
// Note that this was a full build, so we know that we can trust the node start/end offsets.
dom.fullBuild = true;
}
return dom;
} | javascript | function scanDocument(doc) {
if (!_cachedValues.hasOwnProperty(doc.file.fullPath)) {
// TODO: this doesn't seem to be correct any more. The DOM should never be "dirty" (i.e., out of sync
// with the editor) unless the doc is invalid.
// $(doc).on("change.htmlInstrumentation", function () {
// if (_cachedValues[doc.file.fullPath]) {
// _cachedValues[doc.file.fullPath].dirty = true;
// }
// });
// Assign to cache, but don't set a value yet
_cachedValues[doc.file.fullPath] = null;
}
var cachedValue = _cachedValues[doc.file.fullPath];
// TODO: No longer look at doc or cached value "dirty" settings, because even if the doc is dirty, the dom
// should generally be up to date unless the HTML is invalid. (However, the node offsets will be dirty of
// the dom was incrementally updated - we should note that somewhere.)
if (cachedValue && !cachedValue.invalid && cachedValue.timestamp === doc.diskTimestamp) {
return cachedValue.dom;
}
var text = doc.getText(),
dom = HTMLSimpleDOM.build(text);
if (dom) {
// Cache results
_cachedValues[doc.file.fullPath] = {
timestamp: doc.diskTimestamp,
dom: dom,
dirty: false
};
// Note that this was a full build, so we know that we can trust the node start/end offsets.
dom.fullBuild = true;
}
return dom;
} | [
"function",
"scanDocument",
"(",
"doc",
")",
"{",
"if",
"(",
"!",
"_cachedValues",
".",
"hasOwnProperty",
"(",
"doc",
".",
"file",
".",
"fullPath",
")",
")",
"{",
"// TODO: this doesn't seem to be correct any more. The DOM should never be \"dirty\" (i.e., out of sync",
"/... | Parses the document, returning an HTMLSimpleDOM structure and caching it as the
initial state of the document. Will return a cached copy of the DOM if the
document hasn't changed since the last time scanDocument was called.
This is called by generateInstrumentedHTML(), but it can be useful to call it
ahead of time so the DOM is cached and doesn't need to be rescanned when the
instrumented HTML is requested by the browser.
@param {Document} doc The doc to scan.
@return {Object} Root DOM node of the document. | [
"Parses",
"the",
"document",
"returning",
"an",
"HTMLSimpleDOM",
"structure",
"and",
"caching",
"it",
"as",
"the",
"initial",
"state",
"of",
"the",
"document",
".",
"Will",
"return",
"a",
"cached",
"copy",
"of",
"the",
"DOM",
"if",
"the",
"document",
"hasn",... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/MultiBrowserImpl/language/HTMLInstrumentation.js#L677-L714 | train | Scans the document and returns the DOM | [
30522,
3853,
13594,
3527,
24894,
4765,
1006,
9986,
1007,
1063,
2065,
1006,
999,
1035,
17053,
2094,
10175,
15808,
1012,
2038,
12384,
21572,
4842,
3723,
1006,
9986,
1012,
5371,
1012,
2440,
15069,
1007,
1007,
1063,
1013,
1013,
28681,
2080,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/v4/ODataUtils.js | function (sDate) {
var oDate = rDate.test(sDate) && DateFormat.getDateInstance({
pattern : "yyyy-MM-dd",
strictParsing : true,
UTC : true
}).parse(sDate);
if (!oDate) {
throw new Error("Not a valid Edm.Date value: " + sDate);
}
return oDate;
} | javascript | function (sDate) {
var oDate = rDate.test(sDate) && DateFormat.getDateInstance({
pattern : "yyyy-MM-dd",
strictParsing : true,
UTC : true
}).parse(sDate);
if (!oDate) {
throw new Error("Not a valid Edm.Date value: " + sDate);
}
return oDate;
} | [
"function",
"(",
"sDate",
")",
"{",
"var",
"oDate",
"=",
"rDate",
".",
"test",
"(",
"sDate",
")",
"&&",
"DateFormat",
".",
"getDateInstance",
"(",
"{",
"pattern",
":",
"\"yyyy-MM-dd\"",
",",
"strictParsing",
":",
"true",
",",
"UTC",
":",
"true",
"}",
"... | Parses an "Edm.Date" value and returns the corresponding JavaScript <code>Date</code>
value (UTC with a time value of "00:00:00").
@param {string} sDate
The "Edm.Date" value to parse
@returns {Date}
The JavaScript <code>Date</code> value
@throws {Error}
If the input cannot be parsed
@public
@since 1.43.0 | [
"Parses",
"an",
"Edm",
".",
"Date",
"value",
"and",
"returns",
"the",
"corresponding",
"JavaScript",
"<code",
">",
"Date<",
"/",
"code",
">",
"value",
"(",
"UTC",
"with",
"a",
"time",
"value",
"of",
"00",
":",
"00",
":",
"00",
")",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/ODataUtils.js#L111-L122 | train | Parses a Edm. Date value | [
30522,
3853,
1006,
17371,
3686,
1007,
1063,
13075,
1051,
13701,
1027,
16428,
3686,
1012,
3231,
1006,
17371,
3686,
1007,
1004,
1004,
3058,
14192,
4017,
1012,
2131,
13701,
7076,
26897,
1006,
1063,
5418,
1024,
1000,
1061,
2100,
2100,
2100,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
eslint/eslint | lib/code-path-analysis/code-path-analyzer.js | isIdentifierReference | function isIdentifierReference(node) {
const parent = node.parent;
switch (parent.type) {
case "LabeledStatement":
case "BreakStatement":
case "ContinueStatement":
case "ArrayPattern":
case "RestElement":
case "ImportSpecifier":
case "ImportDefaultSpecifier":
case "ImportNamespaceSpecifier":
case "CatchClause":
return false;
case "FunctionDeclaration":
case "FunctionExpression":
case "ArrowFunctionExpression":
case "ClassDeclaration":
case "ClassExpression":
case "VariableDeclarator":
return parent.id !== node;
case "Property":
case "MethodDefinition":
return (
parent.key !== node ||
parent.computed ||
parent.shorthand
);
case "AssignmentPattern":
return parent.key !== node;
default:
return true;
}
} | javascript | function isIdentifierReference(node) {
const parent = node.parent;
switch (parent.type) {
case "LabeledStatement":
case "BreakStatement":
case "ContinueStatement":
case "ArrayPattern":
case "RestElement":
case "ImportSpecifier":
case "ImportDefaultSpecifier":
case "ImportNamespaceSpecifier":
case "CatchClause":
return false;
case "FunctionDeclaration":
case "FunctionExpression":
case "ArrowFunctionExpression":
case "ClassDeclaration":
case "ClassExpression":
case "VariableDeclarator":
return parent.id !== node;
case "Property":
case "MethodDefinition":
return (
parent.key !== node ||
parent.computed ||
parent.shorthand
);
case "AssignmentPattern":
return parent.key !== node;
default:
return true;
}
} | [
"function",
"isIdentifierReference",
"(",
"node",
")",
"{",
"const",
"parent",
"=",
"node",
".",
"parent",
";",
"switch",
"(",
"parent",
".",
"type",
")",
"{",
"case",
"\"LabeledStatement\"",
":",
"case",
"\"BreakStatement\"",
":",
"case",
"\"ContinueStatement\"... | Checks that a given identifier node is a reference or not.
This is used to detect the first throwable node in a `try` block.
@param {ASTNode} node - An Identifier node to check.
@returns {boolean} `true` if the node is a reference. | [
"Checks",
"that",
"a",
"given",
"identifier",
"node",
"is",
"a",
"reference",
"or",
"not",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/code-path-analysis/code-path-analyzer.js#L96-L133 | train | IsIdentifierReference - Check whether a node is a reference to a variable. | [
30522,
3853,
2003,
5178,
16778,
8873,
28849,
25523,
1006,
13045,
1007,
1063,
9530,
3367,
6687,
1027,
13045,
1012,
6687,
1025,
6942,
1006,
6687,
1012,
2828,
1007,
1063,
2553,
1000,
12599,
9153,
18532,
4765,
1000,
1024,
2553,
1000,
7807,
1225... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jgraph/mxgraph | javascript/mxClient.js | function(callback)
{
mxResources.add(mxClient.basePath+'/resources/editor', null, function()
{
mxResources.add(mxClient.basePath+'/resources/graph', null, callback);
});
} | javascript | function(callback)
{
mxResources.add(mxClient.basePath+'/resources/editor', null, function()
{
mxResources.add(mxClient.basePath+'/resources/graph', null, callback);
});
} | [
"function",
"(",
"callback",
")",
"{",
"mxResources",
".",
"add",
"(",
"mxClient",
".",
"basePath",
"+",
"'/resources/editor'",
",",
"null",
",",
"function",
"(",
")",
"{",
"mxResources",
".",
"add",
"(",
"mxClient",
".",
"basePath",
"+",
"'/resources/graph'... | Function: loadResources
Loads all required resources asynchronously. Use this to load the graph and
editor resources if <mxLoadResources> is false.
Parameters:
callback - Callback function for asynchronous loading. | [
"Function",
":",
"loadResources"
] | 33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44 | https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L1682-L1688 | train | This function is called by mxClient to add resources to the editor and graph | [
30522,
3853,
1006,
2655,
5963,
1007,
1063,
25630,
6072,
8162,
9623,
1012,
5587,
1006,
25630,
20464,
11638,
1012,
2918,
15069,
1009,
1005,
1013,
4219,
1013,
3559,
1005,
1010,
19701,
1010,
3853,
1006,
1007,
1063,
25630,
6072,
8162,
9623,
1012... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/analytics/odata4analytics.js | function(aMeasureName) {
if (!aMeasureName) {
aMeasureName = this._oQueryResult.getAllMeasureNames();
}
this._oSelectedPropertyNames = null; // reset previously compiled list of selected properties
this._oMeasures = {};
for (var i = -1, sMeasName; (sMeasName = aMeasureName[++i]) !== undefined;) {
if (!this._oQueryResult.findMeasureByName(sMeasName)) {
throw sMeasName + " is not a valid measure name"; // TODO
}
this._oMeasures[sMeasName] = {
value : true,
text : false,
unit : false
};
}
} | javascript | function(aMeasureName) {
if (!aMeasureName) {
aMeasureName = this._oQueryResult.getAllMeasureNames();
}
this._oSelectedPropertyNames = null; // reset previously compiled list of selected properties
this._oMeasures = {};
for (var i = -1, sMeasName; (sMeasName = aMeasureName[++i]) !== undefined;) {
if (!this._oQueryResult.findMeasureByName(sMeasName)) {
throw sMeasName + " is not a valid measure name"; // TODO
}
this._oMeasures[sMeasName] = {
value : true,
text : false,
unit : false
};
}
} | [
"function",
"(",
"aMeasureName",
")",
"{",
"if",
"(",
"!",
"aMeasureName",
")",
"{",
"aMeasureName",
"=",
"this",
".",
"_oQueryResult",
".",
"getAllMeasureNames",
"(",
")",
";",
"}",
"this",
".",
"_oSelectedPropertyNames",
"=",
"null",
";",
"// reset previousl... | Set the measures to be included in the query result request. By default,
the query result will include the properties holding the raw values of
the given measures. This setting can be changed using
includeMeasureRawFormattedValueUnit.
@param aMeasureName
Array of measure names to be part of the query result request.
If null, the request includes all measures, if empty, no
measure is included.
@public
@function
@name sap.ui.model.analytics.odata4analytics.QueryResultRequest#setMeasures | [
"Set",
"the",
"measures",
"to",
"be",
"included",
"in",
"the",
"query",
"result",
"request",
".",
"By",
"default",
"the",
"query",
"result",
"will",
"include",
"the",
"properties",
"holding",
"the",
"raw",
"values",
"of",
"the",
"given",
"measures",
".",
"... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/analytics/odata4analytics.js#L4302-L4320 | train | Sets the selected properties of the query result | [
30522,
3853,
1006,
2572,
5243,
28632,
18442,
1007,
1063,
2065,
1006,
999,
2572,
5243,
28632,
18442,
1007,
1063,
2572,
5243,
28632,
18442,
1027,
2023,
1012,
1035,
1051,
4226,
2854,
6072,
11314,
1012,
2131,
8095,
4168,
3022,
5397,
18442,
2015... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
BlackrockDigital/startbootstrap-sb-admin-2 | vendor/fontawesome-free/js/fontawesome.js | fastReduceObject | function fastReduceObject(subject, fn, initialValue, thisContext) {
var keys = Object.keys(subject),
length = keys.length,
iterator = thisContext !== undefined ? bindInternal4(fn, thisContext) : fn,
i,
key,
result;
if (initialValue === undefined) {
i = 1;
result = subject[keys[0]];
} else {
i = 0;
result = initialValue;
}
for (; i < length; i++) {
key = keys[i];
result = iterator(result, subject[key], key, subject);
}
return result;
} | javascript | function fastReduceObject(subject, fn, initialValue, thisContext) {
var keys = Object.keys(subject),
length = keys.length,
iterator = thisContext !== undefined ? bindInternal4(fn, thisContext) : fn,
i,
key,
result;
if (initialValue === undefined) {
i = 1;
result = subject[keys[0]];
} else {
i = 0;
result = initialValue;
}
for (; i < length; i++) {
key = keys[i];
result = iterator(result, subject[key], key, subject);
}
return result;
} | [
"function",
"fastReduceObject",
"(",
"subject",
",",
"fn",
",",
"initialValue",
",",
"thisContext",
")",
"{",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"subject",
")",
",",
"length",
"=",
"keys",
".",
"length",
",",
"iterator",
"=",
"thisContext",
... | # Reduce
A fast object `.reduce()` implementation.
@param {Object} subject The object to reduce over.
@param {Function} fn The reducer function.
@param {mixed} initialValue The initial value for the reducer, defaults to subject[0].
@param {Object} thisContext The context for the reducer.
@return {mixed} The final result. | [
"#",
"Reduce"
] | ddfaceb4a8e65a41f163e2fdc4eab49384b810a1 | https://github.com/BlackrockDigital/startbootstrap-sb-admin-2/blob/ddfaceb4a8e65a41f163e2fdc4eab49384b810a1/vendor/fontawesome-free/js/fontawesome.js#L1114-L1136 | train | fastReduceObject - Fast reduce object | [
30522,
3853,
3435,
5596,
18796,
16429,
20614,
1006,
3395,
1010,
1042,
2078,
1010,
3988,
10175,
5657,
1010,
2023,
8663,
18209,
1007,
1063,
13075,
6309,
1027,
4874,
1012,
6309,
1006,
3395,
1007,
1010,
3091,
1027,
6309,
1012,
3091,
1010,
2009,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
NetEase/pomelo | lib/connectors/siosocket.js | function(id, socket) {
EventEmitter.call(this);
this.id = id;
this.socket = socket;
this.remoteAddress = {
ip: socket.handshake.address.address,
port: socket.handshake.address.port
};
var self = this;
socket.on('disconnect', this.emit.bind(this, 'disconnect'));
socket.on('error', this.emit.bind(this, 'error'));
socket.on('message', function(msg) {
self.emit('message', msg);
});
this.state = ST_INITED;
// TODO: any other events?
} | javascript | function(id, socket) {
EventEmitter.call(this);
this.id = id;
this.socket = socket;
this.remoteAddress = {
ip: socket.handshake.address.address,
port: socket.handshake.address.port
};
var self = this;
socket.on('disconnect', this.emit.bind(this, 'disconnect'));
socket.on('error', this.emit.bind(this, 'error'));
socket.on('message', function(msg) {
self.emit('message', msg);
});
this.state = ST_INITED;
// TODO: any other events?
} | [
"function",
"(",
"id",
",",
"socket",
")",
"{",
"EventEmitter",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"id",
"=",
"id",
";",
"this",
".",
"socket",
"=",
"socket",
";",
"this",
".",
"remoteAddress",
"=",
"{",
"ip",
":",
"socket",
".",
"h... | Socket class that wraps socket.io socket to provide unified interface for up level. | [
"Socket",
"class",
"that",
"wraps",
"socket",
".",
"io",
"socket",
"to",
"provide",
"unified",
"interface",
"for",
"up",
"level",
"."
] | defcf019631ed399cc4dad932d3b028a04a039a4 | https://github.com/NetEase/pomelo/blob/defcf019631ed399cc4dad932d3b028a04a039a4/lib/connectors/siosocket.js#L10-L32 | train | A node. js node. js node. js node. js node. js node. js node. js node. js node. js node. js node. js node. js node. js node. js node. js node. js node. js node. js node. js node. js node. js node. js node. js node. js node. js node. js node. js node. js node. js node. js node. js node. js node | [
30522,
3853,
1006,
8909,
1010,
22278,
1007,
1063,
2724,
23238,
12079,
1012,
2655,
1006,
2023,
1007,
1025,
2023,
1012,
8909,
1027,
8909,
1025,
2023,
1012,
22278,
1027,
22278,
1025,
2023,
1012,
6556,
4215,
16200,
4757,
1027,
1063,
12997,
1024... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SeleniumHQ/selenium | javascript/atoms/dom.js | hiddenByOverflow | function hiddenByOverflow(e) {
return bot.dom.getOverflowState(e) == bot.dom.OverflowState.HIDDEN &&
goog.array.every(e.childNodes, function(n) {
return !bot.dom.isElement(n) || hiddenByOverflow(n) ||
!positiveSize(n);
});
} | javascript | function hiddenByOverflow(e) {
return bot.dom.getOverflowState(e) == bot.dom.OverflowState.HIDDEN &&
goog.array.every(e.childNodes, function(n) {
return !bot.dom.isElement(n) || hiddenByOverflow(n) ||
!positiveSize(n);
});
} | [
"function",
"hiddenByOverflow",
"(",
"e",
")",
"{",
"return",
"bot",
".",
"dom",
".",
"getOverflowState",
"(",
"e",
")",
"==",
"bot",
".",
"dom",
".",
"OverflowState",
".",
"HIDDEN",
"&&",
"goog",
".",
"array",
".",
"every",
"(",
"e",
".",
"childNodes"... | Elements that are hidden by overflow are not shown. | [
"Elements",
"that",
"are",
"hidden",
"by",
"overflow",
"are",
"not",
"shown",
"."
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/javascript/atoms/dom.js#L552-L558 | train | Checks if an element is hidden by overflow | [
30522,
3853,
5023,
3762,
7840,
12314,
1006,
1041,
1007,
1063,
2709,
28516,
1012,
14383,
1012,
2131,
7840,
12314,
9153,
2618,
1006,
1041,
1007,
1027,
1027,
28516,
1012,
14383,
1012,
2058,
12314,
9153,
2618,
1012,
5023,
1004,
1004,
27571,
229... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/view/Pane.js | tryFocusingCurrentView | function tryFocusingCurrentView() {
if (self._currentView) {
if (self._currentView.focus) {
// Views can implement a focus
// method for focusing a complex
// DOM like codemirror
self._currentView.focus();
} else {
// Otherwise, no focus method
// just try and give the DOM
// element focus
self._currentView.$el.focus();
}
} else {
// no view so just focus the pane
self.$el.focus();
}
} | javascript | function tryFocusingCurrentView() {
if (self._currentView) {
if (self._currentView.focus) {
// Views can implement a focus
// method for focusing a complex
// DOM like codemirror
self._currentView.focus();
} else {
// Otherwise, no focus method
// just try and give the DOM
// element focus
self._currentView.$el.focus();
}
} else {
// no view so just focus the pane
self.$el.focus();
}
} | [
"function",
"tryFocusingCurrentView",
"(",
")",
"{",
"if",
"(",
"self",
".",
"_currentView",
")",
"{",
"if",
"(",
"self",
".",
"_currentView",
".",
"focus",
")",
"{",
"// Views can implement a focus",
"// method for focusing a complex",
"// DOM like codemirror",
"s... | Helper to focus the current view if it can | [
"Helper",
"to",
"focus",
"the",
"current",
"view",
"if",
"it",
"can"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/view/Pane.js#L1428-L1445 | train | Try focusing the currently focused view | [
30522,
3853,
3046,
14876,
7874,
2075,
10841,
14343,
3372,
8584,
1006,
1007,
1063,
2065,
1006,
2969,
1012,
1035,
2783,
8584,
1007,
1063,
2065,
1006,
2969,
1012,
1035,
2783,
8584,
1012,
3579,
1007,
1063,
1013,
1013,
5328,
2064,
10408,
1037,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
babel/babel | packages/babel-plugin-proposal-object-rest-spread/src/index.js | replaceImpureComputedKeys | function replaceImpureComputedKeys(path) {
const impureComputedPropertyDeclarators = [];
for (const propPath of path.get("properties")) {
const key = propPath.get("key");
if (propPath.node.computed && !key.isPure()) {
const name = path.scope.generateUidBasedOnNode(key.node);
const declarator = t.variableDeclarator(t.identifier(name), key.node);
impureComputedPropertyDeclarators.push(declarator);
key.replaceWith(t.identifier(name));
}
}
return impureComputedPropertyDeclarators;
} | javascript | function replaceImpureComputedKeys(path) {
const impureComputedPropertyDeclarators = [];
for (const propPath of path.get("properties")) {
const key = propPath.get("key");
if (propPath.node.computed && !key.isPure()) {
const name = path.scope.generateUidBasedOnNode(key.node);
const declarator = t.variableDeclarator(t.identifier(name), key.node);
impureComputedPropertyDeclarators.push(declarator);
key.replaceWith(t.identifier(name));
}
}
return impureComputedPropertyDeclarators;
} | [
"function",
"replaceImpureComputedKeys",
"(",
"path",
")",
"{",
"const",
"impureComputedPropertyDeclarators",
"=",
"[",
"]",
";",
"for",
"(",
"const",
"propPath",
"of",
"path",
".",
"get",
"(",
"\"properties\"",
")",
")",
"{",
"const",
"key",
"=",
"propPath",
... | replaces impure computed keys with new identifiers and returns variable declarators of these new identifiers | [
"replaces",
"impure",
"computed",
"keys",
"with",
"new",
"identifiers",
"and",
"returns",
"variable",
"declarators",
"of",
"these",
"new",
"identifiers"
] | 1969e6b6aa7d90be3fbb3aca98ea96849656a55a | https://github.com/babel/babel/blob/1969e6b6aa7d90be3fbb3aca98ea96849656a55a/packages/babel-plugin-proposal-object-rest-spread/src/index.js#L94-L106 | train | Replace impure computed keys with variable declarations | [
30522,
3853,
5672,
5714,
5311,
8586,
25377,
12926,
14839,
2015,
1006,
4130,
1007,
1063,
9530,
3367,
17727,
5397,
9006,
29462,
21572,
4842,
3723,
3207,
20464,
25879,
5668,
1027,
1031,
1033,
1025,
2005,
1006,
9530,
3367,
17678,
15069,
1997,
4... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.fl/src/sap/ui/fl/Utils.js | function(vInitialValue, vError, sInitialPromiseIdentifier) {
Utils.FakePromise.fakePromiseIdentifier = "sap.ui.fl.Utils.FakePromise";
this.vValue = vInitialValue;
this.vError = vError;
this.bContinueWithFakePromise = arguments.length < 3 || (sInitialPromiseIdentifier === Utils.FakePromise.fakePromiseIdentifier);
Utils.FakePromise.prototype.then = function(fn) {
if (!this.bContinueWithFakePromise) {
return Promise.resolve(fn(this.vValue));
}
if (!this.vError) {
try {
this.vValue = fn(this.vValue, Utils.FakePromise.fakePromiseIdentifier);
} catch (oError) {
this.vError = oError;
this.vValue = null;
return this;
}
if (this.vValue instanceof Promise ||
this.vValue instanceof Utils.FakePromise) {
return this.vValue;
}
}
return this;
};
Utils.FakePromise.prototype.catch = function(fn) {
if (!this.bContinueWithFakePromise) {
return Promise.reject(fn(this.vError));
}
if (this.vError) {
try {
this.vValue = fn(this.vError, Utils.FakePromise.fakePromiseIdentifier);
} catch (oError) {
this.vError = oError;
this.vValue = null;
return this;
}
this.vError = null;
if (this.vValue instanceof Promise ||
this.vValue instanceof Utils.FakePromise) {
return this.vValue;
}
}
return this;
};
if (this.vValue instanceof Promise ||
this.vValue instanceof Utils.FakePromise) {
return this.vValue;
}
} | javascript | function(vInitialValue, vError, sInitialPromiseIdentifier) {
Utils.FakePromise.fakePromiseIdentifier = "sap.ui.fl.Utils.FakePromise";
this.vValue = vInitialValue;
this.vError = vError;
this.bContinueWithFakePromise = arguments.length < 3 || (sInitialPromiseIdentifier === Utils.FakePromise.fakePromiseIdentifier);
Utils.FakePromise.prototype.then = function(fn) {
if (!this.bContinueWithFakePromise) {
return Promise.resolve(fn(this.vValue));
}
if (!this.vError) {
try {
this.vValue = fn(this.vValue, Utils.FakePromise.fakePromiseIdentifier);
} catch (oError) {
this.vError = oError;
this.vValue = null;
return this;
}
if (this.vValue instanceof Promise ||
this.vValue instanceof Utils.FakePromise) {
return this.vValue;
}
}
return this;
};
Utils.FakePromise.prototype.catch = function(fn) {
if (!this.bContinueWithFakePromise) {
return Promise.reject(fn(this.vError));
}
if (this.vError) {
try {
this.vValue = fn(this.vError, Utils.FakePromise.fakePromiseIdentifier);
} catch (oError) {
this.vError = oError;
this.vValue = null;
return this;
}
this.vError = null;
if (this.vValue instanceof Promise ||
this.vValue instanceof Utils.FakePromise) {
return this.vValue;
}
}
return this;
};
if (this.vValue instanceof Promise ||
this.vValue instanceof Utils.FakePromise) {
return this.vValue;
}
} | [
"function",
"(",
"vInitialValue",
",",
"vError",
",",
"sInitialPromiseIdentifier",
")",
"{",
"Utils",
".",
"FakePromise",
".",
"fakePromiseIdentifier",
"=",
"\"sap.ui.fl.Utils.FakePromise\"",
";",
"this",
".",
"vValue",
"=",
"vInitialValue",
";",
"this",
".",
"vErro... | Function that behaves like Promise (es6) but is synchronous. Implements 'then' and 'catch' functions.
After instantiating can be used similar to standard Promises but synchronously.
As soon as one of the callback functions returns a Promise the asynchronous Promise replaces the FakePromise in further processing.
@param {any} vInitialValue - value on resolve FakePromise
@param {any} vError - value on reject FakePromise
@param {string} sInitialPromiseIdentifier - value identifies previous promise in chain. If the identifier is passed to the function and don't match with the FakePromiseIdentifier then native Promise execution is used for further processing
@returns {sap.ui.fl.Utils.FakePromise|Promise} Returns instantiated FakePromise only if no Promise is passed by value parameter | [
"Function",
"that",
"behaves",
"like",
"Promise",
"(",
"es6",
")",
"but",
"is",
"synchronous",
".",
"Implements",
"then",
"and",
"catch",
"functions",
".",
"After",
"instantiating",
"can",
"be",
"used",
"similar",
"to",
"standard",
"Promises",
"but",
"synchron... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.fl/src/sap/ui/fl/Utils.js#L1338-L1386 | train | A function that returns a promise that resolves with a fake value and throws an error if the promise is not resolved. | [
30522,
3853,
1006,
19354,
29050,
22144,
7630,
2063,
1010,
2310,
18933,
2099,
1010,
8254,
29050,
14277,
21716,
5562,
5178,
16778,
8873,
2121,
1007,
1063,
21183,
12146,
1012,
8275,
21572,
28732,
1012,
8275,
21572,
28732,
5178,
16778,
8873,
2121... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
aframevr/aframe | src/core/component.js | function (value, clobber) {
var newAttrValue;
var tempObject;
var property;
if (value === undefined) { return; }
// If null value is the new attribute value, make the attribute value falsy.
if (value === null) {
if (this.isObjectBased && this.attrValue) {
this.objectPool.recycle(this.attrValue);
}
this.attrValue = undefined;
return;
}
if (value instanceof Object && !(value instanceof window.HTMLElement)) {
// If value is an object, copy it to our pooled newAttrValue object to use to update
// the attrValue.
tempObject = this.objectPool.use();
newAttrValue = utils.extend(tempObject, value);
} else {
newAttrValue = this.parseAttrValueForCache(value);
}
// Merge new data with previous `attrValue` if updating and not clobbering.
if (this.isObjectBased && !clobber && this.attrValue) {
for (property in this.attrValue) {
if (newAttrValue[property] === undefined) {
newAttrValue[property] = this.attrValue[property];
}
}
}
// Update attrValue.
if (this.isObjectBased && !this.attrValue) {
this.attrValue = this.objectPool.use();
}
utils.objectPool.clearObject(this.attrValue);
this.attrValue = extendProperties(this.attrValue, newAttrValue, this.isObjectBased);
utils.objectPool.clearObject(tempObject);
} | javascript | function (value, clobber) {
var newAttrValue;
var tempObject;
var property;
if (value === undefined) { return; }
// If null value is the new attribute value, make the attribute value falsy.
if (value === null) {
if (this.isObjectBased && this.attrValue) {
this.objectPool.recycle(this.attrValue);
}
this.attrValue = undefined;
return;
}
if (value instanceof Object && !(value instanceof window.HTMLElement)) {
// If value is an object, copy it to our pooled newAttrValue object to use to update
// the attrValue.
tempObject = this.objectPool.use();
newAttrValue = utils.extend(tempObject, value);
} else {
newAttrValue = this.parseAttrValueForCache(value);
}
// Merge new data with previous `attrValue` if updating and not clobbering.
if (this.isObjectBased && !clobber && this.attrValue) {
for (property in this.attrValue) {
if (newAttrValue[property] === undefined) {
newAttrValue[property] = this.attrValue[property];
}
}
}
// Update attrValue.
if (this.isObjectBased && !this.attrValue) {
this.attrValue = this.objectPool.use();
}
utils.objectPool.clearObject(this.attrValue);
this.attrValue = extendProperties(this.attrValue, newAttrValue, this.isObjectBased);
utils.objectPool.clearObject(tempObject);
} | [
"function",
"(",
"value",
",",
"clobber",
")",
"{",
"var",
"newAttrValue",
";",
"var",
"tempObject",
";",
"var",
"property",
";",
"if",
"(",
"value",
"===",
"undefined",
")",
"{",
"return",
";",
"}",
"// If null value is the new attribute value, make the attribute... | Update the cache of the pre-parsed attribute value.
@param {string} value - New data.
@param {boolean } clobber - Whether to wipe out and replace previous data. | [
"Update",
"the",
"cache",
"of",
"the",
"pre",
"-",
"parsed",
"attribute",
"value",
"."
] | 24acc78a7299a4cdfe3ef617f4d40ddf6275c992 | https://github.com/aframevr/aframe/blob/24acc78a7299a4cdfe3ef617f4d40ddf6275c992/src/core/component.js#L186-L227 | train | Updates the attrValue object with the new value. | [
30522,
3853,
1006,
3643,
1010,
18856,
16429,
5677,
1007,
1063,
13075,
2047,
19321,
26585,
5657,
1025,
13075,
13657,
2497,
20614,
1025,
13075,
3200,
1025,
2065,
1006,
3643,
1027,
1027,
1027,
6151,
28344,
1007,
1063,
2709,
1025,
1065,
1013,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
shipshapecode/shepherd | src/js/utils/modal.js | positionModalOpening | function positionModalOpening(targetElement, openingElement) {
if (targetElement.getBoundingClientRect && openingElement instanceof SVGElement) {
const { x, y, width, height, left, top } = targetElement.getBoundingClientRect();
// getBoundingClientRect is not consistent. Some browsers use x and y, while others use left and top
_setAttributes(openingElement, { x: x || left, y: y || top, width, height });
}
} | javascript | function positionModalOpening(targetElement, openingElement) {
if (targetElement.getBoundingClientRect && openingElement instanceof SVGElement) {
const { x, y, width, height, left, top } = targetElement.getBoundingClientRect();
// getBoundingClientRect is not consistent. Some browsers use x and y, while others use left and top
_setAttributes(openingElement, { x: x || left, y: y || top, width, height });
}
} | [
"function",
"positionModalOpening",
"(",
"targetElement",
",",
"openingElement",
")",
"{",
"if",
"(",
"targetElement",
".",
"getBoundingClientRect",
"&&",
"openingElement",
"instanceof",
"SVGElement",
")",
"{",
"const",
"{",
"x",
",",
"y",
",",
"width",
",",
"he... | Uses the bounds of the element we want the opening overtop of to set the dimensions of the opening and position it
@param {HTMLElement} targetElement The element the opening will expose
@param {SVGElement} openingElement The svg mask for the opening | [
"Uses",
"the",
"bounds",
"of",
"the",
"element",
"we",
"want",
"the",
"opening",
"overtop",
"of",
"to",
"set",
"the",
"dimensions",
"of",
"the",
"opening",
"and",
"position",
"it"
] | 0cb1c63fb07b58796358f6d33da5f6405e2b05f4 | https://github.com/shipshapecode/shepherd/blob/0cb1c63fb07b58796358f6d33da5f6405e2b05f4/src/js/utils/modal.js#L131-L138 | train | Position the modal opening element | [
30522,
3853,
2597,
5302,
9305,
26915,
2075,
1006,
4539,
12260,
3672,
1010,
3098,
12260,
3672,
1007,
1063,
2065,
1006,
4539,
12260,
3672,
1012,
2131,
15494,
2075,
20464,
11638,
2890,
6593,
1004,
1004,
3098,
12260,
3672,
6013,
11253,
17917,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
transloadit/uppy | website/inject.js | injectGhStars | async function injectGhStars () {
const opts = {}
if ('GITHUB_TOKEN' in process.env) {
opts.auth = process.env.GITHUB_TOKEN
}
const Octokit = require('@octokit/rest')
const octokit = new Octokit(opts)
let { headers, data } = await octokit.repos.get({
owner: 'transloadit',
repo: 'uppy'
})
console.log(`${headers['x-ratelimit-remaining']} requests remaining until we hit GitHub ratelimiter`)
let dstpath = path.join(webRoot, 'themes', 'uppy', 'layout', 'partials', 'generated_stargazers.ejs')
fs.writeFileSync(dstpath, data.stargazers_count, 'utf-8')
console.log(`${data.stargazers_count} stargazers written to '${dstpath}'`)
} | javascript | async function injectGhStars () {
const opts = {}
if ('GITHUB_TOKEN' in process.env) {
opts.auth = process.env.GITHUB_TOKEN
}
const Octokit = require('@octokit/rest')
const octokit = new Octokit(opts)
let { headers, data } = await octokit.repos.get({
owner: 'transloadit',
repo: 'uppy'
})
console.log(`${headers['x-ratelimit-remaining']} requests remaining until we hit GitHub ratelimiter`)
let dstpath = path.join(webRoot, 'themes', 'uppy', 'layout', 'partials', 'generated_stargazers.ejs')
fs.writeFileSync(dstpath, data.stargazers_count, 'utf-8')
console.log(`${data.stargazers_count} stargazers written to '${dstpath}'`)
} | [
"async",
"function",
"injectGhStars",
"(",
")",
"{",
"const",
"opts",
"=",
"{",
"}",
"if",
"(",
"'GITHUB_TOKEN'",
"in",
"process",
".",
"env",
")",
"{",
"opts",
".",
"auth",
"=",
"process",
".",
"env",
".",
"GITHUB_TOKEN",
"}",
"const",
"Octokit",
"=",... | re-enable after rate limiter issue is fixed | [
"re",
"-",
"enable",
"after",
"rate",
"limiter",
"issue",
"is",
"fixed"
] | 7ae18bf992d544a64da998f033258ec09a3de275 | https://github.com/transloadit/uppy/blob/7ae18bf992d544a64da998f033258ec09a3de275/website/inject.js#L131-L151 | train | Injects the generated stargazers into the theme | [
30522,
2004,
6038,
2278,
3853,
1999,
20614,
5603,
14117,
2015,
1006,
1007,
1063,
9530,
3367,
23569,
2015,
1027,
1063,
1065,
2065,
1006,
1005,
21025,
2705,
12083,
1035,
19204,
1005,
1999,
2832,
1012,
4372,
2615,
1007,
1063,
23569,
2015,
1012... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/LiveDevelopment/MultiBrowserImpl/protocol/remote/DocumentObserver.js | start | function start(document, transport) {
_transport = transport;
_document = document;
// start listening to node changes
_enableListeners();
var rel = related();
// send the current status of related docs.
_transport.send(JSON.stringify({
method: "DocumentRelated",
related: rel
}));
// initialize stylesheets with current status for further notifications.
CSS.stylesheets = rel.stylesheets;
} | javascript | function start(document, transport) {
_transport = transport;
_document = document;
// start listening to node changes
_enableListeners();
var rel = related();
// send the current status of related docs.
_transport.send(JSON.stringify({
method: "DocumentRelated",
related: rel
}));
// initialize stylesheets with current status for further notifications.
CSS.stylesheets = rel.stylesheets;
} | [
"function",
"start",
"(",
"document",
",",
"transport",
")",
"{",
"_transport",
"=",
"transport",
";",
"_document",
"=",
"document",
";",
"// start listening to node changes",
"_enableListeners",
"(",
")",
";",
"var",
"rel",
"=",
"related",
"(",
")",
";",
"// ... | Start listening for events and send initial related documents message.
@param {HTMLDocument} document
@param {object} transport Live development transport connection | [
"Start",
"listening",
"for",
"events",
"and",
"send",
"initial",
"related",
"documents",
"message",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/MultiBrowserImpl/protocol/remote/DocumentObserver.js#L303-L318 | train | Start listening to related docs. | [
30522,
3853,
2707,
1006,
6254,
1010,
3665,
1007,
1063,
1035,
3665,
1027,
3665,
1025,
1035,
6254,
1027,
6254,
1025,
1013,
1013,
2707,
5962,
2000,
13045,
3431,
1035,
9585,
9863,
24454,
2015,
1006,
1007,
1025,
13075,
2128,
2140,
1027,
3141,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/extensibility/ExtensionManager.js | _enableOrDisable | function _enableOrDisable(id, enable) {
var result = new $.Deferred(),
extension = extensions[id];
if (extension && extension.installInfo) {
Package[(enable ? "enable" : "disable")](extension.installInfo.path)
.done(function () {
extension.installInfo.status = enable ? ENABLED : DISABLED;
extension.installInfo.metadata.disabled = !enable;
result.resolve();
exports.trigger("statusChange", id);
})
.fail(function (err) {
result.reject(err);
});
} else {
result.reject(StringUtils.format(Strings.EXTENSION_NOT_INSTALLED, id));
}
return result.promise();
} | javascript | function _enableOrDisable(id, enable) {
var result = new $.Deferred(),
extension = extensions[id];
if (extension && extension.installInfo) {
Package[(enable ? "enable" : "disable")](extension.installInfo.path)
.done(function () {
extension.installInfo.status = enable ? ENABLED : DISABLED;
extension.installInfo.metadata.disabled = !enable;
result.resolve();
exports.trigger("statusChange", id);
})
.fail(function (err) {
result.reject(err);
});
} else {
result.reject(StringUtils.format(Strings.EXTENSION_NOT_INSTALLED, id));
}
return result.promise();
} | [
"function",
"_enableOrDisable",
"(",
"id",
",",
"enable",
")",
"{",
"var",
"result",
"=",
"new",
"$",
".",
"Deferred",
"(",
")",
",",
"extension",
"=",
"extensions",
"[",
"id",
"]",
";",
"if",
"(",
"extension",
"&&",
"extension",
".",
"installInfo",
")... | @private
Disables or enables the installed extensions.
@param {string} id The id of the extension to disable or enable.
@param {boolean} enable A boolean indicating whether to enable or disable.
@return {$.Promise} A promise that's resolved when the extension action is
completed or rejected with an error that prevents the action from completion. | [
"@private"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/extensibility/ExtensionManager.js#L424-L442 | train | Enable or disable an extension | [
30522,
3853,
1035,
9585,
8551,
14268,
3468,
1006,
8909,
1010,
9585,
1007,
1063,
13075,
2765,
1027,
2047,
1002,
1012,
13366,
28849,
2094,
1006,
1007,
1010,
5331,
1027,
14305,
1031,
8909,
1033,
1025,
2065,
1006,
5331,
1004,
1004,
5331,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
graphql/graphql-js | resources/benchmark.js | runBenchmark | function runBenchmark(benchmark, environments) {
let benchmarkName;
const benches = environments.map(environment => {
const module = require(path.join(environment.distPath, benchmark))
benchmarkName = module.name;
return new Benchmark(environment.revision, module.measure);
});
console.log('⏱️ ' + benchmarkName);
for (let i = 0; i < benches.length; ++i) {
benches[i].run({ async: false });
process.stdout.write(' ' + cyan(i + 1) + ' tests completed.\u000D');
}
console.log('\n');
beautifyBenchmark(benches);
console.log('');
} | javascript | function runBenchmark(benchmark, environments) {
let benchmarkName;
const benches = environments.map(environment => {
const module = require(path.join(environment.distPath, benchmark))
benchmarkName = module.name;
return new Benchmark(environment.revision, module.measure);
});
console.log('⏱️ ' + benchmarkName);
for (let i = 0; i < benches.length; ++i) {
benches[i].run({ async: false });
process.stdout.write(' ' + cyan(i + 1) + ' tests completed.\u000D');
}
console.log('\n');
beautifyBenchmark(benches);
console.log('');
} | [
"function",
"runBenchmark",
"(",
"benchmark",
",",
"environments",
")",
"{",
"let",
"benchmarkName",
";",
"const",
"benches",
"=",
"environments",
".",
"map",
"(",
"environment",
"=>",
"{",
"const",
"module",
"=",
"require",
"(",
"path",
".",
"join",
"(",
... | Run a given benchmark test with the provided revisions. | [
"Run",
"a",
"given",
"benchmark",
"test",
"with",
"the",
"provided",
"revisions",
"."
] | b65ff6db8893c1c68f0f236c4b2d663e6c55f5ef | https://github.com/graphql/graphql-js/blob/b65ff6db8893c1c68f0f236c4b2d663e6c55f5ef/resources/benchmark.js#L109-L126 | train | Runs a benchmark in a list of environments | [
30522,
3853,
2448,
10609,
2818,
10665,
1006,
6847,
10665,
1010,
10058,
1007,
1063,
2292,
6847,
10665,
18442,
1025,
9530,
3367,
19571,
1027,
10058,
1012,
4949,
1006,
4044,
1027,
1028,
1063,
9530,
3367,
11336,
1027,
5478,
1006,
4130,
1012,
36... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jgraph/mxgraph | javascript/examples/grapheditor/www/js/Graph.js | cleanNode | function cleanNode(node)
{
var child = node.firstChild;
while (child != null)
{
var next = child.nextSibling;
cleanNode(child);
child = next;
}
if ((node.nodeType != 1 || (node.nodeName !== 'BR' && node.firstChild == null)) &&
(node.nodeType != 3 || mxUtils.trim(mxUtils.getTextContent(node)).length == 0))
{
node.parentNode.removeChild(node);
}
else
{
// Removes linefeeds
if (node.nodeType == 3)
{
mxUtils.setTextContent(node, mxUtils.getTextContent(node).replace(/\n|\r/g, ''));
}
// Removes CSS classes and styles (for Word and Excel)
if (node.nodeType == 1)
{
node.removeAttribute('style');
node.removeAttribute('class');
node.removeAttribute('width');
node.removeAttribute('cellpadding');
node.removeAttribute('cellspacing');
node.removeAttribute('border');
}
}
} | javascript | function cleanNode(node)
{
var child = node.firstChild;
while (child != null)
{
var next = child.nextSibling;
cleanNode(child);
child = next;
}
if ((node.nodeType != 1 || (node.nodeName !== 'BR' && node.firstChild == null)) &&
(node.nodeType != 3 || mxUtils.trim(mxUtils.getTextContent(node)).length == 0))
{
node.parentNode.removeChild(node);
}
else
{
// Removes linefeeds
if (node.nodeType == 3)
{
mxUtils.setTextContent(node, mxUtils.getTextContent(node).replace(/\n|\r/g, ''));
}
// Removes CSS classes and styles (for Word and Excel)
if (node.nodeType == 1)
{
node.removeAttribute('style');
node.removeAttribute('class');
node.removeAttribute('width');
node.removeAttribute('cellpadding');
node.removeAttribute('cellspacing');
node.removeAttribute('border');
}
}
} | [
"function",
"cleanNode",
"(",
"node",
")",
"{",
"var",
"child",
"=",
"node",
".",
"firstChild",
";",
"while",
"(",
"child",
"!=",
"null",
")",
"{",
"var",
"next",
"=",
"child",
".",
"nextSibling",
";",
"cleanNode",
"(",
"child",
")",
";",
"child",
"=... | Removes unused DOM nodes and attributes, recursively | [
"Removes",
"unused",
"DOM",
"nodes",
"and",
"attributes",
"recursively"
] | 33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44 | https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/examples/grapheditor/www/js/Graph.js#L7191-L7226 | train | Removes all text nodes from the DOM | [
30522,
3853,
4550,
3630,
3207,
1006,
13045,
1007,
1063,
13075,
2775,
1027,
13045,
1012,
2034,
19339,
1025,
2096,
1006,
2775,
999,
1027,
19701,
1007,
1063,
13075,
2279,
1027,
2775,
1012,
2279,
5332,
9709,
1025,
4550,
3630,
3207,
1006,
2775,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
GeekyAnts/vue-native-core | packages/vue-server-renderer/build.js | createRenderer$1 | function createRenderer$1 (ref) {
if ( ref === void 0 ) ref = {};
var modules = ref.modules; if ( modules === void 0 ) modules = [];
var directives = ref.directives; if ( directives === void 0 ) directives = {};
var isUnaryTag = ref.isUnaryTag; if ( isUnaryTag === void 0 ) isUnaryTag = (function () { return false; });
var template = ref.template;
var inject = ref.inject;
var cache = ref.cache;
var shouldPreload = ref.shouldPreload;
var clientManifest = ref.clientManifest;
var render = createRenderFunction(modules, directives, isUnaryTag, cache);
var templateRenderer = new TemplateRenderer({
template: template,
inject: inject,
shouldPreload: shouldPreload,
clientManifest: clientManifest
});
return {
renderToString: function renderToString (
component,
context,
done
) {
if (typeof context === 'function') {
done = context;
context = {};
}
if (context) {
templateRenderer.bindRenderFns(context);
}
var result = '';
var write = createWriteFunction(function (text) {
result += text;
return false
}, done);
try {
render(component, write, context, function () {
if (template) {
result = templateRenderer.renderSync(result, context);
}
done(null, result);
});
} catch (e) {
done(e);
}
},
renderToStream: function renderToStream (
component,
context
) {
if (context) {
templateRenderer.bindRenderFns(context);
}
var renderStream = new RenderStream(function (write, done) {
render(component, write, context, done);
});
if (!template) {
return renderStream
} else {
var templateStream = templateRenderer.createStream(context);
renderStream.on('error', function (err) {
templateStream.emit('error', err);
});
renderStream.pipe(templateStream);
return templateStream
}
}
}
} | javascript | function createRenderer$1 (ref) {
if ( ref === void 0 ) ref = {};
var modules = ref.modules; if ( modules === void 0 ) modules = [];
var directives = ref.directives; if ( directives === void 0 ) directives = {};
var isUnaryTag = ref.isUnaryTag; if ( isUnaryTag === void 0 ) isUnaryTag = (function () { return false; });
var template = ref.template;
var inject = ref.inject;
var cache = ref.cache;
var shouldPreload = ref.shouldPreload;
var clientManifest = ref.clientManifest;
var render = createRenderFunction(modules, directives, isUnaryTag, cache);
var templateRenderer = new TemplateRenderer({
template: template,
inject: inject,
shouldPreload: shouldPreload,
clientManifest: clientManifest
});
return {
renderToString: function renderToString (
component,
context,
done
) {
if (typeof context === 'function') {
done = context;
context = {};
}
if (context) {
templateRenderer.bindRenderFns(context);
}
var result = '';
var write = createWriteFunction(function (text) {
result += text;
return false
}, done);
try {
render(component, write, context, function () {
if (template) {
result = templateRenderer.renderSync(result, context);
}
done(null, result);
});
} catch (e) {
done(e);
}
},
renderToStream: function renderToStream (
component,
context
) {
if (context) {
templateRenderer.bindRenderFns(context);
}
var renderStream = new RenderStream(function (write, done) {
render(component, write, context, done);
});
if (!template) {
return renderStream
} else {
var templateStream = templateRenderer.createStream(context);
renderStream.on('error', function (err) {
templateStream.emit('error', err);
});
renderStream.pipe(templateStream);
return templateStream
}
}
}
} | [
"function",
"createRenderer$1",
"(",
"ref",
")",
"{",
"if",
"(",
"ref",
"===",
"void",
"0",
")",
"ref",
"=",
"{",
"}",
";",
"var",
"modules",
"=",
"ref",
".",
"modules",
";",
"if",
"(",
"modules",
"===",
"void",
"0",
")",
"modules",
"=",
"[",
"]"... | /* | [
"/",
"*"
] | a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e | https://github.com/GeekyAnts/vue-native-core/blob/a7b4c9e35fe3f01d7576086f41e5e9ec6975b72e/packages/vue-server-renderer/build.js#L5542-L5613 | train | Creates a renderer function for a component. | [
30522,
3853,
3443,
7389,
4063,
2121,
1002,
1015,
1006,
25416,
1007,
1063,
2065,
1006,
25416,
1027,
1027,
1027,
11675,
1014,
1007,
25416,
1027,
1063,
1065,
1025,
13075,
14184,
1027,
25416,
1012,
14184,
1025,
2065,
1006,
14184,
1027,
1027,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
airyland/vux | build/utils.js | generateLoaders | function generateLoaders (loader, loaderOptions) {
const loaders = options.usePostCSS ? [cssLoader, postcssLoader] : [cssLoader]
if (loader) {
loaders.push({
loader: loader + '-loader',
options: Object.assign({}, loaderOptions, {
sourceMap: options.sourceMap
})
})
}
// Extract CSS when that option is specified
// (which is the case during production build)
if (options.extract) {
return ExtractTextPlugin.extract({
use: loaders,
fallback: 'vue-style-loader'
})
} else {
return ['vue-style-loader'].concat(loaders)
}
} | javascript | function generateLoaders (loader, loaderOptions) {
const loaders = options.usePostCSS ? [cssLoader, postcssLoader] : [cssLoader]
if (loader) {
loaders.push({
loader: loader + '-loader',
options: Object.assign({}, loaderOptions, {
sourceMap: options.sourceMap
})
})
}
// Extract CSS when that option is specified
// (which is the case during production build)
if (options.extract) {
return ExtractTextPlugin.extract({
use: loaders,
fallback: 'vue-style-loader'
})
} else {
return ['vue-style-loader'].concat(loaders)
}
} | [
"function",
"generateLoaders",
"(",
"loader",
",",
"loaderOptions",
")",
"{",
"const",
"loaders",
"=",
"options",
".",
"usePostCSS",
"?",
"[",
"cssLoader",
",",
"postcssLoader",
"]",
":",
"[",
"cssLoader",
"]",
"if",
"(",
"loader",
")",
"{",
"loaders",
"."... | generate loader string to be used with extract text plugin | [
"generate",
"loader",
"string",
"to",
"be",
"used",
"with",
"extract",
"text",
"plugin"
] | 484fc3c18bdca99b0c08efbb678c0ee0f5ceedd6 | https://github.com/airyland/vux/blob/484fc3c18bdca99b0c08efbb678c0ee0f5ceedd6/build/utils.js#L32-L53 | train | Generates the loaders for the given loader | [
30522,
3853,
9699,
11066,
2545,
1006,
7170,
2121,
1010,
7170,
10624,
16790,
2015,
1007,
1063,
9530,
3367,
7170,
2545,
1027,
7047,
1012,
2224,
19894,
6169,
2015,
1029,
1031,
20116,
14540,
10441,
4063,
1010,
2695,
6169,
14540,
10441,
4063,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/preferences/PreferencesBase.js | function (data, oldContext, newContext) {
// this function is called only if the language has changed
if (newContext.language === undefined) {
return _.keys(data[oldContext.language]);
}
if (oldContext.language === undefined) {
return _.keys(data[newContext.language]);
}
return _.union(_.keys(data[newContext.language]), _.keys(data[oldContext.language]));
} | javascript | function (data, oldContext, newContext) {
// this function is called only if the language has changed
if (newContext.language === undefined) {
return _.keys(data[oldContext.language]);
}
if (oldContext.language === undefined) {
return _.keys(data[newContext.language]);
}
return _.union(_.keys(data[newContext.language]), _.keys(data[oldContext.language]));
} | [
"function",
"(",
"data",
",",
"oldContext",
",",
"newContext",
")",
"{",
"// this function is called only if the language has changed",
"if",
"(",
"newContext",
".",
"language",
"===",
"undefined",
")",
"{",
"return",
"_",
".",
"keys",
"(",
"data",
"[",
"oldContex... | Determines if there are preference IDs that could change as a result
of the context change. This implementation considers only changes in
language.
@param {Object} data Data in the Scope
@param {{language: string}} oldContext Old context
@param {{language: string}} newContext New context
@return {Array.<string>|undefined} list of preference IDs that could have changed | [
"Determines",
"if",
"there",
"are",
"preference",
"IDs",
"that",
"could",
"change",
"as",
"a",
"result",
"of",
"the",
"context",
"change",
".",
"This",
"implementation",
"considers",
"only",
"changes",
"in",
"language",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/preferences/PreferencesBase.js#L834-L844 | train | returns a list of all the language keys that have changed | [
30522,
3853,
1006,
2951,
1010,
2214,
8663,
18209,
1010,
2047,
8663,
18209,
1007,
1063,
1013,
1013,
2023,
3853,
2003,
2170,
2069,
2065,
1996,
2653,
2038,
2904,
2065,
1006,
2047,
8663,
18209,
1012,
2653,
1027,
1027,
1027,
6151,
28344,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
adobe/brackets | src/LiveDevelopment/Agents/RemoteFunctions.js | isInViewport | function isInViewport(element) {
var rect = element.getBoundingClientRect();
var html = window.document.documentElement;
return (
rect.top >= 0 &&
rect.left >= 0 &&
rect.bottom <= (window.innerHeight || html.clientHeight) &&
rect.right <= (window.innerWidth || html.clientWidth)
);
} | javascript | function isInViewport(element) {
var rect = element.getBoundingClientRect();
var html = window.document.documentElement;
return (
rect.top >= 0 &&
rect.left >= 0 &&
rect.bottom <= (window.innerHeight || html.clientHeight) &&
rect.right <= (window.innerWidth || html.clientWidth)
);
} | [
"function",
"isInViewport",
"(",
"element",
")",
"{",
"var",
"rect",
"=",
"element",
".",
"getBoundingClientRect",
"(",
")",
";",
"var",
"html",
"=",
"window",
".",
"document",
".",
"documentElement",
";",
"return",
"(",
"rect",
".",
"top",
">=",
"0",
"&... | Checks if the element is in Viewport in the client browser | [
"Checks",
"if",
"the",
"element",
"is",
"in",
"Viewport",
"in",
"the",
"client",
"browser"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/Agents/RemoteFunctions.js#L122-L131 | train | Check if an element is in viewport | [
30522,
3853,
2003,
2378,
8584,
6442,
1006,
5783,
1007,
1063,
13075,
28667,
2102,
1027,
5783,
1012,
2131,
15494,
2075,
20464,
11638,
2890,
6593,
1006,
1007,
1025,
13075,
16129,
1027,
3332,
1012,
6254,
1012,
6254,
12260,
3672,
1025,
2709,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
GitbookIO/gitbook | lib/modifiers/summary/unshiftArticle.js | unshiftArticle | function unshiftArticle(summary, article) {
article = SummaryArticle(article);
var parts = summary.getParts();
var part = parts.get(0) || SummaryPart();
var articles = part.getArticles();
articles = articles.unshift(article);
part = part.set('articles', articles);
parts = parts.set(0, part);
summary = summary.set('parts', parts);
return indexLevels(summary);
} | javascript | function unshiftArticle(summary, article) {
article = SummaryArticle(article);
var parts = summary.getParts();
var part = parts.get(0) || SummaryPart();
var articles = part.getArticles();
articles = articles.unshift(article);
part = part.set('articles', articles);
parts = parts.set(0, part);
summary = summary.set('parts', parts);
return indexLevels(summary);
} | [
"function",
"unshiftArticle",
"(",
"summary",
",",
"article",
")",
"{",
"article",
"=",
"SummaryArticle",
"(",
"article",
")",
";",
"var",
"parts",
"=",
"summary",
".",
"getParts",
"(",
")",
";",
"var",
"part",
"=",
"parts",
".",
"get",
"(",
"0",
")",
... | Insert an article at the beginning of summary
@param {Summary} summary
@param {Article} article
@return {Summary} | [
"Insert",
"an",
"article",
"at",
"the",
"beginning",
"of",
"summary"
] | 6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4 | https://github.com/GitbookIO/gitbook/blob/6c6ef7f4af32a2977e44dd23d3feb6ebf28970f4/lib/modifiers/summary/unshiftArticle.js#L13-L27 | train | unshift an article to the beginning of summary | [
30522,
3853,
4895,
6182,
6199,
8445,
25128,
1006,
12654,
1010,
3720,
1007,
1063,
3720,
1027,
12654,
8445,
25128,
1006,
3720,
1007,
1025,
13075,
3033,
1027,
12654,
1012,
2131,
26950,
1006,
1007,
1025,
13075,
2112,
1027,
3033,
1012,
2131,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/LiveDevelopment/Agents/ScriptAgent.js | _onScriptParsed | function _onScriptParsed(event, res) {
// res = {scriptId, url, startLine, startColumn, endLine, endColumn, isContentScript, sourceMapURL}
_idToScript[res.scriptId] = res;
_urlToScript[res.url] = res;
} | javascript | function _onScriptParsed(event, res) {
// res = {scriptId, url, startLine, startColumn, endLine, endColumn, isContentScript, sourceMapURL}
_idToScript[res.scriptId] = res;
_urlToScript[res.url] = res;
} | [
"function",
"_onScriptParsed",
"(",
"event",
",",
"res",
")",
"{",
"// res = {scriptId, url, startLine, startColumn, endLine, endColumn, isContentScript, sourceMapURL}",
"_idToScript",
"[",
"res",
".",
"scriptId",
"]",
"=",
"res",
";",
"_urlToScript",
"[",
"res",
".",
"ur... | TODO: Strip off query/hash strings from URL (see CSSAgent._canonicalize()) WebInspector Event: Debugger.scriptParsed | [
"TODO",
":",
"Strip",
"off",
"query",
"/",
"hash",
"strings",
"from",
"URL",
"(",
"see",
"CSSAgent",
".",
"_canonicalize",
"()",
")",
"WebInspector",
"Event",
":",
"Debugger",
".",
"scriptParsed"
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/Agents/ScriptAgent.js#L73-L77 | train | This function is called when a script is parsed | [
30522,
3853,
1035,
2006,
22483,
19362,
6924,
1006,
2724,
1010,
24501,
1007,
1063,
1013,
1013,
24501,
1027,
1063,
5896,
3593,
1010,
24471,
2140,
1010,
2707,
4179,
1010,
2707,
25778,
2819,
2078,
1010,
2203,
4179,
1010,
2203,
25778,
2819,
2078... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
moment/luxon | src/duration.js | clone | function clone(dur, alts, clear = false) {
// deep merge for vals
const conf = {
values: clear ? alts.values : Object.assign({}, dur.values, alts.values || {}),
loc: dur.loc.clone(alts.loc),
conversionAccuracy: alts.conversionAccuracy || dur.conversionAccuracy
};
return new Duration(conf);
} | javascript | function clone(dur, alts, clear = false) {
// deep merge for vals
const conf = {
values: clear ? alts.values : Object.assign({}, dur.values, alts.values || {}),
loc: dur.loc.clone(alts.loc),
conversionAccuracy: alts.conversionAccuracy || dur.conversionAccuracy
};
return new Duration(conf);
} | [
"function",
"clone",
"(",
"dur",
",",
"alts",
",",
"clear",
"=",
"false",
")",
"{",
"// deep merge for vals",
"const",
"conf",
"=",
"{",
"values",
":",
"clear",
"?",
"alts",
".",
"values",
":",
"Object",
".",
"assign",
"(",
"{",
"}",
",",
"dur",
".",... | clone really means "create another instance just like this one, but with these changes" | [
"clone",
"really",
"means",
"create",
"another",
"instance",
"just",
"like",
"this",
"one",
"but",
"with",
"these",
"changes"
] | 236f2badea297ee73421aa39a83e06177c1be6d0 | https://github.com/moment/luxon/blob/236f2badea297ee73421aa39a83e06177c1be6d0/src/duration.js#L110-L118 | train | Clone a duration | [
30522,
3853,
17598,
1006,
4241,
2099,
1010,
12456,
2015,
1010,
3154,
1027,
6270,
1007,
1063,
1013,
1013,
2784,
13590,
2005,
11748,
2015,
9530,
3367,
9530,
2546,
1027,
1063,
5300,
1024,
3154,
1029,
12456,
2015,
1012,
5300,
1024,
4874,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.layout/src/sap/ui/layout/form/SimpleForm.js | _applyFieldWeight | function _applyFieldWeight(oElement){
var iMaxWeight = this._iMaxWeight;
var aFields = oElement.getFields();
var oField;
var iLength = aFields.length;
var oLabel = oElement.getLabel();
var oLayoutData;
var i = 0;
this._bLayoutDataChangedByMe = true;
if (oLabel && _getFieldLayoutData.call(this, oLabel)) {
iMaxWeight = iMaxWeight - _getFieldLayoutData.call(this, oLabel).getWeight();
}
// determine weights set from application
for (i = 0; i < aFields.length; i++) {
oField = aFields[i];
oLayoutData = _getFieldLayoutData.call(this, oField);
if (oLayoutData && oLayoutData.isA("sap.ui.layout.ResponsiveFlowLayoutData") &&
!_isMyLayoutData.call(this, oLayoutData)) {
iMaxWeight = iMaxWeight - oLayoutData.getWeight();
iLength--;
}
}
var iWeight = Math.floor(iMaxWeight / iLength);
var iRest = iMaxWeight % iLength;
for (i = 0; i < aFields.length; i++) {
oField = aFields[i];
oLayoutData = _getFieldLayoutData.call(this, oField);
var iCurrentWeight = iWeight;
if (!oLayoutData) {
_createFieldLayoutData.call(this, oField, iCurrentWeight, false, i == 0);
} else if (_isMyLayoutData.call(this, oLayoutData) &&
oLayoutData.isA("sap.ui.layout.ResponsiveFlowLayoutData")) {
// devide rest to first fields (not only to last one) (fist because to ignore manual set weigths)
if (iRest > 0) {
iCurrentWeight++;
iRest--;
}
oLayoutData.setWeight(iCurrentWeight);
}
}
this._bLayoutDataChangedByMe = false;
} | javascript | function _applyFieldWeight(oElement){
var iMaxWeight = this._iMaxWeight;
var aFields = oElement.getFields();
var oField;
var iLength = aFields.length;
var oLabel = oElement.getLabel();
var oLayoutData;
var i = 0;
this._bLayoutDataChangedByMe = true;
if (oLabel && _getFieldLayoutData.call(this, oLabel)) {
iMaxWeight = iMaxWeight - _getFieldLayoutData.call(this, oLabel).getWeight();
}
// determine weights set from application
for (i = 0; i < aFields.length; i++) {
oField = aFields[i];
oLayoutData = _getFieldLayoutData.call(this, oField);
if (oLayoutData && oLayoutData.isA("sap.ui.layout.ResponsiveFlowLayoutData") &&
!_isMyLayoutData.call(this, oLayoutData)) {
iMaxWeight = iMaxWeight - oLayoutData.getWeight();
iLength--;
}
}
var iWeight = Math.floor(iMaxWeight / iLength);
var iRest = iMaxWeight % iLength;
for (i = 0; i < aFields.length; i++) {
oField = aFields[i];
oLayoutData = _getFieldLayoutData.call(this, oField);
var iCurrentWeight = iWeight;
if (!oLayoutData) {
_createFieldLayoutData.call(this, oField, iCurrentWeight, false, i == 0);
} else if (_isMyLayoutData.call(this, oLayoutData) &&
oLayoutData.isA("sap.ui.layout.ResponsiveFlowLayoutData")) {
// devide rest to first fields (not only to last one) (fist because to ignore manual set weigths)
if (iRest > 0) {
iCurrentWeight++;
iRest--;
}
oLayoutData.setWeight(iCurrentWeight);
}
}
this._bLayoutDataChangedByMe = false;
} | [
"function",
"_applyFieldWeight",
"(",
"oElement",
")",
"{",
"var",
"iMaxWeight",
"=",
"this",
".",
"_iMaxWeight",
";",
"var",
"aFields",
"=",
"oElement",
".",
"getFields",
"(",
")",
";",
"var",
"oField",
";",
"var",
"iLength",
"=",
"aFields",
".",
"length"... | /*
Applies the weight property for the fields in the responsive layout.
@param {sap.ui.layout.form.FormElement} oElement The FormElement where the weight is applied.
@private | [
"/",
"*",
"Applies",
"the",
"weight",
"property",
"for",
"the",
"fields",
"in",
"the",
"responsive",
"layout",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.layout/src/sap/ui/layout/form/SimpleForm.js#L1701-L1750 | train | Applies the current weight to the given field | [
30522,
3853,
1035,
6611,
3790,
11179,
1006,
1051,
12260,
3672,
1007,
1063,
13075,
10047,
8528,
11179,
1027,
2023,
1012,
1035,
10047,
8528,
11179,
1025,
13075,
28697,
14273,
2015,
1027,
1051,
12260,
3672,
1012,
2131,
15155,
1006,
1007,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/language/JSUtils.js | nextLine | function nextLine() {
if (stream) {
curOffset++; // account for \n
if (curOffset >= length) {
return false;
}
}
lineStart = curOffset;
var lineEnd = text.indexOf("\n", lineStart);
if (lineEnd === -1) {
lineEnd = length;
}
stream = new CodeMirror.StringStream(text.slice(curOffset, lineEnd));
return true;
} | javascript | function nextLine() {
if (stream) {
curOffset++; // account for \n
if (curOffset >= length) {
return false;
}
}
lineStart = curOffset;
var lineEnd = text.indexOf("\n", lineStart);
if (lineEnd === -1) {
lineEnd = length;
}
stream = new CodeMirror.StringStream(text.slice(curOffset, lineEnd));
return true;
} | [
"function",
"nextLine",
"(",
")",
"{",
"if",
"(",
"stream",
")",
"{",
"curOffset",
"++",
";",
"// account for \\n",
"if",
"(",
"curOffset",
">=",
"length",
")",
"{",
"return",
"false",
";",
"}",
"}",
"lineStart",
"=",
"curOffset",
";",
"var",
"lineEnd",
... | Get a stream for the next line, and update curOffset and lineStart to point to the beginning of that next line. Returns false if we're at the end of the text. | [
"Get",
"a",
"stream",
"for",
"the",
"next",
"line",
"and",
"update",
"curOffset",
"and",
"lineStart",
"to",
"point",
"to",
"the",
"beginning",
"of",
"that",
"next",
"line",
".",
"Returns",
"false",
"if",
"we",
"re",
"at",
"the",
"end",
"of",
"the",
"te... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/language/JSUtils.js#L182-L196 | train | Return true if the next line of text is a newline | [
30522,
3853,
2279,
4179,
1006,
1007,
1063,
2065,
1006,
5460,
1007,
1063,
12731,
3217,
21807,
3388,
1009,
1009,
1025,
1013,
1013,
4070,
2005,
1032,
1050,
2065,
1006,
12731,
3217,
21807,
3388,
1028,
1027,
3091,
1007,
1063,
2709,
6270,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
eslint/eslint | lib/formatters/codeframe.js | formatFilePath | function formatFilePath(filePath, line, column) {
let relPath = path.relative(process.cwd(), filePath);
if (line && column) {
relPath += `:${line}:${column}`;
}
return chalk.green(relPath);
} | javascript | function formatFilePath(filePath, line, column) {
let relPath = path.relative(process.cwd(), filePath);
if (line && column) {
relPath += `:${line}:${column}`;
}
return chalk.green(relPath);
} | [
"function",
"formatFilePath",
"(",
"filePath",
",",
"line",
",",
"column",
")",
"{",
"let",
"relPath",
"=",
"path",
".",
"relative",
"(",
"process",
".",
"cwd",
"(",
")",
",",
"filePath",
")",
";",
"if",
"(",
"line",
"&&",
"column",
")",
"{",
"relPat... | Gets a formatted relative file path from an absolute path and a line/column in the file.
@param {string} filePath The absolute file path to format.
@param {number} line The line from the file to use for formatting.
@param {number} column The column from the file to use for formatting.
@returns {string} The formatted file path. | [
"Gets",
"a",
"formatted",
"relative",
"file",
"path",
"from",
"an",
"absolute",
"path",
"and",
"a",
"line",
"/",
"column",
"in",
"the",
"file",
"."
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/formatters/codeframe.js#L32-L40 | train | Format a file path | [
30522,
3853,
4289,
8873,
2571,
15069,
1006,
5371,
15069,
1010,
2240,
1010,
5930,
1007,
1063,
2292,
2128,
14277,
8988,
1027,
4130,
1012,
5816,
1006,
2832,
1012,
19296,
2094,
1006,
1007,
1010,
5371,
15069,
1007,
1025,
2065,
1006,
2240,
1004,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
adobe/brackets | src/document/DocumentManager.js | notifyPathNameChanged | function notifyPathNameChanged(oldName, newName) {
// Notify all open documents
_.forEach(_openDocuments, function (doc) {
// TODO: Only notify affected documents? For now _notifyFilePathChange
// just updates the language if the extension changed, so it's fine
// to call for all open docs.
doc._notifyFilePathChanged();
});
// Send a "fileNameChange" event. This will trigger the views to update.
exports.trigger("fileNameChange", oldName, newName);
} | javascript | function notifyPathNameChanged(oldName, newName) {
// Notify all open documents
_.forEach(_openDocuments, function (doc) {
// TODO: Only notify affected documents? For now _notifyFilePathChange
// just updates the language if the extension changed, so it's fine
// to call for all open docs.
doc._notifyFilePathChanged();
});
// Send a "fileNameChange" event. This will trigger the views to update.
exports.trigger("fileNameChange", oldName, newName);
} | [
"function",
"notifyPathNameChanged",
"(",
"oldName",
",",
"newName",
")",
"{",
"// Notify all open documents",
"_",
".",
"forEach",
"(",
"_openDocuments",
",",
"function",
"(",
"doc",
")",
"{",
"// TODO: Only notify affected documents? For now _notifyFilePathChange",
"// ju... | Called after a file or folder name has changed. This function is responsible
for updating underlying model data and notifying all views of the change.
@param {string} oldName The old name of the file/folder
@param {string} newName The new name of the file/folder | [
"Called",
"after",
"a",
"file",
"or",
"folder",
"name",
"has",
"changed",
".",
"This",
"function",
"is",
"responsible",
"for",
"updating",
"underlying",
"model",
"data",
"and",
"notifying",
"all",
"views",
"of",
"the",
"change",
"."
] | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/document/DocumentManager.js#L531-L542 | train | Notify all open documents that the file path has changed. | [
30522,
3853,
2025,
8757,
15069,
18442,
22305,
2098,
1006,
2214,
18442,
1010,
2047,
18442,
1007,
1063,
1013,
1013,
2025,
8757,
2035,
2330,
5491,
1035,
1012,
18921,
6776,
1006,
1035,
2330,
3527,
24894,
11187,
1010,
3853,
1006,
9986,
1007,
106... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jgraph/mxgraph | javascript/mxClient.js | function(url, onload, onerror, binary, timeout, ontimeout)
{
var req = new mxXmlRequest(url, null, 'GET');
if (binary != null)
{
req.setBinary(binary);
}
req.send(onload, onerror, timeout, ontimeout);
return req;
} | javascript | function(url, onload, onerror, binary, timeout, ontimeout)
{
var req = new mxXmlRequest(url, null, 'GET');
if (binary != null)
{
req.setBinary(binary);
}
req.send(onload, onerror, timeout, ontimeout);
return req;
} | [
"function",
"(",
"url",
",",
"onload",
",",
"onerror",
",",
"binary",
",",
"timeout",
",",
"ontimeout",
")",
"{",
"var",
"req",
"=",
"new",
"mxXmlRequest",
"(",
"url",
",",
"null",
",",
"'GET'",
")",
";",
"if",
"(",
"binary",
"!=",
"null",
")",
"{"... | Function: get
Loads the specified URL *asynchronously* and invokes the given functions
depending on the request status. Returns the <mxXmlRequest> in use. Both
functions take the <mxXmlRequest> as the only parameter. See
<mxUtils.load> for a synchronous implementation.
Example:
(code)
mxUtils.get(url, function(req)
{
var node = req.getDocumentElement();
// Process XML DOM...
});
(end)
So for example, to load a diagram into an existing graph model, the
following code is used.
(code)
mxUtils.get(url, function(req)
{
var node = req.getDocumentElement();
var dec = new mxCodec(node.ownerDocument);
dec.decode(node, graph.getModel());
});
(end)
Parameters:
url - URL to get the data from.
onload - Optional function to execute for a successful response.
onerror - Optional function to execute on error.
binary - Optional boolean parameter that specifies if the request is
binary.
timeout - Optional timeout in ms before calling ontimeout.
ontimeout - Optional function to execute on timeout. | [
"Function",
":",
"get"
] | 33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44 | https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L3603-L3615 | train | This method is used to get the content of an image | [
30522,
3853,
1006,
24471,
2140,
1010,
2006,
11066,
1010,
2028,
18933,
2099,
1010,
12441,
1010,
2051,
5833,
1010,
2006,
7292,
5833,
1007,
1063,
13075,
2128,
4160,
1027,
2047,
25630,
2595,
19968,
2890,
15500,
1006,
24471,
2140,
1010,
19701,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
adobe/brackets | src/view/ThemeManager.js | Theme | function Theme(file, options) {
options = options || {};
var fileName = file.name;
// If no options.name is provided, then we derive the name of the theme from whichever we find
// first, the options.title or the filename.
if (!options.name) {
if (options.title) {
options.name = options.title;
} else {
// Remove the file extension when the filename is used as the theme name. This is to
// follow CodeMirror conventions where themes are just a CSS file and the filename
// (without the extension) is used to build CSS rules. Also handle removing .min
// in case the ".min" is part of the file name.
options.name = FileUtils.getFilenameWithoutExtension(fileName).replace(/\.min$/, "");
}
// We do a bit of string treatment here to make sure we generate theme names that can be
// used as a CSS class name by CodeMirror.
options.name = options.name.toLocaleLowerCase().replace(/[\W]/g, '-');
}
this.file = file;
this.name = options.name;
this.displayName = options.title || toDisplayName(fileName);
this.dark = options.theme !== undefined && options.theme.dark === true;
this.addModeClass = options.theme !== undefined && options.theme.addModeClass === true;
} | javascript | function Theme(file, options) {
options = options || {};
var fileName = file.name;
// If no options.name is provided, then we derive the name of the theme from whichever we find
// first, the options.title or the filename.
if (!options.name) {
if (options.title) {
options.name = options.title;
} else {
// Remove the file extension when the filename is used as the theme name. This is to
// follow CodeMirror conventions where themes are just a CSS file and the filename
// (without the extension) is used to build CSS rules. Also handle removing .min
// in case the ".min" is part of the file name.
options.name = FileUtils.getFilenameWithoutExtension(fileName).replace(/\.min$/, "");
}
// We do a bit of string treatment here to make sure we generate theme names that can be
// used as a CSS class name by CodeMirror.
options.name = options.name.toLocaleLowerCase().replace(/[\W]/g, '-');
}
this.file = file;
this.name = options.name;
this.displayName = options.title || toDisplayName(fileName);
this.dark = options.theme !== undefined && options.theme.dark === true;
this.addModeClass = options.theme !== undefined && options.theme.addModeClass === true;
} | [
"function",
"Theme",
"(",
"file",
",",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"var",
"fileName",
"=",
"file",
".",
"name",
";",
"// If no options.name is provided, then we derive the name of the theme from whichever we find",
"// first, the... | @constructor
Theme contains all the essential bit to load a theme from disk, display a theme in the settings
dialog, and to properly add a theme into CodeMirror along with the rest of brackets.
@param {File} file for the theme
@param {{name: string, title: string}} options to configure different
properties in the theme | [
"@constructor",
"Theme",
"contains",
"all",
"the",
"essential",
"bit",
"to",
"load",
"a",
"theme",
"from",
"disk",
"display",
"a",
"theme",
"in",
"the",
"settings",
"dialog",
"and",
"to",
"properly",
"add",
"a",
"theme",
"into",
"CodeMirror",
"along",
"with"... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/view/ThemeManager.js#L77-L104 | train | The theme class | [
30522,
3853,
4323,
1006,
5371,
1010,
7047,
1007,
1063,
7047,
1027,
7047,
1064,
1064,
1063,
1065,
1025,
13075,
5371,
18442,
1027,
5371,
1012,
2171,
1025,
1013,
1013,
2065,
2053,
7047,
1012,
2171,
2003,
3024,
1010,
2059,
2057,
18547,
1996,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/BlockLayerUtils.js | deregisterInteractionHandler | function deregisterInteractionHandler(fnHandler) {
var i,
oParentDOM = this.$parent.get(0),
oBlockLayerDOM = this.$blockLayer.get(0);
if (oParentDOM) {
for (i = 0; i < aPreventedEvents.length; i++) {
// Remove event listeners with "useCapture" settings
oParentDOM.removeEventListener(aPreventedEvents[i], fnHandler, {
capture: true,
passive: false
});
}
}
if (this._aSuppressHandler) {
for (i = 0; i < this._aSuppressHandler.length; i++) {
// this part should be done even no DOMRef exists
EventTriggerHook.release(this._aSuppressHandler[i]);
}
}
if (oBlockLayerDOM) {
this.$blockLayer.unbind('keydown', fnHandler);
}
} | javascript | function deregisterInteractionHandler(fnHandler) {
var i,
oParentDOM = this.$parent.get(0),
oBlockLayerDOM = this.$blockLayer.get(0);
if (oParentDOM) {
for (i = 0; i < aPreventedEvents.length; i++) {
// Remove event listeners with "useCapture" settings
oParentDOM.removeEventListener(aPreventedEvents[i], fnHandler, {
capture: true,
passive: false
});
}
}
if (this._aSuppressHandler) {
for (i = 0; i < this._aSuppressHandler.length; i++) {
// this part should be done even no DOMRef exists
EventTriggerHook.release(this._aSuppressHandler[i]);
}
}
if (oBlockLayerDOM) {
this.$blockLayer.unbind('keydown', fnHandler);
}
} | [
"function",
"deregisterInteractionHandler",
"(",
"fnHandler",
")",
"{",
"var",
"i",
",",
"oParentDOM",
"=",
"this",
".",
"$parent",
".",
"get",
"(",
"0",
")",
",",
"oBlockLayerDOM",
"=",
"this",
".",
"$blockLayer",
".",
"get",
"(",
"0",
")",
";",
"if",
... | Deregister event handler to suppress event within busy section | [
"Deregister",
"event",
"handler",
"to",
"suppress",
"event",
"within",
"busy",
"section"
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/BlockLayerUtils.js#L310-L333 | train | deregister interaction handler | [
30522,
3853,
4315,
13910,
12911,
18447,
6906,
7542,
11774,
3917,
1006,
1042,
25311,
5685,
3917,
1007,
1063,
13075,
1045,
1010,
6728,
12069,
3372,
9527,
1027,
2023,
1012,
1002,
6687,
1012,
2131,
1006,
1014,
1007,
1010,
27885,
7878,
24314,
95... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jgraph/mxgraph | javascript/mxClient.js | function(message, width, close, icon)
{
var div = document.createElement('div');
div.style.padding = '20px';
var img = document.createElement('img');
img.setAttribute('src', icon || mxUtils.errorImage);
img.setAttribute('valign', 'bottom');
img.style.verticalAlign = 'middle';
div.appendChild(img);
div.appendChild(document.createTextNode('\u00a0')); //
div.appendChild(document.createTextNode('\u00a0')); //
div.appendChild(document.createTextNode('\u00a0')); //
mxUtils.write(div, message);
var w = document.body.clientWidth;
var h = (document.body.clientHeight || document.documentElement.clientHeight);
var warn = new mxWindow(mxResources.get(mxUtils.errorResource) ||
mxUtils.errorResource, div, (w-width)/2, h/4, width, null,
false, true);
if (close)
{
mxUtils.br(div);
var tmp = document.createElement('p');
var button = document.createElement('button');
if (mxClient.IS_IE)
{
button.style.cssText = 'float:right';
}
else
{
button.setAttribute('style', 'float:right');
}
mxEvent.addListener(button, 'click', function(evt)
{
warn.destroy();
});
mxUtils.write(button, mxResources.get(mxUtils.closeResource) ||
mxUtils.closeResource);
tmp.appendChild(button);
div.appendChild(tmp);
mxUtils.br(div);
warn.setClosable(true);
}
warn.setVisible(true);
return warn;
} | javascript | function(message, width, close, icon)
{
var div = document.createElement('div');
div.style.padding = '20px';
var img = document.createElement('img');
img.setAttribute('src', icon || mxUtils.errorImage);
img.setAttribute('valign', 'bottom');
img.style.verticalAlign = 'middle';
div.appendChild(img);
div.appendChild(document.createTextNode('\u00a0')); //
div.appendChild(document.createTextNode('\u00a0')); //
div.appendChild(document.createTextNode('\u00a0')); //
mxUtils.write(div, message);
var w = document.body.clientWidth;
var h = (document.body.clientHeight || document.documentElement.clientHeight);
var warn = new mxWindow(mxResources.get(mxUtils.errorResource) ||
mxUtils.errorResource, div, (w-width)/2, h/4, width, null,
false, true);
if (close)
{
mxUtils.br(div);
var tmp = document.createElement('p');
var button = document.createElement('button');
if (mxClient.IS_IE)
{
button.style.cssText = 'float:right';
}
else
{
button.setAttribute('style', 'float:right');
}
mxEvent.addListener(button, 'click', function(evt)
{
warn.destroy();
});
mxUtils.write(button, mxResources.get(mxUtils.closeResource) ||
mxUtils.closeResource);
tmp.appendChild(button);
div.appendChild(tmp);
mxUtils.br(div);
warn.setClosable(true);
}
warn.setVisible(true);
return warn;
} | [
"function",
"(",
"message",
",",
"width",
",",
"close",
",",
"icon",
")",
"{",
"var",
"div",
"=",
"document",
".",
"createElement",
"(",
"'div'",
")",
";",
"div",
".",
"style",
".",
"padding",
"=",
"'20px'",
";",
"var",
"img",
"=",
"document",
".",
... | Function: error
Displays the given error message in a new <mxWindow> of the given width.
If close is true then an additional close button is added to the window.
The optional icon specifies the icon to be used for the window. Default
is <mxUtils.errorImage>.
Parameters:
message - String specifying the message to be displayed.
width - Integer specifying the width of the window.
close - Optional boolean indicating whether to add a close button.
icon - Optional icon for the window decoration. | [
"Function",
":",
"error"
] | 33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44 | https://github.com/jgraph/mxgraph/blob/33911ed7e055c17b74d0367f5f1f6c9ee4b4fd44/javascript/mxClient.js#L6338-L6395 | train | Creates a warning window | [
30522,
3853,
1006,
4471,
1010,
9381,
1010,
2485,
1010,
12696,
1007,
1063,
13075,
4487,
2615,
1027,
6254,
1012,
3443,
12260,
3672,
1006,
1005,
4487,
2615,
1005,
1007,
1025,
4487,
2615,
1012,
2806,
1012,
11687,
4667,
1027,
1005,
2322,
2361,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/core/hyphenation/Hyphenation.js | getLanguage | function getLanguage(sLang) {
var oLocale;
if (sLang) {
oLocale = new Locale(sLang);
} else {
oLocale = sap.ui.getCore().getConfiguration().getLocale();
}
var sLanguage = oLocale.getLanguage().toLowerCase();
// adjustment of the language to corresponds to Hyphenopoly pattern files (.hpb files)
switch (sLanguage) {
case "en":
sLanguage = "en-us";
break;
case "nb":
sLanguage = "nb-no";
break;
case "no":
sLanguage = "nb-no";
break;
case "el":
sLanguage = "el-monoton";
break;
}
return sLanguage;
} | javascript | function getLanguage(sLang) {
var oLocale;
if (sLang) {
oLocale = new Locale(sLang);
} else {
oLocale = sap.ui.getCore().getConfiguration().getLocale();
}
var sLanguage = oLocale.getLanguage().toLowerCase();
// adjustment of the language to corresponds to Hyphenopoly pattern files (.hpb files)
switch (sLanguage) {
case "en":
sLanguage = "en-us";
break;
case "nb":
sLanguage = "nb-no";
break;
case "no":
sLanguage = "nb-no";
break;
case "el":
sLanguage = "el-monoton";
break;
}
return sLanguage;
} | [
"function",
"getLanguage",
"(",
"sLang",
")",
"{",
"var",
"oLocale",
";",
"if",
"(",
"sLang",
")",
"{",
"oLocale",
"=",
"new",
"Locale",
"(",
"sLang",
")",
";",
"}",
"else",
"{",
"oLocale",
"=",
"sap",
".",
"ui",
".",
"getCore",
"(",
")",
".",
"g... | Gets global language code or the given language code.
@param {string} [sLang] The language to get. If left empty - the global application language will be returned
@returns {string} The language code
@private | [
"Gets",
"global",
"language",
"code",
"or",
"the",
"given",
"language",
"code",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/hyphenation/Hyphenation.js#L348-L375 | train | Returns the language of the current locale | [
30522,
3853,
2131,
25023,
6692,
3351,
1006,
21435,
1007,
1063,
13075,
19330,
24755,
2571,
1025,
2065,
1006,
21435,
1007,
1063,
19330,
24755,
2571,
1027,
2047,
2334,
2063,
1006,
21435,
1007,
1025,
1065,
2842,
1063,
19330,
24755,
2571,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/thirdparty/RequestRecorder.js | function(sMethod, sUrl) {
var sUrlResourcePart = new URI(sUrl).resource();
sUrlResourcePart = this.replaceEntriesUrlByRegex(sUrlResourcePart);
return sMethod + sUrlResourcePart;
} | javascript | function(sMethod, sUrl) {
var sUrlResourcePart = new URI(sUrl).resource();
sUrlResourcePart = this.replaceEntriesUrlByRegex(sUrlResourcePart);
return sMethod + sUrlResourcePart;
} | [
"function",
"(",
"sMethod",
",",
"sUrl",
")",
"{",
"var",
"sUrlResourcePart",
"=",
"new",
"URI",
"(",
"sUrl",
")",
".",
"resource",
"(",
")",
";",
"sUrlResourcePart",
"=",
"this",
".",
"replaceEntriesUrlByRegex",
"(",
"sUrlResourcePart",
")",
";",
"return",
... | Creates the URL group for to map the requested XMLHttpRequests to it's response.
@param {string} sMethod The http method (e.g. GET, POST...)
@param {string} sUrl The full requested URL.
@returns {string} The created URL group for the mapping. | [
"Creates",
"the",
"URL",
"group",
"for",
"to",
"map",
"the",
"requested",
"XMLHttpRequests",
"to",
"it",
"s",
"response",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/RequestRecorder.js#L197-L201 | train | Returns the URL for the given method and URL. | [
30522,
3853,
1006,
15488,
11031,
7716,
1010,
7505,
2140,
1007,
1063,
13075,
7505,
20974,
2229,
8162,
3401,
19362,
2102,
1027,
2047,
24471,
2072,
1006,
7505,
2140,
1007,
1012,
7692,
1006,
1007,
1025,
7505,
20974,
2229,
8162,
3401,
19362,
210... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
apache/incubator-echarts | src/component/dataZoom/AxisProxy.js | function (dataZoomModel) {
if (dataZoomModel !== this._dataZoomModel) {
return;
}
var targetSeries = this.getTargetSeriesModels();
// Culculate data window and data extent, and record them.
this._dataExtent = calculateDataExtent(this, this._dimName, targetSeries);
// this.hasSeriesStacked = false;
// each(targetSeries, function (series) {
// var data = series.getData();
// var dataDim = data.mapDimension(this._dimName);
// var stackedDimension = data.getCalculationInfo('stackedDimension');
// if (stackedDimension && stackedDimension === dataDim) {
// this.hasSeriesStacked = true;
// }
// }, this);
// `calculateDataWindow` uses min/maxSpan.
setMinMaxSpan(this);
var dataWindow = this.calculateDataWindow(dataZoomModel.option);
this._valueWindow = dataWindow.valueWindow;
this._percentWindow = dataWindow.percentWindow;
// Update axis setting then.
setAxisModel(this);
} | javascript | function (dataZoomModel) {
if (dataZoomModel !== this._dataZoomModel) {
return;
}
var targetSeries = this.getTargetSeriesModels();
// Culculate data window and data extent, and record them.
this._dataExtent = calculateDataExtent(this, this._dimName, targetSeries);
// this.hasSeriesStacked = false;
// each(targetSeries, function (series) {
// var data = series.getData();
// var dataDim = data.mapDimension(this._dimName);
// var stackedDimension = data.getCalculationInfo('stackedDimension');
// if (stackedDimension && stackedDimension === dataDim) {
// this.hasSeriesStacked = true;
// }
// }, this);
// `calculateDataWindow` uses min/maxSpan.
setMinMaxSpan(this);
var dataWindow = this.calculateDataWindow(dataZoomModel.option);
this._valueWindow = dataWindow.valueWindow;
this._percentWindow = dataWindow.percentWindow;
// Update axis setting then.
setAxisModel(this);
} | [
"function",
"(",
"dataZoomModel",
")",
"{",
"if",
"(",
"dataZoomModel",
"!==",
"this",
".",
"_dataZoomModel",
")",
"{",
"return",
";",
"}",
"var",
"targetSeries",
"=",
"this",
".",
"getTargetSeriesModels",
"(",
")",
";",
"// Culculate data window and data extent, ... | Notice: reset should not be called before series.restoreData() called,
so it is recommanded to be called in "process stage" but not "model init
stage".
@param {module: echarts/component/dataZoom/DataZoomModel} dataZoomModel | [
"Notice",
":",
"reset",
"should",
"not",
"be",
"called",
"before",
"series",
".",
"restoreData",
"()",
"called",
"so",
"it",
"is",
"recommanded",
"to",
"be",
"called",
"in",
"process",
"stage",
"but",
"not",
"model",
"init",
"stage",
"."
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/component/dataZoom/AxisProxy.js#L279-L308 | train | Calculate data window and data extent | [
30522,
3853,
1006,
2951,
23221,
7382,
10244,
2140,
1007,
1063,
2065,
1006,
2951,
23221,
7382,
10244,
2140,
999,
1027,
1027,
2023,
1012,
1035,
2951,
23221,
7382,
10244,
2140,
1007,
1063,
2709,
1025,
1065,
13075,
7889,
28077,
1027,
2023,
1012... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
babel/babel | packages/babel-traverse/src/path/evaluation.js | deopt | function deopt(path, state) {
if (!state.confident) return;
state.deoptPath = path;
state.confident = false;
} | javascript | function deopt(path, state) {
if (!state.confident) return;
state.deoptPath = path;
state.confident = false;
} | [
"function",
"deopt",
"(",
"path",
",",
"state",
")",
"{",
"if",
"(",
"!",
"state",
".",
"confident",
")",
"return",
";",
"state",
".",
"deoptPath",
"=",
"path",
";",
"state",
".",
"confident",
"=",
"false",
";",
"}"
] | Deopts the evaluation | [
"Deopts",
"the",
"evaluation"
] | 1969e6b6aa7d90be3fbb3aca98ea96849656a55a | https://github.com/babel/babel/blob/1969e6b6aa7d90be3fbb3aca98ea96849656a55a/packages/babel-traverse/src/path/evaluation.js#L34-L38 | train | Deopt a path | [
30522,
3853,
2139,
7361,
2102,
1006,
4130,
1010,
2110,
1007,
1063,
2065,
1006,
999,
2110,
1012,
9657,
1007,
2709,
1025,
2110,
1012,
2139,
7361,
25856,
8988,
1027,
4130,
1025,
2110,
1012,
9657,
1027,
6270,
1025,
1065,
102,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
showdownjs/showdown | dist/showdown.js | _parseExtension | function _parseExtension (ext, name) {
name = name || null;
// If it's a string, the extension was previously loaded
if (showdown.helper.isString(ext)) {
ext = showdown.helper.stdExtName(ext);
name = ext;
// LEGACY_SUPPORT CODE
if (showdown.extensions[ext]) {
console.warn('DEPRECATION WARNING: ' + ext + ' is an old extension that uses a deprecated loading method.' +
'Please inform the developer that the extension should be updated!');
legacyExtensionLoading(showdown.extensions[ext], ext);
return;
// END LEGACY SUPPORT CODE
} else if (!showdown.helper.isUndefined(extensions[ext])) {
ext = extensions[ext];
} else {
throw Error('Extension "' + ext + '" could not be loaded. It was either not found or is not a valid extension.');
}
}
if (typeof ext === 'function') {
ext = ext();
}
if (!showdown.helper.isArray(ext)) {
ext = [ext];
}
var validExt = validate(ext, name);
if (!validExt.valid) {
throw Error(validExt.error);
}
for (var i = 0; i < ext.length; ++i) {
switch (ext[i].type) {
case 'lang':
langExtensions.push(ext[i]);
break;
case 'output':
outputModifiers.push(ext[i]);
break;
}
if (ext[i].hasOwnProperty('listeners')) {
for (var ln in ext[i].listeners) {
if (ext[i].listeners.hasOwnProperty(ln)) {
listen(ln, ext[i].listeners[ln]);
}
}
}
}
} | javascript | function _parseExtension (ext, name) {
name = name || null;
// If it's a string, the extension was previously loaded
if (showdown.helper.isString(ext)) {
ext = showdown.helper.stdExtName(ext);
name = ext;
// LEGACY_SUPPORT CODE
if (showdown.extensions[ext]) {
console.warn('DEPRECATION WARNING: ' + ext + ' is an old extension that uses a deprecated loading method.' +
'Please inform the developer that the extension should be updated!');
legacyExtensionLoading(showdown.extensions[ext], ext);
return;
// END LEGACY SUPPORT CODE
} else if (!showdown.helper.isUndefined(extensions[ext])) {
ext = extensions[ext];
} else {
throw Error('Extension "' + ext + '" could not be loaded. It was either not found or is not a valid extension.');
}
}
if (typeof ext === 'function') {
ext = ext();
}
if (!showdown.helper.isArray(ext)) {
ext = [ext];
}
var validExt = validate(ext, name);
if (!validExt.valid) {
throw Error(validExt.error);
}
for (var i = 0; i < ext.length; ++i) {
switch (ext[i].type) {
case 'lang':
langExtensions.push(ext[i]);
break;
case 'output':
outputModifiers.push(ext[i]);
break;
}
if (ext[i].hasOwnProperty('listeners')) {
for (var ln in ext[i].listeners) {
if (ext[i].listeners.hasOwnProperty(ln)) {
listen(ln, ext[i].listeners[ln]);
}
}
}
}
} | [
"function",
"_parseExtension",
"(",
"ext",
",",
"name",
")",
"{",
"name",
"=",
"name",
"||",
"null",
";",
"// If it's a string, the extension was previously loaded",
"if",
"(",
"showdown",
".",
"helper",
".",
"isString",
"(",
"ext",
")",
")",
"{",
"ext",
"=",
... | Parse extension
@param {*} ext
@param {string} [name='']
@private | [
"Parse",
"extension"
] | 33bba54535d6fcdde5c82d2ec4d7a3bd951b5bb9 | https://github.com/showdownjs/showdown/blob/33bba54535d6fcdde5c82d2ec4d7a3bd951b5bb9/dist/showdown.js#L4933-L4990 | train | Parse an extension | [
30522,
3853,
1035,
11968,
19763,
18413,
6132,
3258,
1006,
4654,
2102,
1010,
2171,
1007,
1063,
2171,
1027,
2171,
1064,
1064,
19701,
1025,
1013,
1013,
2065,
2009,
1005,
1055,
1037,
5164,
1010,
1996,
5331,
2001,
3130,
8209,
2065,
1006,
24419,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/incubator-echarts | src/model/Global.js | function (cb, context) {
assertSeriesInitialized(this);
each(this._seriesIndices, function (rawSeriesIndex) {
var series = this._componentsMap.get('series')[rawSeriesIndex];
cb.call(context, series, rawSeriesIndex);
}, this);
} | javascript | function (cb, context) {
assertSeriesInitialized(this);
each(this._seriesIndices, function (rawSeriesIndex) {
var series = this._componentsMap.get('series')[rawSeriesIndex];
cb.call(context, series, rawSeriesIndex);
}, this);
} | [
"function",
"(",
"cb",
",",
"context",
")",
"{",
"assertSeriesInitialized",
"(",
"this",
")",
";",
"each",
"(",
"this",
".",
"_seriesIndices",
",",
"function",
"(",
"rawSeriesIndex",
")",
"{",
"var",
"series",
"=",
"this",
".",
"_componentsMap",
".",
"get"... | After filtering, series may be different
frome raw series.
@param {Function} cb
@param {*} context | [
"After",
"filtering",
"series",
"may",
"be",
"different",
"frome",
"raw",
"series",
"."
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/model/Global.js#L527-L533 | train | call the callback for each series | [
30522,
3853,
1006,
17324,
1010,
6123,
1007,
1063,
19514,
28077,
5498,
20925,
3550,
1006,
2023,
1007,
1025,
2169,
1006,
2023,
1012,
1035,
2186,
22254,
23522,
1010,
3853,
1006,
6315,
8043,
3111,
22254,
10288,
1007,
1063,
13075,
2186,
1027,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SeleniumHQ/selenium | third_party/js/mozmill/shared-modules/private-browsing.js | privateBrowsing_waitForTransitionComplete | function privateBrowsing_waitForTransitionComplete(state) {
// We have to wait until the transition has been finished
this._controller.waitForEval("subject.hasAttribute('disabled') == false", gTimeout, 100,
this._pbTransitionItem.getNode());
this._controller.waitForEval("subject.privateBrowsing.enabled == subject.state", gTimeout, 100,
{privateBrowsing: this, state: state});
} | javascript | function privateBrowsing_waitForTransitionComplete(state) {
// We have to wait until the transition has been finished
this._controller.waitForEval("subject.hasAttribute('disabled') == false", gTimeout, 100,
this._pbTransitionItem.getNode());
this._controller.waitForEval("subject.privateBrowsing.enabled == subject.state", gTimeout, 100,
{privateBrowsing: this, state: state});
} | [
"function",
"privateBrowsing_waitForTransitionComplete",
"(",
"state",
")",
"{",
"// We have to wait until the transition has been finished",
"this",
".",
"_controller",
".",
"waitForEval",
"(",
"\"subject.hasAttribute('disabled') == false\"",
",",
"gTimeout",
",",
"100",
",",
... | Waits until the transistion into or out of the Private Browsing mode happened
@param {boolean} state
Expected target state of the Private Browsing mode | [
"Waits",
"until",
"the",
"transistion",
"into",
"or",
"out",
"of",
"the",
"Private",
"Browsing",
"mode",
"happened"
] | 38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd | https://github.com/SeleniumHQ/selenium/blob/38d5e4440b2c866a78a1ccb2a18d9795a1bdeafd/third_party/js/mozmill/shared-modules/private-browsing.js#L227-L233 | train | Wait until the private browsing transition has been finished | [
30522,
3853,
2797,
12618,
9333,
2075,
1035,
3524,
13028,
5521,
28032,
3258,
9006,
10814,
2618,
1006,
2110,
1007,
1063,
1013,
1013,
2057,
2031,
2000,
3524,
2127,
1996,
6653,
2038,
2042,
2736,
2023,
1012,
1035,
11486,
1012,
3524,
29278,
13331... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
angular/material | src/components/datepicker/js/datepickerDirective.spec.js | createDatepickerInstance | function createDatepickerInstance(template) {
var outputElement = $compile(template)(pageScope);
pageScope.$apply();
ngElement = outputElement[0].tagName == 'MD-DATEPICKER' ?
outputElement : outputElement.find('md-datepicker');
element = ngElement[0];
scope = ngElement.isolateScope();
controller = ngElement.controller('mdDatepicker');
return outputElement;
} | javascript | function createDatepickerInstance(template) {
var outputElement = $compile(template)(pageScope);
pageScope.$apply();
ngElement = outputElement[0].tagName == 'MD-DATEPICKER' ?
outputElement : outputElement.find('md-datepicker');
element = ngElement[0];
scope = ngElement.isolateScope();
controller = ngElement.controller('mdDatepicker');
return outputElement;
} | [
"function",
"createDatepickerInstance",
"(",
"template",
")",
"{",
"var",
"outputElement",
"=",
"$compile",
"(",
"template",
")",
"(",
"pageScope",
")",
";",
"pageScope",
".",
"$apply",
"(",
")",
";",
"ngElement",
"=",
"outputElement",
"[",
"0",
"]",
".",
... | Compile and link the given template and store values for element, scope, and controller.
@param {string} template
@returns {angular.JQLite} The root compiled element. | [
"Compile",
"and",
"link",
"the",
"given",
"template",
"and",
"store",
"values",
"for",
"element",
"scope",
"and",
"controller",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/datepicker/js/datepickerDirective.spec.js#L58-L69 | train | Creates a new datepicker instance | [
30522,
3853,
2580,
3686,
24330,
5484,
7076,
26897,
1006,
23561,
1007,
1063,
13075,
6434,
12260,
3672,
1027,
1002,
4012,
22090,
1006,
23561,
1007,
1006,
5530,
16186,
1007,
1025,
5530,
16186,
1012,
1002,
6611,
1006,
1007,
1025,
12835,
12260,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
keplergl/kepler.gl | src/reducers/vis-state-updaters.js | toggleLayerFromSplitMaps | function toggleLayerFromSplitMaps(state, layer) {
return state.splitMaps.map(settings => {
const {layers} = settings;
const newLayers = {
...layers,
[layer.id]: generateLayerMetaForSplitViews(layer)
};
return {
...settings,
layers: newLayers
};
});
} | javascript | function toggleLayerFromSplitMaps(state, layer) {
return state.splitMaps.map(settings => {
const {layers} = settings;
const newLayers = {
...layers,
[layer.id]: generateLayerMetaForSplitViews(layer)
};
return {
...settings,
layers: newLayers
};
});
} | [
"function",
"toggleLayerFromSplitMaps",
"(",
"state",
",",
"layer",
")",
"{",
"return",
"state",
".",
"splitMaps",
".",
"map",
"(",
"settings",
"=>",
"{",
"const",
"{",
"layers",
"}",
"=",
"settings",
";",
"const",
"newLayers",
"=",
"{",
"...",
"layers",
... | Hide an existing layers from custom map layer objects
@param {Object} state
@param {Object} layer
@returns {Object} Maps of custom layer objects | [
"Hide",
"an",
"existing",
"layers",
"from",
"custom",
"map",
"layer",
"objects"
] | 779238435707cc54335c2d00001e4b9334b314aa | https://github.com/keplergl/kepler.gl/blob/779238435707cc54335c2d00001e4b9334b314aa/src/reducers/vis-state-updaters.js#L1172-L1185 | train | toggleLayerFromSplitMaps - Toggles a layer from a list of split maps | [
30522,
3853,
2000,
24679,
24314,
19699,
22225,
24759,
4183,
2863,
4523,
1006,
2110,
1010,
6741,
1007,
1063,
2709,
2110,
1012,
3975,
2863,
4523,
1012,
4949,
1006,
10906,
1027,
1028,
1063,
9530,
3367,
1063,
9014,
1065,
1027,
10906,
1025,
9530... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | function() {
var userAgent = this.USER_AGENT.toLowerCase(),
// Essential for making html elements editable
hasContentEditableSupport = "contentEditable" in testElement,
// Following methods are needed in order to interact with the contentEditable area
hasEditingApiSupport = document.execCommand && document.queryCommandSupported && document.queryCommandState,
// document selector apis are only supported by IE 8+, Safari 4+, Chrome and Firefox 3.5+
hasQuerySelectorSupport = document.querySelector && document.querySelectorAll,
// contentEditable is unusable in mobile browsers (tested iOS 4.2.2, Android 2.2, Opera Mobile, WebOS 3.05)
isIncompatibleMobileBrowser = (this.isIos() && iosVersion(userAgent) < 5) || (this.isAndroid() && androidVersion(userAgent) < 4) || userAgent.indexOf("opera mobi") !== -1 || userAgent.indexOf("hpwos/") !== -1;
return hasContentEditableSupport
&& hasEditingApiSupport
&& hasQuerySelectorSupport
&& !isIncompatibleMobileBrowser;
} | javascript | function() {
var userAgent = this.USER_AGENT.toLowerCase(),
// Essential for making html elements editable
hasContentEditableSupport = "contentEditable" in testElement,
// Following methods are needed in order to interact with the contentEditable area
hasEditingApiSupport = document.execCommand && document.queryCommandSupported && document.queryCommandState,
// document selector apis are only supported by IE 8+, Safari 4+, Chrome and Firefox 3.5+
hasQuerySelectorSupport = document.querySelector && document.querySelectorAll,
// contentEditable is unusable in mobile browsers (tested iOS 4.2.2, Android 2.2, Opera Mobile, WebOS 3.05)
isIncompatibleMobileBrowser = (this.isIos() && iosVersion(userAgent) < 5) || (this.isAndroid() && androidVersion(userAgent) < 4) || userAgent.indexOf("opera mobi") !== -1 || userAgent.indexOf("hpwos/") !== -1;
return hasContentEditableSupport
&& hasEditingApiSupport
&& hasQuerySelectorSupport
&& !isIncompatibleMobileBrowser;
} | [
"function",
"(",
")",
"{",
"var",
"userAgent",
"=",
"this",
".",
"USER_AGENT",
".",
"toLowerCase",
"(",
")",
",",
"// Essential for making html elements editable",
"hasContentEditableSupport",
"=",
"\"contentEditable\"",
"in",
"testElement",
",",
"// Following methods are... | Exclude browsers that are not capable of displaying and handling
contentEditable as desired:
- iPhone, iPad (tested iOS 4.2.2) and Android (tested 2.2) refuse to make contentEditables focusable
- IE < 8 create invalid markup and crash randomly from time to time
@return {Boolean} | [
"Exclude",
"browsers",
"that",
"are",
"not",
"capable",
"of",
"displaying",
"and",
"handling",
"contentEditable",
"as",
"desired",
":",
"-",
"iPhone",
"iPad",
"(",
"tested",
"iOS",
"4",
".",
"2",
".",
"2",
")",
"and",
"Android",
"(",
"tested",
"2",
".",
... | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L4238-L4252 | train | Determines whether the browser supports contentEditable | [
30522,
3853,
1006,
1007,
1063,
13075,
5310,
4270,
3372,
1027,
2023,
1012,
5310,
1035,
4005,
1012,
2000,
27663,
18992,
3366,
1006,
1007,
1010,
1013,
1013,
6827,
2005,
2437,
16129,
3787,
10086,
3085,
2038,
8663,
6528,
3064,
6590,
13510,
6279,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
eslint/eslint | lib/rules/indent-legacy.js | checkLastReturnStatementLineIndent | function checkLastReturnStatementLineIndent(node, firstLineIndent) {
/*
* in case if return statement ends with ');' we have traverse back to ')'
* otherwise we'll measure indent for ';' and replace ')'
*/
const lastToken = sourceCode.getLastToken(node, astUtils.isClosingParenToken);
const textBeforeClosingParenthesis = sourceCode.getText(lastToken, lastToken.loc.start.column).slice(0, -1);
if (textBeforeClosingParenthesis.trim()) {
// There are tokens before the closing paren, don't report this case
return;
}
const endIndent = getNodeIndent(lastToken, true);
if (endIndent.goodChar !== firstLineIndent) {
report(
node,
firstLineIndent,
endIndent.space,
endIndent.tab,
{ line: lastToken.loc.start.line, column: lastToken.loc.start.column },
true
);
}
} | javascript | function checkLastReturnStatementLineIndent(node, firstLineIndent) {
/*
* in case if return statement ends with ');' we have traverse back to ')'
* otherwise we'll measure indent for ';' and replace ')'
*/
const lastToken = sourceCode.getLastToken(node, astUtils.isClosingParenToken);
const textBeforeClosingParenthesis = sourceCode.getText(lastToken, lastToken.loc.start.column).slice(0, -1);
if (textBeforeClosingParenthesis.trim()) {
// There are tokens before the closing paren, don't report this case
return;
}
const endIndent = getNodeIndent(lastToken, true);
if (endIndent.goodChar !== firstLineIndent) {
report(
node,
firstLineIndent,
endIndent.space,
endIndent.tab,
{ line: lastToken.loc.start.line, column: lastToken.loc.start.column },
true
);
}
} | [
"function",
"checkLastReturnStatementLineIndent",
"(",
"node",
",",
"firstLineIndent",
")",
"{",
"/*\n * in case if return statement ends with ');' we have traverse back to ')'\n * otherwise we'll measure indent for ';' and replace ')'\n */",
"const",
"lastTok... | Check last node line indent this detects, that block closed correctly
This function for more complicated return statement case, where closing parenthesis may be followed by ';'
@param {ASTNode} node Node to examine
@param {int} firstLineIndent first line needed indent
@returns {void} | [
"Check",
"last",
"node",
"line",
"indent",
"this",
"detects",
"that",
"block",
"closed",
"correctly",
"This",
"function",
"for",
"more",
"complicated",
"return",
"statement",
"case",
"where",
"closing",
"parenthesis",
"may",
"be",
"followed",
"by",
";"
] | bc0819c94aad14f7fad3cbc2338ea15658b0f272 | https://github.com/eslint/eslint/blob/bc0819c94aad14f7fad3cbc2338ea15658b0f272/lib/rules/indent-legacy.js#L455-L482 | train | Check last return statement line indent | [
30522,
3853,
4638,
8523,
7913,
22299,
9153,
18532,
4765,
4179,
22254,
4765,
1006,
13045,
1010,
2034,
4179,
22254,
4765,
1007,
1063,
1013,
1008,
1008,
1999,
2553,
2065,
2709,
4861,
4515,
2007,
1005,
1007,
1025,
1005,
2057,
2031,
20811,
2067,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
grpc/grpc-node | packages/grpc-native-core/src/client_interceptors.js | _getUnaryListener | function _getUnaryListener(method_definition, emitter, callback) {
var resultMessage;
return {
onReceiveMetadata: function (metadata) {
emitter.emit('metadata', metadata);
},
onReceiveMessage: function (message) {
resultMessage = message;
},
onReceiveStatus: function (status) {
if (status.code !== constants.status.OK) {
var error = common.createStatusError(status);
callback(error);
} else {
callback(null, resultMessage);
}
emitter.emit('status', status);
}
};
} | javascript | function _getUnaryListener(method_definition, emitter, callback) {
var resultMessage;
return {
onReceiveMetadata: function (metadata) {
emitter.emit('metadata', metadata);
},
onReceiveMessage: function (message) {
resultMessage = message;
},
onReceiveStatus: function (status) {
if (status.code !== constants.status.OK) {
var error = common.createStatusError(status);
callback(error);
} else {
callback(null, resultMessage);
}
emitter.emit('status', status);
}
};
} | [
"function",
"_getUnaryListener",
"(",
"method_definition",
",",
"emitter",
",",
"callback",
")",
"{",
"var",
"resultMessage",
";",
"return",
"{",
"onReceiveMetadata",
":",
"function",
"(",
"metadata",
")",
"{",
"emitter",
".",
"emit",
"(",
"'metadata'",
",",
"... | Produces a listener for responding to callers of unary RPCs.
@private
@param {grpc~MethodDefinition} method_definition
@param {EventEmitter} emitter
@param {function} callback
@return {grpc~Listener} | [
"Produces",
"a",
"listener",
"for",
"responding",
"to",
"callers",
"of",
"unary",
"RPCs",
"."
] | b36b285f4cdb334bbd48f74c12c13bec69961488 | https://github.com/grpc/grpc-node/blob/b36b285f4cdb334bbd48f74c12c13bec69961488/packages/grpc-native-core/src/client_interceptors.js#L1193-L1212 | train | Returns a listener for unary method calls | [
30522,
3853,
1035,
2131,
9521,
23320,
27870,
3678,
1006,
4118,
1035,
6210,
1010,
30524,
27425,
1005,
1010,
27425,
1007,
1025,
1065,
1010,
2006,
2890,
3401,
3512,
7834,
3736,
3351,
1024,
3853,
1006,
4471,
1007,
1063,
2765,
7834,
3736,
3351,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/type/String.js | setConstraints | function setConstraints(oType, oConstraints) {
var vIsDigitSequence, vMaxLength, vNullable;
oType.oConstraints = undefined;
if (oConstraints) {
vMaxLength = oConstraints.maxLength;
if (typeof vMaxLength === "string") {
vMaxLength = parseInt(vMaxLength);
}
if (typeof vMaxLength === "number" && !isNaN(vMaxLength) && vMaxLength > 0) {
oType.oConstraints = {maxLength : vMaxLength };
} else if (vMaxLength !== undefined) {
Log.warning("Illegal maxLength: " + oConstraints.maxLength, null, oType.getName());
}
vIsDigitSequence = oConstraints.isDigitSequence;
if (vIsDigitSequence === true || vIsDigitSequence === "true") {
oType.oConstraints = oType.oConstraints || {};
oType.oConstraints.isDigitSequence = true;
} else if (vIsDigitSequence !== undefined && vIsDigitSequence !== false
&& vIsDigitSequence !== "false") {
Log.warning("Illegal isDigitSequence: " + vIsDigitSequence, null, oType.getName());
}
vNullable = oConstraints.nullable;
if (vNullable === false || vNullable === "false") {
oType.oConstraints = oType.oConstraints || {};
oType.oConstraints.nullable = false;
} else if (vNullable !== undefined && vNullable !== true && vNullable !== "true") {
Log.warning("Illegal nullable: " + vNullable, null, oType.getName());
}
}
} | javascript | function setConstraints(oType, oConstraints) {
var vIsDigitSequence, vMaxLength, vNullable;
oType.oConstraints = undefined;
if (oConstraints) {
vMaxLength = oConstraints.maxLength;
if (typeof vMaxLength === "string") {
vMaxLength = parseInt(vMaxLength);
}
if (typeof vMaxLength === "number" && !isNaN(vMaxLength) && vMaxLength > 0) {
oType.oConstraints = {maxLength : vMaxLength };
} else if (vMaxLength !== undefined) {
Log.warning("Illegal maxLength: " + oConstraints.maxLength, null, oType.getName());
}
vIsDigitSequence = oConstraints.isDigitSequence;
if (vIsDigitSequence === true || vIsDigitSequence === "true") {
oType.oConstraints = oType.oConstraints || {};
oType.oConstraints.isDigitSequence = true;
} else if (vIsDigitSequence !== undefined && vIsDigitSequence !== false
&& vIsDigitSequence !== "false") {
Log.warning("Illegal isDigitSequence: " + vIsDigitSequence, null, oType.getName());
}
vNullable = oConstraints.nullable;
if (vNullable === false || vNullable === "false") {
oType.oConstraints = oType.oConstraints || {};
oType.oConstraints.nullable = false;
} else if (vNullable !== undefined && vNullable !== true && vNullable !== "true") {
Log.warning("Illegal nullable: " + vNullable, null, oType.getName());
}
}
} | [
"function",
"setConstraints",
"(",
"oType",
",",
"oConstraints",
")",
"{",
"var",
"vIsDigitSequence",
",",
"vMaxLength",
",",
"vNullable",
";",
"oType",
".",
"oConstraints",
"=",
"undefined",
";",
"if",
"(",
"oConstraints",
")",
"{",
"vMaxLength",
"=",
"oConst... | Sets the constraints.
@param {sap.ui.model.odata.type.String} oType
the type instance
@param {object} [oConstraints]
constraints, see {@link #constructor} | [
"Sets",
"the",
"constraints",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/type/String.js#L39-L70 | train | Sets constraints for the given type | [
30522,
3853,
2275,
8663,
20528,
18447,
2015,
1006,
27178,
18863,
1010,
1051,
8663,
20528,
18447,
2015,
1007,
1063,
13075,
25292,
4305,
23806,
3366,
4226,
5897,
1010,
1058,
17848,
7770,
13512,
2232,
1010,
1058,
11231,
4571,
3468,
1025,
27178,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
testing-library/react-testing-library | src/index.js | cleanupAtContainer | function cleanupAtContainer(container) {
ReactDOM.unmountComponentAtNode(container)
if (container.parentNode === document.body) {
document.body.removeChild(container)
}
mountedContainers.delete(container)
} | javascript | function cleanupAtContainer(container) {
ReactDOM.unmountComponentAtNode(container)
if (container.parentNode === document.body) {
document.body.removeChild(container)
}
mountedContainers.delete(container)
} | [
"function",
"cleanupAtContainer",
"(",
"container",
")",
"{",
"ReactDOM",
".",
"unmountComponentAtNode",
"(",
"container",
")",
"if",
"(",
"container",
".",
"parentNode",
"===",
"document",
".",
"body",
")",
"{",
"document",
".",
"body",
".",
"removeChild",
"(... | maybe one day we'll expose this (perhaps even as a utility returned by render). but let's wait until someone asks for it. | [
"maybe",
"one",
"day",
"we",
"ll",
"expose",
"this",
"(",
"perhaps",
"even",
"as",
"a",
"utility",
"returned",
"by",
"render",
")",
".",
"but",
"let",
"s",
"wait",
"until",
"someone",
"asks",
"for",
"it",
"."
] | 960451b00196352fc3085a3d1bb233b5b85f454b | https://github.com/testing-library/react-testing-library/blob/960451b00196352fc3085a3d1bb233b5b85f454b/src/index.js#L91-L97 | train | Remove a container from the DOM | [
30522,
3853,
27686,
4017,
8663,
18249,
2121,
1006,
11661,
1007,
1063,
10509,
9527,
1012,
4895,
20048,
9006,
29513,
12380,
2102,
3630,
3207,
1006,
11661,
1007,
2065,
1006,
11661,
1012,
6687,
3630,
3207,
1027,
1027,
1027,
6254,
1012,
2303,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/analytics/AnalyticalTreeBindingAdapter.js | function() {
// ensure only TreeBindings are enhanced which have not been enhanced yet
if (!(this instanceof TreeBinding) || this._bIsAdapted) {
return;
}
ODataTreeBindingAdapter.apply(this);
// apply the methods of the adapters prototype to the TreeBinding instance
for (var fn in AnalyticalTreeBindingAdapter.prototype) {
if (AnalyticalTreeBindingAdapter.prototype.hasOwnProperty(fn)) {
this[fn] = AnalyticalTreeBindingAdapter.prototype[fn];
}
}
//set the default auto expand mode
this.setAutoExpandMode(this.mParameters.autoExpandMode || TreeAutoExpandMode.Bundled);
} | javascript | function() {
// ensure only TreeBindings are enhanced which have not been enhanced yet
if (!(this instanceof TreeBinding) || this._bIsAdapted) {
return;
}
ODataTreeBindingAdapter.apply(this);
// apply the methods of the adapters prototype to the TreeBinding instance
for (var fn in AnalyticalTreeBindingAdapter.prototype) {
if (AnalyticalTreeBindingAdapter.prototype.hasOwnProperty(fn)) {
this[fn] = AnalyticalTreeBindingAdapter.prototype[fn];
}
}
//set the default auto expand mode
this.setAutoExpandMode(this.mParameters.autoExpandMode || TreeAutoExpandMode.Bundled);
} | [
"function",
"(",
")",
"{",
"// ensure only TreeBindings are enhanced which have not been enhanced yet",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"TreeBinding",
")",
"||",
"this",
".",
"_bIsAdapted",
")",
"{",
"return",
";",
"}",
"ODataTreeBindingAdapter",
".",
"appl... | Adapter for TreeBindings to add the ListBinding functionality and use the
tree structure in list based controls.
@alias sap.ui.model.analytics.AnalyticalTreeBindingAdapter
@class
@experimental This module is only for experimental use!
@protected | [
"Adapter",
"for",
"TreeBindings",
"to",
"add",
"the",
"ListBinding",
"functionality",
"and",
"use",
"the",
"tree",
"structure",
"in",
"list",
"based",
"controls",
"."
] | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/analytics/AnalyticalTreeBindingAdapter.js#L41-L59 | train | Creates a new TreeBinding instance. | [
30522,
3853,
1006,
1007,
1063,
1013,
1013,
5676,
2069,
3392,
8428,
4667,
2015,
2024,
9412,
2029,
2031,
2025,
2042,
9412,
2664,
2065,
1006,
999,
1006,
2023,
6013,
11253,
3392,
8428,
4667,
1007,
1064,
1064,
2023,
1012,
1035,
20377,
8447,
13... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
dcloudio/mui | js/mui.jsonp.js | function(url) {
var query = getQueryString(url);
for (var name in query) {
if (query[name] === '?') {
return name;
}
}
return null;
} | javascript | function(url) {
var query = getQueryString(url);
for (var name in query) {
if (query[name] === '?') {
return name;
}
}
return null;
} | [
"function",
"(",
"url",
")",
"{",
"var",
"query",
"=",
"getQueryString",
"(",
"url",
")",
";",
"for",
"(",
"var",
"name",
"in",
"query",
")",
"{",
"if",
"(",
"query",
"[",
"name",
"]",
"===",
"'?'",
")",
"{",
"return",
"name",
";",
"}",
"}",
"r... | 获取将传递给服务器的回调函数的请求参数名 | [
"获取将传递给服务器的回调函数的请求参数名"
] | ff74c90a1671a552f3604b1288bf38a4126312d0 | https://github.com/dcloudio/mui/blob/ff74c90a1671a552f3604b1288bf38a4126312d0/js/mui.jsonp.js#L58-L66 | train | Get the name of the query string from the given URL | [
30522,
3853,
1006,
24471,
2140,
1007,
1063,
13075,
23032,
1027,
2131,
4226,
24769,
18886,
3070,
1006,
24471,
2140,
1007,
1025,
2005,
1006,
13075,
2171,
1999,
23032,
1007,
1063,
2065,
1006,
23032,
1031,
2171,
1033,
1027,
1027,
1027,
1005,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
adobe/brackets | src/LiveDevelopment/MultiBrowserImpl/language/HTMLInstrumentation.js | DOMUpdater | function DOMUpdater(previousDOM, editor, changeList) {
var text, startOffset = 0, startOffsetPos;
this.isIncremental = false;
function isDangerousEdit(text) {
// We don't consider & dangerous since entities only affect text content, not
// overall DOM structure.
return (/[<>\/=\"\']/).test(text);
}
// If there's more than one change, be conservative and assume we have to do a full reparse.
if (changeList && changeList.length === 1) {
// If the inserted or removed text doesn't have any characters that could change the
// structure of the DOM (e.g. by adding or removing a tag boundary), then we can do
// an incremental reparse of just the parent tag containing the edit. This should just
// be the marked range that contains the beginning of the edit range, since that position
// isn't changed by the edit.
var change = changeList[0];
if (!isDangerousEdit(change.text) && !isDangerousEdit(change.removed)) {
// If the edit is right at the beginning or end of a tag, we want to be conservative
// and use the parent as the edit range.
var startMark = _getMarkerAtDocumentPos(editor, change.from, true);
if (startMark) {
var range = startMark.find();
if (range) {
text = editor._codeMirror.getRange(range.from, range.to);
this.changedTagID = startMark.tagID;
startOffsetPos = range.from;
startOffset = editor._codeMirror.indexFromPos(startOffsetPos);
this.isIncremental = true;
}
}
}
}
if (!this.changedTagID) {
// We weren't able to incrementally update, so just rebuild and diff everything.
text = editor.document.getText();
}
HTMLSimpleDOM.Builder.call(this, text, startOffset, startOffsetPos);
this.editor = editor;
this.cm = editor._codeMirror;
this.previousDOM = previousDOM;
} | javascript | function DOMUpdater(previousDOM, editor, changeList) {
var text, startOffset = 0, startOffsetPos;
this.isIncremental = false;
function isDangerousEdit(text) {
// We don't consider & dangerous since entities only affect text content, not
// overall DOM structure.
return (/[<>\/=\"\']/).test(text);
}
// If there's more than one change, be conservative and assume we have to do a full reparse.
if (changeList && changeList.length === 1) {
// If the inserted or removed text doesn't have any characters that could change the
// structure of the DOM (e.g. by adding or removing a tag boundary), then we can do
// an incremental reparse of just the parent tag containing the edit. This should just
// be the marked range that contains the beginning of the edit range, since that position
// isn't changed by the edit.
var change = changeList[0];
if (!isDangerousEdit(change.text) && !isDangerousEdit(change.removed)) {
// If the edit is right at the beginning or end of a tag, we want to be conservative
// and use the parent as the edit range.
var startMark = _getMarkerAtDocumentPos(editor, change.from, true);
if (startMark) {
var range = startMark.find();
if (range) {
text = editor._codeMirror.getRange(range.from, range.to);
this.changedTagID = startMark.tagID;
startOffsetPos = range.from;
startOffset = editor._codeMirror.indexFromPos(startOffsetPos);
this.isIncremental = true;
}
}
}
}
if (!this.changedTagID) {
// We weren't able to incrementally update, so just rebuild and diff everything.
text = editor.document.getText();
}
HTMLSimpleDOM.Builder.call(this, text, startOffset, startOffsetPos);
this.editor = editor;
this.cm = editor._codeMirror;
this.previousDOM = previousDOM;
} | [
"function",
"DOMUpdater",
"(",
"previousDOM",
",",
"editor",
",",
"changeList",
")",
"{",
"var",
"text",
",",
"startOffset",
"=",
"0",
",",
"startOffsetPos",
";",
"this",
".",
"isIncremental",
"=",
"false",
";",
"function",
"isDangerousEdit",
"(",
"text",
")... | @constructor
Subclass of HTMLSimpleDOM.Builder that builds an updated DOM after changes have been made,
and maps nodes from the new DOM to the old DOM by tag ID. For non-structural edits, avoids reparsing
the whole editor. Also updates marks in the editor based on the new DOM state.
@param {Object} previousDOM The root of the HTMLSimpleDOM tree representing a previous state of the DOM.
@param {Editor} editor The editor containing the instrumented HTML.
@param {Array=} changeList An optional array of CodeMirror change records representing the
edits the user made in the editor since previousDOM was built. If provided, and the
edits are not structural, DOMUpdater will do a fast incremental reparse. If not provided,
or if one of the edits changes the DOM structure, DOMUpdater will reparse the whole DOM. | [
"@constructor",
"Subclass",
"of",
"HTMLSimpleDOM",
".",
"Builder",
"that",
"builds",
"an",
"updated",
"DOM",
"after",
"changes",
"have",
"been",
"made",
"and",
"maps",
"nodes",
"from",
"the",
"new",
"DOM",
"to",
"the",
"old",
"DOM",
"by",
"tag",
"ID",
".",... | d5d00d43602c438266d32b8eda8f8a3ca937b524 | https://github.com/adobe/brackets/blob/d5d00d43602c438266d32b8eda8f8a3ca937b524/src/LiveDevelopment/MultiBrowserImpl/language/HTMLInstrumentation.js#L238-L283 | train | DOMUpdater - DOM updater | [
30522,
3853,
14383,
6279,
13701,
2099,
1006,
3025,
9527,
1010,
3559,
1010,
2689,
9863,
1007,
1063,
13075,
3793,
1010,
2707,
27475,
3388,
1027,
1014,
1010,
2707,
27475,
3388,
6873,
2015,
1025,
2023,
1012,
2003,
2378,
16748,
26901,
1027,
6270... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
dequelabs/axe-core | lib/commons/text/form-control-value.js | ariaTextboxValue | function ariaTextboxValue(virtualNode) {
const { actualNode } = virtualNode;
const role = aria.getRole(actualNode);
if (role !== 'textbox') {
return '';
}
if (!dom.isHiddenWithCSS(actualNode)) {
return text.visibleVirtual(virtualNode, true);
} else {
return actualNode.textContent;
}
} | javascript | function ariaTextboxValue(virtualNode) {
const { actualNode } = virtualNode;
const role = aria.getRole(actualNode);
if (role !== 'textbox') {
return '';
}
if (!dom.isHiddenWithCSS(actualNode)) {
return text.visibleVirtual(virtualNode, true);
} else {
return actualNode.textContent;
}
} | [
"function",
"ariaTextboxValue",
"(",
"virtualNode",
")",
"{",
"const",
"{",
"actualNode",
"}",
"=",
"virtualNode",
";",
"const",
"role",
"=",
"aria",
".",
"getRole",
"(",
"actualNode",
")",
";",
"if",
"(",
"role",
"!==",
"'textbox'",
")",
"{",
"return",
... | Calculate value of a an element with role=textbox
@param {VirtualNode} element The VirtualNode instance whose value we want
@return {string} The calculated value | [
"Calculate",
"value",
"of",
"a",
"an",
"element",
"with",
"role",
"=",
"textbox"
] | 727323c07980e2291575f545444d389fb942906f | https://github.com/dequelabs/axe-core/blob/727323c07980e2291575f545444d389fb942906f/lib/commons/text/form-control-value.js#L113-L124 | train | Get the value of a textbox element | [
30522,
3853,
9342,
18209,
8758,
10175,
5657,
1006,
7484,
3630,
3207,
1007,
1063,
9530,
3367,
1063,
5025,
3630,
3207,
1065,
1027,
7484,
3630,
3207,
1025,
9530,
3367,
2535,
1027,
9342,
1012,
2131,
13153,
2063,
1006,
5025,
3630,
3207,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
dcloudio/mui | examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js | function () {
clearTimeout(this._conn._idleTimeout);
this._throttledRequestHandler();
this._conn._idleTimeout = setTimeout(this._conn._onIdle.bind(this._conn), 100);
} | javascript | function () {
clearTimeout(this._conn._idleTimeout);
this._throttledRequestHandler();
this._conn._idleTimeout = setTimeout(this._conn._onIdle.bind(this._conn), 100);
} | [
"function",
"(",
")",
"{",
"clearTimeout",
"(",
"this",
".",
"_conn",
".",
"_idleTimeout",
")",
";",
"this",
".",
"_throttledRequestHandler",
"(",
")",
";",
"this",
".",
"_conn",
".",
"_idleTimeout",
"=",
"setTimeout",
"(",
"this",
".",
"_conn",
".",
"_o... | PrivateFunction: _send
_Private_ part of the Connection.send function for BOSH
Just triggers the RequestHandler to send the messages that are in the queue | [
"PrivateFunction",
":",
"_send",
"_Private_",
"part",
"of",
"the",
"Connection",
".",
"send",
"function",
"for",
"BOSH"
] | ff74c90a1671a552f3604b1288bf38a4126312d0 | https://github.com/dcloudio/mui/blob/ff74c90a1671a552f3604b1288bf38a4126312d0/examples/login/libs/easymob-webim-sdk/strophe-custom-2.0.0.js#L4661-L4665 | train | Called when the server is idle | [
30522,
3853,
1006,
1007,
1063,
3154,
7292,
5833,
1006,
2023,
1012,
1035,
9530,
2078,
1012,
1035,
18373,
7292,
5833,
1007,
1025,
2023,
1012,
1035,
24420,
16200,
15500,
11774,
3917,
1006,
1007,
1025,
2023,
1012,
1035,
9530,
2078,
1012,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
SAP/openui5 | src/sap.ui.core/src/sap/ui/model/odata/_AnnotationHelperExpression.js | processProperty | function processProperty(sPropertyPath, i) {
var sProperty = oModel.getProperty(sObjectPath + "/" + sPropertyPath);
if (typeof sProperty === "string") {
aParts[i] = "[${" + sPropertyPath + "}===" + Basics.toJSON(sProperty) + "]";
return true;
}
return false;
} | javascript | function processProperty(sPropertyPath, i) {
var sProperty = oModel.getProperty(sObjectPath + "/" + sPropertyPath);
if (typeof sProperty === "string") {
aParts[i] = "[${" + sPropertyPath + "}===" + Basics.toJSON(sProperty) + "]";
return true;
}
return false;
} | [
"function",
"processProperty",
"(",
"sPropertyPath",
",",
"i",
")",
"{",
"var",
"sProperty",
"=",
"oModel",
".",
"getProperty",
"(",
"sObjectPath",
"+",
"\"/\"",
"+",
"sPropertyPath",
")",
";",
"if",
"(",
"typeof",
"sProperty",
"===",
"\"string\"",
")",
"{",... | Processes the property with the given path of the object at <code>sObjectPath</code>.
If it exists and is of type "string", the index at position <code>i</code> in
<code>aParts</code> is replaced by a query "[${propertyPath}==='propertyValue']".
@param {string} sPropertyPath the property path
@param {number} i the index in aParts
@returns {boolean} true if the index was replaced by a query | [
"Processes",
"the",
"property",
"with",
"the",
"given",
"path",
"of",
"the",
"object",
"at",
"<code",
">",
"sObjectPath<",
"/",
"code",
">",
".",
"If",
"it",
"exists",
"and",
"is",
"of",
"type",
"string",
"the",
"index",
"at",
"position",
"<code",
">",
... | 8a832fca01cb1cdf8df589788e0c5723e2a33c70 | https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/_AnnotationHelperExpression.js#L817-L825 | train | process property | [
30522,
3853,
2832,
21572,
4842,
3723,
1006,
11867,
18981,
15010,
15069,
1010,
1045,
1007,
1063,
13075,
11867,
18981,
15010,
1027,
18168,
10244,
2140,
1012,
2131,
21572,
4842,
3723,
1006,
17540,
20614,
15069,
1009,
1000,
1013,
1000,
1009,
1186... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
dimsemenov/PhotoSwipe | src/js/gestures.js | function(e) {
if(_features.isOldAndroid ) {
if(_oldAndroidTouchEndTimeout && e.type === 'mouseup') {
return;
}
// on Android (v4.1, 4.2, 4.3 & possibly older)
// ghost mousedown/up event isn't preventable via e.preventDefault,
// which causes fake mousedown event
// so we block mousedown/up for 600ms
if( e.type.indexOf('touch') > -1 ) {
clearTimeout(_oldAndroidTouchEndTimeout);
_oldAndroidTouchEndTimeout = setTimeout(function() {
_oldAndroidTouchEndTimeout = 0;
}, 600);
}
}
_shout('pointerUp');
if(_preventDefaultEventBehaviour(e, false)) {
e.preventDefault();
}
var releasePoint;
if(_pointerEventEnabled) {
var pointerIndex = framework.arraySearch(_currPointers, e.pointerId, 'id');
if(pointerIndex > -1) {
releasePoint = _currPointers.splice(pointerIndex, 1)[0];
if(navigator.msPointerEnabled) {
var MSPOINTER_TYPES = {
4: 'mouse', // event.MSPOINTER_TYPE_MOUSE
2: 'touch', // event.MSPOINTER_TYPE_TOUCH
3: 'pen' // event.MSPOINTER_TYPE_PEN
};
releasePoint.type = MSPOINTER_TYPES[e.pointerType];
if(!releasePoint.type) {
releasePoint.type = e.pointerType || 'mouse';
}
} else {
releasePoint.type = e.pointerType || 'mouse';
}
}
}
var touchList = _getTouchPoints(e),
gestureType,
numPoints = touchList.length;
if(e.type === 'mouseup') {
numPoints = 0;
}
// Do nothing if there were 3 touch points or more
if(numPoints === 2) {
_currentPoints = null;
return true;
}
// if second pointer released
if(numPoints === 1) {
_equalizePoints(_startPoint, touchList[0]);
}
// pointer hasn't moved, send "tap release" point
if(numPoints === 0 && !_direction && !_mainScrollAnimating) {
if(!releasePoint) {
if(e.type === 'mouseup') {
releasePoint = {x: e.pageX, y: e.pageY, type:'mouse'};
} else if(e.changedTouches && e.changedTouches[0]) {
releasePoint = {x: e.changedTouches[0].pageX, y: e.changedTouches[0].pageY, type:'touch'};
}
}
_shout('touchRelease', e, releasePoint);
}
// Difference in time between releasing of two last touch points (zoom gesture)
var releaseTimeDiff = -1;
// Gesture completed, no pointers left
if(numPoints === 0) {
_isDragging = false;
framework.unbind(window, _upMoveEvents, self);
_stopDragUpdateLoop();
if(_isZooming) {
// Two points released at the same time
releaseTimeDiff = 0;
} else if(_lastReleaseTime !== -1) {
releaseTimeDiff = _getCurrentTime() - _lastReleaseTime;
}
}
_lastReleaseTime = numPoints === 1 ? _getCurrentTime() : -1;
if(releaseTimeDiff !== -1 && releaseTimeDiff < 150) {
gestureType = 'zoom';
} else {
gestureType = 'swipe';
}
if(_isZooming && numPoints < 2) {
_isZooming = false;
// Only second point released
if(numPoints === 1) {
gestureType = 'zoomPointerUp';
}
_shout('zoomGestureEnded');
}
_currentPoints = null;
if(!_moved && !_zoomStarted && !_mainScrollAnimating && !_verticalDragInitiated) {
// nothing to animate
return;
}
_stopAllAnimations();
if(!_releaseAnimData) {
_releaseAnimData = _initDragReleaseAnimationData();
}
_releaseAnimData.calculateSwipeSpeed('x');
if(_verticalDragInitiated) {
var opacityRatio = _calculateVerticalDragOpacityRatio();
if(opacityRatio < _options.verticalDragRange) {
self.close();
} else {
var initalPanY = _panOffset.y,
initialBgOpacity = _bgOpacity;
_animateProp('verticalDrag', 0, 1, 300, framework.easing.cubic.out, function(now) {
_panOffset.y = (self.currItem.initialPosition.y - initalPanY) * now + initalPanY;
_applyBgOpacity( (1 - initialBgOpacity) * now + initialBgOpacity );
_applyCurrentZoomPan();
});
_shout('onVerticalDrag', 1);
}
return;
}
// main scroll
if( (_mainScrollShifted || _mainScrollAnimating) && numPoints === 0) {
var itemChanged = _finishSwipeMainScrollGesture(gestureType, _releaseAnimData);
if(itemChanged) {
return;
}
gestureType = 'zoomPointerUp';
}
// prevent zoom/pan animation when main scroll animation runs
if(_mainScrollAnimating) {
return;
}
// Complete simple zoom gesture (reset zoom level if it's out of the bounds)
if(gestureType !== 'swipe') {
_completeZoomGesture();
return;
}
// Complete pan gesture if main scroll is not shifted, and it's possible to pan current image
if(!_mainScrollShifted && _currZoomLevel > self.currItem.fitRatio) {
_completePanGesture(_releaseAnimData);
}
} | javascript | function(e) {
if(_features.isOldAndroid ) {
if(_oldAndroidTouchEndTimeout && e.type === 'mouseup') {
return;
}
// on Android (v4.1, 4.2, 4.3 & possibly older)
// ghost mousedown/up event isn't preventable via e.preventDefault,
// which causes fake mousedown event
// so we block mousedown/up for 600ms
if( e.type.indexOf('touch') > -1 ) {
clearTimeout(_oldAndroidTouchEndTimeout);
_oldAndroidTouchEndTimeout = setTimeout(function() {
_oldAndroidTouchEndTimeout = 0;
}, 600);
}
}
_shout('pointerUp');
if(_preventDefaultEventBehaviour(e, false)) {
e.preventDefault();
}
var releasePoint;
if(_pointerEventEnabled) {
var pointerIndex = framework.arraySearch(_currPointers, e.pointerId, 'id');
if(pointerIndex > -1) {
releasePoint = _currPointers.splice(pointerIndex, 1)[0];
if(navigator.msPointerEnabled) {
var MSPOINTER_TYPES = {
4: 'mouse', // event.MSPOINTER_TYPE_MOUSE
2: 'touch', // event.MSPOINTER_TYPE_TOUCH
3: 'pen' // event.MSPOINTER_TYPE_PEN
};
releasePoint.type = MSPOINTER_TYPES[e.pointerType];
if(!releasePoint.type) {
releasePoint.type = e.pointerType || 'mouse';
}
} else {
releasePoint.type = e.pointerType || 'mouse';
}
}
}
var touchList = _getTouchPoints(e),
gestureType,
numPoints = touchList.length;
if(e.type === 'mouseup') {
numPoints = 0;
}
// Do nothing if there were 3 touch points or more
if(numPoints === 2) {
_currentPoints = null;
return true;
}
// if second pointer released
if(numPoints === 1) {
_equalizePoints(_startPoint, touchList[0]);
}
// pointer hasn't moved, send "tap release" point
if(numPoints === 0 && !_direction && !_mainScrollAnimating) {
if(!releasePoint) {
if(e.type === 'mouseup') {
releasePoint = {x: e.pageX, y: e.pageY, type:'mouse'};
} else if(e.changedTouches && e.changedTouches[0]) {
releasePoint = {x: e.changedTouches[0].pageX, y: e.changedTouches[0].pageY, type:'touch'};
}
}
_shout('touchRelease', e, releasePoint);
}
// Difference in time between releasing of two last touch points (zoom gesture)
var releaseTimeDiff = -1;
// Gesture completed, no pointers left
if(numPoints === 0) {
_isDragging = false;
framework.unbind(window, _upMoveEvents, self);
_stopDragUpdateLoop();
if(_isZooming) {
// Two points released at the same time
releaseTimeDiff = 0;
} else if(_lastReleaseTime !== -1) {
releaseTimeDiff = _getCurrentTime() - _lastReleaseTime;
}
}
_lastReleaseTime = numPoints === 1 ? _getCurrentTime() : -1;
if(releaseTimeDiff !== -1 && releaseTimeDiff < 150) {
gestureType = 'zoom';
} else {
gestureType = 'swipe';
}
if(_isZooming && numPoints < 2) {
_isZooming = false;
// Only second point released
if(numPoints === 1) {
gestureType = 'zoomPointerUp';
}
_shout('zoomGestureEnded');
}
_currentPoints = null;
if(!_moved && !_zoomStarted && !_mainScrollAnimating && !_verticalDragInitiated) {
// nothing to animate
return;
}
_stopAllAnimations();
if(!_releaseAnimData) {
_releaseAnimData = _initDragReleaseAnimationData();
}
_releaseAnimData.calculateSwipeSpeed('x');
if(_verticalDragInitiated) {
var opacityRatio = _calculateVerticalDragOpacityRatio();
if(opacityRatio < _options.verticalDragRange) {
self.close();
} else {
var initalPanY = _panOffset.y,
initialBgOpacity = _bgOpacity;
_animateProp('verticalDrag', 0, 1, 300, framework.easing.cubic.out, function(now) {
_panOffset.y = (self.currItem.initialPosition.y - initalPanY) * now + initalPanY;
_applyBgOpacity( (1 - initialBgOpacity) * now + initialBgOpacity );
_applyCurrentZoomPan();
});
_shout('onVerticalDrag', 1);
}
return;
}
// main scroll
if( (_mainScrollShifted || _mainScrollAnimating) && numPoints === 0) {
var itemChanged = _finishSwipeMainScrollGesture(gestureType, _releaseAnimData);
if(itemChanged) {
return;
}
gestureType = 'zoomPointerUp';
}
// prevent zoom/pan animation when main scroll animation runs
if(_mainScrollAnimating) {
return;
}
// Complete simple zoom gesture (reset zoom level if it's out of the bounds)
if(gestureType !== 'swipe') {
_completeZoomGesture();
return;
}
// Complete pan gesture if main scroll is not shifted, and it's possible to pan current image
if(!_mainScrollShifted && _currZoomLevel > self.currItem.fitRatio) {
_completePanGesture(_releaseAnimData);
}
} | [
"function",
"(",
"e",
")",
"{",
"if",
"(",
"_features",
".",
"isOldAndroid",
")",
"{",
"if",
"(",
"_oldAndroidTouchEndTimeout",
"&&",
"e",
".",
"type",
"===",
"'mouseup'",
")",
"{",
"return",
";",
"}",
"// on Android (v4.1, 4.2, 4.3 & possibly older) ",
"// ghos... | amount of pixels to drag to determine direction of swipe | [
"amount",
"of",
"pixels",
"to",
"drag",
"to",
"determine",
"direction",
"of",
"swipe"
] | 80607e12542a1a54ecefa837649e862b35dffd25 | https://github.com/dimsemenov/PhotoSwipe/blob/80607e12542a1a54ecefa837649e862b35dffd25/src/js/gestures.js#L609-L795 | train | Handle mouseup event | [
30522,
3853,
1006,
1041,
1007,
1063,
2065,
1006,
1035,
2838,
1012,
11163,
15150,
4859,
22943,
1007,
1063,
2065,
1006,
1035,
2214,
5685,
22943,
24826,
8661,
11927,
14428,
5833,
1004,
1004,
1041,
1012,
2828,
1027,
1027,
1027,
1005,
8000,
6279... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... | |
cytoscape/cytoscape.js | dist/cytoscape.esm.js | Animation | function Animation(target, opts, opts2) {
var isCore = core(target);
var isEle = !isCore;
var _p = this._private = extend({
duration: 1000
}, opts, opts2);
_p.target = target;
_p.style = _p.style || _p.css;
_p.started = false;
_p.playing = false;
_p.hooked = false;
_p.applying = false;
_p.progress = 0;
_p.completes = [];
_p.frames = [];
if (_p.complete && fn(_p.complete)) {
_p.completes.push(_p.complete);
}
if (isEle) {
var pos = target.position();
_p.startPosition = _p.startPosition || {
x: pos.x,
y: pos.y
};
_p.startStyle = _p.startStyle || target.cy().style().getAnimationStartStyle(target, _p.style);
}
if (isCore) {
var pan = target.pan();
_p.startPan = {
x: pan.x,
y: pan.y
};
_p.startZoom = target.zoom();
} // for future timeline/animations impl
this.length = 1;
this[0] = this;
} | javascript | function Animation(target, opts, opts2) {
var isCore = core(target);
var isEle = !isCore;
var _p = this._private = extend({
duration: 1000
}, opts, opts2);
_p.target = target;
_p.style = _p.style || _p.css;
_p.started = false;
_p.playing = false;
_p.hooked = false;
_p.applying = false;
_p.progress = 0;
_p.completes = [];
_p.frames = [];
if (_p.complete && fn(_p.complete)) {
_p.completes.push(_p.complete);
}
if (isEle) {
var pos = target.position();
_p.startPosition = _p.startPosition || {
x: pos.x,
y: pos.y
};
_p.startStyle = _p.startStyle || target.cy().style().getAnimationStartStyle(target, _p.style);
}
if (isCore) {
var pan = target.pan();
_p.startPan = {
x: pan.x,
y: pan.y
};
_p.startZoom = target.zoom();
} // for future timeline/animations impl
this.length = 1;
this[0] = this;
} | [
"function",
"Animation",
"(",
"target",
",",
"opts",
",",
"opts2",
")",
"{",
"var",
"isCore",
"=",
"core",
"(",
"target",
")",
";",
"var",
"isEle",
"=",
"!",
"isCore",
";",
"var",
"_p",
"=",
"this",
".",
"_private",
"=",
"extend",
"(",
"{",
"durati... | eslint-disable-line no-undef | [
"eslint",
"-",
"disable",
"-",
"line",
"no",
"-",
"undef"
] | ad2051b65e2243cfd953d8b24a8bf95bfa8559e5 | https://github.com/cytoscape/cytoscape.js/blob/ad2051b65e2243cfd953d8b24a8bf95bfa8559e5/dist/cytoscape.esm.js#L5499-L5542 | train | Animation constructor. | [
30522,
3853,
7284,
1006,
4539,
1010,
23569,
2015,
1010,
23569,
2015,
2475,
1007,
1063,
13075,
2003,
17345,
1027,
4563,
1006,
4539,
1007,
1025,
13075,
2003,
12260,
1027,
999,
2003,
17345,
1025,
13075,
1035,
1052,
1027,
2023,
1012,
1035,
2797... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.