id
int32
0
58k
repo
stringlengths
5
67
path
stringlengths
4
116
func_name
stringlengths
0
58
original_string
stringlengths
52
373k
language
stringclasses
1 value
code
stringlengths
52
373k
code_tokens
sequence
docstring
stringlengths
4
11.8k
docstring_tokens
sequence
sha
stringlengths
40
40
url
stringlengths
86
226
4,600
SAP/openui5
src/sap.ui.support/src/sap/ui/support/supportRules/report/IssueRenderer.js
render
function render(issues, enableFiltering) { var content = ''; if (enableFiltering) { content += '<div class="filters">' + getSeverityFilters(issues) + '<div>\n'; } content += '<div>' + getIssues(issues) + '</div>'; return '<div>' + content + '</div>'; }
javascript
function render(issues, enableFiltering) { var content = ''; if (enableFiltering) { content += '<div class="filters">' + getSeverityFilters(issues) + '<div>\n'; } content += '<div>' + getIssues(issues) + '</div>'; return '<div>' + content + '</div>'; }
[ "function", "render", "(", "issues", ",", "enableFiltering", ")", "{", "var", "content", "=", "''", ";", "if", "(", "enableFiltering", ")", "{", "content", "+=", "'<div class=\"filters\">'", "+", "getSeverityFilters", "(", "issues", ")", "+", "'<div>\\n'", ";", "}", "content", "+=", "'<div>'", "+", "getIssues", "(", "issues", ")", "+", "'</div>'", ";", "return", "'<div>'", "+", "content", "+", "'</div>'", ";", "}" ]
Public functions Creates an html string containing the issues. @param {Object} issues - the issues in viewmodel format @param {Boolean} enableFiltering - if true renders the severity filters @returns {String}
[ "Public", "functions", "Creates", "an", "html", "string", "containing", "the", "issues", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/report/IssueRenderer.js#L168-L178
4,601
SAP/openui5
src/sap.ui.core/src/sap/ui/core/IntervalTrigger.js
function() { clearTimeout(this._delayedCallId); // if interval is active and there are registered listeners var bHasListeners = this._oEventBus._defaultChannel.hasListeners(_EVENT_ID); if (this._iInterval > 0 && bHasListeners) { this._oEventBus.publish(_EVENT_ID); this._delayedCallId = setTimeout(this._trigger, this._iInterval); } }
javascript
function() { clearTimeout(this._delayedCallId); // if interval is active and there are registered listeners var bHasListeners = this._oEventBus._defaultChannel.hasListeners(_EVENT_ID); if (this._iInterval > 0 && bHasListeners) { this._oEventBus.publish(_EVENT_ID); this._delayedCallId = setTimeout(this._trigger, this._iInterval); } }
[ "function", "(", ")", "{", "clearTimeout", "(", "this", ".", "_delayedCallId", ")", ";", "// if interval is active and there are registered listeners", "var", "bHasListeners", "=", "this", ".", "_oEventBus", ".", "_defaultChannel", ".", "hasListeners", "(", "_EVENT_ID", ")", ";", "if", "(", "this", ".", "_iInterval", ">", "0", "&&", "bHasListeners", ")", "{", "this", ".", "_oEventBus", ".", "publish", "(", "_EVENT_ID", ")", ";", "this", ".", "_delayedCallId", "=", "setTimeout", "(", "this", ".", "_trigger", ",", "this", ".", "_iInterval", ")", ";", "}", "}" ]
This is the function that will be used for triggering. @private
[ "This", "is", "the", "function", "that", "will", "be", "used", "for", "triggering", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/IntervalTrigger.js#L50-L60
4,602
SAP/openui5
src/sap.m/src/sap/m/SearchField.js
openSuggestions
function openSuggestions(oSF) { if (oSF.getEnableSuggestions()) { if (!oSF._oSuggest) { oSF._oSuggest = new Suggest(oSF); } oSF._oSuggest.open(); } }
javascript
function openSuggestions(oSF) { if (oSF.getEnableSuggestions()) { if (!oSF._oSuggest) { oSF._oSuggest = new Suggest(oSF); } oSF._oSuggest.open(); } }
[ "function", "openSuggestions", "(", "oSF", ")", "{", "if", "(", "oSF", ".", "getEnableSuggestions", "(", ")", ")", "{", "if", "(", "!", "oSF", ".", "_oSuggest", ")", "{", "oSF", ".", "_oSuggest", "=", "new", "Suggest", "(", "oSF", ")", ";", "}", "oSF", ".", "_oSuggest", ".", "open", "(", ")", ";", "}", "}" ]
Close the suggestions list. @param {sap.m.SearchField} oSF a SearchField instance
[ "Close", "the", "suggestions", "list", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/SearchField.js#L883-L890
4,603
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableAccRenderExtension.js
function(oRm, oTable) { if (!oTable._getAccExtension().getAccMode()) { return; } var sTableId = oTable.getId(); oRm.write("<div class='sapUiTableHiddenTexts' style='display:none;' aria-hidden='true'>"); // aria description for the row and column count _writeAccText(oRm, sTableId, "ariacount"); // aria description for toggling the edit mode _writeAccText(oRm, sTableId, "toggleedit", TableUtils.getResourceText("TBL_TOGGLE_EDIT_KEY")); // aria description for select all button var bAllRowsSelected = TableUtils.areAllRowsSelected(oTable); var mRenderConfig = oTable._oSelectionPlugin.getRenderConfig(); var sSelectAllResourceTextID; if (mRenderConfig.headerSelector.type === "toggle") { sSelectAllResourceTextID = bAllRowsSelected ? "TBL_DESELECT_ALL" : "TBL_SELECT_ALL"; } else if (mRenderConfig.headerSelector.type === "clear") { sSelectAllResourceTextID = "TBL_DESELECT_ALL"; } _writeAccText(oRm, sTableId, "ariaselectall", TableUtils.getResourceText(sSelectAllResourceTextID)); // aria label for row headers _writeAccText(oRm, sTableId, "ariarowheaderlabel", TableUtils.getResourceText("TBL_ROW_HEADER_LABEL")); // aria label for group rows _writeAccText(oRm, sTableId, "ariarowgrouplabel", TableUtils.getResourceText("TBL_ROW_GROUP_LABEL")); // aria label for grand total sums _writeAccText(oRm, sTableId, "ariagrandtotallabel", TableUtils.getResourceText("TBL_GRAND_TOTAL_ROW")); // aria label for group total sums _writeAccText(oRm, sTableId, "ariagrouptotallabel", TableUtils.getResourceText("TBL_GROUP_TOTAL_ROW")); // aria label for column row header _writeAccText(oRm, sTableId, "ariacolrowheaderlabel", TableUtils.getResourceText("TBL_ROW_COL_HEADER_LABEL")); // aria description for table row count _writeAccText(oRm, sTableId, "rownumberofrows"); // aria description for table column count _writeAccText(oRm, sTableId, "colnumberofcols"); // aria description for table cell content _writeAccText(oRm, sTableId, "cellacc"); // aria description for selected row _writeAccText(oRm, sTableId, "ariarowselected", TableUtils.getResourceText("TBL_ROW_DESC_SELECTED")); // aria description for column menu _writeAccText(oRm, sTableId, "ariacolmenu", TableUtils.getResourceText("TBL_COL_DESC_MENU")); // aria description for column header span _writeAccText(oRm, sTableId, "ariacolspan"); // aria description for a filtered column _writeAccText(oRm, sTableId, "ariacolfiltered", TableUtils.getResourceText("TBL_COL_DESC_FILTERED")); // aria description for a sorted column _writeAccText(oRm, sTableId, "ariacolsortedasc", TableUtils.getResourceText("TBL_COL_DESC_SORTED_ASC")); // aria description for a sorted column _writeAccText(oRm, sTableId, "ariacolsorteddes", TableUtils.getResourceText("TBL_COL_DESC_SORTED_DES")); // aria description for invalid table (table with overlay) _writeAccText(oRm, sTableId, "ariainvalid", TableUtils.getResourceText("TBL_TABLE_INVALID")); // aria description for column vsisiblity menu item (Show Column) _writeAccText(oRm, sTableId, "ariashowcolmenu", TableUtils.getResourceText("TBL_COL_VISBILITY_MENUITEM_SHOW")); // aria description for column vsisiblity menu item (Hide Column) _writeAccText(oRm, sTableId, "ariahidecolmenu", TableUtils.getResourceText("TBL_COL_VISBILITY_MENUITEM_HIDE")); // aria description for row expansion via keyboard _writeAccText(oRm, sTableId, "rowexpandtext", TableUtils.getResourceText("TBL_ROW_EXPAND_KEY")); // aria description for row collapse via keyboard _writeAccText(oRm, sTableId, "rowcollapsetext", TableUtils.getResourceText("TBL_ROW_COLLAPSE_KEY")); var oSelectionMode = oTable.getSelectionMode(); if (oSelectionMode !== SelectionMode.None) { // aria description for selection mode in table _writeAccText(oRm, sTableId, "ariaselection", TableUtils.getResourceText(oSelectionMode == SelectionMode.MultiToggle ? "TBL_TABLE_SELECTION_MULTI" : "TBL_TABLE_SELECTION_SINGLE")); } if (oTable.getComputedFixedColumnCount() > 0) { // aria description for fixed columns _writeAccText(oRm, sTableId, "ariafixedcolumn", TableUtils.getResourceText("TBL_FIXED_COLUMN")); } oRm.write("</div>"); }
javascript
function(oRm, oTable) { if (!oTable._getAccExtension().getAccMode()) { return; } var sTableId = oTable.getId(); oRm.write("<div class='sapUiTableHiddenTexts' style='display:none;' aria-hidden='true'>"); // aria description for the row and column count _writeAccText(oRm, sTableId, "ariacount"); // aria description for toggling the edit mode _writeAccText(oRm, sTableId, "toggleedit", TableUtils.getResourceText("TBL_TOGGLE_EDIT_KEY")); // aria description for select all button var bAllRowsSelected = TableUtils.areAllRowsSelected(oTable); var mRenderConfig = oTable._oSelectionPlugin.getRenderConfig(); var sSelectAllResourceTextID; if (mRenderConfig.headerSelector.type === "toggle") { sSelectAllResourceTextID = bAllRowsSelected ? "TBL_DESELECT_ALL" : "TBL_SELECT_ALL"; } else if (mRenderConfig.headerSelector.type === "clear") { sSelectAllResourceTextID = "TBL_DESELECT_ALL"; } _writeAccText(oRm, sTableId, "ariaselectall", TableUtils.getResourceText(sSelectAllResourceTextID)); // aria label for row headers _writeAccText(oRm, sTableId, "ariarowheaderlabel", TableUtils.getResourceText("TBL_ROW_HEADER_LABEL")); // aria label for group rows _writeAccText(oRm, sTableId, "ariarowgrouplabel", TableUtils.getResourceText("TBL_ROW_GROUP_LABEL")); // aria label for grand total sums _writeAccText(oRm, sTableId, "ariagrandtotallabel", TableUtils.getResourceText("TBL_GRAND_TOTAL_ROW")); // aria label for group total sums _writeAccText(oRm, sTableId, "ariagrouptotallabel", TableUtils.getResourceText("TBL_GROUP_TOTAL_ROW")); // aria label for column row header _writeAccText(oRm, sTableId, "ariacolrowheaderlabel", TableUtils.getResourceText("TBL_ROW_COL_HEADER_LABEL")); // aria description for table row count _writeAccText(oRm, sTableId, "rownumberofrows"); // aria description for table column count _writeAccText(oRm, sTableId, "colnumberofcols"); // aria description for table cell content _writeAccText(oRm, sTableId, "cellacc"); // aria description for selected row _writeAccText(oRm, sTableId, "ariarowselected", TableUtils.getResourceText("TBL_ROW_DESC_SELECTED")); // aria description for column menu _writeAccText(oRm, sTableId, "ariacolmenu", TableUtils.getResourceText("TBL_COL_DESC_MENU")); // aria description for column header span _writeAccText(oRm, sTableId, "ariacolspan"); // aria description for a filtered column _writeAccText(oRm, sTableId, "ariacolfiltered", TableUtils.getResourceText("TBL_COL_DESC_FILTERED")); // aria description for a sorted column _writeAccText(oRm, sTableId, "ariacolsortedasc", TableUtils.getResourceText("TBL_COL_DESC_SORTED_ASC")); // aria description for a sorted column _writeAccText(oRm, sTableId, "ariacolsorteddes", TableUtils.getResourceText("TBL_COL_DESC_SORTED_DES")); // aria description for invalid table (table with overlay) _writeAccText(oRm, sTableId, "ariainvalid", TableUtils.getResourceText("TBL_TABLE_INVALID")); // aria description for column vsisiblity menu item (Show Column) _writeAccText(oRm, sTableId, "ariashowcolmenu", TableUtils.getResourceText("TBL_COL_VISBILITY_MENUITEM_SHOW")); // aria description for column vsisiblity menu item (Hide Column) _writeAccText(oRm, sTableId, "ariahidecolmenu", TableUtils.getResourceText("TBL_COL_VISBILITY_MENUITEM_HIDE")); // aria description for row expansion via keyboard _writeAccText(oRm, sTableId, "rowexpandtext", TableUtils.getResourceText("TBL_ROW_EXPAND_KEY")); // aria description for row collapse via keyboard _writeAccText(oRm, sTableId, "rowcollapsetext", TableUtils.getResourceText("TBL_ROW_COLLAPSE_KEY")); var oSelectionMode = oTable.getSelectionMode(); if (oSelectionMode !== SelectionMode.None) { // aria description for selection mode in table _writeAccText(oRm, sTableId, "ariaselection", TableUtils.getResourceText(oSelectionMode == SelectionMode.MultiToggle ? "TBL_TABLE_SELECTION_MULTI" : "TBL_TABLE_SELECTION_SINGLE")); } if (oTable.getComputedFixedColumnCount() > 0) { // aria description for fixed columns _writeAccText(oRm, sTableId, "ariafixedcolumn", TableUtils.getResourceText("TBL_FIXED_COLUMN")); } oRm.write("</div>"); }
[ "function", "(", "oRm", ",", "oTable", ")", "{", "if", "(", "!", "oTable", ".", "_getAccExtension", "(", ")", ".", "getAccMode", "(", ")", ")", "{", "return", ";", "}", "var", "sTableId", "=", "oTable", ".", "getId", "(", ")", ";", "oRm", ".", "write", "(", "\"<div class='sapUiTableHiddenTexts' style='display:none;' aria-hidden='true'>\"", ")", ";", "// aria description for the row and column count", "_writeAccText", "(", "oRm", ",", "sTableId", ",", "\"ariacount\"", ")", ";", "// aria description for toggling the edit mode", "_writeAccText", "(", "oRm", ",", "sTableId", ",", "\"toggleedit\"", ",", "TableUtils", ".", "getResourceText", "(", "\"TBL_TOGGLE_EDIT_KEY\"", ")", ")", ";", "// aria description for select all button", "var", "bAllRowsSelected", "=", "TableUtils", ".", "areAllRowsSelected", "(", "oTable", ")", ";", "var", "mRenderConfig", "=", "oTable", ".", "_oSelectionPlugin", ".", "getRenderConfig", "(", ")", ";", "var", "sSelectAllResourceTextID", ";", "if", "(", "mRenderConfig", ".", "headerSelector", ".", "type", "===", "\"toggle\"", ")", "{", "sSelectAllResourceTextID", "=", "bAllRowsSelected", "?", "\"TBL_DESELECT_ALL\"", ":", "\"TBL_SELECT_ALL\"", ";", "}", "else", "if", "(", "mRenderConfig", ".", "headerSelector", ".", "type", "===", "\"clear\"", ")", "{", "sSelectAllResourceTextID", "=", "\"TBL_DESELECT_ALL\"", ";", "}", "_writeAccText", "(", "oRm", ",", "sTableId", ",", "\"ariaselectall\"", ",", "TableUtils", ".", "getResourceText", "(", "sSelectAllResourceTextID", ")", ")", ";", "// aria label for row headers", "_writeAccText", "(", "oRm", ",", "sTableId", ",", "\"ariarowheaderlabel\"", ",", "TableUtils", ".", "getResourceText", "(", "\"TBL_ROW_HEADER_LABEL\"", ")", ")", ";", "// aria label for group rows", "_writeAccText", "(", "oRm", ",", "sTableId", ",", "\"ariarowgrouplabel\"", ",", "TableUtils", ".", "getResourceText", "(", "\"TBL_ROW_GROUP_LABEL\"", ")", ")", ";", "// aria label for grand total sums", "_writeAccText", "(", "oRm", ",", "sTableId", ",", "\"ariagrandtotallabel\"", ",", "TableUtils", ".", "getResourceText", "(", "\"TBL_GRAND_TOTAL_ROW\"", ")", ")", ";", "// aria label for group total sums", "_writeAccText", "(", "oRm", ",", "sTableId", ",", "\"ariagrouptotallabel\"", ",", "TableUtils", ".", "getResourceText", "(", "\"TBL_GROUP_TOTAL_ROW\"", ")", ")", ";", "// aria label for column row header", "_writeAccText", "(", "oRm", ",", "sTableId", ",", "\"ariacolrowheaderlabel\"", ",", "TableUtils", ".", "getResourceText", "(", "\"TBL_ROW_COL_HEADER_LABEL\"", ")", ")", ";", "// aria description for table row count", "_writeAccText", "(", "oRm", ",", "sTableId", ",", "\"rownumberofrows\"", ")", ";", "// aria description for table column count", "_writeAccText", "(", "oRm", ",", "sTableId", ",", "\"colnumberofcols\"", ")", ";", "// aria description for table cell content", "_writeAccText", "(", "oRm", ",", "sTableId", ",", "\"cellacc\"", ")", ";", "// aria description for selected row", "_writeAccText", "(", "oRm", ",", "sTableId", ",", "\"ariarowselected\"", ",", "TableUtils", ".", "getResourceText", "(", "\"TBL_ROW_DESC_SELECTED\"", ")", ")", ";", "// aria description for column menu", "_writeAccText", "(", "oRm", ",", "sTableId", ",", "\"ariacolmenu\"", ",", "TableUtils", ".", "getResourceText", "(", "\"TBL_COL_DESC_MENU\"", ")", ")", ";", "// aria description for column header span", "_writeAccText", "(", "oRm", ",", "sTableId", ",", "\"ariacolspan\"", ")", ";", "// aria description for a filtered column", "_writeAccText", "(", "oRm", ",", "sTableId", ",", "\"ariacolfiltered\"", ",", "TableUtils", ".", "getResourceText", "(", "\"TBL_COL_DESC_FILTERED\"", ")", ")", ";", "// aria description for a sorted column", "_writeAccText", "(", "oRm", ",", "sTableId", ",", "\"ariacolsortedasc\"", ",", "TableUtils", ".", "getResourceText", "(", "\"TBL_COL_DESC_SORTED_ASC\"", ")", ")", ";", "// aria description for a sorted column", "_writeAccText", "(", "oRm", ",", "sTableId", ",", "\"ariacolsorteddes\"", ",", "TableUtils", ".", "getResourceText", "(", "\"TBL_COL_DESC_SORTED_DES\"", ")", ")", ";", "// aria description for invalid table (table with overlay)", "_writeAccText", "(", "oRm", ",", "sTableId", ",", "\"ariainvalid\"", ",", "TableUtils", ".", "getResourceText", "(", "\"TBL_TABLE_INVALID\"", ")", ")", ";", "// aria description for column vsisiblity menu item (Show Column)", "_writeAccText", "(", "oRm", ",", "sTableId", ",", "\"ariashowcolmenu\"", ",", "TableUtils", ".", "getResourceText", "(", "\"TBL_COL_VISBILITY_MENUITEM_SHOW\"", ")", ")", ";", "// aria description for column vsisiblity menu item (Hide Column)", "_writeAccText", "(", "oRm", ",", "sTableId", ",", "\"ariahidecolmenu\"", ",", "TableUtils", ".", "getResourceText", "(", "\"TBL_COL_VISBILITY_MENUITEM_HIDE\"", ")", ")", ";", "// aria description for row expansion via keyboard", "_writeAccText", "(", "oRm", ",", "sTableId", ",", "\"rowexpandtext\"", ",", "TableUtils", ".", "getResourceText", "(", "\"TBL_ROW_EXPAND_KEY\"", ")", ")", ";", "// aria description for row collapse via keyboard", "_writeAccText", "(", "oRm", ",", "sTableId", ",", "\"rowcollapsetext\"", ",", "TableUtils", ".", "getResourceText", "(", "\"TBL_ROW_COLLAPSE_KEY\"", ")", ")", ";", "var", "oSelectionMode", "=", "oTable", ".", "getSelectionMode", "(", ")", ";", "if", "(", "oSelectionMode", "!==", "SelectionMode", ".", "None", ")", "{", "// aria description for selection mode in table", "_writeAccText", "(", "oRm", ",", "sTableId", ",", "\"ariaselection\"", ",", "TableUtils", ".", "getResourceText", "(", "oSelectionMode", "==", "SelectionMode", ".", "MultiToggle", "?", "\"TBL_TABLE_SELECTION_MULTI\"", ":", "\"TBL_TABLE_SELECTION_SINGLE\"", ")", ")", ";", "}", "if", "(", "oTable", ".", "getComputedFixedColumnCount", "(", ")", ">", "0", ")", "{", "// aria description for fixed columns", "_writeAccText", "(", "oRm", ",", "sTableId", ",", "\"ariafixedcolumn\"", ",", "TableUtils", ".", "getResourceText", "(", "\"TBL_FIXED_COLUMN\"", ")", ")", ";", "}", "oRm", ".", "write", "(", "\"</div>\"", ")", ";", "}" ]
Renders all necessary hidden text elements of the table. @param {sap.ui.core.RenderManager} oRm The RenderManager that can be used for writing to the Render-Output-Buffer. @param {sap.ui.table.Table} oTable Instance of the table. @public
[ "Renders", "all", "necessary", "hidden", "text", "elements", "of", "the", "table", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableAccRenderExtension.js#L63-L138
4,604
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableAccRenderExtension.js
function(oRm, oTable, sType, mParams) { var oExtension = oTable._getAccExtension(); if (!oExtension.getAccMode()) { return; } var mAttributes = oExtension.getAriaAttributesFor(sType, mParams); var oValue, sKey; for (sKey in mAttributes) { oValue = mAttributes[sKey]; if (Array.isArray(oValue)) { oValue = oValue.join(" "); } if (oValue) { oRm.writeAttributeEscaped(sKey, oValue); } } }
javascript
function(oRm, oTable, sType, mParams) { var oExtension = oTable._getAccExtension(); if (!oExtension.getAccMode()) { return; } var mAttributes = oExtension.getAriaAttributesFor(sType, mParams); var oValue, sKey; for (sKey in mAttributes) { oValue = mAttributes[sKey]; if (Array.isArray(oValue)) { oValue = oValue.join(" "); } if (oValue) { oRm.writeAttributeEscaped(sKey, oValue); } } }
[ "function", "(", "oRm", ",", "oTable", ",", "sType", ",", "mParams", ")", "{", "var", "oExtension", "=", "oTable", ".", "_getAccExtension", "(", ")", ";", "if", "(", "!", "oExtension", ".", "getAccMode", "(", ")", ")", "{", "return", ";", "}", "var", "mAttributes", "=", "oExtension", ".", "getAriaAttributesFor", "(", "sType", ",", "mParams", ")", ";", "var", "oValue", ",", "sKey", ";", "for", "(", "sKey", "in", "mAttributes", ")", "{", "oValue", "=", "mAttributes", "[", "sKey", "]", ";", "if", "(", "Array", ".", "isArray", "(", "oValue", ")", ")", "{", "oValue", "=", "oValue", ".", "join", "(", "\" \"", ")", ";", "}", "if", "(", "oValue", ")", "{", "oRm", ".", "writeAttributeEscaped", "(", "sKey", ",", "oValue", ")", ";", "}", "}", "}" ]
Renders the default aria attributes of the element with the given type and settings. @param {sap.ui.core.RenderManager} oRm The RenderManager that can be used for writing to the Render-Output-Buffer. @param {sap.ui.table.Table} oTable Instance of the table. @param {sap.ui.table.TableAccExtension.ELEMENTTYPES} sType The type of the table area to write the aria attributes for. @param {Object} mParams Accessibility parameters. @see sap.ui.table.TableAccExtension#getAriaAttributesFor @public
[ "Renders", "the", "default", "aria", "attributes", "of", "the", "element", "with", "the", "given", "type", "and", "settings", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableAccRenderExtension.js#L150-L169
4,605
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableAccRenderExtension.js
function(oRm, oTable, oRow, iRowIndex) { if (!oTable._getAccExtension().getAccMode()) { return; } var bIsSelected = oTable.isIndexSelected(iRowIndex); var mTooltipTexts = oTable._getAccExtension().getAriaTextsForSelectionMode(true); var sText = mTooltipTexts.keyboard[bIsSelected ? "rowDeselect" : "rowSelect"]; _writeAccText(oRm, oRow.getId(), "rowselecttext", oRow._bHidden ? "" : sText, ["sapUiTableAriaRowSel"]); }
javascript
function(oRm, oTable, oRow, iRowIndex) { if (!oTable._getAccExtension().getAccMode()) { return; } var bIsSelected = oTable.isIndexSelected(iRowIndex); var mTooltipTexts = oTable._getAccExtension().getAriaTextsForSelectionMode(true); var sText = mTooltipTexts.keyboard[bIsSelected ? "rowDeselect" : "rowSelect"]; _writeAccText(oRm, oRow.getId(), "rowselecttext", oRow._bHidden ? "" : sText, ["sapUiTableAriaRowSel"]); }
[ "function", "(", "oRm", ",", "oTable", ",", "oRow", ",", "iRowIndex", ")", "{", "if", "(", "!", "oTable", ".", "_getAccExtension", "(", ")", ".", "getAccMode", "(", ")", ")", "{", "return", ";", "}", "var", "bIsSelected", "=", "oTable", ".", "isIndexSelected", "(", "iRowIndex", ")", ";", "var", "mTooltipTexts", "=", "oTable", ".", "_getAccExtension", "(", ")", ".", "getAriaTextsForSelectionMode", "(", "true", ")", ";", "var", "sText", "=", "mTooltipTexts", ".", "keyboard", "[", "bIsSelected", "?", "\"rowDeselect\"", ":", "\"rowSelect\"", "]", ";", "_writeAccText", "(", "oRm", ",", "oRow", ".", "getId", "(", ")", ",", "\"rowselecttext\"", ",", "oRow", ".", "_bHidden", "?", "\"\"", ":", "sText", ",", "[", "\"sapUiTableAriaRowSel\"", "]", ")", ";", "}" ]
Renders the default row selector content. @param {sap.ui.core.RenderManager} oRm The RenderManager that can be used for writing to the Render-Output-Buffer. @param {sap.ui.table.Table} oTable Instance of the table. @param {sap.ui.table.Row} oRow Instance of the row. @param {int} iRowIndex The index of the row. @see sap.ui.table.TableRenderer.writeRowSelectorContent @public
[ "Renders", "the", "default", "row", "selector", "content", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableAccRenderExtension.js#L181-L191
4,606
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableAccRenderExtension.js
function(oRm, oTable, oRow, iRowIndex) { if (!oTable._getAccExtension().getAccMode()) { return; } var oRowSettings = oRow.getAggregation("_settings"); var sHighlightText = oRowSettings._getHighlightText(); _writeAccText(oRm, oRow.getId(), "highlighttext", sHighlightText); }
javascript
function(oRm, oTable, oRow, iRowIndex) { if (!oTable._getAccExtension().getAccMode()) { return; } var oRowSettings = oRow.getAggregation("_settings"); var sHighlightText = oRowSettings._getHighlightText(); _writeAccText(oRm, oRow.getId(), "highlighttext", sHighlightText); }
[ "function", "(", "oRm", ",", "oTable", ",", "oRow", ",", "iRowIndex", ")", "{", "if", "(", "!", "oTable", ".", "_getAccExtension", "(", ")", ".", "getAccMode", "(", ")", ")", "{", "return", ";", "}", "var", "oRowSettings", "=", "oRow", ".", "getAggregation", "(", "\"_settings\"", ")", ";", "var", "sHighlightText", "=", "oRowSettings", ".", "_getHighlightText", "(", ")", ";", "_writeAccText", "(", "oRm", ",", "oRow", ".", "getId", "(", ")", ",", "\"highlighttext\"", ",", "sHighlightText", ")", ";", "}" ]
Renders the default row highlight content. @param {sap.ui.core.RenderManager} oRm The RenderManager that can be used for writing to the Render-Output-Buffer. @param {sap.ui.table.Table} oTable Instance of the table. @param {sap.ui.table.Row} oRow Instance of the row. @param {int} iRowIndex The index of the row. @see sap.ui.table.TableRenderer#writeRowHighlightContent @public
[ "Renders", "the", "default", "row", "highlight", "content", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableAccRenderExtension.js#L203-L212
4,607
SAP/openui5
src/sap.ui.table/src/sap/ui/table/TableAccRenderExtension.js
function(oRm, oTable, oCreationRow) { if (!oTable._getAccExtension().getAccMode()) { return; } _writeAccText(oRm, oCreationRow.getId(), "label", TableUtils.getResourceText("TBL_CREATEROW_LABEL")); }
javascript
function(oRm, oTable, oCreationRow) { if (!oTable._getAccExtension().getAccMode()) { return; } _writeAccText(oRm, oCreationRow.getId(), "label", TableUtils.getResourceText("TBL_CREATEROW_LABEL")); }
[ "function", "(", "oRm", ",", "oTable", ",", "oCreationRow", ")", "{", "if", "(", "!", "oTable", ".", "_getAccExtension", "(", ")", ".", "getAccMode", "(", ")", ")", "{", "return", ";", "}", "_writeAccText", "(", "oRm", ",", "oCreationRow", ".", "getId", "(", ")", ",", "\"label\"", ",", "TableUtils", ".", "getResourceText", "(", "\"TBL_CREATEROW_LABEL\"", ")", ")", ";", "}" ]
Renders the hidden label for a creation row. @param {sap.ui.core.RenderManager} oRm The RenderManager that can be used for writing to the Render-Output-Buffer. @param {sap.ui.table.Table} oTable Instance of the table. @param {sap.ui.table.CreationRow} oCreationRow Instance of the creation row. @see sap.ui.table.CreationRowRenderer#render @public
[ "Renders", "the", "hidden", "label", "for", "a", "creation", "row", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.table/src/sap/ui/table/TableAccRenderExtension.js#L223-L229
4,608
SAP/openui5
src/sap.m/src/sap/m/changeHandler/MoveTableColumns.js
_applyChange
function _applyChange(oChange, oRelevantContainer, mPropertyBag, fnIterator) { var oModifier = mPropertyBag.modifier, oView = mPropertyBag.view, oAppComponent = mPropertyBag.appComponent, oChangeContent = oChange.getContent(), oTargetSource = oChange.getDependentControl(SOURCE_ALIAS, mPropertyBag), oTable = oChange.getDependentControl(TARGET_ALIAS, mPropertyBag), aColumns = oModifier.getAggregation(oTable, COLUMNS_AGGREGATION_NAME), switchCells = function (oRow, iSourceIndex, iTargetIndex) { var aCells = oModifier.getAggregation(oRow, CELLS_AGGREGATION_NAME); // ColumnListItem and GroupHeaderListItem are only allowed for the tables items aggregation. if (!aCells) { Log.warning("Aggregation cells to move not found"); return; } if (iSourceIndex < 0 || iSourceIndex >= aCells.length) { Log.warning("Move cells in table item called with invalid index: " + iSourceIndex); return; } var oMovedCell = aCells[iSourceIndex]; oModifier.removeAggregation(oRow, CELLS_AGGREGATION_NAME, oMovedCell); oModifier.insertAggregation(oRow, CELLS_AGGREGATION_NAME, oMovedCell, iTargetIndex, oView); }, moveColumns = function (iSourceIndex, iTargetIndex) { oModifier.getAggregation(oTable, ITEMS_AGGREGATION_NAME).forEach(function (oItem) { // We are skipping the GroupHeaderListItems, because they are valid for the whole row and does not have cells to move. if (oModifier.getControlType(oItem) === "sap.m.GroupHeaderListItem") { return; } switchCells(oItem, iSourceIndex, iTargetIndex); }); }; if (oTargetSource !== oTable) { Log.warning("Moving columns between different tables is not yet supported."); return false; } // Fetch the information about the movedElements together with the source and target index. oChangeContent.movedElements.forEach(function (mMovedElement) { var oMovedElement = oModifier.bySelector(mMovedElement.selector, oAppComponent, oView), iSourceIndex, iTargetIndex, iCurrentIndexInAggregation, iStoredSourceIndexInChange, sMovedElementId; if (!oMovedElement) { sMovedElementId = mMovedElement.selector && mMovedElement.selector.id; Log.warning("The table column with id: '" + sMovedElementId + "' stored in the change is not found and the move operation cannot be applied"); return; } iCurrentIndexInAggregation = aColumns.indexOf(oMovedElement); iStoredSourceIndexInChange = mMovedElement.sourceIndex; iTargetIndex = jQuery.isFunction(fnIterator) && fnIterator(iCurrentIndexInAggregation); iTargetIndex = jQuery.isNumeric(iTargetIndex) ? iTargetIndex : mMovedElement.targetIndex; if (iCurrentIndexInAggregation !== iTargetIndex) { // By default we are getting the index from the aggregation, because it is possible that the order is // already modified and the column that we want to move is not on the passed source index iSourceIndex = iCurrentIndexInAggregation; } else { // In RTA edit mode, the condition will be false, because the aggregation is modified by the drag and drop action. // Therefore, we need to use the passed source index iSourceIndex = iStoredSourceIndexInChange; } // move children in `columns` aggregation oModifier.removeAggregation(oTable, COLUMNS_AGGREGATION_NAME, oMovedElement); oModifier.insertAggregation(oTable, COLUMNS_AGGREGATION_NAME, oMovedElement, iTargetIndex, oView); // move children in `items` aggregation (actual content) var oTemplate = oModifier.getBindingTemplate(oTable, ITEMS_AGGREGATION_NAME); if (oTemplate) { switchCells(oTemplate, iSourceIndex, iTargetIndex); oModifier.updateAggregation(oTable, ITEMS_AGGREGATION_NAME); } else { moveColumns(iSourceIndex, iTargetIndex); } }, this); return true; }
javascript
function _applyChange(oChange, oRelevantContainer, mPropertyBag, fnIterator) { var oModifier = mPropertyBag.modifier, oView = mPropertyBag.view, oAppComponent = mPropertyBag.appComponent, oChangeContent = oChange.getContent(), oTargetSource = oChange.getDependentControl(SOURCE_ALIAS, mPropertyBag), oTable = oChange.getDependentControl(TARGET_ALIAS, mPropertyBag), aColumns = oModifier.getAggregation(oTable, COLUMNS_AGGREGATION_NAME), switchCells = function (oRow, iSourceIndex, iTargetIndex) { var aCells = oModifier.getAggregation(oRow, CELLS_AGGREGATION_NAME); // ColumnListItem and GroupHeaderListItem are only allowed for the tables items aggregation. if (!aCells) { Log.warning("Aggregation cells to move not found"); return; } if (iSourceIndex < 0 || iSourceIndex >= aCells.length) { Log.warning("Move cells in table item called with invalid index: " + iSourceIndex); return; } var oMovedCell = aCells[iSourceIndex]; oModifier.removeAggregation(oRow, CELLS_AGGREGATION_NAME, oMovedCell); oModifier.insertAggregation(oRow, CELLS_AGGREGATION_NAME, oMovedCell, iTargetIndex, oView); }, moveColumns = function (iSourceIndex, iTargetIndex) { oModifier.getAggregation(oTable, ITEMS_AGGREGATION_NAME).forEach(function (oItem) { // We are skipping the GroupHeaderListItems, because they are valid for the whole row and does not have cells to move. if (oModifier.getControlType(oItem) === "sap.m.GroupHeaderListItem") { return; } switchCells(oItem, iSourceIndex, iTargetIndex); }); }; if (oTargetSource !== oTable) { Log.warning("Moving columns between different tables is not yet supported."); return false; } // Fetch the information about the movedElements together with the source and target index. oChangeContent.movedElements.forEach(function (mMovedElement) { var oMovedElement = oModifier.bySelector(mMovedElement.selector, oAppComponent, oView), iSourceIndex, iTargetIndex, iCurrentIndexInAggregation, iStoredSourceIndexInChange, sMovedElementId; if (!oMovedElement) { sMovedElementId = mMovedElement.selector && mMovedElement.selector.id; Log.warning("The table column with id: '" + sMovedElementId + "' stored in the change is not found and the move operation cannot be applied"); return; } iCurrentIndexInAggregation = aColumns.indexOf(oMovedElement); iStoredSourceIndexInChange = mMovedElement.sourceIndex; iTargetIndex = jQuery.isFunction(fnIterator) && fnIterator(iCurrentIndexInAggregation); iTargetIndex = jQuery.isNumeric(iTargetIndex) ? iTargetIndex : mMovedElement.targetIndex; if (iCurrentIndexInAggregation !== iTargetIndex) { // By default we are getting the index from the aggregation, because it is possible that the order is // already modified and the column that we want to move is not on the passed source index iSourceIndex = iCurrentIndexInAggregation; } else { // In RTA edit mode, the condition will be false, because the aggregation is modified by the drag and drop action. // Therefore, we need to use the passed source index iSourceIndex = iStoredSourceIndexInChange; } // move children in `columns` aggregation oModifier.removeAggregation(oTable, COLUMNS_AGGREGATION_NAME, oMovedElement); oModifier.insertAggregation(oTable, COLUMNS_AGGREGATION_NAME, oMovedElement, iTargetIndex, oView); // move children in `items` aggregation (actual content) var oTemplate = oModifier.getBindingTemplate(oTable, ITEMS_AGGREGATION_NAME); if (oTemplate) { switchCells(oTemplate, iSourceIndex, iTargetIndex); oModifier.updateAggregation(oTable, ITEMS_AGGREGATION_NAME); } else { moveColumns(iSourceIndex, iTargetIndex); } }, this); return true; }
[ "function", "_applyChange", "(", "oChange", ",", "oRelevantContainer", ",", "mPropertyBag", ",", "fnIterator", ")", "{", "var", "oModifier", "=", "mPropertyBag", ".", "modifier", ",", "oView", "=", "mPropertyBag", ".", "view", ",", "oAppComponent", "=", "mPropertyBag", ".", "appComponent", ",", "oChangeContent", "=", "oChange", ".", "getContent", "(", ")", ",", "oTargetSource", "=", "oChange", ".", "getDependentControl", "(", "SOURCE_ALIAS", ",", "mPropertyBag", ")", ",", "oTable", "=", "oChange", ".", "getDependentControl", "(", "TARGET_ALIAS", ",", "mPropertyBag", ")", ",", "aColumns", "=", "oModifier", ".", "getAggregation", "(", "oTable", ",", "COLUMNS_AGGREGATION_NAME", ")", ",", "switchCells", "=", "function", "(", "oRow", ",", "iSourceIndex", ",", "iTargetIndex", ")", "{", "var", "aCells", "=", "oModifier", ".", "getAggregation", "(", "oRow", ",", "CELLS_AGGREGATION_NAME", ")", ";", "// ColumnListItem and GroupHeaderListItem are only allowed for the tables items aggregation.", "if", "(", "!", "aCells", ")", "{", "Log", ".", "warning", "(", "\"Aggregation cells to move not found\"", ")", ";", "return", ";", "}", "if", "(", "iSourceIndex", "<", "0", "||", "iSourceIndex", ">=", "aCells", ".", "length", ")", "{", "Log", ".", "warning", "(", "\"Move cells in table item called with invalid index: \"", "+", "iSourceIndex", ")", ";", "return", ";", "}", "var", "oMovedCell", "=", "aCells", "[", "iSourceIndex", "]", ";", "oModifier", ".", "removeAggregation", "(", "oRow", ",", "CELLS_AGGREGATION_NAME", ",", "oMovedCell", ")", ";", "oModifier", ".", "insertAggregation", "(", "oRow", ",", "CELLS_AGGREGATION_NAME", ",", "oMovedCell", ",", "iTargetIndex", ",", "oView", ")", ";", "}", ",", "moveColumns", "=", "function", "(", "iSourceIndex", ",", "iTargetIndex", ")", "{", "oModifier", ".", "getAggregation", "(", "oTable", ",", "ITEMS_AGGREGATION_NAME", ")", ".", "forEach", "(", "function", "(", "oItem", ")", "{", "// We are skipping the GroupHeaderListItems, because they are valid for the whole row and does not have cells to move.", "if", "(", "oModifier", ".", "getControlType", "(", "oItem", ")", "===", "\"sap.m.GroupHeaderListItem\"", ")", "{", "return", ";", "}", "switchCells", "(", "oItem", ",", "iSourceIndex", ",", "iTargetIndex", ")", ";", "}", ")", ";", "}", ";", "if", "(", "oTargetSource", "!==", "oTable", ")", "{", "Log", ".", "warning", "(", "\"Moving columns between different tables is not yet supported.\"", ")", ";", "return", "false", ";", "}", "// Fetch the information about the movedElements together with the source and target index.", "oChangeContent", ".", "movedElements", ".", "forEach", "(", "function", "(", "mMovedElement", ")", "{", "var", "oMovedElement", "=", "oModifier", ".", "bySelector", "(", "mMovedElement", ".", "selector", ",", "oAppComponent", ",", "oView", ")", ",", "iSourceIndex", ",", "iTargetIndex", ",", "iCurrentIndexInAggregation", ",", "iStoredSourceIndexInChange", ",", "sMovedElementId", ";", "if", "(", "!", "oMovedElement", ")", "{", "sMovedElementId", "=", "mMovedElement", ".", "selector", "&&", "mMovedElement", ".", "selector", ".", "id", ";", "Log", ".", "warning", "(", "\"The table column with id: '\"", "+", "sMovedElementId", "+", "\"' stored in the change is not found and the move operation cannot be applied\"", ")", ";", "return", ";", "}", "iCurrentIndexInAggregation", "=", "aColumns", ".", "indexOf", "(", "oMovedElement", ")", ";", "iStoredSourceIndexInChange", "=", "mMovedElement", ".", "sourceIndex", ";", "iTargetIndex", "=", "jQuery", ".", "isFunction", "(", "fnIterator", ")", "&&", "fnIterator", "(", "iCurrentIndexInAggregation", ")", ";", "iTargetIndex", "=", "jQuery", ".", "isNumeric", "(", "iTargetIndex", ")", "?", "iTargetIndex", ":", "mMovedElement", ".", "targetIndex", ";", "if", "(", "iCurrentIndexInAggregation", "!==", "iTargetIndex", ")", "{", "// By default we are getting the index from the aggregation, because it is possible that the order is", "// already modified and the column that we want to move is not on the passed source index", "iSourceIndex", "=", "iCurrentIndexInAggregation", ";", "}", "else", "{", "// In RTA edit mode, the condition will be false, because the aggregation is modified by the drag and drop action.", "// Therefore, we need to use the passed source index", "iSourceIndex", "=", "iStoredSourceIndexInChange", ";", "}", "// move children in `columns` aggregation", "oModifier", ".", "removeAggregation", "(", "oTable", ",", "COLUMNS_AGGREGATION_NAME", ",", "oMovedElement", ")", ";", "oModifier", ".", "insertAggregation", "(", "oTable", ",", "COLUMNS_AGGREGATION_NAME", ",", "oMovedElement", ",", "iTargetIndex", ",", "oView", ")", ";", "// move children in `items` aggregation (actual content)", "var", "oTemplate", "=", "oModifier", ".", "getBindingTemplate", "(", "oTable", ",", "ITEMS_AGGREGATION_NAME", ")", ";", "if", "(", "oTemplate", ")", "{", "switchCells", "(", "oTemplate", ",", "iSourceIndex", ",", "iTargetIndex", ")", ";", "oModifier", ".", "updateAggregation", "(", "oTable", ",", "ITEMS_AGGREGATION_NAME", ")", ";", "}", "else", "{", "moveColumns", "(", "iSourceIndex", ",", "iTargetIndex", ")", ";", "}", "}", ",", "this", ")", ";", "return", "true", ";", "}" ]
Moves a column from one index to another. @param {sap.ui.fl.Change} oChange Change object with instructions to be applied on the control @param {sap.ui.core.Control} oRelevantContainer Control that matches the change selector for applying the change, which is the source of the move @param {object} mPropertyBag Map of properties @param {object} mPropertyBag.view XML node representing a ui5 view @param {sap.ui.core.util.reflection.BaseTreeModifier} mPropertyBag.modifier Modifier for the controls @param {sap.ui.core.UIComponent} mPropertyBag.appComponent AppComponent @param {function} fnIterator - Iterator function which is called on each movedElement, as an argument it gets CurrentIndex of the element and may return TargetIndex as a result. @return {boolean} true Indicates whether the change can be applied
[ "Moves", "a", "column", "from", "one", "index", "to", "another", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/changeHandler/MoveTableColumns.js#L37-L121
4,609
SAP/openui5
src/sap.ui.core/src/sap/ui/core/support/debugReboot.js
function(oScript, rRegex) { if (oScript && oScript.getAttribute("src") && rRegex.exec(oScript.getAttribute("src"))) { return oScript; } }
javascript
function(oScript, rRegex) { if (oScript && oScript.getAttribute("src") && rRegex.exec(oScript.getAttribute("src"))) { return oScript; } }
[ "function", "(", "oScript", ",", "rRegex", ")", "{", "if", "(", "oScript", "&&", "oScript", ".", "getAttribute", "(", "\"src\"", ")", "&&", "rRegex", ".", "exec", "(", "oScript", ".", "getAttribute", "(", "\"src\"", ")", ")", ")", "{", "return", "oScript", ";", "}", "}" ]
replace the bootstrap tag with a newly created script tag to enable restarting the core from a different server
[ "replace", "the", "bootstrap", "tag", "with", "a", "newly", "created", "script", "tag", "to", "enable", "restarting", "the", "core", "from", "a", "different", "server" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/support/debugReboot.js#L56-L60
4,610
SAP/openui5
src/sap.ui.core/src/sap/ui/core/CustomizingConfiguration.js
findConfig
function findConfig(sType, vObject, fnCheck) { var sComponentId = vObject && typeof vObject === "string" ? vObject : (vObject && Component.getOwnerIdFor(vObject)); if (sComponentId) { // if a component name is given only the component customizing // configuration is checked - the customizing configuration is // merged in case of extending components - so the configuration // should be available properly var oComponent = Component.get(sComponentId); var sComponentName = oComponent && oComponent.getMetadata().getComponentName(); // starting with manifest first we need to check the instance // specific configuration first and fallback to the general // customizing configuration of the component var oConfig = mComponentConfigs[sComponentName + "::" + sComponentId]; if (oConfig && oConfig[sType] && fnCheck(oConfig[sType])) { return false; } else { oConfig = mComponentConfigs[sComponentName]; if (oConfig && oConfig[sType] && fnCheck(oConfig[sType])) { return false; } } } else { // TODO: checking order of components? jQuery.each(mComponentConfigs, function(sComponentName, oConfig) { if (oConfig && oConfig[sType] && fnCheck(oConfig[sType])) { return false; } }); } }
javascript
function findConfig(sType, vObject, fnCheck) { var sComponentId = vObject && typeof vObject === "string" ? vObject : (vObject && Component.getOwnerIdFor(vObject)); if (sComponentId) { // if a component name is given only the component customizing // configuration is checked - the customizing configuration is // merged in case of extending components - so the configuration // should be available properly var oComponent = Component.get(sComponentId); var sComponentName = oComponent && oComponent.getMetadata().getComponentName(); // starting with manifest first we need to check the instance // specific configuration first and fallback to the general // customizing configuration of the component var oConfig = mComponentConfigs[sComponentName + "::" + sComponentId]; if (oConfig && oConfig[sType] && fnCheck(oConfig[sType])) { return false; } else { oConfig = mComponentConfigs[sComponentName]; if (oConfig && oConfig[sType] && fnCheck(oConfig[sType])) { return false; } } } else { // TODO: checking order of components? jQuery.each(mComponentConfigs, function(sComponentName, oConfig) { if (oConfig && oConfig[sType] && fnCheck(oConfig[sType])) { return false; } }); } }
[ "function", "findConfig", "(", "sType", ",", "vObject", ",", "fnCheck", ")", "{", "var", "sComponentId", "=", "vObject", "&&", "typeof", "vObject", "===", "\"string\"", "?", "vObject", ":", "(", "vObject", "&&", "Component", ".", "getOwnerIdFor", "(", "vObject", ")", ")", ";", "if", "(", "sComponentId", ")", "{", "// if a component name is given only the component customizing", "// configuration is checked - the customizing configuration is", "// merged in case of extending components - so the configuration", "// should be available properly", "var", "oComponent", "=", "Component", ".", "get", "(", "sComponentId", ")", ";", "var", "sComponentName", "=", "oComponent", "&&", "oComponent", ".", "getMetadata", "(", ")", ".", "getComponentName", "(", ")", ";", "// starting with manifest first we need to check the instance", "// specific configuration first and fallback to the general", "// customizing configuration of the component", "var", "oConfig", "=", "mComponentConfigs", "[", "sComponentName", "+", "\"::\"", "+", "sComponentId", "]", ";", "if", "(", "oConfig", "&&", "oConfig", "[", "sType", "]", "&&", "fnCheck", "(", "oConfig", "[", "sType", "]", ")", ")", "{", "return", "false", ";", "}", "else", "{", "oConfig", "=", "mComponentConfigs", "[", "sComponentName", "]", ";", "if", "(", "oConfig", "&&", "oConfig", "[", "sType", "]", "&&", "fnCheck", "(", "oConfig", "[", "sType", "]", ")", ")", "{", "return", "false", ";", "}", "}", "}", "else", "{", "// TODO: checking order of components?", "jQuery", ".", "each", "(", "mComponentConfigs", ",", "function", "(", "sComponentName", ",", "oConfig", ")", "{", "if", "(", "oConfig", "&&", "oConfig", "[", "sType", "]", "&&", "fnCheck", "(", "oConfig", "[", "sType", "]", ")", ")", "{", "return", "false", ";", "}", "}", ")", ";", "}", "}" ]
Finds the config in the given type and use the check function to validate if the correct entry has been found! @param {string} sType Name of the config section @param {string|sap.ui.base.ManagedObject} vObject Component ID or ManagedObject @param {function} fnCheck Check function
[ "Finds", "the", "config", "in", "the", "given", "type", "and", "use", "the", "check", "function", "to", "validate", "if", "the", "correct", "entry", "has", "been", "found!" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/CustomizingConfiguration.js#L35-L64
4,611
SAP/openui5
src/sap.ui.core/src/sap/ui/core/CustomizingConfiguration.js
function(sComponentName) { Log.info("CustomizingConfiguration: activateForComponent('" + sComponentName + "')"); var sFullComponentName = sComponentName + ".Component"; sap.ui.requireSync(sFullComponentName.replace(/\./g, "/")); var oCustomizingConfig = ObjectPath.get(sFullComponentName).getMetadata().getCustomizing(); mComponentConfigs[sComponentName] = oCustomizingConfig; Log.debug("CustomizingConfiguration: customizing configuration for component '" + sComponentName + "' loaded: " + JSON.stringify(oCustomizingConfig)); }
javascript
function(sComponentName) { Log.info("CustomizingConfiguration: activateForComponent('" + sComponentName + "')"); var sFullComponentName = sComponentName + ".Component"; sap.ui.requireSync(sFullComponentName.replace(/\./g, "/")); var oCustomizingConfig = ObjectPath.get(sFullComponentName).getMetadata().getCustomizing(); mComponentConfigs[sComponentName] = oCustomizingConfig; Log.debug("CustomizingConfiguration: customizing configuration for component '" + sComponentName + "' loaded: " + JSON.stringify(oCustomizingConfig)); }
[ "function", "(", "sComponentName", ")", "{", "Log", ".", "info", "(", "\"CustomizingConfiguration: activateForComponent('\"", "+", "sComponentName", "+", "\"')\"", ")", ";", "var", "sFullComponentName", "=", "sComponentName", "+", "\".Component\"", ";", "sap", ".", "ui", ".", "requireSync", "(", "sFullComponentName", ".", "replace", "(", "/", "\\.", "/", "g", ",", "\"/\"", ")", ")", ";", "var", "oCustomizingConfig", "=", "ObjectPath", ".", "get", "(", "sFullComponentName", ")", ".", "getMetadata", "(", ")", ".", "getCustomizing", "(", ")", ";", "mComponentConfigs", "[", "sComponentName", "]", "=", "oCustomizingConfig", ";", "Log", ".", "debug", "(", "\"CustomizingConfiguration: customizing configuration for component '\"", "+", "sComponentName", "+", "\"' loaded: \"", "+", "JSON", ".", "stringify", "(", "oCustomizingConfig", ")", ")", ";", "}" ]
Activates the Customizing of a component by registering the component configuration in the central customizing configuration. @param {string} sComponentName the name of the component @private
[ "Activates", "the", "Customizing", "of", "a", "component", "by", "registering", "the", "component", "configuration", "in", "the", "central", "customizing", "configuration", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/CustomizingConfiguration.js#L98-L106
4,612
SAP/openui5
src/sap.ui.core/src/sap/ui/core/CustomizingConfiguration.js
function(oComponent) { Log.info("CustomizingConfiguration: activateForComponentInstance('" + oComponent.getId() + "')"); var sComponentName = oComponent.getMetadata().getComponentName(), sKey = sComponentName + "::" + oComponent.getId(), oCustomizingConfig = oComponent.getManifest()["sap.ui5"] && oComponent.getManifest()["sap.ui5"]["extends"] && oComponent.getManifest()["sap.ui5"]["extends"]["extensions"]; mComponentConfigs[sKey] = oCustomizingConfig; Log.debug("CustomizingConfiguration: customizing configuration for component '" + sKey + "' loaded: " + JSON.stringify(oCustomizingConfig)); }
javascript
function(oComponent) { Log.info("CustomizingConfiguration: activateForComponentInstance('" + oComponent.getId() + "')"); var sComponentName = oComponent.getMetadata().getComponentName(), sKey = sComponentName + "::" + oComponent.getId(), oCustomizingConfig = oComponent.getManifest()["sap.ui5"] && oComponent.getManifest()["sap.ui5"]["extends"] && oComponent.getManifest()["sap.ui5"]["extends"]["extensions"]; mComponentConfigs[sKey] = oCustomizingConfig; Log.debug("CustomizingConfiguration: customizing configuration for component '" + sKey + "' loaded: " + JSON.stringify(oCustomizingConfig)); }
[ "function", "(", "oComponent", ")", "{", "Log", ".", "info", "(", "\"CustomizingConfiguration: activateForComponentInstance('\"", "+", "oComponent", ".", "getId", "(", ")", "+", "\"')\"", ")", ";", "var", "sComponentName", "=", "oComponent", ".", "getMetadata", "(", ")", ".", "getComponentName", "(", ")", ",", "sKey", "=", "sComponentName", "+", "\"::\"", "+", "oComponent", ".", "getId", "(", ")", ",", "oCustomizingConfig", "=", "oComponent", ".", "getManifest", "(", ")", "[", "\"sap.ui5\"", "]", "&&", "oComponent", ".", "getManifest", "(", ")", "[", "\"sap.ui5\"", "]", "[", "\"extends\"", "]", "&&", "oComponent", ".", "getManifest", "(", ")", "[", "\"sap.ui5\"", "]", "[", "\"extends\"", "]", "[", "\"extensions\"", "]", ";", "mComponentConfigs", "[", "sKey", "]", "=", "oCustomizingConfig", ";", "Log", ".", "debug", "(", "\"CustomizingConfiguration: customizing configuration for component '\"", "+", "sKey", "+", "\"' loaded: \"", "+", "JSON", ".", "stringify", "(", "oCustomizingConfig", ")", ")", ";", "}" ]
Activates the Customizing of a component instance by registering the component configuration in the central Customizing configuration. @param {sap.ui.core.Component} oComponent the component instance @private
[ "Activates", "the", "Customizing", "of", "a", "component", "instance", "by", "registering", "the", "component", "configuration", "in", "the", "central", "Customizing", "configuration", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/CustomizingConfiguration.js#L127-L135
4,613
SAP/openui5
src/sap.ui.core/src/sap/ui/core/CustomizingConfiguration.js
function(oComponent) { var sComponentName = oComponent.getMetadata().getComponentName(), sKey = sComponentName + "::" + oComponent.getId(); if (mComponentConfigs[sKey]) { Log.info("CustomizingConfiguration: deactivateForComponent('" + sKey + "')"); delete mComponentConfigs[sKey]; } }
javascript
function(oComponent) { var sComponentName = oComponent.getMetadata().getComponentName(), sKey = sComponentName + "::" + oComponent.getId(); if (mComponentConfigs[sKey]) { Log.info("CustomizingConfiguration: deactivateForComponent('" + sKey + "')"); delete mComponentConfigs[sKey]; } }
[ "function", "(", "oComponent", ")", "{", "var", "sComponentName", "=", "oComponent", ".", "getMetadata", "(", ")", ".", "getComponentName", "(", ")", ",", "sKey", "=", "sComponentName", "+", "\"::\"", "+", "oComponent", ".", "getId", "(", ")", ";", "if", "(", "mComponentConfigs", "[", "sKey", "]", ")", "{", "Log", ".", "info", "(", "\"CustomizingConfiguration: deactivateForComponent('\"", "+", "sKey", "+", "\"')\"", ")", ";", "delete", "mComponentConfigs", "[", "sKey", "]", ";", "}", "}" ]
Deactivates the Customizing of a component instance by removing the component configuration in the central Customizing configuration. @param {sap.ui.core.Component} oComponent the component instance @private
[ "Deactivates", "the", "Customizing", "of", "a", "component", "instance", "by", "removing", "the", "component", "configuration", "in", "the", "central", "Customizing", "configuration", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/CustomizingConfiguration.js#L143-L150
4,614
SAP/openui5
src/sap.ui.core/src/sap/ui/core/CustomizingConfiguration.js
function(sViewName, vObject) { var oResultConfig; // TODO: checking order of components? findConfig(CONFIG_VIEW_REPLACEMENTS, vObject, function(oConfig) { oResultConfig = oConfig[sViewName]; return !!oResultConfig; }); return oResultConfig; }
javascript
function(sViewName, vObject) { var oResultConfig; // TODO: checking order of components? findConfig(CONFIG_VIEW_REPLACEMENTS, vObject, function(oConfig) { oResultConfig = oConfig[sViewName]; return !!oResultConfig; }); return oResultConfig; }
[ "function", "(", "sViewName", ",", "vObject", ")", "{", "var", "oResultConfig", ";", "// TODO: checking order of components?", "findConfig", "(", "CONFIG_VIEW_REPLACEMENTS", ",", "vObject", ",", "function", "(", "oConfig", ")", "{", "oResultConfig", "=", "oConfig", "[", "sViewName", "]", ";", "return", "!", "!", "oResultConfig", ";", "}", ")", ";", "return", "oResultConfig", ";", "}" ]
returns the configuration of the replacement View or undefined @private
[ "returns", "the", "configuration", "of", "the", "replacement", "View", "or", "undefined" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/CustomizingConfiguration.js#L156-L164
4,615
SAP/openui5
src/sap.ui.core/src/sap/ui/core/CustomizingConfiguration.js
function(sViewName, sExtensionPointName, vObject) { // FIXME: currently ONE extension wins, but they should be somehow merged - but how to define the order? var oResultConfig; // TODO: checking order of components? findConfig(CONFIG_VIEW_EXTENSIONS, vObject, function(oConfig) { oResultConfig = oConfig[sViewName] && oConfig[sViewName][sExtensionPointName]; return !!oResultConfig; }); return oResultConfig; }
javascript
function(sViewName, sExtensionPointName, vObject) { // FIXME: currently ONE extension wins, but they should be somehow merged - but how to define the order? var oResultConfig; // TODO: checking order of components? findConfig(CONFIG_VIEW_EXTENSIONS, vObject, function(oConfig) { oResultConfig = oConfig[sViewName] && oConfig[sViewName][sExtensionPointName]; return !!oResultConfig; }); return oResultConfig; }
[ "function", "(", "sViewName", ",", "sExtensionPointName", ",", "vObject", ")", "{", "// FIXME: currently ONE extension wins, but they should be somehow merged - but how to define the order?", "var", "oResultConfig", ";", "// TODO: checking order of components?", "findConfig", "(", "CONFIG_VIEW_EXTENSIONS", ",", "vObject", ",", "function", "(", "oConfig", ")", "{", "oResultConfig", "=", "oConfig", "[", "sViewName", "]", "&&", "oConfig", "[", "sViewName", "]", "[", "sExtensionPointName", "]", ";", "return", "!", "!", "oResultConfig", ";", "}", ")", ";", "return", "oResultConfig", ";", "}" ]
returns the configuration of the given extension point or undefined @private
[ "returns", "the", "configuration", "of", "the", "given", "extension", "point", "or", "undefined" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/CustomizingConfiguration.js#L170-L178
4,616
SAP/openui5
src/sap.ui.core/src/sap/ui/core/CustomizingConfiguration.js
function(sControllerName, vObject) { var oResultConfig; findConfig(CONFIG_CONTROLLER_EXTENSIONS, vObject, function(oConfig) { oResultConfig = oConfig[sControllerName]; return !!oResultConfig; }); return oResultConfig; }
javascript
function(sControllerName, vObject) { var oResultConfig; findConfig(CONFIG_CONTROLLER_EXTENSIONS, vObject, function(oConfig) { oResultConfig = oConfig[sControllerName]; return !!oResultConfig; }); return oResultConfig; }
[ "function", "(", "sControllerName", ",", "vObject", ")", "{", "var", "oResultConfig", ";", "findConfig", "(", "CONFIG_CONTROLLER_EXTENSIONS", ",", "vObject", ",", "function", "(", "oConfig", ")", "{", "oResultConfig", "=", "oConfig", "[", "sControllerName", "]", ";", "return", "!", "!", "oResultConfig", ";", "}", ")", ";", "return", "oResultConfig", ";", "}" ]
returns the configuration of the controller extensions for the given controller name @private
[ "returns", "the", "configuration", "of", "the", "controller", "extensions", "for", "the", "given", "controller", "name" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/CustomizingConfiguration.js#L185-L192
4,617
SAP/openui5
src/sap.ui.core/src/sap/ui/core/CustomizingConfiguration.js
function(sControllerName, vObject) { var oResultConfig; findConfig(CONFIG_CONTROLLER_REPLACEMENTS, vObject, function(oConfig) { oResultConfig = oConfig[sControllerName]; return !!oResultConfig; }); return oResultConfig; }
javascript
function(sControllerName, vObject) { var oResultConfig; findConfig(CONFIG_CONTROLLER_REPLACEMENTS, vObject, function(oConfig) { oResultConfig = oConfig[sControllerName]; return !!oResultConfig; }); return oResultConfig; }
[ "function", "(", "sControllerName", ",", "vObject", ")", "{", "var", "oResultConfig", ";", "findConfig", "(", "CONFIG_CONTROLLER_REPLACEMENTS", ",", "vObject", ",", "function", "(", "oConfig", ")", "{", "oResultConfig", "=", "oConfig", "[", "sControllerName", "]", ";", "return", "!", "!", "oResultConfig", ";", "}", ")", ";", "return", "oResultConfig", ";", "}" ]
returns the configuration of the controller replacement for the given controller name @private
[ "returns", "the", "configuration", "of", "the", "controller", "replacement", "for", "the", "given", "controller", "name" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/CustomizingConfiguration.js#L199-L206
4,618
SAP/openui5
src/sap.ui.support/src/sap/ui/support/supportRules/ui/controllers/Issues.controller.js
function(aIssues) { aIssues.forEach(function(element){ switch (element.severity) { case constants.SUPPORT_ASSISTANT_ISSUE_SEVERITY_LOW: element.severityIcon = mIssueSettings.severityIcons.Low; element.severityColor = constants.SUPPORT_ASSISTANT_SEVERITY_LOW_COLOR; break; case constants.SUPPORT_ASSISTANT_ISSUE_SEVERITY_MEDIUM: element.severityIcon = mIssueSettings.severityIcons.Medium; element.severityColor = constants.SUPPORT_ASSISTANT_SEVERITY_MEDIUM_COLOR; break; case constants.SUPPORT_ASSISTANT_ISSUE_SEVERITY_HIGH: element.severityIcon = mIssueSettings.severityIcons.High; element.severityColor = constants.SUPPORT_ASSISTANT_SEVERITY_HIGH_COLOR; break; } }); }
javascript
function(aIssues) { aIssues.forEach(function(element){ switch (element.severity) { case constants.SUPPORT_ASSISTANT_ISSUE_SEVERITY_LOW: element.severityIcon = mIssueSettings.severityIcons.Low; element.severityColor = constants.SUPPORT_ASSISTANT_SEVERITY_LOW_COLOR; break; case constants.SUPPORT_ASSISTANT_ISSUE_SEVERITY_MEDIUM: element.severityIcon = mIssueSettings.severityIcons.Medium; element.severityColor = constants.SUPPORT_ASSISTANT_SEVERITY_MEDIUM_COLOR; break; case constants.SUPPORT_ASSISTANT_ISSUE_SEVERITY_HIGH: element.severityIcon = mIssueSettings.severityIcons.High; element.severityColor = constants.SUPPORT_ASSISTANT_SEVERITY_HIGH_COLOR; break; } }); }
[ "function", "(", "aIssues", ")", "{", "aIssues", ".", "forEach", "(", "function", "(", "element", ")", "{", "switch", "(", "element", ".", "severity", ")", "{", "case", "constants", ".", "SUPPORT_ASSISTANT_ISSUE_SEVERITY_LOW", ":", "element", ".", "severityIcon", "=", "mIssueSettings", ".", "severityIcons", ".", "Low", ";", "element", ".", "severityColor", "=", "constants", ".", "SUPPORT_ASSISTANT_SEVERITY_LOW_COLOR", ";", "break", ";", "case", "constants", ".", "SUPPORT_ASSISTANT_ISSUE_SEVERITY_MEDIUM", ":", "element", ".", "severityIcon", "=", "mIssueSettings", ".", "severityIcons", ".", "Medium", ";", "element", ".", "severityColor", "=", "constants", ".", "SUPPORT_ASSISTANT_SEVERITY_MEDIUM_COLOR", ";", "break", ";", "case", "constants", ".", "SUPPORT_ASSISTANT_ISSUE_SEVERITY_HIGH", ":", "element", ".", "severityIcon", "=", "mIssueSettings", ".", "severityIcons", ".", "High", ";", "element", ".", "severityColor", "=", "constants", ".", "SUPPORT_ASSISTANT_SEVERITY_HIGH_COLOR", ";", "break", ";", "}", "}", ")", ";", "}" ]
Set to model icon and color depending on severity. @private @param {array} aIssues @returns {void}
[ "Set", "to", "model", "icon", "and", "color", "depending", "on", "severity", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/ui/controllers/Issues.controller.js#L240-L257
4,619
SAP/openui5
src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/DemoApps.controller.js
function(oEvent) { this.byId("phoneImage").setVisible(oEvent.name === "Phone"); this.byId("desktopImage").setVisible(oEvent.name !== "Phone"); this.byId("phoneImage").toggleStyleClass("phoneHeaderImageDesktop", oEvent.name === "Phone"); }
javascript
function(oEvent) { this.byId("phoneImage").setVisible(oEvent.name === "Phone"); this.byId("desktopImage").setVisible(oEvent.name !== "Phone"); this.byId("phoneImage").toggleStyleClass("phoneHeaderImageDesktop", oEvent.name === "Phone"); }
[ "function", "(", "oEvent", ")", "{", "this", ".", "byId", "(", "\"phoneImage\"", ")", ".", "setVisible", "(", "oEvent", ".", "name", "===", "\"Phone\"", ")", ";", "this", ".", "byId", "(", "\"desktopImage\"", ")", ".", "setVisible", "(", "oEvent", ".", "name", "!==", "\"Phone\"", ")", ";", "this", ".", "byId", "(", "\"phoneImage\"", ")", ".", "toggleStyleClass", "(", "\"phoneHeaderImageDesktop\"", ",", "oEvent", ".", "name", "===", "\"Phone\"", ")", ";", "}" ]
Switches the image to phone and hides the download icon when decreasing the window size @param {sap.ui.base.Event} oEvent Device media change event @private
[ "Switches", "the", "image", "to", "phone", "and", "hides", "the", "download", "icon", "when", "decreasing", "the", "window", "size" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/DemoApps.controller.js#L134-L138
4,620
SAP/openui5
src/sap.ui.core/src/sap/ui/core/delegate/ScrollEnablement.js
function(oIconTabBar, fnScrollEndCallback, fnScrollStartCallback) { this._oIconTabBar = oIconTabBar; this._fnScrollEndCallback = jQuery.proxy(fnScrollEndCallback, oIconTabBar); this._fnScrollStartCallback = jQuery.proxy(fnScrollStartCallback, oIconTabBar); return this; }
javascript
function(oIconTabBar, fnScrollEndCallback, fnScrollStartCallback) { this._oIconTabBar = oIconTabBar; this._fnScrollEndCallback = jQuery.proxy(fnScrollEndCallback, oIconTabBar); this._fnScrollStartCallback = jQuery.proxy(fnScrollStartCallback, oIconTabBar); return this; }
[ "function", "(", "oIconTabBar", ",", "fnScrollEndCallback", ",", "fnScrollStartCallback", ")", "{", "this", ".", "_oIconTabBar", "=", "oIconTabBar", ";", "this", ".", "_fnScrollEndCallback", "=", "jQuery", ".", "proxy", "(", "fnScrollEndCallback", ",", "oIconTabBar", ")", ";", "this", ".", "_fnScrollStartCallback", "=", "jQuery", ".", "proxy", "(", "fnScrollStartCallback", ",", "oIconTabBar", ")", ";", "return", "this", ";", "}" ]
Sets IconTabBar control to scroll container @param {sap.m.IconTabBar} oIconTabBar instance @param {function} fnScrollEndCallback callback function for the scroll end event @param {function} fnScrollStartCallback callback function for the scroll start event @protected @since 1.16.1
[ "Sets", "IconTabBar", "control", "to", "scroll", "container" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/delegate/ScrollEnablement.js#L174-L179
4,621
SAP/openui5
src/sap.ui.core/src/sap/ui/core/delegate/ScrollEnablement.js
function(vElement) { // check if vElement is a DOM element and if yes convert it to jQuery object var $Element = vElement instanceof jQuery ? vElement : jQuery(vElement), oElementPosition = $Element.position(), $OffsetParent = $Element.offsetParent(), oAddUpPosition; while (!$OffsetParent.is(this._$Container)) { oAddUpPosition = $OffsetParent.position(); oElementPosition.top += oAddUpPosition.top; oElementPosition.left += oAddUpPosition.left; $OffsetParent = $OffsetParent.offsetParent(); } return oElementPosition; }
javascript
function(vElement) { // check if vElement is a DOM element and if yes convert it to jQuery object var $Element = vElement instanceof jQuery ? vElement : jQuery(vElement), oElementPosition = $Element.position(), $OffsetParent = $Element.offsetParent(), oAddUpPosition; while (!$OffsetParent.is(this._$Container)) { oAddUpPosition = $OffsetParent.position(); oElementPosition.top += oAddUpPosition.top; oElementPosition.left += oAddUpPosition.left; $OffsetParent = $OffsetParent.offsetParent(); } return oElementPosition; }
[ "function", "(", "vElement", ")", "{", "// check if vElement is a DOM element and if yes convert it to jQuery object", "var", "$Element", "=", "vElement", "instanceof", "jQuery", "?", "vElement", ":", "jQuery", "(", "vElement", ")", ",", "oElementPosition", "=", "$Element", ".", "position", "(", ")", ",", "$OffsetParent", "=", "$Element", ".", "offsetParent", "(", ")", ",", "oAddUpPosition", ";", "while", "(", "!", "$OffsetParent", ".", "is", "(", "this", ".", "_$Container", ")", ")", "{", "oAddUpPosition", "=", "$OffsetParent", ".", "position", "(", ")", ";", "oElementPosition", ".", "top", "+=", "oAddUpPosition", ".", "top", ";", "oElementPosition", ".", "left", "+=", "oAddUpPosition", ".", "left", ";", "$OffsetParent", "=", "$OffsetParent", ".", "offsetParent", "(", ")", ";", "}", "return", "oElementPosition", ";", "}" ]
Calculates scroll position of a child of a container. @param {HTMLElement | jQuery} vElement An element(DOM or jQuery) for which the scroll position will be calculated. @returns {object} Position object. @protected
[ "Calculates", "scroll", "position", "of", "a", "child", "of", "a", "container", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/delegate/ScrollEnablement.js#L194-L209
4,622
SAP/openui5
src/sap.ui.core/src/sap/ui/core/delegate/ScrollEnablement.js
function(oElement, iTime, aOffset) { aOffset = aOffset || [0, 0]; // do nothing if _$Container is not a (grand)parent of oElement if (!this._$Container[0].contains(oElement) || oElement.style.display === "none" || oElement.offsetParent.nodeName.toUpperCase() === "HTML") { return this; } var $Element = jQuery(oElement), oScrollPosition = this.getChildPosition($Element), iLeftScroll = this.getScrollLeft() + oScrollPosition.left + aOffset[0], iTopScroll = this.getScrollTop() + oScrollPosition.top + aOffset[1]; if (this._bFlipX) { // in IE RTL scrollLeft goes opposite direction iLeftScroll = this.getScrollLeft() - (oScrollPosition.left - this._$Container.width()) - $Element.width(); } // scroll to destination this._scrollTo(iLeftScroll, iTopScroll , iTime); return this; }
javascript
function(oElement, iTime, aOffset) { aOffset = aOffset || [0, 0]; // do nothing if _$Container is not a (grand)parent of oElement if (!this._$Container[0].contains(oElement) || oElement.style.display === "none" || oElement.offsetParent.nodeName.toUpperCase() === "HTML") { return this; } var $Element = jQuery(oElement), oScrollPosition = this.getChildPosition($Element), iLeftScroll = this.getScrollLeft() + oScrollPosition.left + aOffset[0], iTopScroll = this.getScrollTop() + oScrollPosition.top + aOffset[1]; if (this._bFlipX) { // in IE RTL scrollLeft goes opposite direction iLeftScroll = this.getScrollLeft() - (oScrollPosition.left - this._$Container.width()) - $Element.width(); } // scroll to destination this._scrollTo(iLeftScroll, iTopScroll , iTime); return this; }
[ "function", "(", "oElement", ",", "iTime", ",", "aOffset", ")", "{", "aOffset", "=", "aOffset", "||", "[", "0", ",", "0", "]", ";", "// do nothing if _$Container is not a (grand)parent of oElement", "if", "(", "!", "this", ".", "_$Container", "[", "0", "]", ".", "contains", "(", "oElement", ")", "||", "oElement", ".", "style", ".", "display", "===", "\"none\"", "||", "oElement", ".", "offsetParent", ".", "nodeName", ".", "toUpperCase", "(", ")", "===", "\"HTML\"", ")", "{", "return", "this", ";", "}", "var", "$Element", "=", "jQuery", "(", "oElement", ")", ",", "oScrollPosition", "=", "this", ".", "getChildPosition", "(", "$Element", ")", ",", "iLeftScroll", "=", "this", ".", "getScrollLeft", "(", ")", "+", "oScrollPosition", ".", "left", "+", "aOffset", "[", "0", "]", ",", "iTopScroll", "=", "this", ".", "getScrollTop", "(", ")", "+", "oScrollPosition", ".", "top", "+", "aOffset", "[", "1", "]", ";", "if", "(", "this", ".", "_bFlipX", ")", "{", "// in IE RTL scrollLeft goes opposite direction", "iLeftScroll", "=", "this", ".", "getScrollLeft", "(", ")", "-", "(", "oScrollPosition", ".", "left", "-", "this", ".", "_$Container", ".", "width", "(", ")", ")", "-", "$Element", ".", "width", "(", ")", ";", "}", "// scroll to destination", "this", ".", "_scrollTo", "(", "iLeftScroll", ",", "iTopScroll", ",", "iTime", ")", ";", "return", "this", ";", "}" ]
Scrolls to an element within a container. @param {HTMLElement} oElement A DOM element. @param {int} [iTime=0] The duration of animated scrolling in milliseconds. To scroll immediately without animation, give 0 as value. @param {int[]} [aOffset=[0,0]] Specifies an additional left and top offset of the target scroll position, relative to the upper left corner of the DOM element @returns {sap.ui.core.delegate.ScrollEnablement} @protected
[ "Scrolls", "to", "an", "element", "within", "a", "container", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/delegate/ScrollEnablement.js#L223-L247
4,623
SAP/openui5
lib/cldr-openui5/lib/generate.js
Generator
function Generator(sOutputFolder, bPrettyPrint) { if (!(this instanceof Generator)) { return new Generator(sOutputFolder, bPrettyPrint); } this._sOutputFolder = sOutputFolder; this._bPrettyPrint = bPrettyPrint; events.EventEmitter.call(this); }
javascript
function Generator(sOutputFolder, bPrettyPrint) { if (!(this instanceof Generator)) { return new Generator(sOutputFolder, bPrettyPrint); } this._sOutputFolder = sOutputFolder; this._bPrettyPrint = bPrettyPrint; events.EventEmitter.call(this); }
[ "function", "Generator", "(", "sOutputFolder", ",", "bPrettyPrint", ")", "{", "if", "(", "!", "(", "this", "instanceof", "Generator", ")", ")", "{", "return", "new", "Generator", "(", "sOutputFolder", ",", "bPrettyPrint", ")", ";", "}", "this", ".", "_sOutputFolder", "=", "sOutputFolder", ";", "this", ".", "_bPrettyPrint", "=", "bPrettyPrint", ";", "events", ".", "EventEmitter", ".", "call", "(", "this", ")", ";", "}" ]
Generates the UI5 locale JSON files using the original JSON files.
[ "Generates", "the", "UI5", "locale", "JSON", "files", "using", "the", "original", "JSON", "files", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/cldr-openui5/lib/generate.js#L27-L34
4,624
SAP/openui5
src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/util/SearchUtil.js
init
function init() { if (!oInitPromise) { oInitPromise = new Promise(function(resolve, reject) { oWorker = new window.Worker(WORKER.URL); // listen for confirmation from worker oWorker.addEventListener('message', function(oEvent) { var oData = oEvent.data; resolve(oData && oData[WORKER.RESPONSE_FIELDS.DONE] === true); }, false); // instruct the worker to fetch the index data oWorker.postMessage({ "cmd": WORKER.COMMANDS.INIT, "bIsMsieBrowser": !!Device.browser.msie }); }); } return oInitPromise; }
javascript
function init() { if (!oInitPromise) { oInitPromise = new Promise(function(resolve, reject) { oWorker = new window.Worker(WORKER.URL); // listen for confirmation from worker oWorker.addEventListener('message', function(oEvent) { var oData = oEvent.data; resolve(oData && oData[WORKER.RESPONSE_FIELDS.DONE] === true); }, false); // instruct the worker to fetch the index data oWorker.postMessage({ "cmd": WORKER.COMMANDS.INIT, "bIsMsieBrowser": !!Device.browser.msie }); }); } return oInitPromise; }
[ "function", "init", "(", ")", "{", "if", "(", "!", "oInitPromise", ")", "{", "oInitPromise", "=", "new", "Promise", "(", "function", "(", "resolve", ",", "reject", ")", "{", "oWorker", "=", "new", "window", ".", "Worker", "(", "WORKER", ".", "URL", ")", ";", "// listen for confirmation from worker", "oWorker", ".", "addEventListener", "(", "'message'", ",", "function", "(", "oEvent", ")", "{", "var", "oData", "=", "oEvent", ".", "data", ";", "resolve", "(", "oData", "&&", "oData", "[", "WORKER", ".", "RESPONSE_FIELDS", ".", "DONE", "]", "===", "true", ")", ";", "}", ",", "false", ")", ";", "// instruct the worker to fetch the index data", "oWorker", ".", "postMessage", "(", "{", "\"cmd\"", ":", "WORKER", ".", "COMMANDS", ".", "INIT", ",", "\"bIsMsieBrowser\"", ":", "!", "!", "Device", ".", "browser", ".", "msie", "}", ")", ";", "}", ")", ";", "}", "return", "oInitPromise", ";", "}" ]
Initializes the setup for client-search @returns {*}
[ "Initializes", "the", "setup", "for", "client", "-", "search" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/util/SearchUtil.js#L29-L50
4,625
SAP/openui5
src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/util/SearchUtil.js
search
function search(sQuery) { return new Promise(function(resolve, reject) { init().then(function() { oWorker.addEventListener('message', function(oEvent) { var oData = oEvent.data; resolve(oData && oData[WORKER.RESPONSE_FIELDS.SEARCH_RESULT]); }, false); oWorker.postMessage({ "cmd": WORKER.COMMANDS.SEARCH, "sQuery": sQuery }); }); }); }
javascript
function search(sQuery) { return new Promise(function(resolve, reject) { init().then(function() { oWorker.addEventListener('message', function(oEvent) { var oData = oEvent.data; resolve(oData && oData[WORKER.RESPONSE_FIELDS.SEARCH_RESULT]); }, false); oWorker.postMessage({ "cmd": WORKER.COMMANDS.SEARCH, "sQuery": sQuery }); }); }); }
[ "function", "search", "(", "sQuery", ")", "{", "return", "new", "Promise", "(", "function", "(", "resolve", ",", "reject", ")", "{", "init", "(", ")", ".", "then", "(", "function", "(", ")", "{", "oWorker", ".", "addEventListener", "(", "'message'", ",", "function", "(", "oEvent", ")", "{", "var", "oData", "=", "oEvent", ".", "data", ";", "resolve", "(", "oData", "&&", "oData", "[", "WORKER", ".", "RESPONSE_FIELDS", ".", "SEARCH_RESULT", "]", ")", ";", "}", ",", "false", ")", ";", "oWorker", ".", "postMessage", "(", "{", "\"cmd\"", ":", "WORKER", ".", "COMMANDS", ".", "SEARCH", ",", "\"sQuery\"", ":", "sQuery", "}", ")", ";", "}", ")", ";", "}", ")", ";", "}" ]
Initiates search and return a promise with the search result @param sQuery the search string @returns {Promise<any>}
[ "Initiates", "search", "and", "return", "a", "promise", "with", "the", "search", "result" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.documentation/src/sap/ui/documentation/sdk/controller/util/SearchUtil.js#L59-L75
4,626
SAP/openui5
src/sap.ui.core/src/sap/ui/core/support/RuleEngineOpaExtension.js
function () { var bLoaded = sap.ui.getCore().getLoadedLibraries()["sap.ui.support"], deferred = jQueryDOM.Deferred(); if (!bLoaded) { sap.ui.require(["sap/ui/support/Bootstrap"], function (bootstrap) { bootstrap.initSupportRules(["true", "silent"], { onReady: function () { deferred.resolve(); } }); }); } else { deferred.resolve(); } return deferred.promise(); }
javascript
function () { var bLoaded = sap.ui.getCore().getLoadedLibraries()["sap.ui.support"], deferred = jQueryDOM.Deferred(); if (!bLoaded) { sap.ui.require(["sap/ui/support/Bootstrap"], function (bootstrap) { bootstrap.initSupportRules(["true", "silent"], { onReady: function () { deferred.resolve(); } }); }); } else { deferred.resolve(); } return deferred.promise(); }
[ "function", "(", ")", "{", "var", "bLoaded", "=", "sap", ".", "ui", ".", "getCore", "(", ")", ".", "getLoadedLibraries", "(", ")", "[", "\"sap.ui.support\"", "]", ",", "deferred", "=", "jQueryDOM", ".", "Deferred", "(", ")", ";", "if", "(", "!", "bLoaded", ")", "{", "sap", ".", "ui", ".", "require", "(", "[", "\"sap/ui/support/Bootstrap\"", "]", ",", "function", "(", "bootstrap", ")", "{", "bootstrap", ".", "initSupportRules", "(", "[", "\"true\"", ",", "\"silent\"", "]", ",", "{", "onReady", ":", "function", "(", ")", "{", "deferred", ".", "resolve", "(", ")", ";", "}", "}", ")", ";", "}", ")", ";", "}", "else", "{", "deferred", ".", "resolve", "(", ")", ";", "}", "return", "deferred", ".", "promise", "(", ")", ";", "}" ]
When the application under test is started in a UIComponent container instead of an iframe the Support Assistant is not loaded because the application doesn't start a separate instance of the Core to start in Support Mode. In such cases manually start the Support Assistant in the current instance of the Core. @returns {jQuery.promise} A promise that gets resolved when the Support Assistant is ready.
[ "When", "the", "application", "under", "test", "is", "started", "in", "a", "UIComponent", "container", "instead", "of", "an", "iframe", "the", "Support", "Assistant", "is", "not", "loaded", "because", "the", "application", "doesn", "t", "start", "a", "separate", "instance", "of", "the", "Core", "to", "start", "in", "Support", "Mode", ".", "In", "such", "cases", "manually", "start", "the", "Support", "Assistant", "in", "the", "current", "instance", "of", "the", "Core", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/support/RuleEngineOpaExtension.js#L45-L62
4,627
SAP/openui5
src/sap.ui.core/src/sap/ui/core/support/RuleEngineOpaExtension.js
function(options) { var ruleDeferred = jQueryDOM.Deferred(), options = options[0] || {}, failOnAnyRuleIssues = options["failOnAnyIssues"], failOnHighRuleIssues = options["failOnHighIssues"], rules = options.rules, preset = options.preset, metadata = options.metadata, executionScope = options.executionScope; // private API provided by jquery.sap.global RuleAnalyzer.analyze(executionScope, rules || preset, metadata).then(function () { var analysisHistory = RuleAnalyzer.getAnalysisHistory(), lastAnalysis = { issues: [] }; if (analysisHistory.length) { lastAnalysis = analysisHistory[analysisHistory.length - 1]; } var issueSummary = lastAnalysis.issues.reduce(function (summary, issue) { summary[issue.severity.toLowerCase()] += 1; return summary; }, { high: 0, medium: 0, low: 0 }); var assertionResult = lastAnalysis.issues.length === 0; if (failOnHighRuleIssues) { assertionResult = issueSummary.high === 0; } else if (failOnAnyRuleIssues === false || failOnHighRuleIssues === false) { assertionResult = true; } if (fnShouldSkipRulesIssues()) { assertionResult = true; } ruleDeferred.resolve({ result: assertionResult, message: "Support Assistant issues found: [High: " + issueSummary.high + ", Medium: " + issueSummary.medium + ", Low: " + issueSummary.low + "]", expected: "0 high 0 medium 0 low", actual: issueSummary.high + " high " + issueSummary.medium + " medium " + issueSummary.low + " low" }); }); return ruleDeferred.promise(); }
javascript
function(options) { var ruleDeferred = jQueryDOM.Deferred(), options = options[0] || {}, failOnAnyRuleIssues = options["failOnAnyIssues"], failOnHighRuleIssues = options["failOnHighIssues"], rules = options.rules, preset = options.preset, metadata = options.metadata, executionScope = options.executionScope; // private API provided by jquery.sap.global RuleAnalyzer.analyze(executionScope, rules || preset, metadata).then(function () { var analysisHistory = RuleAnalyzer.getAnalysisHistory(), lastAnalysis = { issues: [] }; if (analysisHistory.length) { lastAnalysis = analysisHistory[analysisHistory.length - 1]; } var issueSummary = lastAnalysis.issues.reduce(function (summary, issue) { summary[issue.severity.toLowerCase()] += 1; return summary; }, { high: 0, medium: 0, low: 0 }); var assertionResult = lastAnalysis.issues.length === 0; if (failOnHighRuleIssues) { assertionResult = issueSummary.high === 0; } else if (failOnAnyRuleIssues === false || failOnHighRuleIssues === false) { assertionResult = true; } if (fnShouldSkipRulesIssues()) { assertionResult = true; } ruleDeferred.resolve({ result: assertionResult, message: "Support Assistant issues found: [High: " + issueSummary.high + ", Medium: " + issueSummary.medium + ", Low: " + issueSummary.low + "]", expected: "0 high 0 medium 0 low", actual: issueSummary.high + " high " + issueSummary.medium + " medium " + issueSummary.low + " low" }); }); return ruleDeferred.promise(); }
[ "function", "(", "options", ")", "{", "var", "ruleDeferred", "=", "jQueryDOM", ".", "Deferred", "(", ")", ",", "options", "=", "options", "[", "0", "]", "||", "{", "}", ",", "failOnAnyRuleIssues", "=", "options", "[", "\"failOnAnyIssues\"", "]", ",", "failOnHighRuleIssues", "=", "options", "[", "\"failOnHighIssues\"", "]", ",", "rules", "=", "options", ".", "rules", ",", "preset", "=", "options", ".", "preset", ",", "metadata", "=", "options", ".", "metadata", ",", "executionScope", "=", "options", ".", "executionScope", ";", "// private API provided by jquery.sap.global", "RuleAnalyzer", ".", "analyze", "(", "executionScope", ",", "rules", "||", "preset", ",", "metadata", ")", ".", "then", "(", "function", "(", ")", "{", "var", "analysisHistory", "=", "RuleAnalyzer", ".", "getAnalysisHistory", "(", ")", ",", "lastAnalysis", "=", "{", "issues", ":", "[", "]", "}", ";", "if", "(", "analysisHistory", ".", "length", ")", "{", "lastAnalysis", "=", "analysisHistory", "[", "analysisHistory", ".", "length", "-", "1", "]", ";", "}", "var", "issueSummary", "=", "lastAnalysis", ".", "issues", ".", "reduce", "(", "function", "(", "summary", ",", "issue", ")", "{", "summary", "[", "issue", ".", "severity", ".", "toLowerCase", "(", ")", "]", "+=", "1", ";", "return", "summary", ";", "}", ",", "{", "high", ":", "0", ",", "medium", ":", "0", ",", "low", ":", "0", "}", ")", ";", "var", "assertionResult", "=", "lastAnalysis", ".", "issues", ".", "length", "===", "0", ";", "if", "(", "failOnHighRuleIssues", ")", "{", "assertionResult", "=", "issueSummary", ".", "high", "===", "0", ";", "}", "else", "if", "(", "failOnAnyRuleIssues", "===", "false", "||", "failOnHighRuleIssues", "===", "false", ")", "{", "assertionResult", "=", "true", ";", "}", "if", "(", "fnShouldSkipRulesIssues", "(", ")", ")", "{", "assertionResult", "=", "true", ";", "}", "ruleDeferred", ".", "resolve", "(", "{", "result", ":", "assertionResult", ",", "message", ":", "\"Support Assistant issues found: [High: \"", "+", "issueSummary", ".", "high", "+", "\", Medium: \"", "+", "issueSummary", ".", "medium", "+", "\", Low: \"", "+", "issueSummary", ".", "low", "+", "\"]\"", ",", "expected", ":", "\"0 high 0 medium 0 low\"", ",", "actual", ":", "issueSummary", ".", "high", "+", "\" high \"", "+", "issueSummary", ".", "medium", "+", "\" medium \"", "+", "issueSummary", ".", "low", "+", "\" low\"", "}", ")", ";", "}", ")", ";", "return", "ruleDeferred", ".", "promise", "(", ")", ";", "}" ]
Run the Support Assistant and analyze against a specific state of the application. Depending on the options passed the assertion might either fail or not if any issues were found. If "sap-skip-rules-issues=true" is set as an URI parameter, assertion result will be always positive. @function @name sap.ui.core.support.RuleEngineOpaAssertions#noRuleFailures @param {Object} [options] The options used to configure an analysis. @param {boolean} [options.failOnAnyIssues=true] Should the test fail or not if there are issues of any severity. @param {boolean} [options.failOnHighIssues] Should the test fail or not if there are issues of high severity. This parameter will override failOnAnyIssues if set. @param {Array.<{libName:string, ruleId:string}>} [options.rules] The rules to check. @param {Object} [options.executionScope] The execution scope of the analysis. @param {Object} [options.metadata] The metadata that will be passed to the analyse method. @param {string} [options.executionScope.type=global] The type of the execution scope, one of 'global', 'subtree' or 'components'. @param {string|string[]} [options.executionScope.selectors] The IDs of the components or the subtree. @public @returns {Promise} Promise.
[ "Run", "the", "Support", "Assistant", "and", "analyze", "against", "a", "specific", "state", "of", "the", "application", ".", "Depending", "on", "the", "options", "passed", "the", "assertion", "might", "either", "fail", "or", "not", "if", "any", "issues", "were", "found", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/support/RuleEngineOpaExtension.js#L109-L156
4,628
SAP/openui5
src/sap.ui.core/src/sap/ui/core/support/RuleEngineOpaExtension.js
function () { var ruleDeferred = jQueryDOM.Deferred(), history = RuleAnalyzer.getFormattedAnalysisHistory(), analysisHistory = RuleAnalyzer.getAnalysisHistory(), totalIssues = analysisHistory.reduce(function (total, analysis) { return total + analysis.issues.length; }, 0), result = totalIssues === 0, message = "Support Assistant Analysis History", actual = message; if (result) { message += " - no issues found"; } else if (fnShouldSkipRulesIssues()) { result = true; message += ' - issues are found. To see them remove the "sap-skip-rules-issues=true" URI parameter'; } ruleDeferred.resolve({ result: result, message: message, actual: actual, expected: history }); return ruleDeferred.promise(); }
javascript
function () { var ruleDeferred = jQueryDOM.Deferred(), history = RuleAnalyzer.getFormattedAnalysisHistory(), analysisHistory = RuleAnalyzer.getAnalysisHistory(), totalIssues = analysisHistory.reduce(function (total, analysis) { return total + analysis.issues.length; }, 0), result = totalIssues === 0, message = "Support Assistant Analysis History", actual = message; if (result) { message += " - no issues found"; } else if (fnShouldSkipRulesIssues()) { result = true; message += ' - issues are found. To see them remove the "sap-skip-rules-issues=true" URI parameter'; } ruleDeferred.resolve({ result: result, message: message, actual: actual, expected: history }); return ruleDeferred.promise(); }
[ "function", "(", ")", "{", "var", "ruleDeferred", "=", "jQueryDOM", ".", "Deferred", "(", ")", ",", "history", "=", "RuleAnalyzer", ".", "getFormattedAnalysisHistory", "(", ")", ",", "analysisHistory", "=", "RuleAnalyzer", ".", "getAnalysisHistory", "(", ")", ",", "totalIssues", "=", "analysisHistory", ".", "reduce", "(", "function", "(", "total", ",", "analysis", ")", "{", "return", "total", "+", "analysis", ".", "issues", ".", "length", ";", "}", ",", "0", ")", ",", "result", "=", "totalIssues", "===", "0", ",", "message", "=", "\"Support Assistant Analysis History\"", ",", "actual", "=", "message", ";", "if", "(", "result", ")", "{", "message", "+=", "\" - no issues found\"", ";", "}", "else", "if", "(", "fnShouldSkipRulesIssues", "(", ")", ")", "{", "result", "=", "true", ";", "message", "+=", "' - issues are found. To see them remove the \"sap-skip-rules-issues=true\" URI parameter'", ";", "}", "ruleDeferred", ".", "resolve", "(", "{", "result", ":", "result", ",", "message", ":", "message", ",", "actual", ":", "actual", ",", "expected", ":", "history", "}", ")", ";", "return", "ruleDeferred", ".", "promise", "(", ")", ";", "}" ]
If there are issues found the assertion result will be false and a report with all the issues will be generated in the message of the test. If no issues were found the assertion result will be true and no report will be generated. If "sap-skip-rules-issues=true" is set as an URI parameter, assertion result will be always positive. @function @name sap.ui.core.support.RuleEngineOpaAssertions#getFinalReport @public @returns {Promise} Promise.
[ "If", "there", "are", "issues", "found", "the", "assertion", "result", "will", "be", "false", "and", "a", "report", "with", "all", "the", "issues", "will", "be", "generated", "in", "the", "message", "of", "the", "test", ".", "If", "no", "issues", "were", "found", "the", "assertion", "result", "will", "be", "true", "and", "no", "report", "will", "be", "generated", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/support/RuleEngineOpaExtension.js#L170-L196
4,629
SAP/openui5
src/sap.ui.core/src/sap/ui/model/analytics/AnalyticalVersionInfo.js
function (oODataModelInstance) { var iVersion; var sODataModelName; // check if the given object has metadata and a class name if (oODataModelInstance && oODataModelInstance.getMetadata) { sODataModelName = oODataModelInstance.getMetadata().getName(); } switch (sODataModelName) { case "sap.ui.model.odata.ODataModel": iVersion = this.V1; break; case "sap.ui.model.odata.v2.ODataModel": iVersion = this.V2; break; default: iVersion = this.NONE; Log.info("AnalyticalVersionInfo.getVersion(...) - The given object is no instance of ODataModel V1 or V2!"); break; } return iVersion; }
javascript
function (oODataModelInstance) { var iVersion; var sODataModelName; // check if the given object has metadata and a class name if (oODataModelInstance && oODataModelInstance.getMetadata) { sODataModelName = oODataModelInstance.getMetadata().getName(); } switch (sODataModelName) { case "sap.ui.model.odata.ODataModel": iVersion = this.V1; break; case "sap.ui.model.odata.v2.ODataModel": iVersion = this.V2; break; default: iVersion = this.NONE; Log.info("AnalyticalVersionInfo.getVersion(...) - The given object is no instance of ODataModel V1 or V2!"); break; } return iVersion; }
[ "function", "(", "oODataModelInstance", ")", "{", "var", "iVersion", ";", "var", "sODataModelName", ";", "// check if the given object has metadata and a class name", "if", "(", "oODataModelInstance", "&&", "oODataModelInstance", ".", "getMetadata", ")", "{", "sODataModelName", "=", "oODataModelInstance", ".", "getMetadata", "(", ")", ".", "getName", "(", ")", ";", "}", "switch", "(", "sODataModelName", ")", "{", "case", "\"sap.ui.model.odata.ODataModel\"", ":", "iVersion", "=", "this", ".", "V1", ";", "break", ";", "case", "\"sap.ui.model.odata.v2.ODataModel\"", ":", "iVersion", "=", "this", ".", "V2", ";", "break", ";", "default", ":", "iVersion", "=", "this", ".", "NONE", ";", "Log", ".", "info", "(", "\"AnalyticalVersionInfo.getVersion(...) - The given object is no instance of ODataModel V1 or V2!\"", ")", ";", "break", ";", "}", "return", "iVersion", ";", "}" ]
find out which model is used
[ "find", "out", "which", "model", "is", "used" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/analytics/AnalyticalVersionInfo.js#L21-L38
4,630
SAP/openui5
src/sap.ui.core/src/sap/ui/performance/XHRInterceptor.js
createOverride
function createOverride(sXHRMethod) { mRegistry[sXHRMethod] = Object.create(null); // backup the original function mXHRFunctions[sXHRMethod] = window.XMLHttpRequest.prototype[sXHRMethod]; window.XMLHttpRequest.prototype[sXHRMethod] = function() { var oArgs = arguments; // call the original function first mXHRFunctions[sXHRMethod].apply(this, oArgs); // call the registered callbacks in order of their registration for (var sName in mRegistry[sXHRMethod]) { mRegistry[sXHRMethod][sName].apply(this, oArgs); } }; }
javascript
function createOverride(sXHRMethod) { mRegistry[sXHRMethod] = Object.create(null); // backup the original function mXHRFunctions[sXHRMethod] = window.XMLHttpRequest.prototype[sXHRMethod]; window.XMLHttpRequest.prototype[sXHRMethod] = function() { var oArgs = arguments; // call the original function first mXHRFunctions[sXHRMethod].apply(this, oArgs); // call the registered callbacks in order of their registration for (var sName in mRegistry[sXHRMethod]) { mRegistry[sXHRMethod][sName].apply(this, oArgs); } }; }
[ "function", "createOverride", "(", "sXHRMethod", ")", "{", "mRegistry", "[", "sXHRMethod", "]", "=", "Object", ".", "create", "(", "null", ")", ";", "// backup the original function", "mXHRFunctions", "[", "sXHRMethod", "]", "=", "window", ".", "XMLHttpRequest", ".", "prototype", "[", "sXHRMethod", "]", ";", "window", ".", "XMLHttpRequest", ".", "prototype", "[", "sXHRMethod", "]", "=", "function", "(", ")", "{", "var", "oArgs", "=", "arguments", ";", "// call the original function first", "mXHRFunctions", "[", "sXHRMethod", "]", ".", "apply", "(", "this", ",", "oArgs", ")", ";", "// call the registered callbacks in order of their registration", "for", "(", "var", "sName", "in", "mRegistry", "[", "sXHRMethod", "]", ")", "{", "mRegistry", "[", "sXHRMethod", "]", "[", "sName", "]", ".", "apply", "(", "this", ",", "oArgs", ")", ";", "}", "}", ";", "}" ]
Creates the initial override for an original XHR method. @param {string} sXHRMethod Name of the actual XHR method @param {function} fnCallback The registered callback function @private
[ "Creates", "the", "initial", "override", "for", "an", "original", "XHR", "method", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/performance/XHRInterceptor.js#L45-L65
4,631
SAP/openui5
src/sap.ui.core/src/sap/ui/performance/XHRInterceptor.js
function(sName, sXHRMethod, fnCallback) { Log.debug("Register '" + sName + "' for XHR function '" + sXHRMethod + "'", XHRINTERCEPTOR); // initially the override needs to be placed per XHR method if (!mRegistry[sXHRMethod]) { createOverride(sXHRMethod); } mRegistry[sXHRMethod][sName] = fnCallback; }
javascript
function(sName, sXHRMethod, fnCallback) { Log.debug("Register '" + sName + "' for XHR function '" + sXHRMethod + "'", XHRINTERCEPTOR); // initially the override needs to be placed per XHR method if (!mRegistry[sXHRMethod]) { createOverride(sXHRMethod); } mRegistry[sXHRMethod][sName] = fnCallback; }
[ "function", "(", "sName", ",", "sXHRMethod", ",", "fnCallback", ")", "{", "Log", ".", "debug", "(", "\"Register '\"", "+", "sName", "+", "\"' for XHR function '\"", "+", "sXHRMethod", "+", "\"'\"", ",", "XHRINTERCEPTOR", ")", ";", "// initially the override needs to be placed per XHR method", "if", "(", "!", "mRegistry", "[", "sXHRMethod", "]", ")", "{", "createOverride", "(", "sXHRMethod", ")", ";", "}", "mRegistry", "[", "sXHRMethod", "]", "[", "sName", "]", "=", "fnCallback", ";", "}" ]
Register a function callback which gets called as it would be an own method of XHR. @param {string} sName Name under which the function is registered @param {string} sXHRMethod Name of the actual XHR method @param {function} fnCallback The registered callback function @public
[ "Register", "a", "function", "callback", "which", "gets", "called", "as", "it", "would", "be", "an", "own", "method", "of", "XHR", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/performance/XHRInterceptor.js#L83-L91
4,632
SAP/openui5
src/sap.ui.core/src/sap/ui/performance/XHRInterceptor.js
function(sName, sXHRMethod) { var bRemove = delete mRegistry[sXHRMethod][sName]; Log.debug("Unregister '" + sName + "' for XHR function '" + sXHRMethod + (bRemove ? "'" : "' failed"), XHRINTERCEPTOR); return bRemove; }
javascript
function(sName, sXHRMethod) { var bRemove = delete mRegistry[sXHRMethod][sName]; Log.debug("Unregister '" + sName + "' for XHR function '" + sXHRMethod + (bRemove ? "'" : "' failed"), XHRINTERCEPTOR); return bRemove; }
[ "function", "(", "sName", ",", "sXHRMethod", ")", "{", "var", "bRemove", "=", "delete", "mRegistry", "[", "sXHRMethod", "]", "[", "sName", "]", ";", "Log", ".", "debug", "(", "\"Unregister '\"", "+", "sName", "+", "\"' for XHR function '\"", "+", "sXHRMethod", "+", "(", "bRemove", "?", "\"'\"", ":", "\"' failed\"", ")", ",", "XHRINTERCEPTOR", ")", ";", "return", "bRemove", ";", "}" ]
Unregister a registered function. @param {string} sName Name under which the function is registered @param {string} sXHRMethod Name of the actual XHR method @return {boolean} True if unregister was successful @public
[ "Unregister", "a", "registered", "function", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/performance/XHRInterceptor.js#L101-L105
4,633
SAP/openui5
src/sap.ui.support/src/sap/ui/support/supportRules/ui/models/Documentation.js
function (sTopicId) { var sUrl = "", sVersion = "", sFullVersion = sap.ui.getVersionInfo().version, iMajorVersion = jQuery.sap.Version(sFullVersion).getMajor(), iMinorVersion = jQuery.sap.Version(sFullVersion).getMinor(), sOrigin = window.location.origin; //This check is to make sure that version is even. Example: 1.53 will back down to 1.52 // This is used to generate the correct path to demokit if (iMinorVersion % 2 !== 0) { iMinorVersion--; } sVersion += String(iMajorVersion) + "." + String(iMinorVersion); if (sOrigin.indexOf("veui5infra") !== -1) { sUrl = sOrigin + "/sapui5-sdk-internal/#/topic/" + sTopicId; } else { sUrl = sOrigin + "/demokit-" + sVersion + "/#/topic/" + sTopicId; } this._redirectToUrlWithFallback(sUrl, sTopicId); }
javascript
function (sTopicId) { var sUrl = "", sVersion = "", sFullVersion = sap.ui.getVersionInfo().version, iMajorVersion = jQuery.sap.Version(sFullVersion).getMajor(), iMinorVersion = jQuery.sap.Version(sFullVersion).getMinor(), sOrigin = window.location.origin; //This check is to make sure that version is even. Example: 1.53 will back down to 1.52 // This is used to generate the correct path to demokit if (iMinorVersion % 2 !== 0) { iMinorVersion--; } sVersion += String(iMajorVersion) + "." + String(iMinorVersion); if (sOrigin.indexOf("veui5infra") !== -1) { sUrl = sOrigin + "/sapui5-sdk-internal/#/topic/" + sTopicId; } else { sUrl = sOrigin + "/demokit-" + sVersion + "/#/topic/" + sTopicId; } this._redirectToUrlWithFallback(sUrl, sTopicId); }
[ "function", "(", "sTopicId", ")", "{", "var", "sUrl", "=", "\"\"", ",", "sVersion", "=", "\"\"", ",", "sFullVersion", "=", "sap", ".", "ui", ".", "getVersionInfo", "(", ")", ".", "version", ",", "iMajorVersion", "=", "jQuery", ".", "sap", ".", "Version", "(", "sFullVersion", ")", ".", "getMajor", "(", ")", ",", "iMinorVersion", "=", "jQuery", ".", "sap", ".", "Version", "(", "sFullVersion", ")", ".", "getMinor", "(", ")", ",", "sOrigin", "=", "window", ".", "location", ".", "origin", ";", "//This check is to make sure that version is even. Example: 1.53 will back down to 1.52", "// This is used to generate the correct path to demokit", "if", "(", "iMinorVersion", "%", "2", "!==", "0", ")", "{", "iMinorVersion", "--", ";", "}", "sVersion", "+=", "String", "(", "iMajorVersion", ")", "+", "\".\"", "+", "String", "(", "iMinorVersion", ")", ";", "if", "(", "sOrigin", ".", "indexOf", "(", "\"veui5infra\"", ")", "!==", "-", "1", ")", "{", "sUrl", "=", "sOrigin", "+", "\"/sapui5-sdk-internal/#/topic/\"", "+", "sTopicId", ";", "}", "else", "{", "sUrl", "=", "sOrigin", "+", "\"/demokit-\"", "+", "sVersion", "+", "\"/#/topic/\"", "+", "sTopicId", ";", "}", "this", ".", "_redirectToUrlWithFallback", "(", "sUrl", ",", "sTopicId", ")", ";", "}" ]
Opens the given topic @param {string} sTopicId The ID of the topic to open
[ "Opens", "the", "given", "topic" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/ui/models/Documentation.js#L16-L39
4,634
SAP/openui5
src/sap.ui.support/src/sap/ui/support/supportRules/ui/models/Documentation.js
function (sUrl, sTopicId) { this._pingUrl(sUrl).then(function success() { mLibrary.URLHelper.redirect(sUrl, true); }, function error() { jQuery.sap.log.info("Support Assistant tried to load documentation link in " + sUrl + "but fail"); sUrl = "https://ui5.sap.com/#/topic/" + sTopicId; mLibrary.URLHelper.redirect(sUrl, true); }); }
javascript
function (sUrl, sTopicId) { this._pingUrl(sUrl).then(function success() { mLibrary.URLHelper.redirect(sUrl, true); }, function error() { jQuery.sap.log.info("Support Assistant tried to load documentation link in " + sUrl + "but fail"); sUrl = "https://ui5.sap.com/#/topic/" + sTopicId; mLibrary.URLHelper.redirect(sUrl, true); }); }
[ "function", "(", "sUrl", ",", "sTopicId", ")", "{", "this", ".", "_pingUrl", "(", "sUrl", ")", ".", "then", "(", "function", "success", "(", ")", "{", "mLibrary", ".", "URLHelper", ".", "redirect", "(", "sUrl", ",", "true", ")", ";", "}", ",", "function", "error", "(", ")", "{", "jQuery", ".", "sap", ".", "log", ".", "info", "(", "\"Support Assistant tried to load documentation link in \"", "+", "sUrl", "+", "\"but fail\"", ")", ";", "sUrl", "=", "\"https://ui5.sap.com/#/topic/\"", "+", "sTopicId", ";", "mLibrary", ".", "URLHelper", ".", "redirect", "(", "sUrl", ",", "true", ")", ";", "}", ")", ";", "}" ]
Pings the given URL to check that this is a valid path. If the ping is successful - redirects to the given URL. If something goes wrong - falls back to a default public URL. @private @param {string} sUrl URL that needs to be pinged and redirected to @param {string} sTopicId The ID of the topic to open
[ "Pings", "the", "given", "URL", "to", "check", "that", "this", "is", "a", "valid", "path", ".", "If", "the", "ping", "is", "successful", "-", "redirects", "to", "the", "given", "URL", ".", "If", "something", "goes", "wrong", "-", "falls", "back", "to", "a", "default", "public", "URL", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/ui/models/Documentation.js#L49-L57
4,635
SAP/openui5
lib/cldr-openui5/lib/index.js
CLDR
function CLDR(oOptions) { if (!(this instanceof CLDR)) { return new CLDR(oOptions); } this._oOptions = oOptions; events.EventEmitter.call(this); }
javascript
function CLDR(oOptions) { if (!(this instanceof CLDR)) { return new CLDR(oOptions); } this._oOptions = oOptions; events.EventEmitter.call(this); }
[ "function", "CLDR", "(", "oOptions", ")", "{", "if", "(", "!", "(", "this", "instanceof", "CLDR", ")", ")", "{", "return", "new", "CLDR", "(", "oOptions", ")", ";", "}", "this", ".", "_oOptions", "=", "oOptions", ";", "events", ".", "EventEmitter", ".", "call", "(", "this", ")", ";", "}" ]
Generate UI5 CLDR JSON file for each suppported locale using from the modern JSON version CLDR file provided by unicode.org The CLDR data is defined as a npm dependency, use npm update to fetch the latest released version. The generated UI5 CLDR JSON files are saved under folder oOptions.output. @param {object} oOptions The options parameter which contains the necessary settings @param {string} oOptions.output] The path of a folder where the generated UI5 JSON files are stored @class @constructor
[ "Generate", "UI5", "CLDR", "JSON", "file", "for", "each", "suppported", "locale", "using", "from", "the", "modern", "JSON", "version", "CLDR", "file", "provided", "by", "unicode", ".", "org", "The", "CLDR", "data", "is", "defined", "as", "a", "npm", "dependency", "use", "npm", "update", "to", "fetch", "the", "latest", "released", "version", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/lib/cldr-openui5/lib/index.js#L19-L25
4,636
SAP/openui5
src/sap.ui.core/src/sap/ui/core/date/Islamic.js
toIslamic
function toIslamic(oGregorian) { var iGregorianYear = oGregorian.year, iGregorianMonth = oGregorian.month, iGregorianDay = oGregorian.day, iIslamicYear, iIslamicMonth, iIslamicDay, iMonths, iDays, iLeapAdj, iJulianDay; iLeapAdj = 0; if ((iGregorianMonth + 1) > 2) { iLeapAdj = isGregorianLeapYear(iGregorianYear) ? -1 : -2; } iJulianDay = (GREGORIAN_EPOCH_DAYS - 1) + (365 * (iGregorianYear - 1)) + Math.floor((iGregorianYear - 1) / 4) + (-Math.floor((iGregorianYear - 1) / 100)) + Math.floor((iGregorianYear - 1) / 400) + Math.floor((((367 * (iGregorianMonth + 1)) - 362) / 12) + iLeapAdj + iGregorianDay); iJulianDay = Math.floor(iJulianDay) + 0.5; iDays = iJulianDay - ISLAMIC_EPOCH_DAYS; iMonths = Math.floor(iDays / 29.530588853); // day/CalendarAstronomer.SYNODIC_MONTH if (iMonths < 0) { //negative means Islamic date before the Islamic's calendar start. So we do not apply customization. iIslamicYear = Math.floor(iMonths / 12) + 1; iIslamicMonth = iMonths % 12; if (iIslamicMonth < 0) { iIslamicMonth += 12; } iIslamicDay = iDays - monthStart(iIslamicYear, iIslamicMonth) + 1; } else { /* Guess the month start. * Always also check the next month, since customization can * differ. It can differ for not more than 3 days. so that * checking the next month is enough. */ iMonths++; /* * Check the true month start for the given month. If it is * later, check the previous month, until a suitable is found. */ while (getCustomMonthStartDays(iMonths) > iDays) { iMonths--; } iIslamicYear = Math.floor(iMonths / 12) + 1; iIslamicMonth = iMonths % 12; iIslamicDay = (iDays - getCustomMonthStartDays(12 * (iIslamicYear - 1) + iIslamicMonth)) + 1; } return { day: iIslamicDay, month: iIslamicMonth, year: iIslamicYear }; }
javascript
function toIslamic(oGregorian) { var iGregorianYear = oGregorian.year, iGregorianMonth = oGregorian.month, iGregorianDay = oGregorian.day, iIslamicYear, iIslamicMonth, iIslamicDay, iMonths, iDays, iLeapAdj, iJulianDay; iLeapAdj = 0; if ((iGregorianMonth + 1) > 2) { iLeapAdj = isGregorianLeapYear(iGregorianYear) ? -1 : -2; } iJulianDay = (GREGORIAN_EPOCH_DAYS - 1) + (365 * (iGregorianYear - 1)) + Math.floor((iGregorianYear - 1) / 4) + (-Math.floor((iGregorianYear - 1) / 100)) + Math.floor((iGregorianYear - 1) / 400) + Math.floor((((367 * (iGregorianMonth + 1)) - 362) / 12) + iLeapAdj + iGregorianDay); iJulianDay = Math.floor(iJulianDay) + 0.5; iDays = iJulianDay - ISLAMIC_EPOCH_DAYS; iMonths = Math.floor(iDays / 29.530588853); // day/CalendarAstronomer.SYNODIC_MONTH if (iMonths < 0) { //negative means Islamic date before the Islamic's calendar start. So we do not apply customization. iIslamicYear = Math.floor(iMonths / 12) + 1; iIslamicMonth = iMonths % 12; if (iIslamicMonth < 0) { iIslamicMonth += 12; } iIslamicDay = iDays - monthStart(iIslamicYear, iIslamicMonth) + 1; } else { /* Guess the month start. * Always also check the next month, since customization can * differ. It can differ for not more than 3 days. so that * checking the next month is enough. */ iMonths++; /* * Check the true month start for the given month. If it is * later, check the previous month, until a suitable is found. */ while (getCustomMonthStartDays(iMonths) > iDays) { iMonths--; } iIslamicYear = Math.floor(iMonths / 12) + 1; iIslamicMonth = iMonths % 12; iIslamicDay = (iDays - getCustomMonthStartDays(12 * (iIslamicYear - 1) + iIslamicMonth)) + 1; } return { day: iIslamicDay, month: iIslamicMonth, year: iIslamicYear }; }
[ "function", "toIslamic", "(", "oGregorian", ")", "{", "var", "iGregorianYear", "=", "oGregorian", ".", "year", ",", "iGregorianMonth", "=", "oGregorian", ".", "month", ",", "iGregorianDay", "=", "oGregorian", ".", "day", ",", "iIslamicYear", ",", "iIslamicMonth", ",", "iIslamicDay", ",", "iMonths", ",", "iDays", ",", "iLeapAdj", ",", "iJulianDay", ";", "iLeapAdj", "=", "0", ";", "if", "(", "(", "iGregorianMonth", "+", "1", ")", ">", "2", ")", "{", "iLeapAdj", "=", "isGregorianLeapYear", "(", "iGregorianYear", ")", "?", "-", "1", ":", "-", "2", ";", "}", "iJulianDay", "=", "(", "GREGORIAN_EPOCH_DAYS", "-", "1", ")", "+", "(", "365", "*", "(", "iGregorianYear", "-", "1", ")", ")", "+", "Math", ".", "floor", "(", "(", "iGregorianYear", "-", "1", ")", "/", "4", ")", "+", "(", "-", "Math", ".", "floor", "(", "(", "iGregorianYear", "-", "1", ")", "/", "100", ")", ")", "+", "Math", ".", "floor", "(", "(", "iGregorianYear", "-", "1", ")", "/", "400", ")", "+", "Math", ".", "floor", "(", "(", "(", "(", "367", "*", "(", "iGregorianMonth", "+", "1", ")", ")", "-", "362", ")", "/", "12", ")", "+", "iLeapAdj", "+", "iGregorianDay", ")", ";", "iJulianDay", "=", "Math", ".", "floor", "(", "iJulianDay", ")", "+", "0.5", ";", "iDays", "=", "iJulianDay", "-", "ISLAMIC_EPOCH_DAYS", ";", "iMonths", "=", "Math", ".", "floor", "(", "iDays", "/", "29.530588853", ")", ";", "// day/CalendarAstronomer.SYNODIC_MONTH", "if", "(", "iMonths", "<", "0", ")", "{", "//negative means Islamic date before the Islamic's calendar start. So we do not apply customization.", "iIslamicYear", "=", "Math", ".", "floor", "(", "iMonths", "/", "12", ")", "+", "1", ";", "iIslamicMonth", "=", "iMonths", "%", "12", ";", "if", "(", "iIslamicMonth", "<", "0", ")", "{", "iIslamicMonth", "+=", "12", ";", "}", "iIslamicDay", "=", "iDays", "-", "monthStart", "(", "iIslamicYear", ",", "iIslamicMonth", ")", "+", "1", ";", "}", "else", "{", "/* Guess the month start.\n\t\t\t * Always also check the next month, since customization can\n\t\t\t * differ. It can differ for not more than 3 days. so that\n\t\t\t * checking the next month is enough.\n\t\t\t */", "iMonths", "++", ";", "/*\n\t\t\t * Check the true month start for the given month. If it is\n\t\t\t * later, check the previous month, until a suitable is found.\n\t\t\t */", "while", "(", "getCustomMonthStartDays", "(", "iMonths", ")", ">", "iDays", ")", "{", "iMonths", "--", ";", "}", "iIslamicYear", "=", "Math", ".", "floor", "(", "iMonths", "/", "12", ")", "+", "1", ";", "iIslamicMonth", "=", "iMonths", "%", "12", ";", "iIslamicDay", "=", "(", "iDays", "-", "getCustomMonthStartDays", "(", "12", "*", "(", "iIslamicYear", "-", "1", ")", "+", "iIslamicMonth", ")", ")", "+", "1", ";", "}", "return", "{", "day", ":", "iIslamicDay", ",", "month", ":", "iIslamicMonth", ",", "year", ":", "iIslamicYear", "}", ";", "}" ]
Calculate islamic date from gregorian. @param {object} oGregorian A JS object containing day, month and year in the gregorian calendar @returns {object} The islamic date object created @private
[ "Calculate", "islamic", "date", "from", "gregorian", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/date/Islamic.js#L57-L116
4,637
SAP/openui5
src/sap.ui.commons/src/sap/ui/commons/MenuButton.js
function(oEvent){ var oItem = oEvent.getParameter("item"); this.fireItemSelected({itemId: oItem.getId(), item: oItem}); this.firePress({itemId: oItem.getId(), item: oItem}); }
javascript
function(oEvent){ var oItem = oEvent.getParameter("item"); this.fireItemSelected({itemId: oItem.getId(), item: oItem}); this.firePress({itemId: oItem.getId(), item: oItem}); }
[ "function", "(", "oEvent", ")", "{", "var", "oItem", "=", "oEvent", ".", "getParameter", "(", "\"item\"", ")", ";", "this", ".", "fireItemSelected", "(", "{", "itemId", ":", "oItem", ".", "getId", "(", ")", ",", "item", ":", "oItem", "}", ")", ";", "this", ".", "firePress", "(", "{", "itemId", ":", "oItem", ".", "getId", "(", ")", ",", "item", ":", "oItem", "}", ")", ";", "}" ]
Function is called when an item in the menu was selected.
[ "Function", "is", "called", "when", "an", "item", "in", "the", "menu", "was", "selected", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.commons/src/sap/ui/commons/MenuButton.js#L224-L228
4,638
SAP/openui5
src/sap.ui.core/src/sap/ui/thirdparty/sinon-server.js
each
function each(collection, callback) { if (!collection) { return; } for (var i = 0, l = collection.length; i < l; i += 1) { callback(collection[i]); } }
javascript
function each(collection, callback) { if (!collection) { return; } for (var i = 0, l = collection.length; i < l; i += 1) { callback(collection[i]); } }
[ "function", "each", "(", "collection", ",", "callback", ")", "{", "if", "(", "!", "collection", ")", "{", "return", ";", "}", "for", "(", "var", "i", "=", "0", ",", "l", "=", "collection", ".", "length", ";", "i", "<", "l", ";", "i", "+=", "1", ")", "{", "callback", "(", "collection", "[", "i", "]", ")", ";", "}", "}" ]
filtering to enable a white-list version of Sinon FakeXhr, where whitelisted requests are passed through to real XHR
[ "filtering", "to", "enable", "a", "white", "-", "list", "version", "of", "Sinon", "FakeXhr", "where", "whitelisted", "requests", "are", "passed", "through", "to", "real", "XHR" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/thirdparty/sinon-server.js#L1122-L1130
4,639
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/type/String.js
isDigitSequence
function isDigitSequence(sValue, oConstraints) { return oConstraints && oConstraints.isDigitSequence && sValue && sValue.match(rDigitsOnly); }
javascript
function isDigitSequence(sValue, oConstraints) { return oConstraints && oConstraints.isDigitSequence && sValue && sValue.match(rDigitsOnly); }
[ "function", "isDigitSequence", "(", "sValue", ",", "oConstraints", ")", "{", "return", "oConstraints", "&&", "oConstraints", ".", "isDigitSequence", "&&", "sValue", "&&", "sValue", ".", "match", "(", "rDigitsOnly", ")", ";", "}" ]
Checks whether isDigitSequence constraint is set to true and the given value is a digit sequence. @param {string} [sValue] the value to be checked @param {object} [oConstraints] the currently used constraints @returns {boolean} true if isDigitSequence is set to true and the given value is a digit sequence
[ "Checks", "whether", "isDigitSequence", "constraint", "is", "set", "to", "true", "and", "the", "given", "value", "is", "a", "digit", "sequence", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/type/String.js#L27-L29
4,640
SAP/openui5
src/sap.f/src/sap/f/cards/BaseContent.js
_bind
function _bind(sAggregation, oControl, oBindingInfo) { var oBindingContext = this.getBindingContext(); if (oBindingContext) { oBindingInfo.path = oBindingContext.getPath(); oControl.bindAggregation(sAggregation, oBindingInfo); } }
javascript
function _bind(sAggregation, oControl, oBindingInfo) { var oBindingContext = this.getBindingContext(); if (oBindingContext) { oBindingInfo.path = oBindingContext.getPath(); oControl.bindAggregation(sAggregation, oBindingInfo); } }
[ "function", "_bind", "(", "sAggregation", ",", "oControl", ",", "oBindingInfo", ")", "{", "var", "oBindingContext", "=", "this", ".", "getBindingContext", "(", ")", ";", "if", "(", "oBindingContext", ")", "{", "oBindingInfo", ".", "path", "=", "oBindingContext", ".", "getPath", "(", ")", ";", "oControl", ".", "bindAggregation", "(", "sAggregation", ",", "oBindingInfo", ")", ";", "}", "}" ]
Helper function to bind an aggregation. @param {string} sAggregation The name of the aggregation to bind. @param {sap.ui.core.Control} oControl The control which aggregation is going to be bound. @param {Object} oBindingInfo The binding info.
[ "Helper", "function", "to", "bind", "an", "aggregation", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.f/src/sap/f/cards/BaseContent.js#L210-L216
4,641
SAP/openui5
src/sap.ui.support/src/sap/ui/support/supportRules/History.js
function (oRun, sLibraryName, sRuleName) { var aIssues = []; if (oRun.issues[sLibraryName] && oRun.issues[sLibraryName][sRuleName]) { oRun.issues[sLibraryName][sRuleName].forEach(function (oIssue) { var oMinimizedIssue = { "context": oIssue.context, "details": oIssue.details, "name": oIssue.name, "severity": oIssue.severity }; aIssues.push(oMinimizedIssue); }); } return aIssues; }
javascript
function (oRun, sLibraryName, sRuleName) { var aIssues = []; if (oRun.issues[sLibraryName] && oRun.issues[sLibraryName][sRuleName]) { oRun.issues[sLibraryName][sRuleName].forEach(function (oIssue) { var oMinimizedIssue = { "context": oIssue.context, "details": oIssue.details, "name": oIssue.name, "severity": oIssue.severity }; aIssues.push(oMinimizedIssue); }); } return aIssues; }
[ "function", "(", "oRun", ",", "sLibraryName", ",", "sRuleName", ")", "{", "var", "aIssues", "=", "[", "]", ";", "if", "(", "oRun", ".", "issues", "[", "sLibraryName", "]", "&&", "oRun", ".", "issues", "[", "sLibraryName", "]", "[", "sRuleName", "]", ")", "{", "oRun", ".", "issues", "[", "sLibraryName", "]", "[", "sRuleName", "]", ".", "forEach", "(", "function", "(", "oIssue", ")", "{", "var", "oMinimizedIssue", "=", "{", "\"context\"", ":", "oIssue", ".", "context", ",", "\"details\"", ":", "oIssue", ".", "details", ",", "\"name\"", ":", "oIssue", ".", "name", ",", "\"severity\"", ":", "oIssue", ".", "severity", "}", ";", "aIssues", ".", "push", "(", "oMinimizedIssue", ")", ";", "}", ")", ";", "}", "return", "aIssues", ";", "}" ]
Gets all issues reported from a specific rule in shortened format - containing only the necessary details of the issue. @param {Object} oRun The analysis run @param {string} sLibraryName The name of the library @param {string} sRuleName The name of the rule @returns {Array} All issues from a rule @private @method
[ "Gets", "all", "issues", "reported", "from", "a", "specific", "rule", "in", "shortened", "format", "-", "containing", "only", "the", "necessary", "details", "of", "the", "issue", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/History.js#L109-L125
4,642
SAP/openui5
src/sap.ui.support/src/sap/ui/support/supportRules/History.js
function (oContext) { var mIssues = IssueManager.groupIssues(IssueManager.getIssuesModel()), aIssues = IssueManager.getIssues(), mRules = RuleSetLoader.getRuleSets(), mSelectedRules = oContext._oSelectedRulesIds, oSelectedRulePreset = oContext._oSelectedRulePreset; _aRuns.push({ date: new Date().toUTCString(), issues: mIssues, onlyIssues: aIssues, application: oContext._oDataCollector.getAppInfo(), technical: oContext._oDataCollector.getTechInfoJSON(), rules: IssueManager.getRulesViewModel(mRules, mSelectedRules, mIssues), rulePreset: oSelectedRulePreset, scope: { executionScope: { type: oContext._oExecutionScope.getType(), selectors: oContext._oExecutionScope._getContext().parentId || oContext._oExecutionScope._getContext().components } }, analysisDuration: oContext._oAnalyzer.getElapsedTimeString(), analysisMetadata: oContext._oAnalysisMetadata || null }); }
javascript
function (oContext) { var mIssues = IssueManager.groupIssues(IssueManager.getIssuesModel()), aIssues = IssueManager.getIssues(), mRules = RuleSetLoader.getRuleSets(), mSelectedRules = oContext._oSelectedRulesIds, oSelectedRulePreset = oContext._oSelectedRulePreset; _aRuns.push({ date: new Date().toUTCString(), issues: mIssues, onlyIssues: aIssues, application: oContext._oDataCollector.getAppInfo(), technical: oContext._oDataCollector.getTechInfoJSON(), rules: IssueManager.getRulesViewModel(mRules, mSelectedRules, mIssues), rulePreset: oSelectedRulePreset, scope: { executionScope: { type: oContext._oExecutionScope.getType(), selectors: oContext._oExecutionScope._getContext().parentId || oContext._oExecutionScope._getContext().components } }, analysisDuration: oContext._oAnalyzer.getElapsedTimeString(), analysisMetadata: oContext._oAnalysisMetadata || null }); }
[ "function", "(", "oContext", ")", "{", "var", "mIssues", "=", "IssueManager", ".", "groupIssues", "(", "IssueManager", ".", "getIssuesModel", "(", ")", ")", ",", "aIssues", "=", "IssueManager", ".", "getIssues", "(", ")", ",", "mRules", "=", "RuleSetLoader", ".", "getRuleSets", "(", ")", ",", "mSelectedRules", "=", "oContext", ".", "_oSelectedRulesIds", ",", "oSelectedRulePreset", "=", "oContext", ".", "_oSelectedRulePreset", ";", "_aRuns", ".", "push", "(", "{", "date", ":", "new", "Date", "(", ")", ".", "toUTCString", "(", ")", ",", "issues", ":", "mIssues", ",", "onlyIssues", ":", "aIssues", ",", "application", ":", "oContext", ".", "_oDataCollector", ".", "getAppInfo", "(", ")", ",", "technical", ":", "oContext", ".", "_oDataCollector", ".", "getTechInfoJSON", "(", ")", ",", "rules", ":", "IssueManager", ".", "getRulesViewModel", "(", "mRules", ",", "mSelectedRules", ",", "mIssues", ")", ",", "rulePreset", ":", "oSelectedRulePreset", ",", "scope", ":", "{", "executionScope", ":", "{", "type", ":", "oContext", ".", "_oExecutionScope", ".", "getType", "(", ")", ",", "selectors", ":", "oContext", ".", "_oExecutionScope", ".", "_getContext", "(", ")", ".", "parentId", "||", "oContext", ".", "_oExecutionScope", ".", "_getContext", "(", ")", ".", "components", "}", "}", ",", "analysisDuration", ":", "oContext", ".", "_oAnalyzer", ".", "getElapsedTimeString", "(", ")", ",", "analysisMetadata", ":", "oContext", ".", "_oAnalysisMetadata", "||", "null", "}", ")", ";", "}" ]
Stores the passed analysis object to an array of passed runs. @public @method @param {Object} oContext the context of the analysis @name sap.ui.support.History.saveAnalysis
[ "Stores", "the", "passed", "analysis", "object", "to", "an", "array", "of", "passed", "runs", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/History.js#L146-L170
4,643
SAP/openui5
src/sap.ui.support/src/sap/ui/support/supportRules/History.js
function () { var aOutput = []; _aRuns.forEach(function (oRun) { var oTmp = _generateRootLevelKeys(oRun); for (var sLibraryName in oRun.rules) { _generateLibraryStructure(oTmp, sLibraryName, oRun); for (var sRuleName in oRun.rules[sLibraryName]) { _generateRuleStructure(oTmp, sLibraryName, sRuleName, oRun); } } aOutput.push(oTmp); }); return aOutput; }
javascript
function () { var aOutput = []; _aRuns.forEach(function (oRun) { var oTmp = _generateRootLevelKeys(oRun); for (var sLibraryName in oRun.rules) { _generateLibraryStructure(oTmp, sLibraryName, oRun); for (var sRuleName in oRun.rules[sLibraryName]) { _generateRuleStructure(oTmp, sLibraryName, sRuleName, oRun); } } aOutput.push(oTmp); }); return aOutput; }
[ "function", "(", ")", "{", "var", "aOutput", "=", "[", "]", ";", "_aRuns", ".", "forEach", "(", "function", "(", "oRun", ")", "{", "var", "oTmp", "=", "_generateRootLevelKeys", "(", "oRun", ")", ";", "for", "(", "var", "sLibraryName", "in", "oRun", ".", "rules", ")", "{", "_generateLibraryStructure", "(", "oTmp", ",", "sLibraryName", ",", "oRun", ")", ";", "for", "(", "var", "sRuleName", "in", "oRun", ".", "rules", "[", "sLibraryName", "]", ")", "{", "_generateRuleStructure", "(", "oTmp", ",", "sLibraryName", ",", "sRuleName", ",", "oRun", ")", ";", "}", "}", "aOutput", ".", "push", "(", "oTmp", ")", ";", "}", ")", ";", "return", "aOutput", ";", "}" ]
Gets all passed analyses in a JSON object that can easily be converted into a string. @public @method @name sap.ui.support.History.getHistory @returns {Array} Which contains all passed run analysis objects.
[ "Gets", "all", "passed", "analyses", "in", "a", "JSON", "object", "that", "can", "easily", "be", "converted", "into", "a", "string", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/History.js#L191-L209
4,644
SAP/openui5
src/sap.ui.support/src/sap/ui/support/supportRules/History.js
function (sFormat) { var oFormattedHistory, aHistory = this.getHistory(); switch (sFormat) { case library.HistoryFormats.Abap: oFormattedHistory = AbapHistoryFormatter.format(aHistory); break; default : oFormattedHistory = StringHistoryFormatter.format(aHistory); } return oFormattedHistory; }
javascript
function (sFormat) { var oFormattedHistory, aHistory = this.getHistory(); switch (sFormat) { case library.HistoryFormats.Abap: oFormattedHistory = AbapHistoryFormatter.format(aHistory); break; default : oFormattedHistory = StringHistoryFormatter.format(aHistory); } return oFormattedHistory; }
[ "function", "(", "sFormat", ")", "{", "var", "oFormattedHistory", ",", "aHistory", "=", "this", ".", "getHistory", "(", ")", ";", "switch", "(", "sFormat", ")", "{", "case", "library", ".", "HistoryFormats", ".", "Abap", ":", "oFormattedHistory", "=", "AbapHistoryFormatter", ".", "format", "(", "aHistory", ")", ";", "break", ";", "default", ":", "oFormattedHistory", "=", "StringHistoryFormatter", ".", "format", "(", "aHistory", ")", ";", "}", "return", "oFormattedHistory", ";", "}" ]
Returns the history into formatted output depending on the passed format. @public @method @param {string} sFormat The format into which the history object will be converted. Possible values are listed in sap.ui.support.HistoryFormats. @name sap.ui.support.History.getFormattedHistory @returns {*} All analysis history objects in the correct format.
[ "Returns", "the", "history", "into", "formatted", "output", "depending", "on", "the", "passed", "format", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/History.js#L220-L233
4,645
SAP/openui5
src/sap.ui.support/src/sap/ui/support/supportRules/ui/external/Highlighter.js
_createHighLighter
function _createHighLighter() { var highLighter = document.createElement("div"); highLighter.style.cssText = "box-sizing: border-box;border:1px solid blue;background: rgba(20, 20, 200, 0.4);position: absolute"; var highLighterWrapper = document.createElement("div"); highLighterWrapper.id = "ui5-highlighter"; highLighterWrapper.style.cssText = "position: fixed;top:0;right:0;bottom:0;left:0;z-index: 1000;overflow: hidden;"; highLighterWrapper.appendChild(highLighter); document.body.appendChild(highLighterWrapper); // Save reference for later usage _highLighter = document.getElementById("ui5-highlighter"); // Add event handler _highLighter.onmouseover = _hideHighLighter; }
javascript
function _createHighLighter() { var highLighter = document.createElement("div"); highLighter.style.cssText = "box-sizing: border-box;border:1px solid blue;background: rgba(20, 20, 200, 0.4);position: absolute"; var highLighterWrapper = document.createElement("div"); highLighterWrapper.id = "ui5-highlighter"; highLighterWrapper.style.cssText = "position: fixed;top:0;right:0;bottom:0;left:0;z-index: 1000;overflow: hidden;"; highLighterWrapper.appendChild(highLighter); document.body.appendChild(highLighterWrapper); // Save reference for later usage _highLighter = document.getElementById("ui5-highlighter"); // Add event handler _highLighter.onmouseover = _hideHighLighter; }
[ "function", "_createHighLighter", "(", ")", "{", "var", "highLighter", "=", "document", ".", "createElement", "(", "\"div\"", ")", ";", "highLighter", ".", "style", ".", "cssText", "=", "\"box-sizing: border-box;border:1px solid blue;background: rgba(20, 20, 200, 0.4);position: absolute\"", ";", "var", "highLighterWrapper", "=", "document", ".", "createElement", "(", "\"div\"", ")", ";", "highLighterWrapper", ".", "id", "=", "\"ui5-highlighter\"", ";", "highLighterWrapper", ".", "style", ".", "cssText", "=", "\"position: fixed;top:0;right:0;bottom:0;left:0;z-index: 1000;overflow: hidden;\"", ";", "highLighterWrapper", ".", "appendChild", "(", "highLighter", ")", ";", "document", ".", "body", ".", "appendChild", "(", "highLighterWrapper", ")", ";", "// Save reference for later usage", "_highLighter", "=", "document", ".", "getElementById", "(", "\"ui5-highlighter\"", ")", ";", "// Add event handler", "_highLighter", ".", "onmouseover", "=", "_hideHighLighter", ";", "}" ]
Create DOM element for visual highlighting. @private
[ "Create", "DOM", "element", "for", "visual", "highlighting", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/ui/external/Highlighter.js#L32-L50
4,646
SAP/openui5
src/sap.ui.support/src/sap/ui/support/supportRules/ui/external/Highlighter.js
function (elementId) { var highlighter; var targetDomElement; var targetRect; if (_highLighter === null && !document.getElementById("ui5-highlighter")) { _createHighLighter(); } else { _showHighLighter(); } highlighter = _highLighter.firstElementChild; targetDomElement = document.getElementById(elementId); if (targetDomElement) { targetRect = targetDomElement.getBoundingClientRect(); highlighter.style.top = targetRect.top + "px"; highlighter.style.left = targetRect.left + "px"; highlighter.style.height = targetRect.height + "px"; highlighter.style.width = targetRect.width + "px"; } return this; }
javascript
function (elementId) { var highlighter; var targetDomElement; var targetRect; if (_highLighter === null && !document.getElementById("ui5-highlighter")) { _createHighLighter(); } else { _showHighLighter(); } highlighter = _highLighter.firstElementChild; targetDomElement = document.getElementById(elementId); if (targetDomElement) { targetRect = targetDomElement.getBoundingClientRect(); highlighter.style.top = targetRect.top + "px"; highlighter.style.left = targetRect.left + "px"; highlighter.style.height = targetRect.height + "px"; highlighter.style.width = targetRect.width + "px"; } return this; }
[ "function", "(", "elementId", ")", "{", "var", "highlighter", ";", "var", "targetDomElement", ";", "var", "targetRect", ";", "if", "(", "_highLighter", "===", "null", "&&", "!", "document", ".", "getElementById", "(", "\"ui5-highlighter\"", ")", ")", "{", "_createHighLighter", "(", ")", ";", "}", "else", "{", "_showHighLighter", "(", ")", ";", "}", "highlighter", "=", "_highLighter", ".", "firstElementChild", ";", "targetDomElement", "=", "document", ".", "getElementById", "(", "elementId", ")", ";", "if", "(", "targetDomElement", ")", "{", "targetRect", "=", "targetDomElement", ".", "getBoundingClientRect", "(", ")", ";", "highlighter", ".", "style", ".", "top", "=", "targetRect", ".", "top", "+", "\"px\"", ";", "highlighter", ".", "style", ".", "left", "=", "targetRect", ".", "left", "+", "\"px\"", ";", "highlighter", ".", "style", ".", "height", "=", "targetRect", ".", "height", "+", "\"px\"", ";", "highlighter", ".", "style", ".", "width", "=", "targetRect", ".", "width", "+", "\"px\"", ";", "}", "return", "this", ";", "}" ]
Set the position of the visual highlighter. @param {string} elementId - The id of the DOM element that need to be highlighted @returns {exports}
[ "Set", "the", "position", "of", "the", "visual", "highlighter", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/ui/external/Highlighter.js#L62-L86
4,647
SAP/openui5
src/sap.ui.support/src/sap/ui/support/supportRules/ui/controllers/BaseController.js
function() { var aVisibleColumnsIds = [], aColumns = SelectionUtils.treeTable.getColumns(); aColumns.forEach(function (oColumn) { if (oColumn.getVisible()){ aVisibleColumnsIds.push(oColumn.sId); } }); storage.setVisibleColumns(aVisibleColumnsIds); }
javascript
function() { var aVisibleColumnsIds = [], aColumns = SelectionUtils.treeTable.getColumns(); aColumns.forEach(function (oColumn) { if (oColumn.getVisible()){ aVisibleColumnsIds.push(oColumn.sId); } }); storage.setVisibleColumns(aVisibleColumnsIds); }
[ "function", "(", ")", "{", "var", "aVisibleColumnsIds", "=", "[", "]", ",", "aColumns", "=", "SelectionUtils", ".", "treeTable", ".", "getColumns", "(", ")", ";", "aColumns", ".", "forEach", "(", "function", "(", "oColumn", ")", "{", "if", "(", "oColumn", ".", "getVisible", "(", ")", ")", "{", "aVisibleColumnsIds", ".", "push", "(", "oColumn", ".", "sId", ")", ";", "}", "}", ")", ";", "storage", ".", "setVisibleColumns", "(", "aVisibleColumnsIds", ")", ";", "}" ]
Persist visible columns selection in local storage.
[ "Persist", "visible", "columns", "selection", "in", "local", "storage", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.support/src/sap/ui/support/supportRules/ui/controllers/BaseController.js#L54-L65
4,648
SAP/openui5
src/sap.ui.core/src/sap/ui/core/BlockLayerUtils.js
fnAddHTML
function fnAddHTML (oBlockSection, sBlockedLayerId) { var oContainer = document.createElement("div"); oContainer.id = sBlockedLayerId; oContainer.className = "sapUiBlockLayer "; BlockLayerUtils.addAriaAttributes(oContainer); oBlockSection.appendChild(oContainer); return oContainer; }
javascript
function fnAddHTML (oBlockSection, sBlockedLayerId) { var oContainer = document.createElement("div"); oContainer.id = sBlockedLayerId; oContainer.className = "sapUiBlockLayer "; BlockLayerUtils.addAriaAttributes(oContainer); oBlockSection.appendChild(oContainer); return oContainer; }
[ "function", "fnAddHTML", "(", "oBlockSection", ",", "sBlockedLayerId", ")", "{", "var", "oContainer", "=", "document", ".", "createElement", "(", "\"div\"", ")", ";", "oContainer", ".", "id", "=", "sBlockedLayerId", ";", "oContainer", ".", "className", "=", "\"sapUiBlockLayer \"", ";", "BlockLayerUtils", ".", "addAriaAttributes", "(", "oContainer", ")", ";", "oBlockSection", ".", "appendChild", "(", "oContainer", ")", ";", "return", "oContainer", ";", "}" ]
Adds the BlockLayer to the given DOM. @param {object} oBlockSection The DOM to be appended. This can be a DOM section or the DomRef of a control. @param {string} sBlockedLayerId The controls id @returns {object} oContainer The block layer DOM @private
[ "Adds", "the", "BlockLayer", "to", "the", "given", "DOM", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/BlockLayerUtils.js#L155-L165
4,649
SAP/openui5
src/sap.ui.core/src/sap/ui/core/BlockLayerUtils.js
suppressDefaultAndStopPropagation
function suppressDefaultAndStopPropagation(oEvent) { var bTargetIsBlockLayer = oEvent.target === this.$blockLayer.get(0), oTabbable; if (bTargetIsBlockLayer && oEvent.type === 'keydown' && oEvent.keyCode === 9) { // Special handling for "tab" keydown: redirect to next element before or after busy section Log.debug("Local Busy Indicator Event keydown handled: " + oEvent.type); oTabbable = oEvent.shiftKey ? this.oTabbableBefore : this.oTabbableAfter; oTabbable.setAttribute("tabindex", -1); // ignore execution of focus handler this.bIgnoreFocus = true; oTabbable.focus(); this.bIgnoreFocus = false; oTabbable.setAttribute("tabindex", 0); oEvent.stopImmediatePropagation(); } else if (bTargetIsBlockLayer && (oEvent.type === 'mousedown' || oEvent.type === 'touchstart')) { // Do not "preventDefault" to allow to focus busy indicator Log.debug("Local Busy Indicator click handled on busy area: " + oEvent.target.id); oEvent.stopImmediatePropagation(); } else { Log.debug("Local Busy Indicator Event Suppressed: " + oEvent.type); oEvent.preventDefault(); oEvent.stopImmediatePropagation(); } }
javascript
function suppressDefaultAndStopPropagation(oEvent) { var bTargetIsBlockLayer = oEvent.target === this.$blockLayer.get(0), oTabbable; if (bTargetIsBlockLayer && oEvent.type === 'keydown' && oEvent.keyCode === 9) { // Special handling for "tab" keydown: redirect to next element before or after busy section Log.debug("Local Busy Indicator Event keydown handled: " + oEvent.type); oTabbable = oEvent.shiftKey ? this.oTabbableBefore : this.oTabbableAfter; oTabbable.setAttribute("tabindex", -1); // ignore execution of focus handler this.bIgnoreFocus = true; oTabbable.focus(); this.bIgnoreFocus = false; oTabbable.setAttribute("tabindex", 0); oEvent.stopImmediatePropagation(); } else if (bTargetIsBlockLayer && (oEvent.type === 'mousedown' || oEvent.type === 'touchstart')) { // Do not "preventDefault" to allow to focus busy indicator Log.debug("Local Busy Indicator click handled on busy area: " + oEvent.target.id); oEvent.stopImmediatePropagation(); } else { Log.debug("Local Busy Indicator Event Suppressed: " + oEvent.type); oEvent.preventDefault(); oEvent.stopImmediatePropagation(); } }
[ "function", "suppressDefaultAndStopPropagation", "(", "oEvent", ")", "{", "var", "bTargetIsBlockLayer", "=", "oEvent", ".", "target", "===", "this", ".", "$blockLayer", ".", "get", "(", "0", ")", ",", "oTabbable", ";", "if", "(", "bTargetIsBlockLayer", "&&", "oEvent", ".", "type", "===", "'keydown'", "&&", "oEvent", ".", "keyCode", "===", "9", ")", "{", "// Special handling for \"tab\" keydown: redirect to next element before or after busy section", "Log", ".", "debug", "(", "\"Local Busy Indicator Event keydown handled: \"", "+", "oEvent", ".", "type", ")", ";", "oTabbable", "=", "oEvent", ".", "shiftKey", "?", "this", ".", "oTabbableBefore", ":", "this", ".", "oTabbableAfter", ";", "oTabbable", ".", "setAttribute", "(", "\"tabindex\"", ",", "-", "1", ")", ";", "// ignore execution of focus handler", "this", ".", "bIgnoreFocus", "=", "true", ";", "oTabbable", ".", "focus", "(", ")", ";", "this", ".", "bIgnoreFocus", "=", "false", ";", "oTabbable", ".", "setAttribute", "(", "\"tabindex\"", ",", "0", ")", ";", "oEvent", ".", "stopImmediatePropagation", "(", ")", ";", "}", "else", "if", "(", "bTargetIsBlockLayer", "&&", "(", "oEvent", ".", "type", "===", "'mousedown'", "||", "oEvent", ".", "type", "===", "'touchstart'", ")", ")", "{", "// Do not \"preventDefault\" to allow to focus busy indicator", "Log", ".", "debug", "(", "\"Local Busy Indicator click handled on busy area: \"", "+", "oEvent", ".", "target", ".", "id", ")", ";", "oEvent", ".", "stopImmediatePropagation", "(", ")", ";", "}", "else", "{", "Log", ".", "debug", "(", "\"Local Busy Indicator Event Suppressed: \"", "+", "oEvent", ".", "type", ")", ";", "oEvent", ".", "preventDefault", "(", ")", ";", "oEvent", ".", "stopImmediatePropagation", "(", ")", ";", "}", "}" ]
Handler which suppresses event bubbling for blocked section @param {object} oEvent The event on the suppressed DOM @private
[ "Handler", "which", "suppresses", "event", "bubbling", "for", "blocked", "section" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/BlockLayerUtils.js#L215-L241
4,650
SAP/openui5
src/sap.ui.core/src/sap/ui/core/BlockLayerUtils.js
registerInteractionHandler
function registerInteractionHandler(fnHandler) { var aSuppressHandler = [], oParentDOM = this.$parent.get(0), oBlockLayerDOM = this.$blockLayer.get(0); for (var i = 0; i < aPreventedEvents.length; i++) { // Add event listeners with "useCapture" settings to suppress events before dispatching/bubbling starts oParentDOM.addEventListener(aPreventedEvents[i], fnHandler, { capture: true, passive: false }); aSuppressHandler.push(EventTriggerHook.suppress(aPreventedEvents[i], oParentDOM, oBlockLayerDOM)); } //for jQuery triggered events we also need the keydown handler this.$blockLayer.bind('keydown', fnHandler); return aSuppressHandler; }
javascript
function registerInteractionHandler(fnHandler) { var aSuppressHandler = [], oParentDOM = this.$parent.get(0), oBlockLayerDOM = this.$blockLayer.get(0); for (var i = 0; i < aPreventedEvents.length; i++) { // Add event listeners with "useCapture" settings to suppress events before dispatching/bubbling starts oParentDOM.addEventListener(aPreventedEvents[i], fnHandler, { capture: true, passive: false }); aSuppressHandler.push(EventTriggerHook.suppress(aPreventedEvents[i], oParentDOM, oBlockLayerDOM)); } //for jQuery triggered events we also need the keydown handler this.$blockLayer.bind('keydown', fnHandler); return aSuppressHandler; }
[ "function", "registerInteractionHandler", "(", "fnHandler", ")", "{", "var", "aSuppressHandler", "=", "[", "]", ",", "oParentDOM", "=", "this", ".", "$parent", ".", "get", "(", "0", ")", ",", "oBlockLayerDOM", "=", "this", ".", "$blockLayer", ".", "get", "(", "0", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "aPreventedEvents", ".", "length", ";", "i", "++", ")", "{", "// Add event listeners with \"useCapture\" settings to suppress events before dispatching/bubbling starts", "oParentDOM", ".", "addEventListener", "(", "aPreventedEvents", "[", "i", "]", ",", "fnHandler", ",", "{", "capture", ":", "true", ",", "passive", ":", "false", "}", ")", ";", "aSuppressHandler", ".", "push", "(", "EventTriggerHook", ".", "suppress", "(", "aPreventedEvents", "[", "i", "]", ",", "oParentDOM", ",", "oBlockLayerDOM", ")", ")", ";", "}", "//for jQuery triggered events we also need the keydown handler", "this", ".", "$blockLayer", ".", "bind", "(", "'keydown'", ",", "fnHandler", ")", ";", "return", "aSuppressHandler", ";", "}" ]
Register event handler to suppress event within busy section
[ "Register", "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#L288-L305
4,651
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", "(", "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", ")", ";", "}", "}" ]
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
4,652
SAP/openui5
src/sap.ui.core/src/sap/ui/core/History.js
function() { if (!this._aHistory) { var aHistory = this._oStorage.get(this._sHistoryId); if (typeof (aHistory) === "string") { // in case it is a string, convert it to an array aHistory = aHistory.split(","); } else if (!aHistory) { // or create a new one in case of non existence aHistory = []; } // else assume that there is the means for serializing JSON used, returning an array directly //do a final check of the entries this._aHistory = this._fCheckHistory(aHistory); } return this._aHistory; }
javascript
function() { if (!this._aHistory) { var aHistory = this._oStorage.get(this._sHistoryId); if (typeof (aHistory) === "string") { // in case it is a string, convert it to an array aHistory = aHistory.split(","); } else if (!aHistory) { // or create a new one in case of non existence aHistory = []; } // else assume that there is the means for serializing JSON used, returning an array directly //do a final check of the entries this._aHistory = this._fCheckHistory(aHistory); } return this._aHistory; }
[ "function", "(", ")", "{", "if", "(", "!", "this", ".", "_aHistory", ")", "{", "var", "aHistory", "=", "this", ".", "_oStorage", ".", "get", "(", "this", ".", "_sHistoryId", ")", ";", "if", "(", "typeof", "(", "aHistory", ")", "===", "\"string\"", ")", "{", "// in case it is a string, convert it to an array", "aHistory", "=", "aHistory", ".", "split", "(", "\",\"", ")", ";", "}", "else", "if", "(", "!", "aHistory", ")", "{", "// or create a new one in case of non existence", "aHistory", "=", "[", "]", ";", "}", "// else assume that there is the means for serializing JSON used, returning an array directly", "//do a final check of the entries", "this", ".", "_aHistory", "=", "this", ".", "_fCheckHistory", "(", "aHistory", ")", ";", "}", "return", "this", ".", "_aHistory", ";", "}" ]
Initializes the history if not already done. @private
[ "Initializes", "the", "history", "if", "not", "already", "done", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/History.js#L55-L69
4,653
SAP/openui5
src/sap.ui.core/src/sap/ui/core/History.js
function(sValue) { var aHistory = this._initHistory(); var aResult = []; for (var i = 0; i < aHistory.length; i++) { if (this._fFilter(aHistory[i], sValue)) { aResult.push(aHistory[i]); } } return aResult; }
javascript
function(sValue) { var aHistory = this._initHistory(); var aResult = []; for (var i = 0; i < aHistory.length; i++) { if (this._fFilter(aHistory[i], sValue)) { aResult.push(aHistory[i]); } } return aResult; }
[ "function", "(", "sValue", ")", "{", "var", "aHistory", "=", "this", ".", "_initHistory", "(", ")", ";", "var", "aResult", "=", "[", "]", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "aHistory", ".", "length", ";", "i", "++", ")", "{", "if", "(", "this", ".", "_fFilter", "(", "aHistory", "[", "i", "]", ",", "sValue", ")", ")", "{", "aResult", ".", "push", "(", "aHistory", "[", "i", "]", ")", ";", "}", "}", "return", "aResult", ";", "}" ]
Returns the history values fitting to the given value (according to the specified filter. @private
[ "Returns", "the", "history", "values", "fitting", "to", "the", "given", "value", "(", "according", "to", "the", "specified", "filter", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/History.js#L76-L85
4,654
SAP/openui5
src/sap.ui.core/src/sap/ui/core/History.js
function(sValue) { var aHistory = this._initHistory(); for (var i = 0; i < aHistory.length; i++) { if (aHistory[i] == sValue) { aHistory.splice(i, 1); break; } } }
javascript
function(sValue) { var aHistory = this._initHistory(); for (var i = 0; i < aHistory.length; i++) { if (aHistory[i] == sValue) { aHistory.splice(i, 1); break; } } }
[ "function", "(", "sValue", ")", "{", "var", "aHistory", "=", "this", ".", "_initHistory", "(", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "aHistory", ".", "length", ";", "i", "++", ")", "{", "if", "(", "aHistory", "[", "i", "]", "==", "sValue", ")", "{", "aHistory", ".", "splice", "(", "i", ",", "1", ")", ";", "break", ";", "}", "}", "}" ]
Removes the given value from the history values. @private
[ "Removes", "the", "given", "value", "from", "the", "history", "values", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/History.js#L92-L100
4,655
SAP/openui5
src/sap.ui.core/src/sap/ui/core/History.js
function(sValue) { var aHistory = this._initHistory(); // ensure it is not contained twice -> remove for (var i = 0; i < aHistory.length; i++) { if (aHistory[i] === sValue) { aHistory.splice(i,1); break; } } // and put it to the 'very top' aHistory.unshift(sValue); // but do not store more than specified if (aHistory.length > this._iMaxHistory) { aHistory.splice(this._iMaxHistory); } this._oStorage.put(this._sHistoryId, aHistory); }
javascript
function(sValue) { var aHistory = this._initHistory(); // ensure it is not contained twice -> remove for (var i = 0; i < aHistory.length; i++) { if (aHistory[i] === sValue) { aHistory.splice(i,1); break; } } // and put it to the 'very top' aHistory.unshift(sValue); // but do not store more than specified if (aHistory.length > this._iMaxHistory) { aHistory.splice(this._iMaxHistory); } this._oStorage.put(this._sHistoryId, aHistory); }
[ "function", "(", "sValue", ")", "{", "var", "aHistory", "=", "this", ".", "_initHistory", "(", ")", ";", "// ensure it is not contained twice -> remove", "for", "(", "var", "i", "=", "0", ";", "i", "<", "aHistory", ".", "length", ";", "i", "++", ")", "{", "if", "(", "aHistory", "[", "i", "]", "===", "sValue", ")", "{", "aHistory", ".", "splice", "(", "i", ",", "1", ")", ";", "break", ";", "}", "}", "// and put it to the 'very top'", "aHistory", ".", "unshift", "(", "sValue", ")", ";", "// but do not store more than specified", "if", "(", "aHistory", ".", "length", ">", "this", ".", "_iMaxHistory", ")", "{", "aHistory", ".", "splice", "(", "this", ".", "_iMaxHistory", ")", ";", "}", "this", ".", "_oStorage", ".", "put", "(", "this", ".", "_sHistoryId", ",", "aHistory", ")", ";", "}" ]
Adds the given value to the history. @private
[ "Adds", "the", "given", "value", "to", "the", "history", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/History.js#L107-L124
4,656
SAP/openui5
src/sap.ui.codeeditor/src/sap/ui/codeeditor/js/ace/worker-javascript.js
each
function each(obj, cb) { if (!obj) return; if (!Array.isArray(obj) && typeof obj === "object") obj = Object.keys(obj); obj.forEach(cb); }
javascript
function each(obj, cb) { if (!obj) return; if (!Array.isArray(obj) && typeof obj === "object") obj = Object.keys(obj); obj.forEach(cb); }
[ "function", "each", "(", "obj", ",", "cb", ")", "{", "if", "(", "!", "obj", ")", "return", ";", "if", "(", "!", "Array", ".", "isArray", "(", "obj", ")", "&&", "typeof", "obj", "===", "\"object\"", ")", "obj", "=", "Object", ".", "keys", "(", "obj", ")", ";", "obj", ".", "forEach", "(", "cb", ")", ";", "}" ]
Variables that live outside the current file
[ "Variables", "that", "live", "outside", "the", "current", "file" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.codeeditor/src/sap/ui/codeeditor/js/ace/worker-javascript.js#L7837-L7845
4,657
SAP/openui5
src/sap.m/src/sap/m/MultiComboBox.js
function (oEvent) { var sValue = this.getValue(); if (sValue) { that.setValue(sValue); that._selectItemByKey(); this.setValue(that._sOldInput); that.close(); } }
javascript
function (oEvent) { var sValue = this.getValue(); if (sValue) { that.setValue(sValue); that._selectItemByKey(); this.setValue(that._sOldInput); that.close(); } }
[ "function", "(", "oEvent", ")", "{", "var", "sValue", "=", "this", ".", "getValue", "(", ")", ";", "if", "(", "sValue", ")", "{", "that", ".", "setValue", "(", "sValue", ")", ";", "that", ".", "_selectItemByKey", "(", ")", ";", "this", ".", "setValue", "(", "that", ".", "_sOldInput", ")", ";", "that", ".", "close", "(", ")", ";", "}", "}" ]
select a list item, when enter is triggered in picker text field
[ "select", "a", "list", "item", "when", "enter", "is", "triggered", "in", "picker", "text", "field" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.m/src/sap/m/MultiComboBox.js#L959-L967
4,658
SAP/openui5
src/sap.ui.core/src/sap/ui/base/ManagedObjectObserver.js
handleChange
function handleChange(sType, oObject, sName, fnCreateChange) { var sId = oObject.getId(), oTargetConfig = mTargets[sId]; if (oTargetConfig) { var oChange; for (var i = 0; i < oTargetConfig.listeners.length; i++) { if (isObserving(oTargetConfig.configurations[i], sType, sName)) { if (!oChange) { oChange = fnCreateChange(); oChange.name = sName; oChange.object = oObject; } var oListener = oTargetConfig.listeners[i]; oListener._fnCallback(oChange); } } } }
javascript
function handleChange(sType, oObject, sName, fnCreateChange) { var sId = oObject.getId(), oTargetConfig = mTargets[sId]; if (oTargetConfig) { var oChange; for (var i = 0; i < oTargetConfig.listeners.length; i++) { if (isObserving(oTargetConfig.configurations[i], sType, sName)) { if (!oChange) { oChange = fnCreateChange(); oChange.name = sName; oChange.object = oObject; } var oListener = oTargetConfig.listeners[i]; oListener._fnCallback(oChange); } } } }
[ "function", "handleChange", "(", "sType", ",", "oObject", ",", "sName", ",", "fnCreateChange", ")", "{", "var", "sId", "=", "oObject", ".", "getId", "(", ")", ",", "oTargetConfig", "=", "mTargets", "[", "sId", "]", ";", "if", "(", "oTargetConfig", ")", "{", "var", "oChange", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "oTargetConfig", ".", "listeners", ".", "length", ";", "i", "++", ")", "{", "if", "(", "isObserving", "(", "oTargetConfig", ".", "configurations", "[", "i", "]", ",", "sType", ",", "sName", ")", ")", "{", "if", "(", "!", "oChange", ")", "{", "oChange", "=", "fnCreateChange", "(", ")", ";", "oChange", ".", "name", "=", "sName", ";", "oChange", ".", "object", "=", "oObject", ";", "}", "var", "oListener", "=", "oTargetConfig", ".", "listeners", "[", "i", "]", ";", "oListener", ".", "_fnCallback", "(", "oChange", ")", ";", "}", "}", "}", "}" ]
handles the change event and pipelines it to the ManagedObjectObservers that are attached as listeners
[ "handles", "the", "change", "event", "and", "pipelines", "it", "to", "the", "ManagedObjectObservers", "that", "are", "attached", "as", "listeners" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/base/ManagedObjectObserver.js#L421-L439
4,659
SAP/openui5
src/sap.ui.core/src/sap/ui/base/ManagedObjectObserver.js
isObserving
function isObserving(oConfiguration, sType, sName) { // no configuration, listen to all types if (oConfiguration == null || !sType) { return false; } if (sType != "destroy" && sType != "parent" && !sName) { return false; } // either all (true) properties/aggregations/associations are relevant or a specific list or names is provided return oConfiguration[sType] === true || (Array.isArray(oConfiguration[sType]) && oConfiguration[sType].indexOf(sName) > -1); }
javascript
function isObserving(oConfiguration, sType, sName) { // no configuration, listen to all types if (oConfiguration == null || !sType) { return false; } if (sType != "destroy" && sType != "parent" && !sName) { return false; } // either all (true) properties/aggregations/associations are relevant or a specific list or names is provided return oConfiguration[sType] === true || (Array.isArray(oConfiguration[sType]) && oConfiguration[sType].indexOf(sName) > -1); }
[ "function", "isObserving", "(", "oConfiguration", ",", "sType", ",", "sName", ")", "{", "// no configuration, listen to all types", "if", "(", "oConfiguration", "==", "null", "||", "!", "sType", ")", "{", "return", "false", ";", "}", "if", "(", "sType", "!=", "\"destroy\"", "&&", "sType", "!=", "\"parent\"", "&&", "!", "sName", ")", "{", "return", "false", ";", "}", "// either all (true) properties/aggregations/associations are relevant or a specific list or names is provided", "return", "oConfiguration", "[", "sType", "]", "===", "true", "||", "(", "Array", ".", "isArray", "(", "oConfiguration", "[", "sType", "]", ")", "&&", "oConfiguration", "[", "sType", "]", ".", "indexOf", "(", "sName", ")", ">", "-", "1", ")", ";", "}" ]
checks whether the type and name is part of the given configuration. if true is returned a change needs to be processed.
[ "checks", "whether", "the", "type", "and", "name", "is", "part", "of", "the", "given", "configuration", ".", "if", "true", "is", "returned", "a", "change", "needs", "to", "be", "processed", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/base/ManagedObjectObserver.js#L443-L455
4,660
SAP/openui5
src/sap.ui.core/src/sap/ui/base/ManagedObjectObserver.js
remove
function remove(oTarget, oListener, oConfiguration) { oConfiguration = oConfiguration || getConfiguration(oTarget, oListener); updateConfiguration(oTarget, oListener, oConfiguration, true); }
javascript
function remove(oTarget, oListener, oConfiguration) { oConfiguration = oConfiguration || getConfiguration(oTarget, oListener); updateConfiguration(oTarget, oListener, oConfiguration, true); }
[ "function", "remove", "(", "oTarget", ",", "oListener", ",", "oConfiguration", ")", "{", "oConfiguration", "=", "oConfiguration", "||", "getConfiguration", "(", "oTarget", ",", "oListener", ")", ";", "updateConfiguration", "(", "oTarget", ",", "oListener", ",", "oConfiguration", ",", "true", ")", ";", "}" ]
removes the given configuration for the given listener from the internal list of observed targets mTargets. removes the observer from the target managed object if the target hasn't to be observed any longer
[ "removes", "the", "given", "configuration", "for", "the", "given", "listener", "from", "the", "internal", "list", "of", "observed", "targets", "mTargets", ".", "removes", "the", "observer", "from", "the", "target", "managed", "object", "if", "the", "target", "hasn", "t", "to", "be", "observed", "any", "longer" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/base/ManagedObjectObserver.js#L481-L484
4,661
SAP/openui5
src/sap.ui.core/src/sap/ui/base/ManagedObjectObserver.js
destroy
function destroy(oListener) { for (var n in mTargets) { var oTargetConfig = mTargets[n]; for (var i = 0; i < oTargetConfig.listeners.length; i++) { if (oTargetConfig.listeners[i] === oListener) { oTargetConfig.listeners.splice(i, 1); oTargetConfig.configurations.splice(i, 1); } } if (oTargetConfig.listeners && oTargetConfig.listeners.length === 0) { delete mTargets[n]; oTargetConfig.object._observer = undefined; } } }
javascript
function destroy(oListener) { for (var n in mTargets) { var oTargetConfig = mTargets[n]; for (var i = 0; i < oTargetConfig.listeners.length; i++) { if (oTargetConfig.listeners[i] === oListener) { oTargetConfig.listeners.splice(i, 1); oTargetConfig.configurations.splice(i, 1); } } if (oTargetConfig.listeners && oTargetConfig.listeners.length === 0) { delete mTargets[n]; oTargetConfig.object._observer = undefined; } } }
[ "function", "destroy", "(", "oListener", ")", "{", "for", "(", "var", "n", "in", "mTargets", ")", "{", "var", "oTargetConfig", "=", "mTargets", "[", "n", "]", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "oTargetConfig", ".", "listeners", ".", "length", ";", "i", "++", ")", "{", "if", "(", "oTargetConfig", ".", "listeners", "[", "i", "]", "===", "oListener", ")", "{", "oTargetConfig", ".", "listeners", ".", "splice", "(", "i", ",", "1", ")", ";", "oTargetConfig", ".", "configurations", ".", "splice", "(", "i", ",", "1", ")", ";", "}", "}", "if", "(", "oTargetConfig", ".", "listeners", "&&", "oTargetConfig", ".", "listeners", ".", "length", "===", "0", ")", "{", "delete", "mTargets", "[", "n", "]", ";", "oTargetConfig", ".", "object", ".", "_observer", "=", "undefined", ";", "}", "}", "}" ]
removes a given listener by looking at all registered targets and their listeners. if there are no more listeners to a target, the registered target is removed from the mTargets map.
[ "removes", "a", "given", "listener", "by", "looking", "at", "all", "registered", "targets", "and", "their", "listeners", ".", "if", "there", "are", "no", "more", "listeners", "to", "a", "target", "the", "registered", "target", "is", "removed", "from", "the", "mTargets", "map", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/base/ManagedObjectObserver.js#L513-L527
4,662
SAP/openui5
src/sap.ui.core/src/sap/ui/base/ManagedObjectObserver.js
updateConfiguration
function updateConfiguration(oTarget, oListener, oConfiguration, bRemove) { var sId = oTarget.getId(), oTargetConfig = mTargets[sId], oCurrentConfig, iIndex; if (bRemove) { if (!oTargetConfig) { // no registration so far, nothing to remove return; } iIndex = oTargetConfig.listeners.indexOf(oListener); if (iIndex >= 0) { // already registered, update the configuration oCurrentConfig = oTargetConfig.configurations[iIndex]; } } else { if (!oTargetConfig) { oTargetConfig = mTargets[sId] = { listeners: [], configurations: [], object: oTarget }; } iIndex = oTargetConfig.listeners.indexOf(oListener); if (iIndex === -1) { // not registered, push listener and configuration oTargetConfig.listeners.push(oListener); oTargetConfig.configurations.push(oConfiguration); } else { oCurrentConfig = oTargetConfig.configurations[iIndex]; } } if (oCurrentConfig) { oCurrentConfig.properties = oCurrentConfig.properties || []; updateSingleArray(oCurrentConfig.properties, oConfiguration.properties, bRemove); oCurrentConfig.aggregations = oCurrentConfig.aggregations || []; updateSingleArray(oCurrentConfig.aggregations, oConfiguration.aggregations, bRemove); oCurrentConfig.associations = oCurrentConfig.associations || []; updateSingleArray(oCurrentConfig.associations, oConfiguration.associations, bRemove); oCurrentConfig.bindings = oCurrentConfig.bindings || []; updateSingleArray(oCurrentConfig.bindings, oConfiguration.bindings, bRemove); oCurrentConfig.events = oCurrentConfig.events || []; updateSingleArray(oCurrentConfig.events, oConfiguration.events, bRemove); if (oConfiguration.destroy != null) { if (bRemove) { delete oCurrentConfig.destroy; } else { oCurrentConfig.destroy = oConfiguration.destroy; } } if (oConfiguration.parent != null) { if (bRemove) { delete oCurrentConfig.parent; } else { oCurrentConfig.parent = oConfiguration.parent; } } } var bEventsObserved = hasObserverFor(oTarget, "events"); if (oTarget._observer && bRemove) { //delete oTarget._observer; if (!bEventsObserved && EventProvider.hasListener(oTarget, "EventHandlerChange", fnHandleEventChange)) { oTarget.detachEvent("EventHandlerChange", fnHandleEventChange); } if (!bEventsObserved && !hasObserverFor(oTarget, "properties") && !hasObserverFor(oTarget, "aggregations") && !hasObserverFor(oTarget, "associations") && !hasObserverFor(oTarget, "destroy") && !hasObserverFor(oTarget, "parent") && !hasObserverFor(oTarget, "bindings")) { delete oTarget._observer; delete mTargets[sId]; } } else if (!oTarget._observer && !bRemove) { //is any config listening to events if (bEventsObserved && !EventProvider.hasListener(oTarget, "EventHandlerChange", fnHandleEventChange)) { oTarget.attachEvent("EventHandlerChange", fnHandleEventChange); } oTarget._observer = Observer; } }
javascript
function updateConfiguration(oTarget, oListener, oConfiguration, bRemove) { var sId = oTarget.getId(), oTargetConfig = mTargets[sId], oCurrentConfig, iIndex; if (bRemove) { if (!oTargetConfig) { // no registration so far, nothing to remove return; } iIndex = oTargetConfig.listeners.indexOf(oListener); if (iIndex >= 0) { // already registered, update the configuration oCurrentConfig = oTargetConfig.configurations[iIndex]; } } else { if (!oTargetConfig) { oTargetConfig = mTargets[sId] = { listeners: [], configurations: [], object: oTarget }; } iIndex = oTargetConfig.listeners.indexOf(oListener); if (iIndex === -1) { // not registered, push listener and configuration oTargetConfig.listeners.push(oListener); oTargetConfig.configurations.push(oConfiguration); } else { oCurrentConfig = oTargetConfig.configurations[iIndex]; } } if (oCurrentConfig) { oCurrentConfig.properties = oCurrentConfig.properties || []; updateSingleArray(oCurrentConfig.properties, oConfiguration.properties, bRemove); oCurrentConfig.aggregations = oCurrentConfig.aggregations || []; updateSingleArray(oCurrentConfig.aggregations, oConfiguration.aggregations, bRemove); oCurrentConfig.associations = oCurrentConfig.associations || []; updateSingleArray(oCurrentConfig.associations, oConfiguration.associations, bRemove); oCurrentConfig.bindings = oCurrentConfig.bindings || []; updateSingleArray(oCurrentConfig.bindings, oConfiguration.bindings, bRemove); oCurrentConfig.events = oCurrentConfig.events || []; updateSingleArray(oCurrentConfig.events, oConfiguration.events, bRemove); if (oConfiguration.destroy != null) { if (bRemove) { delete oCurrentConfig.destroy; } else { oCurrentConfig.destroy = oConfiguration.destroy; } } if (oConfiguration.parent != null) { if (bRemove) { delete oCurrentConfig.parent; } else { oCurrentConfig.parent = oConfiguration.parent; } } } var bEventsObserved = hasObserverFor(oTarget, "events"); if (oTarget._observer && bRemove) { //delete oTarget._observer; if (!bEventsObserved && EventProvider.hasListener(oTarget, "EventHandlerChange", fnHandleEventChange)) { oTarget.detachEvent("EventHandlerChange", fnHandleEventChange); } if (!bEventsObserved && !hasObserverFor(oTarget, "properties") && !hasObserverFor(oTarget, "aggregations") && !hasObserverFor(oTarget, "associations") && !hasObserverFor(oTarget, "destroy") && !hasObserverFor(oTarget, "parent") && !hasObserverFor(oTarget, "bindings")) { delete oTarget._observer; delete mTargets[sId]; } } else if (!oTarget._observer && !bRemove) { //is any config listening to events if (bEventsObserved && !EventProvider.hasListener(oTarget, "EventHandlerChange", fnHandleEventChange)) { oTarget.attachEvent("EventHandlerChange", fnHandleEventChange); } oTarget._observer = Observer; } }
[ "function", "updateConfiguration", "(", "oTarget", ",", "oListener", ",", "oConfiguration", ",", "bRemove", ")", "{", "var", "sId", "=", "oTarget", ".", "getId", "(", ")", ",", "oTargetConfig", "=", "mTargets", "[", "sId", "]", ",", "oCurrentConfig", ",", "iIndex", ";", "if", "(", "bRemove", ")", "{", "if", "(", "!", "oTargetConfig", ")", "{", "// no registration so far, nothing to remove", "return", ";", "}", "iIndex", "=", "oTargetConfig", ".", "listeners", ".", "indexOf", "(", "oListener", ")", ";", "if", "(", "iIndex", ">=", "0", ")", "{", "// already registered, update the configuration", "oCurrentConfig", "=", "oTargetConfig", ".", "configurations", "[", "iIndex", "]", ";", "}", "}", "else", "{", "if", "(", "!", "oTargetConfig", ")", "{", "oTargetConfig", "=", "mTargets", "[", "sId", "]", "=", "{", "listeners", ":", "[", "]", ",", "configurations", ":", "[", "]", ",", "object", ":", "oTarget", "}", ";", "}", "iIndex", "=", "oTargetConfig", ".", "listeners", ".", "indexOf", "(", "oListener", ")", ";", "if", "(", "iIndex", "===", "-", "1", ")", "{", "// not registered, push listener and configuration", "oTargetConfig", ".", "listeners", ".", "push", "(", "oListener", ")", ";", "oTargetConfig", ".", "configurations", ".", "push", "(", "oConfiguration", ")", ";", "}", "else", "{", "oCurrentConfig", "=", "oTargetConfig", ".", "configurations", "[", "iIndex", "]", ";", "}", "}", "if", "(", "oCurrentConfig", ")", "{", "oCurrentConfig", ".", "properties", "=", "oCurrentConfig", ".", "properties", "||", "[", "]", ";", "updateSingleArray", "(", "oCurrentConfig", ".", "properties", ",", "oConfiguration", ".", "properties", ",", "bRemove", ")", ";", "oCurrentConfig", ".", "aggregations", "=", "oCurrentConfig", ".", "aggregations", "||", "[", "]", ";", "updateSingleArray", "(", "oCurrentConfig", ".", "aggregations", ",", "oConfiguration", ".", "aggregations", ",", "bRemove", ")", ";", "oCurrentConfig", ".", "associations", "=", "oCurrentConfig", ".", "associations", "||", "[", "]", ";", "updateSingleArray", "(", "oCurrentConfig", ".", "associations", ",", "oConfiguration", ".", "associations", ",", "bRemove", ")", ";", "oCurrentConfig", ".", "bindings", "=", "oCurrentConfig", ".", "bindings", "||", "[", "]", ";", "updateSingleArray", "(", "oCurrentConfig", ".", "bindings", ",", "oConfiguration", ".", "bindings", ",", "bRemove", ")", ";", "oCurrentConfig", ".", "events", "=", "oCurrentConfig", ".", "events", "||", "[", "]", ";", "updateSingleArray", "(", "oCurrentConfig", ".", "events", ",", "oConfiguration", ".", "events", ",", "bRemove", ")", ";", "if", "(", "oConfiguration", ".", "destroy", "!=", "null", ")", "{", "if", "(", "bRemove", ")", "{", "delete", "oCurrentConfig", ".", "destroy", ";", "}", "else", "{", "oCurrentConfig", ".", "destroy", "=", "oConfiguration", ".", "destroy", ";", "}", "}", "if", "(", "oConfiguration", ".", "parent", "!=", "null", ")", "{", "if", "(", "bRemove", ")", "{", "delete", "oCurrentConfig", ".", "parent", ";", "}", "else", "{", "oCurrentConfig", ".", "parent", "=", "oConfiguration", ".", "parent", ";", "}", "}", "}", "var", "bEventsObserved", "=", "hasObserverFor", "(", "oTarget", ",", "\"events\"", ")", ";", "if", "(", "oTarget", ".", "_observer", "&&", "bRemove", ")", "{", "//delete oTarget._observer;", "if", "(", "!", "bEventsObserved", "&&", "EventProvider", ".", "hasListener", "(", "oTarget", ",", "\"EventHandlerChange\"", ",", "fnHandleEventChange", ")", ")", "{", "oTarget", ".", "detachEvent", "(", "\"EventHandlerChange\"", ",", "fnHandleEventChange", ")", ";", "}", "if", "(", "!", "bEventsObserved", "&&", "!", "hasObserverFor", "(", "oTarget", ",", "\"properties\"", ")", "&&", "!", "hasObserverFor", "(", "oTarget", ",", "\"aggregations\"", ")", "&&", "!", "hasObserverFor", "(", "oTarget", ",", "\"associations\"", ")", "&&", "!", "hasObserverFor", "(", "oTarget", ",", "\"destroy\"", ")", "&&", "!", "hasObserverFor", "(", "oTarget", ",", "\"parent\"", ")", "&&", "!", "hasObserverFor", "(", "oTarget", ",", "\"bindings\"", ")", ")", "{", "delete", "oTarget", ".", "_observer", ";", "delete", "mTargets", "[", "sId", "]", ";", "}", "}", "else", "if", "(", "!", "oTarget", ".", "_observer", "&&", "!", "bRemove", ")", "{", "//is any config listening to events", "if", "(", "bEventsObserved", "&&", "!", "EventProvider", ".", "hasListener", "(", "oTarget", ",", "\"EventHandlerChange\"", ",", "fnHandleEventChange", ")", ")", "{", "oTarget", ".", "attachEvent", "(", "\"EventHandlerChange\"", ",", "fnHandleEventChange", ")", ";", "}", "oTarget", ".", "_observer", "=", "Observer", ";", "}", "}" ]
update a complete configuration, create one if needed or remove it
[ "update", "a", "complete", "configuration", "create", "one", "if", "needed", "or", "remove", "it" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/base/ManagedObjectObserver.js#L530-L620
4,663
SAP/openui5
src/sap.ui.core/src/sap/ui/base/ManagedObjectObserver.js
updateSingleArray
function updateSingleArray(aOrig, aAdditional, bRemove) { if (!aAdditional) { return; } for (var i = 0; i < aAdditional.length; i++) { var iIndex = aOrig.indexOf(aAdditional[i]); if (iIndex > -1 && bRemove) { aOrig.splice(iIndex, 1); } else if (iIndex === -1 && !bRemove) { aOrig.push(aAdditional[i]); } } }
javascript
function updateSingleArray(aOrig, aAdditional, bRemove) { if (!aAdditional) { return; } for (var i = 0; i < aAdditional.length; i++) { var iIndex = aOrig.indexOf(aAdditional[i]); if (iIndex > -1 && bRemove) { aOrig.splice(iIndex, 1); } else if (iIndex === -1 && !bRemove) { aOrig.push(aAdditional[i]); } } }
[ "function", "updateSingleArray", "(", "aOrig", ",", "aAdditional", ",", "bRemove", ")", "{", "if", "(", "!", "aAdditional", ")", "{", "return", ";", "}", "for", "(", "var", "i", "=", "0", ";", "i", "<", "aAdditional", ".", "length", ";", "i", "++", ")", "{", "var", "iIndex", "=", "aOrig", ".", "indexOf", "(", "aAdditional", "[", "i", "]", ")", ";", "if", "(", "iIndex", ">", "-", "1", "&&", "bRemove", ")", "{", "aOrig", ".", "splice", "(", "iIndex", ",", "1", ")", ";", "}", "else", "if", "(", "iIndex", "===", "-", "1", "&&", "!", "bRemove", ")", "{", "aOrig", ".", "push", "(", "aAdditional", "[", "i", "]", ")", ";", "}", "}", "}" ]
update the single array for observing and unobserving
[ "update", "the", "single", "array", "for", "observing", "and", "unobserving" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/base/ManagedObjectObserver.js#L649-L662
4,664
SAP/openui5
src/sap.ui.core/src/sap/ui/base/ManagedObjectObserver.js
normalizeConfiguration
function normalizeConfiguration(oObject, oConfiguration) { var oMetadata = oObject.getMetadata(), aProperties = Object.keys(oMetadata.getAllProperties()), aAggregations = Object.keys(oMetadata.getAllAggregations()), aAssociations = Object.keys(oMetadata.getAllAssociations()), aBindings = uniqueSort(aProperties.concat(aAggregations)), aEvents = Object.keys(oMetadata.getAllEvents()); oConfiguration.properties = oConfiguration.properties === true ? aProperties : oConfiguration.properties; oConfiguration.aggregations = oConfiguration.aggregations === true ? aAggregations : oConfiguration.aggregations; oConfiguration.associations = oConfiguration.associations === true ? aAssociations : oConfiguration.associations; oConfiguration.bindings = oConfiguration.bindings === true ? aBindings : oConfiguration.bindings; oConfiguration.events = oConfiguration.events === true ? aEvents : oConfiguration.events; oConfiguration.destroy = (oConfiguration.destroy == null) ? false : oConfiguration.destroy; oConfiguration.parent = (oConfiguration.parent == null) ? false : oConfiguration.parent; }
javascript
function normalizeConfiguration(oObject, oConfiguration) { var oMetadata = oObject.getMetadata(), aProperties = Object.keys(oMetadata.getAllProperties()), aAggregations = Object.keys(oMetadata.getAllAggregations()), aAssociations = Object.keys(oMetadata.getAllAssociations()), aBindings = uniqueSort(aProperties.concat(aAggregations)), aEvents = Object.keys(oMetadata.getAllEvents()); oConfiguration.properties = oConfiguration.properties === true ? aProperties : oConfiguration.properties; oConfiguration.aggregations = oConfiguration.aggregations === true ? aAggregations : oConfiguration.aggregations; oConfiguration.associations = oConfiguration.associations === true ? aAssociations : oConfiguration.associations; oConfiguration.bindings = oConfiguration.bindings === true ? aBindings : oConfiguration.bindings; oConfiguration.events = oConfiguration.events === true ? aEvents : oConfiguration.events; oConfiguration.destroy = (oConfiguration.destroy == null) ? false : oConfiguration.destroy; oConfiguration.parent = (oConfiguration.parent == null) ? false : oConfiguration.parent; }
[ "function", "normalizeConfiguration", "(", "oObject", ",", "oConfiguration", ")", "{", "var", "oMetadata", "=", "oObject", ".", "getMetadata", "(", ")", ",", "aProperties", "=", "Object", ".", "keys", "(", "oMetadata", ".", "getAllProperties", "(", ")", ")", ",", "aAggregations", "=", "Object", ".", "keys", "(", "oMetadata", ".", "getAllAggregations", "(", ")", ")", ",", "aAssociations", "=", "Object", ".", "keys", "(", "oMetadata", ".", "getAllAssociations", "(", ")", ")", ",", "aBindings", "=", "uniqueSort", "(", "aProperties", ".", "concat", "(", "aAggregations", ")", ")", ",", "aEvents", "=", "Object", ".", "keys", "(", "oMetadata", ".", "getAllEvents", "(", ")", ")", ";", "oConfiguration", ".", "properties", "=", "oConfiguration", ".", "properties", "===", "true", "?", "aProperties", ":", "oConfiguration", ".", "properties", ";", "oConfiguration", ".", "aggregations", "=", "oConfiguration", ".", "aggregations", "===", "true", "?", "aAggregations", ":", "oConfiguration", ".", "aggregations", ";", "oConfiguration", ".", "associations", "=", "oConfiguration", ".", "associations", "===", "true", "?", "aAssociations", ":", "oConfiguration", ".", "associations", ";", "oConfiguration", ".", "bindings", "=", "oConfiguration", ".", "bindings", "===", "true", "?", "aBindings", ":", "oConfiguration", ".", "bindings", ";", "oConfiguration", ".", "events", "=", "oConfiguration", ".", "events", "===", "true", "?", "aEvents", ":", "oConfiguration", ".", "events", ";", "oConfiguration", ".", "destroy", "=", "(", "oConfiguration", ".", "destroy", "==", "null", ")", "?", "false", ":", "oConfiguration", ".", "destroy", ";", "oConfiguration", ".", "parent", "=", "(", "oConfiguration", ".", "parent", "==", "null", ")", "?", "false", ":", "oConfiguration", ".", "parent", ";", "}" ]
in case the configuration for a specific type is set to true translate this to the complete array in order not to get in trouble when deregistering properties
[ "in", "case", "the", "configuration", "for", "a", "specific", "type", "is", "set", "to", "true", "translate", "this", "to", "the", "complete", "array", "in", "order", "not", "to", "get", "in", "trouble", "when", "deregistering", "properties" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/base/ManagedObjectObserver.js#L692-L708
4,665
SAP/openui5
src/sap.ui.core/src/sap/base/Log.js
getLogEntryListenerInstance
function getLogEntryListenerInstance(){ if (!oListener) { oListener = { listeners: [], onLogEntry: function(oLogEntry){ for (var i = 0; i < oListener.listeners.length; i++) { if (oListener.listeners[i].onLogEntry) { oListener.listeners[i].onLogEntry(oLogEntry); } } }, attach: function(oLog, oLstnr){ if (oLstnr) { oListener.listeners.push(oLstnr); if (oLstnr.onAttachToLog) { oLstnr.onAttachToLog(oLog); } } }, detach: function(oLog, oLstnr){ for (var i = 0; i < oListener.listeners.length; i++) { if (oListener.listeners[i] === oLstnr) { if (oLstnr.onDetachFromLog) { oLstnr.onDetachFromLog(oLog); } oListener.listeners.splice(i,1); return; } } } }; } return oListener; }
javascript
function getLogEntryListenerInstance(){ if (!oListener) { oListener = { listeners: [], onLogEntry: function(oLogEntry){ for (var i = 0; i < oListener.listeners.length; i++) { if (oListener.listeners[i].onLogEntry) { oListener.listeners[i].onLogEntry(oLogEntry); } } }, attach: function(oLog, oLstnr){ if (oLstnr) { oListener.listeners.push(oLstnr); if (oLstnr.onAttachToLog) { oLstnr.onAttachToLog(oLog); } } }, detach: function(oLog, oLstnr){ for (var i = 0; i < oListener.listeners.length; i++) { if (oListener.listeners[i] === oLstnr) { if (oLstnr.onDetachFromLog) { oLstnr.onDetachFromLog(oLog); } oListener.listeners.splice(i,1); return; } } } }; } return oListener; }
[ "function", "getLogEntryListenerInstance", "(", ")", "{", "if", "(", "!", "oListener", ")", "{", "oListener", "=", "{", "listeners", ":", "[", "]", ",", "onLogEntry", ":", "function", "(", "oLogEntry", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "oListener", ".", "listeners", ".", "length", ";", "i", "++", ")", "{", "if", "(", "oListener", ".", "listeners", "[", "i", "]", ".", "onLogEntry", ")", "{", "oListener", ".", "listeners", "[", "i", "]", ".", "onLogEntry", "(", "oLogEntry", ")", ";", "}", "}", "}", ",", "attach", ":", "function", "(", "oLog", ",", "oLstnr", ")", "{", "if", "(", "oLstnr", ")", "{", "oListener", ".", "listeners", ".", "push", "(", "oLstnr", ")", ";", "if", "(", "oLstnr", ".", "onAttachToLog", ")", "{", "oLstnr", ".", "onAttachToLog", "(", "oLog", ")", ";", "}", "}", "}", ",", "detach", ":", "function", "(", "oLog", ",", "oLstnr", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "oListener", ".", "listeners", ".", "length", ";", "i", "++", ")", "{", "if", "(", "oListener", ".", "listeners", "[", "i", "]", "===", "oLstnr", ")", "{", "if", "(", "oLstnr", ".", "onDetachFromLog", ")", "{", "oLstnr", ".", "onDetachFromLog", "(", "oLog", ")", ";", "}", "oListener", ".", "listeners", ".", "splice", "(", "i", ",", "1", ")", ";", "return", ";", "}", "}", "}", "}", ";", "}", "return", "oListener", ";", "}" ]
Gets the log entry listener instance, if not present creates a new one @returns {Object} the singleton log entry listener
[ "Gets", "the", "log", "entry", "listener", "instance", "if", "not", "present", "creates", "a", "new", "one" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/base/Log.js#L132-L165
4,666
SAP/openui5
src/sap.ui.core/src/sap/base/Log.js
log
function log(iLevel, sMessage, sDetails, sComponent, fnSupportInfo) { if (!fnSupportInfo && !sComponent && typeof sDetails === "function") { fnSupportInfo = sDetails; sDetails = ""; } if (!fnSupportInfo && typeof sComponent === "function") { fnSupportInfo = sComponent; sComponent = ""; } sComponent = sComponent || sDefaultComponent; if (iLevel <= level(sComponent) ) { var fNow = now(), oNow = new Date(fNow), iMicroSeconds = Math.floor((fNow - Math.floor(fNow)) * 1000), oLogEntry = { time : pad0(oNow.getHours(),2) + ":" + pad0(oNow.getMinutes(),2) + ":" + pad0(oNow.getSeconds(),2) + "." + pad0(oNow.getMilliseconds(),3) + pad0(iMicroSeconds,3), date : pad0(oNow.getFullYear(),4) + "-" + pad0(oNow.getMonth() + 1,2) + "-" + pad0(oNow.getDate(),2), timestamp: fNow, level : iLevel, message : String(sMessage || ""), details : String(sDetails || ""), component: String(sComponent || "") }; if (bLogSupportInfo && typeof fnSupportInfo === "function") { oLogEntry.supportInfo = fnSupportInfo(); } aLog.push( oLogEntry ); if (oListener) { oListener.onLogEntry(oLogEntry); } /* * Console Log, also tries to log to the console, if available. * * Unfortunately, the support for console is quite different between the UI5 browsers. The most important differences are: * - in IE (checked until IE9), the console object does not exist in a window, until the developer tools are opened for that window. * After opening the dev tools, the console remains available even when the tools are closed again. Only using a new window (or tab) * restores the old state without console. * When the console is available, it provides most standard methods, but not debug and trace * - in FF3.6 the console is not available, until FireBug is opened. It disappears again, when fire bug is closed. * But when the settings for a web site are stored (convenience), the console remains open * When the console is available, it supports all relevant methods * - in FF9.0, the console is always available, but method assert is only available when firebug is open * - in Webkit browsers, the console object is always available and has all required methods * - Exception: in the iOS Simulator, console.info() does not exist */ /*eslint-disable no-console */ if (console) { // in IE and FF, console might not exist; in FF it might even disappear var isDetailsError = sDetails instanceof Error, logText = oLogEntry.date + " " + oLogEntry.time + " " + oLogEntry.message + " - " + oLogEntry.details + " " + oLogEntry.component; switch (iLevel) { case Log.Level.FATAL: case Log.Level.ERROR: isDetailsError ? console.error(logText, "\n", sDetails) : console.error(logText); break; case Log.Level.WARNING: isDetailsError ? console.warn(logText, "\n", sDetails) : console.warn(logText); break; case Log.Level.INFO: if (console.info) { // info not available in iOS simulator isDetailsError ? console.info(logText, "\n", sDetails) : console.info(logText); } else { isDetailsError ? console.log(logText, "\n", sDetails) : console.log(logText); } break; case Log.Level.DEBUG: if (console.debug) { // debug not available in IE, fallback to log isDetailsError ? console.debug(logText, "\n", sDetails) : console.debug(logText); } else { isDetailsError ? console.log(logText, "\n", sDetails) : console.log(logText); } break; case Log.Level.TRACE: if (console.trace) { // trace not available in IE, fallback to log (no trace) isDetailsError ? console.trace(logText, "\n", sDetails) : console.trace(logText); } else { isDetailsError ? console.log(logText, "\n", sDetails) : console.log(logText); } break; } if (console.info && oLogEntry.supportInfo) { console.info(oLogEntry.supportInfo); } } /*eslint-enable no-console */ return oLogEntry; } }
javascript
function log(iLevel, sMessage, sDetails, sComponent, fnSupportInfo) { if (!fnSupportInfo && !sComponent && typeof sDetails === "function") { fnSupportInfo = sDetails; sDetails = ""; } if (!fnSupportInfo && typeof sComponent === "function") { fnSupportInfo = sComponent; sComponent = ""; } sComponent = sComponent || sDefaultComponent; if (iLevel <= level(sComponent) ) { var fNow = now(), oNow = new Date(fNow), iMicroSeconds = Math.floor((fNow - Math.floor(fNow)) * 1000), oLogEntry = { time : pad0(oNow.getHours(),2) + ":" + pad0(oNow.getMinutes(),2) + ":" + pad0(oNow.getSeconds(),2) + "." + pad0(oNow.getMilliseconds(),3) + pad0(iMicroSeconds,3), date : pad0(oNow.getFullYear(),4) + "-" + pad0(oNow.getMonth() + 1,2) + "-" + pad0(oNow.getDate(),2), timestamp: fNow, level : iLevel, message : String(sMessage || ""), details : String(sDetails || ""), component: String(sComponent || "") }; if (bLogSupportInfo && typeof fnSupportInfo === "function") { oLogEntry.supportInfo = fnSupportInfo(); } aLog.push( oLogEntry ); if (oListener) { oListener.onLogEntry(oLogEntry); } /* * Console Log, also tries to log to the console, if available. * * Unfortunately, the support for console is quite different between the UI5 browsers. The most important differences are: * - in IE (checked until IE9), the console object does not exist in a window, until the developer tools are opened for that window. * After opening the dev tools, the console remains available even when the tools are closed again. Only using a new window (or tab) * restores the old state without console. * When the console is available, it provides most standard methods, but not debug and trace * - in FF3.6 the console is not available, until FireBug is opened. It disappears again, when fire bug is closed. * But when the settings for a web site are stored (convenience), the console remains open * When the console is available, it supports all relevant methods * - in FF9.0, the console is always available, but method assert is only available when firebug is open * - in Webkit browsers, the console object is always available and has all required methods * - Exception: in the iOS Simulator, console.info() does not exist */ /*eslint-disable no-console */ if (console) { // in IE and FF, console might not exist; in FF it might even disappear var isDetailsError = sDetails instanceof Error, logText = oLogEntry.date + " " + oLogEntry.time + " " + oLogEntry.message + " - " + oLogEntry.details + " " + oLogEntry.component; switch (iLevel) { case Log.Level.FATAL: case Log.Level.ERROR: isDetailsError ? console.error(logText, "\n", sDetails) : console.error(logText); break; case Log.Level.WARNING: isDetailsError ? console.warn(logText, "\n", sDetails) : console.warn(logText); break; case Log.Level.INFO: if (console.info) { // info not available in iOS simulator isDetailsError ? console.info(logText, "\n", sDetails) : console.info(logText); } else { isDetailsError ? console.log(logText, "\n", sDetails) : console.log(logText); } break; case Log.Level.DEBUG: if (console.debug) { // debug not available in IE, fallback to log isDetailsError ? console.debug(logText, "\n", sDetails) : console.debug(logText); } else { isDetailsError ? console.log(logText, "\n", sDetails) : console.log(logText); } break; case Log.Level.TRACE: if (console.trace) { // trace not available in IE, fallback to log (no trace) isDetailsError ? console.trace(logText, "\n", sDetails) : console.trace(logText); } else { isDetailsError ? console.log(logText, "\n", sDetails) : console.log(logText); } break; } if (console.info && oLogEntry.supportInfo) { console.info(oLogEntry.supportInfo); } } /*eslint-enable no-console */ return oLogEntry; } }
[ "function", "log", "(", "iLevel", ",", "sMessage", ",", "sDetails", ",", "sComponent", ",", "fnSupportInfo", ")", "{", "if", "(", "!", "fnSupportInfo", "&&", "!", "sComponent", "&&", "typeof", "sDetails", "===", "\"function\"", ")", "{", "fnSupportInfo", "=", "sDetails", ";", "sDetails", "=", "\"\"", ";", "}", "if", "(", "!", "fnSupportInfo", "&&", "typeof", "sComponent", "===", "\"function\"", ")", "{", "fnSupportInfo", "=", "sComponent", ";", "sComponent", "=", "\"\"", ";", "}", "sComponent", "=", "sComponent", "||", "sDefaultComponent", ";", "if", "(", "iLevel", "<=", "level", "(", "sComponent", ")", ")", "{", "var", "fNow", "=", "now", "(", ")", ",", "oNow", "=", "new", "Date", "(", "fNow", ")", ",", "iMicroSeconds", "=", "Math", ".", "floor", "(", "(", "fNow", "-", "Math", ".", "floor", "(", "fNow", ")", ")", "*", "1000", ")", ",", "oLogEntry", "=", "{", "time", ":", "pad0", "(", "oNow", ".", "getHours", "(", ")", ",", "2", ")", "+", "\":\"", "+", "pad0", "(", "oNow", ".", "getMinutes", "(", ")", ",", "2", ")", "+", "\":\"", "+", "pad0", "(", "oNow", ".", "getSeconds", "(", ")", ",", "2", ")", "+", "\".\"", "+", "pad0", "(", "oNow", ".", "getMilliseconds", "(", ")", ",", "3", ")", "+", "pad0", "(", "iMicroSeconds", ",", "3", ")", ",", "date", ":", "pad0", "(", "oNow", ".", "getFullYear", "(", ")", ",", "4", ")", "+", "\"-\"", "+", "pad0", "(", "oNow", ".", "getMonth", "(", ")", "+", "1", ",", "2", ")", "+", "\"-\"", "+", "pad0", "(", "oNow", ".", "getDate", "(", ")", ",", "2", ")", ",", "timestamp", ":", "fNow", ",", "level", ":", "iLevel", ",", "message", ":", "String", "(", "sMessage", "||", "\"\"", ")", ",", "details", ":", "String", "(", "sDetails", "||", "\"\"", ")", ",", "component", ":", "String", "(", "sComponent", "||", "\"\"", ")", "}", ";", "if", "(", "bLogSupportInfo", "&&", "typeof", "fnSupportInfo", "===", "\"function\"", ")", "{", "oLogEntry", ".", "supportInfo", "=", "fnSupportInfo", "(", ")", ";", "}", "aLog", ".", "push", "(", "oLogEntry", ")", ";", "if", "(", "oListener", ")", "{", "oListener", ".", "onLogEntry", "(", "oLogEntry", ")", ";", "}", "/*\n\t\t\t * Console Log, also tries to log to the console, if available.\n\t\t\t *\n\t\t\t * Unfortunately, the support for console is quite different between the UI5 browsers. The most important differences are:\n\t\t\t * - in IE (checked until IE9), the console object does not exist in a window, until the developer tools are opened for that window.\n\t\t\t * After opening the dev tools, the console remains available even when the tools are closed again. Only using a new window (or tab)\n\t\t\t * restores the old state without console.\n\t\t\t * When the console is available, it provides most standard methods, but not debug and trace\n\t\t\t * - in FF3.6 the console is not available, until FireBug is opened. It disappears again, when fire bug is closed.\n\t\t\t * But when the settings for a web site are stored (convenience), the console remains open\n\t\t\t * When the console is available, it supports all relevant methods\n\t\t\t * - in FF9.0, the console is always available, but method assert is only available when firebug is open\n\t\t\t * - in Webkit browsers, the console object is always available and has all required methods\n\t\t\t * - Exception: in the iOS Simulator, console.info() does not exist\n\t\t\t */", "/*eslint-disable no-console */", "if", "(", "console", ")", "{", "// in IE and FF, console might not exist; in FF it might even disappear", "var", "isDetailsError", "=", "sDetails", "instanceof", "Error", ",", "logText", "=", "oLogEntry", ".", "date", "+", "\" \"", "+", "oLogEntry", ".", "time", "+", "\" \"", "+", "oLogEntry", ".", "message", "+", "\" - \"", "+", "oLogEntry", ".", "details", "+", "\" \"", "+", "oLogEntry", ".", "component", ";", "switch", "(", "iLevel", ")", "{", "case", "Log", ".", "Level", ".", "FATAL", ":", "case", "Log", ".", "Level", ".", "ERROR", ":", "isDetailsError", "?", "console", ".", "error", "(", "logText", ",", "\"\\n\"", ",", "sDetails", ")", ":", "console", ".", "error", "(", "logText", ")", ";", "break", ";", "case", "Log", ".", "Level", ".", "WARNING", ":", "isDetailsError", "?", "console", ".", "warn", "(", "logText", ",", "\"\\n\"", ",", "sDetails", ")", ":", "console", ".", "warn", "(", "logText", ")", ";", "break", ";", "case", "Log", ".", "Level", ".", "INFO", ":", "if", "(", "console", ".", "info", ")", "{", "// info not available in iOS simulator", "isDetailsError", "?", "console", ".", "info", "(", "logText", ",", "\"\\n\"", ",", "sDetails", ")", ":", "console", ".", "info", "(", "logText", ")", ";", "}", "else", "{", "isDetailsError", "?", "console", ".", "log", "(", "logText", ",", "\"\\n\"", ",", "sDetails", ")", ":", "console", ".", "log", "(", "logText", ")", ";", "}", "break", ";", "case", "Log", ".", "Level", ".", "DEBUG", ":", "if", "(", "console", ".", "debug", ")", "{", "// debug not available in IE, fallback to log", "isDetailsError", "?", "console", ".", "debug", "(", "logText", ",", "\"\\n\"", ",", "sDetails", ")", ":", "console", ".", "debug", "(", "logText", ")", ";", "}", "else", "{", "isDetailsError", "?", "console", ".", "log", "(", "logText", ",", "\"\\n\"", ",", "sDetails", ")", ":", "console", ".", "log", "(", "logText", ")", ";", "}", "break", ";", "case", "Log", ".", "Level", ".", "TRACE", ":", "if", "(", "console", ".", "trace", ")", "{", "// trace not available in IE, fallback to log (no trace)", "isDetailsError", "?", "console", ".", "trace", "(", "logText", ",", "\"\\n\"", ",", "sDetails", ")", ":", "console", ".", "trace", "(", "logText", ")", ";", "}", "else", "{", "isDetailsError", "?", "console", ".", "log", "(", "logText", ",", "\"\\n\"", ",", "sDetails", ")", ":", "console", ".", "log", "(", "logText", ")", ";", "}", "break", ";", "}", "if", "(", "console", ".", "info", "&&", "oLogEntry", ".", "supportInfo", ")", "{", "console", ".", "info", "(", "oLogEntry", ".", "supportInfo", ")", ";", "}", "}", "/*eslint-enable no-console */", "return", "oLogEntry", ";", "}", "}" ]
Creates a new log entry depending on its level and component. If the given level is higher than the max level for the given component (or higher than the global level, if no component is given), then no entry is created and <code>undefined</code> is returned. If an <code>Error</code> is passed via <code>sDetails</code> the stack of the <code>Error</code> will be logged as a separate parameter in the proper <code>console</code> function for the matching log level. @param {module:sap/base/Log.Level} iLevel One of the log levels FATAL, ERROR, WARNING, INFO, DEBUG, TRACE @param {string} sMessage The message to be logged @param {string|Error} [sDetails] The optional details for the message; could be an Error which will be logged with the stack to easily find the root cause of the Error @param {string} [sComponent] The log component under which the message should be logged @param {function} [fnSupportInfo] Callback that returns an additional support object to be logged in support mode. This function is only called if support info mode is turned on with <code>logSupportInfo(true)</code>. To avoid negative effects regarding execution times and memory consumption, the returned object should be a simple immutable JSON object with mostly static and stable content. @returns {object} The log entry as an object or <code>undefined</code> if no entry was created @private
[ "Creates", "a", "new", "log", "entry", "depending", "on", "its", "level", "and", "component", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/base/Log.js#L359-L443
4,667
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_AggregationCache.js
filter
function filter(mMap, fnFilter) { return Object.keys(mMap).filter(fnFilter).reduce(copyTo.bind(mMap), {}); }
javascript
function filter(mMap, fnFilter) { return Object.keys(mMap).filter(fnFilter).reduce(copyTo.bind(mMap), {}); }
[ "function", "filter", "(", "mMap", ",", "fnFilter", ")", "{", "return", "Object", ".", "keys", "(", "mMap", ")", ".", "filter", "(", "fnFilter", ")", ".", "reduce", "(", "copyTo", ".", "bind", "(", "mMap", ")", ",", "{", "}", ")", ";", "}" ]
filters the given map according to the given filter function for keys
[ "filters", "the", "given", "map", "according", "to", "the", "given", "filter", "function", "for", "keys" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/lib/_AggregationCache.js#L330-L332
4,668
SAP/openui5
src/sap.ui.demokit/src/sap/ui/demokit/explored/Component.js
function () { // 1. call overridden init (calls createContent) UIComponent.prototype.init.apply(this, arguments); // 2. nav to initial pages var router = this.getRouter(); if (!Device.system.phone) { router.myNavToWithoutHash("sap.ui.demokit.explored.view.master", "XML", true); router.myNavToWithoutHash("sap.ui.demokit.explored.view.welcome", "XML", false); } // 3. initialize the router this.routeHandler = new RouteMatchedHandler(router); router.initialize(); }
javascript
function () { // 1. call overridden init (calls createContent) UIComponent.prototype.init.apply(this, arguments); // 2. nav to initial pages var router = this.getRouter(); if (!Device.system.phone) { router.myNavToWithoutHash("sap.ui.demokit.explored.view.master", "XML", true); router.myNavToWithoutHash("sap.ui.demokit.explored.view.welcome", "XML", false); } // 3. initialize the router this.routeHandler = new RouteMatchedHandler(router); router.initialize(); }
[ "function", "(", ")", "{", "// 1. call overridden init (calls createContent)", "UIComponent", ".", "prototype", ".", "init", ".", "apply", "(", "this", ",", "arguments", ")", ";", "// 2. nav to initial pages", "var", "router", "=", "this", ".", "getRouter", "(", ")", ";", "if", "(", "!", "Device", ".", "system", ".", "phone", ")", "{", "router", ".", "myNavToWithoutHash", "(", "\"sap.ui.demokit.explored.view.master\"", ",", "\"XML\"", ",", "true", ")", ";", "router", ".", "myNavToWithoutHash", "(", "\"sap.ui.demokit.explored.view.welcome\"", ",", "\"XML\"", ",", "false", ")", ";", "}", "// 3. initialize the router", "this", ".", "routeHandler", "=", "new", "RouteMatchedHandler", "(", "router", ")", ";", "router", ".", "initialize", "(", ")", ";", "}" ]
!!! The steps in here are sequence dependent !!!
[ "!!!", "The", "steps", "in", "here", "are", "sequence", "dependent", "!!!" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.demokit/src/sap/ui/demokit/explored/Component.js#L84-L99
4,669
SAP/openui5
src/sap.ui.core/src/sap/ui/model/odata/v4/Context.js
function (oModel, oBinding, sPath, iIndex, oCreatePromise) { return new Context(oModel, oBinding, sPath, iIndex, oCreatePromise); }
javascript
function (oModel, oBinding, sPath, iIndex, oCreatePromise) { return new Context(oModel, oBinding, sPath, iIndex, oCreatePromise); }
[ "function", "(", "oModel", ",", "oBinding", ",", "sPath", ",", "iIndex", ",", "oCreatePromise", ")", "{", "return", "new", "Context", "(", "oModel", ",", "oBinding", ",", "sPath", ",", "iIndex", ",", "oCreatePromise", ")", ";", "}" ]
Creates a context for an OData V4 model. @param {sap.ui.model.odata.v4.ODataModel} oModel The model @param {sap.ui.model.odata.v4.ODataContextBinding|sap.ui.model.odata.v4.ODataListBinding} oBinding A binding that belongs to the model @param {string} sPath An absolute path without trailing slash @param {number} [iIndex] Index of item represented by this context, used by list bindings, not context bindings @param {Promise} [oCreatePromise] Promise returned by {@link #created} @returns {sap.ui.model.odata.v4.Context} A context for an OData V4 model @throws {Error} If an invalid path is given @private
[ "Creates", "a", "context", "for", "an", "OData", "V4", "model", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/model/odata/v4/Context.js#L868-L870
4,670
SAP/openui5
src/sap.ui.core/src/sap/ui/core/support/trace/E2eTraceLib.js
onLoadstart
function onLoadstart(event) { Log.info(getTstmp(event.timeStamp) + ", " + this.xidx + ": loadstart"); this.xfirstByteSent = getTstmp(event.timeStamp); }
javascript
function onLoadstart(event) { Log.info(getTstmp(event.timeStamp) + ", " + this.xidx + ": loadstart"); this.xfirstByteSent = getTstmp(event.timeStamp); }
[ "function", "onLoadstart", "(", "event", ")", "{", "Log", ".", "info", "(", "getTstmp", "(", "event", ".", "timeStamp", ")", "+", "\", \"", "+", "this", ".", "xidx", "+", "\": loadstart\"", ")", ";", "this", ".", "xfirstByteSent", "=", "getTstmp", "(", "event", ".", "timeStamp", ")", ";", "}" ]
timestamps dependent on browser type event listeners
[ "timestamps", "dependent", "on", "browser", "type", "event", "listeners" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/support/trace/E2eTraceLib.js#L291-L294
4,671
SAP/openui5
src/sap.ui.core/src/sap/ui/core/mvc/JSONView.js
function(oSettings) { var oMetadata = this.getMetadata(), aValidKeys = oMetadata.getJSONKeys(), // UID names required, they're part of the documented contract sKey, oValue, oKeyInfo; for (sKey in oSettings) { // get info object for the key if ( (oKeyInfo = aValidKeys[sKey]) !== undefined ) { oValue = oSettings[sKey]; switch (oKeyInfo._iKind) { case 3: // SINGLE ASSOCIATIONS // prefix the association ids with the view id if ( typeof oValue === "string" ) { oSettings[sKey] = that.createId(oValue); } break; case 5: // EVENTS if ( typeof oValue === "string" ) { oSettings[sKey] = EventHandlerResolver.resolveEventHandler(oValue, oController); } break; } } } }
javascript
function(oSettings) { var oMetadata = this.getMetadata(), aValidKeys = oMetadata.getJSONKeys(), // UID names required, they're part of the documented contract sKey, oValue, oKeyInfo; for (sKey in oSettings) { // get info object for the key if ( (oKeyInfo = aValidKeys[sKey]) !== undefined ) { oValue = oSettings[sKey]; switch (oKeyInfo._iKind) { case 3: // SINGLE ASSOCIATIONS // prefix the association ids with the view id if ( typeof oValue === "string" ) { oSettings[sKey] = that.createId(oValue); } break; case 5: // EVENTS if ( typeof oValue === "string" ) { oSettings[sKey] = EventHandlerResolver.resolveEventHandler(oValue, oController); } break; } } } }
[ "function", "(", "oSettings", ")", "{", "var", "oMetadata", "=", "this", ".", "getMetadata", "(", ")", ",", "aValidKeys", "=", "oMetadata", ".", "getJSONKeys", "(", ")", ",", "// UID names required, they're part of the documented contract", "sKey", ",", "oValue", ",", "oKeyInfo", ";", "for", "(", "sKey", "in", "oSettings", ")", "{", "// get info object for the key", "if", "(", "(", "oKeyInfo", "=", "aValidKeys", "[", "sKey", "]", ")", "!==", "undefined", ")", "{", "oValue", "=", "oSettings", "[", "sKey", "]", ";", "switch", "(", "oKeyInfo", ".", "_iKind", ")", "{", "case", "3", ":", "// SINGLE ASSOCIATIONS", "// prefix the association ids with the view id", "if", "(", "typeof", "oValue", "===", "\"string\"", ")", "{", "oSettings", "[", "sKey", "]", "=", "that", ".", "createId", "(", "oValue", ")", ";", "}", "break", ";", "case", "5", ":", "// EVENTS", "if", "(", "typeof", "oValue", "===", "\"string\"", ")", "{", "oSettings", "[", "sKey", "]", "=", "EventHandlerResolver", ".", "resolveEventHandler", "(", "oValue", ",", "oController", ")", ";", "}", "break", ";", "}", "}", "}", "}" ]
preprocess 'mSettings' for setting the controller as Listener for defined events => make sure to store old preprocessor in case of nested views
[ "preprocess", "mSettings", "for", "setting", "the", "controller", "as", "Listener", "for", "defined", "events", "=", ">", "make", "sure", "to", "store", "old", "preprocessor", "in", "case", "of", "nested", "views" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/mvc/JSONView.js#L216-L239
4,672
SAP/openui5
src/sap.ui.core/src/sap/ui/core/Manifest.js
getVersionWithoutSuffix
function getVersionWithoutSuffix(sVersion) { var oVersion = Version(sVersion); return oVersion.getSuffix() ? Version(oVersion.getMajor() + "." + oVersion.getMinor() + "." + oVersion.getPatch()) : oVersion; }
javascript
function getVersionWithoutSuffix(sVersion) { var oVersion = Version(sVersion); return oVersion.getSuffix() ? Version(oVersion.getMajor() + "." + oVersion.getMinor() + "." + oVersion.getPatch()) : oVersion; }
[ "function", "getVersionWithoutSuffix", "(", "sVersion", ")", "{", "var", "oVersion", "=", "Version", "(", "sVersion", ")", ";", "return", "oVersion", ".", "getSuffix", "(", ")", "?", "Version", "(", "oVersion", ".", "getMajor", "(", ")", "+", "\".\"", "+", "oVersion", ".", "getMinor", "(", ")", "+", "\".\"", "+", "oVersion", ".", "getPatch", "(", ")", ")", ":", "oVersion", ";", "}" ]
Removes the version suffix @param {string} sVersion Version @return {string} Version without suffix
[ "Removes", "the", "version", "suffix" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Manifest.js#L43-L46
4,673
SAP/openui5
src/sap.ui.core/src/sap/ui/core/Manifest.js
getObject
function getObject(oObject, sPath) { // if the incoming sPath is a path we do a nested lookup in the // manifest object and return the concrete value, e.g. "/sap.ui5/extends" if (oObject && sPath && typeof sPath === "string" && sPath[0] === "/") { var aPaths = sPath.substring(1).split("/"), sPathSegment; for (var i = 0, l = aPaths.length; i < l; i++) { sPathSegment = aPaths[i]; // Prevent access to native properties oObject = oObject.hasOwnProperty(sPathSegment) ? oObject[sPathSegment] : undefined; // Only continue with lookup if the value is an object. // Accessing properties of other types is not allowed! if (oObject === null || typeof oObject !== "object") { // Clear the value in case this is not the last segment in the path. // Otherwise e.g. "/foo/bar/baz" would return the value of "/foo/bar" // in case it is not an object. if (i + 1 < l && oObject !== undefined) { oObject = undefined; } break; } } return oObject; } // if no path starting with slash is specified we access and // return the value directly from the manifest return oObject && oObject[sPath]; }
javascript
function getObject(oObject, sPath) { // if the incoming sPath is a path we do a nested lookup in the // manifest object and return the concrete value, e.g. "/sap.ui5/extends" if (oObject && sPath && typeof sPath === "string" && sPath[0] === "/") { var aPaths = sPath.substring(1).split("/"), sPathSegment; for (var i = 0, l = aPaths.length; i < l; i++) { sPathSegment = aPaths[i]; // Prevent access to native properties oObject = oObject.hasOwnProperty(sPathSegment) ? oObject[sPathSegment] : undefined; // Only continue with lookup if the value is an object. // Accessing properties of other types is not allowed! if (oObject === null || typeof oObject !== "object") { // Clear the value in case this is not the last segment in the path. // Otherwise e.g. "/foo/bar/baz" would return the value of "/foo/bar" // in case it is not an object. if (i + 1 < l && oObject !== undefined) { oObject = undefined; } break; } } return oObject; } // if no path starting with slash is specified we access and // return the value directly from the manifest return oObject && oObject[sPath]; }
[ "function", "getObject", "(", "oObject", ",", "sPath", ")", "{", "// if the incoming sPath is a path we do a nested lookup in the", "// manifest object and return the concrete value, e.g. \"/sap.ui5/extends\"", "if", "(", "oObject", "&&", "sPath", "&&", "typeof", "sPath", "===", "\"string\"", "&&", "sPath", "[", "0", "]", "===", "\"/\"", ")", "{", "var", "aPaths", "=", "sPath", ".", "substring", "(", "1", ")", ".", "split", "(", "\"/\"", ")", ",", "sPathSegment", ";", "for", "(", "var", "i", "=", "0", ",", "l", "=", "aPaths", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "sPathSegment", "=", "aPaths", "[", "i", "]", ";", "// Prevent access to native properties", "oObject", "=", "oObject", ".", "hasOwnProperty", "(", "sPathSegment", ")", "?", "oObject", "[", "sPathSegment", "]", ":", "undefined", ";", "// Only continue with lookup if the value is an object.", "// Accessing properties of other types is not allowed!", "if", "(", "oObject", "===", "null", "||", "typeof", "oObject", "!==", "\"object\"", ")", "{", "// Clear the value in case this is not the last segment in the path.", "// Otherwise e.g. \"/foo/bar/baz\" would return the value of \"/foo/bar\"", "// in case it is not an object.", "if", "(", "i", "+", "1", "<", "l", "&&", "oObject", "!==", "undefined", ")", "{", "oObject", "=", "undefined", ";", "}", "break", ";", "}", "}", "return", "oObject", ";", "}", "// if no path starting with slash is specified we access and", "// return the value directly from the manifest", "return", "oObject", "&&", "oObject", "[", "sPath", "]", ";", "}" ]
Utility function to access a child member by a given path @param {object} oObject Object @param {string} sPath Path starting with a slash (/) @return {any} value of a member specified by its path; if the path doesn't start with a slash it returns the value for the given path of the object
[ "Utility", "function", "to", "access", "a", "child", "member", "by", "a", "given", "path" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Manifest.js#L84-L116
4,674
SAP/openui5
src/sap.ui.core/src/sap/ui/core/Manifest.js
deepFreeze
function deepFreeze(oObject) { if (oObject && typeof oObject === 'object' && !Object.isFrozen(oObject)) { Object.freeze(oObject); for (var sKey in oObject) { if (oObject.hasOwnProperty(sKey)) { deepFreeze(oObject[sKey]); } } } }
javascript
function deepFreeze(oObject) { if (oObject && typeof oObject === 'object' && !Object.isFrozen(oObject)) { Object.freeze(oObject); for (var sKey in oObject) { if (oObject.hasOwnProperty(sKey)) { deepFreeze(oObject[sKey]); } } } }
[ "function", "deepFreeze", "(", "oObject", ")", "{", "if", "(", "oObject", "&&", "typeof", "oObject", "===", "'object'", "&&", "!", "Object", ".", "isFrozen", "(", "oObject", ")", ")", "{", "Object", ".", "freeze", "(", "oObject", ")", ";", "for", "(", "var", "sKey", "in", "oObject", ")", "{", "if", "(", "oObject", ".", "hasOwnProperty", "(", "sKey", ")", ")", "{", "deepFreeze", "(", "oObject", "[", "sKey", "]", ")", ";", "}", "}", "}", "}" ]
Freezes the object and nested objects to avoid later manipulation @param oObject the object to deep freeze
[ "Freezes", "the", "object", "and", "nested", "objects", "to", "avoid", "later", "manipulation" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Manifest.js#L124-L133
4,675
SAP/openui5
src/sap.ui.core/src/sap/ui/core/Manifest.js
function(sPath) { if (!sPath || sPath.indexOf(".") <= 0) { Log.warning("Manifest entries with keys without namespace prefix can not be read via getEntry. Key: " + sPath + ", Component: " + this.getComponentName()); return null; } var oManifest = this.getJson(); var oEntry = getObject(oManifest, sPath); // top-level manifest section must be an object (e.g. sap.ui5) if (sPath && sPath[0] !== "/" && !isPlainObject(oEntry)) { Log.warning("Manifest entry with key '" + sPath + "' must be an object. Component: " + this.getComponentName()); return null; } return oEntry; }
javascript
function(sPath) { if (!sPath || sPath.indexOf(".") <= 0) { Log.warning("Manifest entries with keys without namespace prefix can not be read via getEntry. Key: " + sPath + ", Component: " + this.getComponentName()); return null; } var oManifest = this.getJson(); var oEntry = getObject(oManifest, sPath); // top-level manifest section must be an object (e.g. sap.ui5) if (sPath && sPath[0] !== "/" && !isPlainObject(oEntry)) { Log.warning("Manifest entry with key '" + sPath + "' must be an object. Component: " + this.getComponentName()); return null; } return oEntry; }
[ "function", "(", "sPath", ")", "{", "if", "(", "!", "sPath", "||", "sPath", ".", "indexOf", "(", "\".\"", ")", "<=", "0", ")", "{", "Log", ".", "warning", "(", "\"Manifest entries with keys without namespace prefix can not be read via getEntry. Key: \"", "+", "sPath", "+", "\", Component: \"", "+", "this", ".", "getComponentName", "(", ")", ")", ";", "return", "null", ";", "}", "var", "oManifest", "=", "this", ".", "getJson", "(", ")", ";", "var", "oEntry", "=", "getObject", "(", "oManifest", ",", "sPath", ")", ";", "// top-level manifest section must be an object (e.g. sap.ui5)", "if", "(", "sPath", "&&", "sPath", "[", "0", "]", "!==", "\"/\"", "&&", "!", "isPlainObject", "(", "oEntry", ")", ")", "{", "Log", ".", "warning", "(", "\"Manifest entry with key '\"", "+", "sPath", "+", "\"' must be an object. Component: \"", "+", "this", ".", "getComponentName", "(", ")", ")", ";", "return", "null", ";", "}", "return", "oEntry", ";", "}" ]
Returns the configuration of a manifest section or the value for a specific path. If no key is specified, the return value is null. Example: <code> { "sap.ui5": { "dependencies": { "libs": { "sap.m": {} }, "components": { "my.component.a": {} } } }); </code> The configuration above can be accessed in the following ways: <ul> <li><b>By section/namespace</b>: <code>oManifest.getEntry("sap.ui5")</code></li> <li><b>By path</b>: <code>oManifest.getEntry("/sap.ui5/dependencies/libs")</code></li> </ul> By section/namespace returns the configuration for the specified manifest section and by path allows to specify a concrete path to a dedicated entry inside the manifest. The path syntax always starts with a slash (/). @param {string} sKey Either the manifest section name (namespace) or a concrete path @return {any|null} Value of the key (could be any kind of value) @public
[ "Returns", "the", "configuration", "of", "a", "manifest", "section", "or", "the", "value", "for", "a", "specific", "path", ".", "If", "no", "key", "is", "specified", "the", "return", "value", "is", "null", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Manifest.js#L343-L359
4,676
SAP/openui5
src/sap.ui.core/src/sap/ui/core/Manifest.js
function() { // version check => only if minVersion is available a warning // will be logged and the debug mode is turned on // TODO: enhance version check also for libraries and components var sMinUI5Version = this.getEntry("/sap.ui5/dependencies/minUI5Version"); if (sMinUI5Version && Log.isLoggable(Log.Level.WARNING) && sap.ui.getCore().getConfiguration().getDebug()) { sap.ui.getVersionInfo({async: true}).then(function(oVersionInfo) { var oMinVersion = getVersionWithoutSuffix(sMinUI5Version); var oVersion = getVersionWithoutSuffix(oVersionInfo && oVersionInfo.version); if (oMinVersion.compareTo(oVersion) > 0) { Log.warning("Component \"" + this.getComponentName() + "\" requires at least version \"" + oMinVersion.toString() + "\" but running on \"" + oVersion.toString() + "\"!"); } }.bind(this), function(e) { Log.warning("The validation of the version for Component \"" + this.getComponentName() + "\" failed! Reasion: " + e); }.bind(this)); } }
javascript
function() { // version check => only if minVersion is available a warning // will be logged and the debug mode is turned on // TODO: enhance version check also for libraries and components var sMinUI5Version = this.getEntry("/sap.ui5/dependencies/minUI5Version"); if (sMinUI5Version && Log.isLoggable(Log.Level.WARNING) && sap.ui.getCore().getConfiguration().getDebug()) { sap.ui.getVersionInfo({async: true}).then(function(oVersionInfo) { var oMinVersion = getVersionWithoutSuffix(sMinUI5Version); var oVersion = getVersionWithoutSuffix(oVersionInfo && oVersionInfo.version); if (oMinVersion.compareTo(oVersion) > 0) { Log.warning("Component \"" + this.getComponentName() + "\" requires at least version \"" + oMinVersion.toString() + "\" but running on \"" + oVersion.toString() + "\"!"); } }.bind(this), function(e) { Log.warning("The validation of the version for Component \"" + this.getComponentName() + "\" failed! Reasion: " + e); }.bind(this)); } }
[ "function", "(", ")", "{", "// version check => only if minVersion is available a warning", "// will be logged and the debug mode is turned on", "// TODO: enhance version check also for libraries and components", "var", "sMinUI5Version", "=", "this", ".", "getEntry", "(", "\"/sap.ui5/dependencies/minUI5Version\"", ")", ";", "if", "(", "sMinUI5Version", "&&", "Log", ".", "isLoggable", "(", "Log", ".", "Level", ".", "WARNING", ")", "&&", "sap", ".", "ui", ".", "getCore", "(", ")", ".", "getConfiguration", "(", ")", ".", "getDebug", "(", ")", ")", "{", "sap", ".", "ui", ".", "getVersionInfo", "(", "{", "async", ":", "true", "}", ")", ".", "then", "(", "function", "(", "oVersionInfo", ")", "{", "var", "oMinVersion", "=", "getVersionWithoutSuffix", "(", "sMinUI5Version", ")", ";", "var", "oVersion", "=", "getVersionWithoutSuffix", "(", "oVersionInfo", "&&", "oVersionInfo", ".", "version", ")", ";", "if", "(", "oMinVersion", ".", "compareTo", "(", "oVersion", ")", ">", "0", ")", "{", "Log", ".", "warning", "(", "\"Component \\\"\"", "+", "this", ".", "getComponentName", "(", ")", "+", "\"\\\" requires at least version \\\"\"", "+", "oMinVersion", ".", "toString", "(", ")", "+", "\"\\\" but running on \\\"\"", "+", "oVersion", ".", "toString", "(", ")", "+", "\"\\\"!\"", ")", ";", "}", "}", ".", "bind", "(", "this", ")", ",", "function", "(", "e", ")", "{", "Log", ".", "warning", "(", "\"The validation of the version for Component \\\"\"", "+", "this", ".", "getComponentName", "(", ")", "+", "\"\\\" failed! Reasion: \"", "+", "e", ")", ";", "}", ".", "bind", "(", "this", ")", ")", ";", "}", "}" ]
Validates the current UI5 version with the minimal version defined in the manifest. If the minimal version is greater than the current version an issue will be reported in the console if open. @private
[ "Validates", "the", "current", "UI5", "version", "with", "the", "minimal", "version", "defined", "in", "the", "manifest", ".", "If", "the", "minimal", "version", "is", "greater", "than", "the", "current", "version", "an", "issue", "will", "be", "reported", "in", "the", "console", "if", "open", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Manifest.js#L368-L388
4,677
SAP/openui5
src/sap.ui.core/src/sap/ui/core/Manifest.js
function() { // skip loading includes once already loaded if (this._bIncludesLoaded) { return; } var mResources = this.getEntry("/sap.ui5/resources"); if (!mResources) { return; } var sComponentName = this.getComponentName(); // load JS files var aJSResources = mResources["js"]; if (aJSResources) { for (var i = 0; i < aJSResources.length; i++) { var oJSResource = aJSResources[i]; var sFile = oJSResource.uri; if (sFile) { // load javascript file var m = sFile.match(/\.js$/i); if (m) { //var sJsUrl = this.resolveUri(sFile.slice(0, m.index)); var sJsUrl = sComponentName.replace(/\./g, '/') + (sFile.slice(0, 1) === '/' ? '' : '/') + sFile.slice(0, m.index); Log.info("Component \"" + sComponentName + "\" is loading JS: \"" + sJsUrl + "\""); // call internal sap.ui.require variant that accepts a requireJS path and loads the module synchronously sap.ui.requireSync(sJsUrl); } } } } // include CSS files var aCSSResources = mResources["css"]; if (aCSSResources) { for (var j = 0; j < aCSSResources.length; j++) { var oCSSResource = aCSSResources[j]; if (oCSSResource.uri) { var sCssUrl = this.resolveUri(oCSSResource.uri); Log.info("Component \"" + sComponentName + "\" is loading CSS: \"" + sCssUrl + "\""); includeStylesheet(sCssUrl, { id: oCSSResource.id, "data-sap-ui-manifest-uid": this._uid }); } } } this._bIncludesLoaded = true; }
javascript
function() { // skip loading includes once already loaded if (this._bIncludesLoaded) { return; } var mResources = this.getEntry("/sap.ui5/resources"); if (!mResources) { return; } var sComponentName = this.getComponentName(); // load JS files var aJSResources = mResources["js"]; if (aJSResources) { for (var i = 0; i < aJSResources.length; i++) { var oJSResource = aJSResources[i]; var sFile = oJSResource.uri; if (sFile) { // load javascript file var m = sFile.match(/\.js$/i); if (m) { //var sJsUrl = this.resolveUri(sFile.slice(0, m.index)); var sJsUrl = sComponentName.replace(/\./g, '/') + (sFile.slice(0, 1) === '/' ? '' : '/') + sFile.slice(0, m.index); Log.info("Component \"" + sComponentName + "\" is loading JS: \"" + sJsUrl + "\""); // call internal sap.ui.require variant that accepts a requireJS path and loads the module synchronously sap.ui.requireSync(sJsUrl); } } } } // include CSS files var aCSSResources = mResources["css"]; if (aCSSResources) { for (var j = 0; j < aCSSResources.length; j++) { var oCSSResource = aCSSResources[j]; if (oCSSResource.uri) { var sCssUrl = this.resolveUri(oCSSResource.uri); Log.info("Component \"" + sComponentName + "\" is loading CSS: \"" + sCssUrl + "\""); includeStylesheet(sCssUrl, { id: oCSSResource.id, "data-sap-ui-manifest-uid": this._uid }); } } } this._bIncludesLoaded = true; }
[ "function", "(", ")", "{", "// skip loading includes once already loaded", "if", "(", "this", ".", "_bIncludesLoaded", ")", "{", "return", ";", "}", "var", "mResources", "=", "this", ".", "getEntry", "(", "\"/sap.ui5/resources\"", ")", ";", "if", "(", "!", "mResources", ")", "{", "return", ";", "}", "var", "sComponentName", "=", "this", ".", "getComponentName", "(", ")", ";", "// load JS files", "var", "aJSResources", "=", "mResources", "[", "\"js\"", "]", ";", "if", "(", "aJSResources", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "aJSResources", ".", "length", ";", "i", "++", ")", "{", "var", "oJSResource", "=", "aJSResources", "[", "i", "]", ";", "var", "sFile", "=", "oJSResource", ".", "uri", ";", "if", "(", "sFile", ")", "{", "// load javascript file", "var", "m", "=", "sFile", ".", "match", "(", "/", "\\.js$", "/", "i", ")", ";", "if", "(", "m", ")", "{", "//var sJsUrl = this.resolveUri(sFile.slice(0, m.index));", "var", "sJsUrl", "=", "sComponentName", ".", "replace", "(", "/", "\\.", "/", "g", ",", "'/'", ")", "+", "(", "sFile", ".", "slice", "(", "0", ",", "1", ")", "===", "'/'", "?", "''", ":", "'/'", ")", "+", "sFile", ".", "slice", "(", "0", ",", "m", ".", "index", ")", ";", "Log", ".", "info", "(", "\"Component \\\"\"", "+", "sComponentName", "+", "\"\\\" is loading JS: \\\"\"", "+", "sJsUrl", "+", "\"\\\"\"", ")", ";", "// call internal sap.ui.require variant that accepts a requireJS path and loads the module synchronously", "sap", ".", "ui", ".", "requireSync", "(", "sJsUrl", ")", ";", "}", "}", "}", "}", "// include CSS files", "var", "aCSSResources", "=", "mResources", "[", "\"css\"", "]", ";", "if", "(", "aCSSResources", ")", "{", "for", "(", "var", "j", "=", "0", ";", "j", "<", "aCSSResources", ".", "length", ";", "j", "++", ")", "{", "var", "oCSSResource", "=", "aCSSResources", "[", "j", "]", ";", "if", "(", "oCSSResource", ".", "uri", ")", "{", "var", "sCssUrl", "=", "this", ".", "resolveUri", "(", "oCSSResource", ".", "uri", ")", ";", "Log", ".", "info", "(", "\"Component \\\"\"", "+", "sComponentName", "+", "\"\\\" is loading CSS: \\\"\"", "+", "sCssUrl", "+", "\"\\\"\"", ")", ";", "includeStylesheet", "(", "sCssUrl", ",", "{", "id", ":", "oCSSResource", ".", "id", ",", "\"data-sap-ui-manifest-uid\"", ":", "this", ".", "_uid", "}", ")", ";", "}", "}", "}", "this", ".", "_bIncludesLoaded", "=", "true", ";", "}" ]
Loads the included CSS and JavaScript resources. The resources will be resolved relative to the component location. @private
[ "Loads", "the", "included", "CSS", "and", "JavaScript", "resources", ".", "The", "resources", "will", "be", "resolved", "relative", "to", "the", "component", "location", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Manifest.js#L397-L450
4,678
SAP/openui5
src/sap.ui.core/src/sap/ui/core/Manifest.js
function() { // skip removing includes when not loaded yet if (!this._bIncludesLoaded) { return; } var mResources = this.getEntry("/sap.ui5/resources"); if (!mResources) { return; } var sComponentName = this.getComponentName(); // remove CSS files var aCSSResources = mResources["css"]; if (aCSSResources) { // As all <link> tags have been marked with the manifest's unique id (via data-sap-ui-manifest-uid) // it is not needed to check for all individual CSS files defined in the manifest. // Checking for all "href"s again might also cause issues when they have been adopted (e.g. to add cachebuster url params). var aLinks = document.querySelectorAll("link[data-sap-ui-manifest-uid='" + this._uid + "']"); for (var i = 0; i < aLinks.length; i++) { var oLink = aLinks[i]; Log.info("Component \"" + sComponentName + "\" is removing CSS: \"" + oLink.href + "\""); oLink.parentNode.removeChild(oLink); } } this._bIncludesLoaded = false; }
javascript
function() { // skip removing includes when not loaded yet if (!this._bIncludesLoaded) { return; } var mResources = this.getEntry("/sap.ui5/resources"); if (!mResources) { return; } var sComponentName = this.getComponentName(); // remove CSS files var aCSSResources = mResources["css"]; if (aCSSResources) { // As all <link> tags have been marked with the manifest's unique id (via data-sap-ui-manifest-uid) // it is not needed to check for all individual CSS files defined in the manifest. // Checking for all "href"s again might also cause issues when they have been adopted (e.g. to add cachebuster url params). var aLinks = document.querySelectorAll("link[data-sap-ui-manifest-uid='" + this._uid + "']"); for (var i = 0; i < aLinks.length; i++) { var oLink = aLinks[i]; Log.info("Component \"" + sComponentName + "\" is removing CSS: \"" + oLink.href + "\""); oLink.parentNode.removeChild(oLink); } } this._bIncludesLoaded = false; }
[ "function", "(", ")", "{", "// skip removing includes when not loaded yet", "if", "(", "!", "this", ".", "_bIncludesLoaded", ")", "{", "return", ";", "}", "var", "mResources", "=", "this", ".", "getEntry", "(", "\"/sap.ui5/resources\"", ")", ";", "if", "(", "!", "mResources", ")", "{", "return", ";", "}", "var", "sComponentName", "=", "this", ".", "getComponentName", "(", ")", ";", "// remove CSS files", "var", "aCSSResources", "=", "mResources", "[", "\"css\"", "]", ";", "if", "(", "aCSSResources", ")", "{", "// As all <link> tags have been marked with the manifest's unique id (via data-sap-ui-manifest-uid)", "// it is not needed to check for all individual CSS files defined in the manifest.", "// Checking for all \"href\"s again might also cause issues when they have been adopted (e.g. to add cachebuster url params).", "var", "aLinks", "=", "document", ".", "querySelectorAll", "(", "\"link[data-sap-ui-manifest-uid='\"", "+", "this", ".", "_uid", "+", "\"']\"", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "aLinks", ".", "length", ";", "i", "++", ")", "{", "var", "oLink", "=", "aLinks", "[", "i", "]", ";", "Log", ".", "info", "(", "\"Component \\\"\"", "+", "sComponentName", "+", "\"\\\" is removing CSS: \\\"\"", "+", "oLink", ".", "href", "+", "\"\\\"\"", ")", ";", "oLink", ".", "parentNode", ".", "removeChild", "(", "oLink", ")", ";", "}", "}", "this", ".", "_bIncludesLoaded", "=", "false", ";", "}" ]
Removes the included CSS resources. @private
[ "Removes", "the", "included", "CSS", "resources", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Manifest.js#L457-L489
4,679
SAP/openui5
src/sap.ui.core/src/sap/ui/core/Manifest.js
function(sUri, sRelativeTo) { var oUri = this._resolveUri(new URI(sUri), sRelativeTo); return oUri && oUri.toString(); }
javascript
function(sUri, sRelativeTo) { var oUri = this._resolveUri(new URI(sUri), sRelativeTo); return oUri && oUri.toString(); }
[ "function", "(", "sUri", ",", "sRelativeTo", ")", "{", "var", "oUri", "=", "this", ".", "_resolveUri", "(", "new", "URI", "(", "sUri", ")", ",", "sRelativeTo", ")", ";", "return", "oUri", "&&", "oUri", ".", "toString", "(", ")", ";", "}" ]
Resolves the given URI relative to the Component by default or optional relative to the manifest when passing 'manifest' as second parameter. @param {string} sUri URI to resolve as string @param {string} [sRelativeTo='component'] defines to which base URI the given URI will be resolved to; one of ‘component' (default) or 'manifest' @return {string} resolved URI as string @public @since 1.60.1
[ "Resolves", "the", "given", "URI", "relative", "to", "the", "Component", "by", "default", "or", "optional", "relative", "to", "the", "manifest", "when", "passing", "manifest", "as", "second", "parameter", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Manifest.js#L599-L602
4,680
SAP/openui5
src/sap.ui.core/src/sap/ui/core/Manifest.js
function(oInstance) { if (this._iInstanceCount === 0) { // version check => only if minVersion is available a warning // will be logged and the debug mode is turned on this.checkUI5Version(); // define the resource roots // => if not loaded via manifest first approach the resource roots // will be registered too late for the AMD modules of the Component // controller. This is a constraint for the resource roots config // in the manifest! this.defineResourceRoots(); // load the component dependencies (other UI5 libraries) this.loadDependencies(); // load the custom scripts and CSS files this.loadIncludes(); // activate the static customizing this.activateCustomizing(); } // activate the instance customizing if (oInstance) { this.activateCustomizing(oInstance); } this._iInstanceCount++; }
javascript
function(oInstance) { if (this._iInstanceCount === 0) { // version check => only if minVersion is available a warning // will be logged and the debug mode is turned on this.checkUI5Version(); // define the resource roots // => if not loaded via manifest first approach the resource roots // will be registered too late for the AMD modules of the Component // controller. This is a constraint for the resource roots config // in the manifest! this.defineResourceRoots(); // load the component dependencies (other UI5 libraries) this.loadDependencies(); // load the custom scripts and CSS files this.loadIncludes(); // activate the static customizing this.activateCustomizing(); } // activate the instance customizing if (oInstance) { this.activateCustomizing(oInstance); } this._iInstanceCount++; }
[ "function", "(", "oInstance", ")", "{", "if", "(", "this", ".", "_iInstanceCount", "===", "0", ")", "{", "// version check => only if minVersion is available a warning", "// will be logged and the debug mode is turned on", "this", ".", "checkUI5Version", "(", ")", ";", "// define the resource roots", "// => if not loaded via manifest first approach the resource roots", "// will be registered too late for the AMD modules of the Component", "// controller. This is a constraint for the resource roots config", "// in the manifest!", "this", ".", "defineResourceRoots", "(", ")", ";", "// load the component dependencies (other UI5 libraries)", "this", ".", "loadDependencies", "(", ")", ";", "// load the custom scripts and CSS files", "this", ".", "loadIncludes", "(", ")", ";", "// activate the static customizing", "this", ".", "activateCustomizing", "(", ")", ";", "}", "// activate the instance customizing", "if", "(", "oInstance", ")", "{", "this", ".", "activateCustomizing", "(", "oInstance", ")", ";", "}", "this", ".", "_iInstanceCount", "++", ";", "}" ]
Initializes the manifest which executes checks, define the resource roots, load the dependencies and the includes. @private
[ "Initializes", "the", "manifest", "which", "executes", "checks", "define", "the", "resource", "roots", "load", "the", "dependencies", "and", "the", "includes", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Manifest.js#L625-L658
4,681
SAP/openui5
src/sap.ui.core/src/sap/ui/core/Manifest.js
function(oInstance) { // ensure that the instance count is never negative var iInstanceCount = Math.max(this._iInstanceCount - 1, 0); // deactivate the instance customizing if (oInstance) { this.deactivateCustomizing(oInstance); } if (iInstanceCount === 0) { // deactivcate the customizing this.deactivateCustomizing(); // remove the custom scripts and CSS files this.removeIncludes(); } this._iInstanceCount = iInstanceCount; }
javascript
function(oInstance) { // ensure that the instance count is never negative var iInstanceCount = Math.max(this._iInstanceCount - 1, 0); // deactivate the instance customizing if (oInstance) { this.deactivateCustomizing(oInstance); } if (iInstanceCount === 0) { // deactivcate the customizing this.deactivateCustomizing(); // remove the custom scripts and CSS files this.removeIncludes(); } this._iInstanceCount = iInstanceCount; }
[ "function", "(", "oInstance", ")", "{", "// ensure that the instance count is never negative", "var", "iInstanceCount", "=", "Math", ".", "max", "(", "this", ".", "_iInstanceCount", "-", "1", ",", "0", ")", ";", "// deactivate the instance customizing", "if", "(", "oInstance", ")", "{", "this", ".", "deactivateCustomizing", "(", "oInstance", ")", ";", "}", "if", "(", "iInstanceCount", "===", "0", ")", "{", "// deactivcate the customizing", "this", ".", "deactivateCustomizing", "(", ")", ";", "// remove the custom scripts and CSS files", "this", ".", "removeIncludes", "(", ")", ";", "}", "this", ".", "_iInstanceCount", "=", "iInstanceCount", ";", "}" ]
Terminates the manifest and does some final clean-up. @private
[ "Terminates", "the", "manifest", "and", "does", "some", "final", "clean", "-", "up", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Manifest.js#L664-L686
4,682
SAP/openui5
src/sap.ui.core/src/sap/ui/core/Manifest.js
function(oInstance) { // activate the customizing configuration var oUI5Manifest = this.getEntry("sap.ui5", true), mExtensions = oUI5Manifest && oUI5Manifest["extends"] && oUI5Manifest["extends"].extensions; if (!jQuery.isEmptyObject(mExtensions)) { var CustomizingConfiguration = sap.ui.requireSync('sap/ui/core/CustomizingConfiguration'); if (!oInstance) { CustomizingConfiguration.activateForComponent(this.getComponentName()); } else { CustomizingConfiguration.activateForComponentInstance(oInstance); } } }
javascript
function(oInstance) { // activate the customizing configuration var oUI5Manifest = this.getEntry("sap.ui5", true), mExtensions = oUI5Manifest && oUI5Manifest["extends"] && oUI5Manifest["extends"].extensions; if (!jQuery.isEmptyObject(mExtensions)) { var CustomizingConfiguration = sap.ui.requireSync('sap/ui/core/CustomizingConfiguration'); if (!oInstance) { CustomizingConfiguration.activateForComponent(this.getComponentName()); } else { CustomizingConfiguration.activateForComponentInstance(oInstance); } } }
[ "function", "(", "oInstance", ")", "{", "// activate the customizing configuration", "var", "oUI5Manifest", "=", "this", ".", "getEntry", "(", "\"sap.ui5\"", ",", "true", ")", ",", "mExtensions", "=", "oUI5Manifest", "&&", "oUI5Manifest", "[", "\"extends\"", "]", "&&", "oUI5Manifest", "[", "\"extends\"", "]", ".", "extensions", ";", "if", "(", "!", "jQuery", ".", "isEmptyObject", "(", "mExtensions", ")", ")", "{", "var", "CustomizingConfiguration", "=", "sap", ".", "ui", ".", "requireSync", "(", "'sap/ui/core/CustomizingConfiguration'", ")", ";", "if", "(", "!", "oInstance", ")", "{", "CustomizingConfiguration", ".", "activateForComponent", "(", "this", ".", "getComponentName", "(", ")", ")", ";", "}", "else", "{", "CustomizingConfiguration", ".", "activateForComponentInstance", "(", "oInstance", ")", ";", "}", "}", "}" ]
Activates the customizing for the component or a dedicated component instance when providing the component instance as parameter. @param {sap.ui.core.Component} [oInstance] Reference to the Component instance @private
[ "Activates", "the", "customizing", "for", "the", "component", "or", "a", "dedicated", "component", "instance", "when", "providing", "the", "component", "instance", "as", "parameter", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Manifest.js#L694-L706
4,683
SAP/openui5
src/sap.ui.core/src/sap/ui/core/Manifest.js
function(oInstance) { // deactivate the customizing configuration var CustomizingConfiguration = sap.ui.require('sap/ui/core/CustomizingConfiguration'); if (CustomizingConfiguration) { if (!oInstance) { CustomizingConfiguration.deactivateForComponent(this.getComponentName()); } else { CustomizingConfiguration.deactivateForComponentInstance(oInstance); } } }
javascript
function(oInstance) { // deactivate the customizing configuration var CustomizingConfiguration = sap.ui.require('sap/ui/core/CustomizingConfiguration'); if (CustomizingConfiguration) { if (!oInstance) { CustomizingConfiguration.deactivateForComponent(this.getComponentName()); } else { CustomizingConfiguration.deactivateForComponentInstance(oInstance); } } }
[ "function", "(", "oInstance", ")", "{", "// deactivate the customizing configuration", "var", "CustomizingConfiguration", "=", "sap", ".", "ui", ".", "require", "(", "'sap/ui/core/CustomizingConfiguration'", ")", ";", "if", "(", "CustomizingConfiguration", ")", "{", "if", "(", "!", "oInstance", ")", "{", "CustomizingConfiguration", ".", "deactivateForComponent", "(", "this", ".", "getComponentName", "(", ")", ")", ";", "}", "else", "{", "CustomizingConfiguration", ".", "deactivateForComponentInstance", "(", "oInstance", ")", ";", "}", "}", "}" ]
Deactivates the customizing for the component or a dedicated component instance when providing the component instance as parameter. @param {sap.ui.core.Component} [oInstance] Reference to the Component instance @private
[ "Deactivates", "the", "customizing", "for", "the", "component", "or", "a", "dedicated", "component", "instance", "when", "providing", "the", "component", "instance", "as", "parameter", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/core/Manifest.js#L714-L724
4,684
SAP/openui5
src/sap.ui.core/src/sap/ui/qunit/QUnitUtils.js
function (sDateString) { var iMillis = NativeDate_parse.apply(Date, arguments); if (sDateString && typeof sDateString === "string") { // if the year is gt/eq 2034 we need to increment the // date by one additional day since this is broken in // PhantomJS => this is a workaround for the upper BUG! var m = /^(\d{4})(?:-(\d+)?-(\d+))(?:[T ](\d+):(\d+)(?::(\d+)(?:\.(\d+))?)?)?(?:Z(-?\d*))?$/.exec(sDateString); if (m && parseInt(m[1]) >= 2034) { iMillis += 24 * 60 * 60 * 1000; } } return iMillis; }
javascript
function (sDateString) { var iMillis = NativeDate_parse.apply(Date, arguments); if (sDateString && typeof sDateString === "string") { // if the year is gt/eq 2034 we need to increment the // date by one additional day since this is broken in // PhantomJS => this is a workaround for the upper BUG! var m = /^(\d{4})(?:-(\d+)?-(\d+))(?:[T ](\d+):(\d+)(?::(\d+)(?:\.(\d+))?)?)?(?:Z(-?\d*))?$/.exec(sDateString); if (m && parseInt(m[1]) >= 2034) { iMillis += 24 * 60 * 60 * 1000; } } return iMillis; }
[ "function", "(", "sDateString", ")", "{", "var", "iMillis", "=", "NativeDate_parse", ".", "apply", "(", "Date", ",", "arguments", ")", ";", "if", "(", "sDateString", "&&", "typeof", "sDateString", "===", "\"string\"", ")", "{", "// if the year is gt/eq 2034 we need to increment the", "// date by one additional day since this is broken in", "// PhantomJS => this is a workaround for the upper BUG!", "var", "m", "=", "/", "^(\\d{4})(?:-(\\d+)?-(\\d+))(?:[T ](\\d+):(\\d+)(?::(\\d+)(?:\\.(\\d+))?)?)?(?:Z(-?\\d*))?$", "/", ".", "exec", "(", "sDateString", ")", ";", "if", "(", "m", "&&", "parseInt", "(", "m", "[", "1", "]", ")", ">=", "2034", ")", "{", "iMillis", "+=", "24", "*", "60", "*", "60", "*", "1000", ";", "}", "}", "return", "iMillis", ";", "}" ]
patch the parse function of the Date
[ "patch", "the", "parse", "function", "of", "the", "Date" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/qunit/QUnitUtils.js#L142-L154
4,685
SAP/openui5
src/sap.ui.core/src/sap/ui/qunit/QUnitUtils.js
mapKeyCodeToKey
function mapKeyCodeToKey(sKeyCode) { // look up number in KeyCodes enum to get the string if (!isNaN(sKeyCode)) { sKeyCode = getKeyCodeStringFromNumber(sKeyCode); } if (!sKeyCode) { return undefined; } sKeyCode = sKeyCode.toLowerCase(); // replace underscores with dash character such as 'ARROW_LEFT' --> 'ARROW-LEFT' and then camelize it --> 'ArrowLeft' sKeyCode = camelize(sKeyCode.replace(/_/g, "-")); // capitalize key var sKey = capitalize(sKeyCode); // remove "Digit" and "Numpad" from the resulting string as this info is present within the Location property and not the key property // e.g. "Digit9" --> "9" if (sKey.startsWith("Digit")) { return sKey.substring("Digit".length); } else if (sKey.startsWith("Numpad")) { sKey = sKey.substring("Numpad".length); } // special handling where KeyCodes[sKeyCode] does not match // e.g. KeyCodes.BREAK --> 'Pause' instead of 'Break' switch (sKey) { case "Break": return "Pause"; case "Space": return " "; case "Print": return "PrintScreen"; case "Windows": return "Meta"; case "Sleep": return "Standby"; case "TurnOff": return "PowerOff"; case "Asterisk": return "*"; case "Plus": return "+"; case "Minus": return "-"; case "Comma": return ","; case "Slash": return "/"; case "OpenBracket": return ";"; case "Dot": return "."; case "Pipe": return "|"; case "Semicolon": return ";"; case "Equals": return "="; case "SingleQUote": return "="; case "Backslash": return "\\"; case "GreatAccent": return "`"; default: return sKey; } }
javascript
function mapKeyCodeToKey(sKeyCode) { // look up number in KeyCodes enum to get the string if (!isNaN(sKeyCode)) { sKeyCode = getKeyCodeStringFromNumber(sKeyCode); } if (!sKeyCode) { return undefined; } sKeyCode = sKeyCode.toLowerCase(); // replace underscores with dash character such as 'ARROW_LEFT' --> 'ARROW-LEFT' and then camelize it --> 'ArrowLeft' sKeyCode = camelize(sKeyCode.replace(/_/g, "-")); // capitalize key var sKey = capitalize(sKeyCode); // remove "Digit" and "Numpad" from the resulting string as this info is present within the Location property and not the key property // e.g. "Digit9" --> "9" if (sKey.startsWith("Digit")) { return sKey.substring("Digit".length); } else if (sKey.startsWith("Numpad")) { sKey = sKey.substring("Numpad".length); } // special handling where KeyCodes[sKeyCode] does not match // e.g. KeyCodes.BREAK --> 'Pause' instead of 'Break' switch (sKey) { case "Break": return "Pause"; case "Space": return " "; case "Print": return "PrintScreen"; case "Windows": return "Meta"; case "Sleep": return "Standby"; case "TurnOff": return "PowerOff"; case "Asterisk": return "*"; case "Plus": return "+"; case "Minus": return "-"; case "Comma": return ","; case "Slash": return "/"; case "OpenBracket": return ";"; case "Dot": return "."; case "Pipe": return "|"; case "Semicolon": return ";"; case "Equals": return "="; case "SingleQUote": return "="; case "Backslash": return "\\"; case "GreatAccent": return "`"; default: return sKey; } }
[ "function", "mapKeyCodeToKey", "(", "sKeyCode", ")", "{", "// look up number in KeyCodes enum to get the string", "if", "(", "!", "isNaN", "(", "sKeyCode", ")", ")", "{", "sKeyCode", "=", "getKeyCodeStringFromNumber", "(", "sKeyCode", ")", ";", "}", "if", "(", "!", "sKeyCode", ")", "{", "return", "undefined", ";", "}", "sKeyCode", "=", "sKeyCode", ".", "toLowerCase", "(", ")", ";", "// replace underscores with dash character such as 'ARROW_LEFT' --> 'ARROW-LEFT' and then camelize it --> 'ArrowLeft'", "sKeyCode", "=", "camelize", "(", "sKeyCode", ".", "replace", "(", "/", "_", "/", "g", ",", "\"-\"", ")", ")", ";", "// capitalize key", "var", "sKey", "=", "capitalize", "(", "sKeyCode", ")", ";", "// remove \"Digit\" and \"Numpad\" from the resulting string as this info is present within the Location property and not the key property", "// e.g. \"Digit9\" --> \"9\"", "if", "(", "sKey", ".", "startsWith", "(", "\"Digit\"", ")", ")", "{", "return", "sKey", ".", "substring", "(", "\"Digit\"", ".", "length", ")", ";", "}", "else", "if", "(", "sKey", ".", "startsWith", "(", "\"Numpad\"", ")", ")", "{", "sKey", "=", "sKey", ".", "substring", "(", "\"Numpad\"", ".", "length", ")", ";", "}", "// special handling where KeyCodes[sKeyCode] does not match", "// e.g. KeyCodes.BREAK --> 'Pause' instead of 'Break'", "switch", "(", "sKey", ")", "{", "case", "\"Break\"", ":", "return", "\"Pause\"", ";", "case", "\"Space\"", ":", "return", "\" \"", ";", "case", "\"Print\"", ":", "return", "\"PrintScreen\"", ";", "case", "\"Windows\"", ":", "return", "\"Meta\"", ";", "case", "\"Sleep\"", ":", "return", "\"Standby\"", ";", "case", "\"TurnOff\"", ":", "return", "\"PowerOff\"", ";", "case", "\"Asterisk\"", ":", "return", "\"*\"", ";", "case", "\"Plus\"", ":", "return", "\"+\"", ";", "case", "\"Minus\"", ":", "return", "\"-\"", ";", "case", "\"Comma\"", ":", "return", "\",\"", ";", "case", "\"Slash\"", ":", "return", "\"/\"", ";", "case", "\"OpenBracket\"", ":", "return", "\";\"", ";", "case", "\"Dot\"", ":", "return", "\".\"", ";", "case", "\"Pipe\"", ":", "return", "\"|\"", ";", "case", "\"Semicolon\"", ":", "return", "\";\"", ";", "case", "\"Equals\"", ":", "return", "\"=\"", ";", "case", "\"SingleQUote\"", ":", "return", "\"=\"", ";", "case", "\"Backslash\"", ":", "return", "\"\\\\\"", ";", "case", "\"GreatAccent\"", ":", "return", "\"`\"", ";", "default", ":", "return", "sKey", ";", "}", "}" ]
Maps the input keyCode to key property @param sKeyCode {string|Integer} keyCode number or string, e.g. 27 or ESCAPE @returns {*} the key property of KeyBoardEvent, e.g. Escape
[ "Maps", "the", "input", "keyCode", "to", "key", "property" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/qunit/QUnitUtils.js#L356-L404
4,686
SAP/openui5
src/sap.ui.core/src/sap/ui/qunit/QUnitUtils.js
getKeyCodeStringFromNumber
function getKeyCodeStringFromNumber(iKeyCode) { for (var sKey in KeyCodes) { if (KeyCodes.hasOwnProperty(sKey)) { if (KeyCodes[sKey] === iKeyCode) { return sKey; } } } }
javascript
function getKeyCodeStringFromNumber(iKeyCode) { for (var sKey in KeyCodes) { if (KeyCodes.hasOwnProperty(sKey)) { if (KeyCodes[sKey] === iKeyCode) { return sKey; } } } }
[ "function", "getKeyCodeStringFromNumber", "(", "iKeyCode", ")", "{", "for", "(", "var", "sKey", "in", "KeyCodes", ")", "{", "if", "(", "KeyCodes", ".", "hasOwnProperty", "(", "sKey", ")", ")", "{", "if", "(", "KeyCodes", "[", "sKey", "]", "===", "iKeyCode", ")", "{", "return", "sKey", ";", "}", "}", "}", "}" ]
Retrieves keycode string from number @param iKeyCode @returns {string}
[ "Retrieves", "keycode", "string", "from", "number" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/qunit/QUnitUtils.js#L411-L419
4,687
SAP/openui5
src/sap.ui.core/src/sap/ui/qunit/QUnitUtils.js
offset
function offset(a,b,va,vb) { return abOffset[a * N + b] + va * params[b].n + vb; }
javascript
function offset(a,b,va,vb) { return abOffset[a * N + b] + va * params[b].n + vb; }
[ "function", "offset", "(", "a", ",", "b", ",", "va", ",", "vb", ")", "{", "return", "abOffset", "[", "a", "*", "N", "+", "b", "]", "+", "va", "*", "params", "[", "b", "]", ".", "n", "+", "vb", ";", "}" ]
Helper that calculates the offset into the occurs array for a given combination of a,b and the values of a and b.
[ "Helper", "that", "calculates", "the", "offset", "into", "the", "occurs", "array", "for", "a", "given", "combination", "of", "a", "b", "and", "the", "values", "of", "a", "and", "b", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/qunit/QUnitUtils.js#L981-L983
4,688
SAP/openui5
src/sap.ui.core/src/sap/ui/qunit/QUnitUtils.js
calcCost
function calcCost(a, va) { var score = { va: va, pairs:0, redundant:0 }; for (var c = 0; c < N; c++) { var count; if ( c < a ) { count = occurs[offset(c,a,value_index[c],va)]; } else if ( c > a ) { var j = offset(a,c,va,0), end = j + params[c].n; for (count = occurs[j]; count > 0 && i < end; j++ ) { if ( occurs[j] < count ) { count = occurs[j]; } } } score.redundant = score.redundant + count; if ( count == 0 ) { score.pairs++; } } return score; }
javascript
function calcCost(a, va) { var score = { va: va, pairs:0, redundant:0 }; for (var c = 0; c < N; c++) { var count; if ( c < a ) { count = occurs[offset(c,a,value_index[c],va)]; } else if ( c > a ) { var j = offset(a,c,va,0), end = j + params[c].n; for (count = occurs[j]; count > 0 && i < end; j++ ) { if ( occurs[j] < count ) { count = occurs[j]; } } } score.redundant = score.redundant + count; if ( count == 0 ) { score.pairs++; } } return score; }
[ "function", "calcCost", "(", "a", ",", "va", ")", "{", "var", "score", "=", "{", "va", ":", "va", ",", "pairs", ":", "0", ",", "redundant", ":", "0", "}", ";", "for", "(", "var", "c", "=", "0", ";", "c", "<", "N", ";", "c", "++", ")", "{", "var", "count", ";", "if", "(", "c", "<", "a", ")", "{", "count", "=", "occurs", "[", "offset", "(", "c", ",", "a", ",", "value_index", "[", "c", "]", ",", "va", ")", "]", ";", "}", "else", "if", "(", "c", ">", "a", ")", "{", "var", "j", "=", "offset", "(", "a", ",", "c", ",", "va", ",", "0", ")", ",", "end", "=", "j", "+", "params", "[", "c", "]", ".", "n", ";", "for", "(", "count", "=", "occurs", "[", "j", "]", ";", "count", ">", "0", "&&", "i", "<", "end", ";", "j", "++", ")", "{", "if", "(", "occurs", "[", "j", "]", "<", "count", ")", "{", "count", "=", "occurs", "[", "j", "]", ";", "}", "}", "}", "score", ".", "redundant", "=", "score", ".", "redundant", "+", "count", ";", "if", "(", "count", "==", "0", ")", "{", "score", ".", "pairs", "++", ";", "}", "}", "return", "score", ";", "}" ]
Calculates a cost function for the case where for property 'a' the value 'va' is taken. The calculated cost consists of two parts: - pairs : number of newly addressed unique pairs - redundant : number of redundantly added pairs @param a @param va @return
[ "Calculates", "a", "cost", "function", "for", "the", "case", "where", "for", "property", "a", "the", "value", "va", "is", "taken", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/sap/ui/qunit/QUnitUtils.js#L1001-L1022
4,689
SAP/openui5
src/sap.ui.core/src/ui5loader.js
normalize
function normalize(sResourceName, sBaseName) { var p = sResourceName.search(rDotSegmentAnywhere), aSegments, sSegment, i,j,l; // check whether the name needs to be resolved at all - if not, just return the sModuleName as it is. if ( p < 0 ) { return sResourceName; } // if the name starts with a relative segment then there must be a base name (a global sap.ui.require doesn't support relative names) if ( p === 0 ) { if ( sBaseName == null ) { throw new Error("relative name not supported ('" + sResourceName + "'"); } // prefix module name with the parent package sResourceName = sBaseName.slice(0, sBaseName.lastIndexOf('/') + 1) + sResourceName; } aSegments = sResourceName.split('/'); // process path segments for (i = 0, j = 0, l = aSegments.length; i < l; i++) { sSegment = aSegments[i]; if ( rDotSegment.test(sSegment) ) { if (sSegment === '.' || sSegment === '') { // ignore '.' as it's just a pointer to current package. ignore '' as it results from double slashes (ignored by browsers as well) continue; } else if (sSegment === '..') { // move to parent directory if ( j === 0 ) { throw new Error("Can't navigate to parent of root ('" + sResourceName + "')"); } j--; } else { throw new Error("Illegal path segment '" + sSegment + "' ('" + sResourceName + "')"); } } else { aSegments[j++] = sSegment; } } aSegments.length = j; return aSegments.join('/'); }
javascript
function normalize(sResourceName, sBaseName) { var p = sResourceName.search(rDotSegmentAnywhere), aSegments, sSegment, i,j,l; // check whether the name needs to be resolved at all - if not, just return the sModuleName as it is. if ( p < 0 ) { return sResourceName; } // if the name starts with a relative segment then there must be a base name (a global sap.ui.require doesn't support relative names) if ( p === 0 ) { if ( sBaseName == null ) { throw new Error("relative name not supported ('" + sResourceName + "'"); } // prefix module name with the parent package sResourceName = sBaseName.slice(0, sBaseName.lastIndexOf('/') + 1) + sResourceName; } aSegments = sResourceName.split('/'); // process path segments for (i = 0, j = 0, l = aSegments.length; i < l; i++) { sSegment = aSegments[i]; if ( rDotSegment.test(sSegment) ) { if (sSegment === '.' || sSegment === '') { // ignore '.' as it's just a pointer to current package. ignore '' as it results from double slashes (ignored by browsers as well) continue; } else if (sSegment === '..') { // move to parent directory if ( j === 0 ) { throw new Error("Can't navigate to parent of root ('" + sResourceName + "')"); } j--; } else { throw new Error("Illegal path segment '" + sSegment + "' ('" + sResourceName + "')"); } } else { aSegments[j++] = sSegment; } } aSegments.length = j; return aSegments.join('/'); }
[ "function", "normalize", "(", "sResourceName", ",", "sBaseName", ")", "{", "var", "p", "=", "sResourceName", ".", "search", "(", "rDotSegmentAnywhere", ")", ",", "aSegments", ",", "sSegment", ",", "i", ",", "j", ",", "l", ";", "// check whether the name needs to be resolved at all - if not, just return the sModuleName as it is.", "if", "(", "p", "<", "0", ")", "{", "return", "sResourceName", ";", "}", "// if the name starts with a relative segment then there must be a base name (a global sap.ui.require doesn't support relative names)", "if", "(", "p", "===", "0", ")", "{", "if", "(", "sBaseName", "==", "null", ")", "{", "throw", "new", "Error", "(", "\"relative name not supported ('\"", "+", "sResourceName", "+", "\"'\"", ")", ";", "}", "// prefix module name with the parent package", "sResourceName", "=", "sBaseName", ".", "slice", "(", "0", ",", "sBaseName", ".", "lastIndexOf", "(", "'/'", ")", "+", "1", ")", "+", "sResourceName", ";", "}", "aSegments", "=", "sResourceName", ".", "split", "(", "'/'", ")", ";", "// process path segments", "for", "(", "i", "=", "0", ",", "j", "=", "0", ",", "l", "=", "aSegments", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "sSegment", "=", "aSegments", "[", "i", "]", ";", "if", "(", "rDotSegment", ".", "test", "(", "sSegment", ")", ")", "{", "if", "(", "sSegment", "===", "'.'", "||", "sSegment", "===", "''", ")", "{", "// ignore '.' as it's just a pointer to current package. ignore '' as it results from double slashes (ignored by browsers as well)", "continue", ";", "}", "else", "if", "(", "sSegment", "===", "'..'", ")", "{", "// move to parent directory", "if", "(", "j", "===", "0", ")", "{", "throw", "new", "Error", "(", "\"Can't navigate to parent of root ('\"", "+", "sResourceName", "+", "\"')\"", ")", ";", "}", "j", "--", ";", "}", "else", "{", "throw", "new", "Error", "(", "\"Illegal path segment '\"", "+", "sSegment", "+", "\"' ('\"", "+", "sResourceName", "+", "\"')\"", ")", ";", "}", "}", "else", "{", "aSegments", "[", "j", "++", "]", "=", "sSegment", ";", "}", "}", "aSegments", ".", "length", "=", "j", ";", "return", "aSegments", ".", "join", "(", "'/'", ")", ";", "}" ]
Normalizes a resource name by resolving any relative name segments. A segment consisting of a single dot <code>./</code>, when used at the beginning of a name refers to the containing package of the <code>sBaseName</code>. When used inside a name, it is ignored. A segment consisting of two dots <code>../</code> refers to the parent package. It can be used anywhere in a name, but the resolved name prefix up to that point must not be empty. Example: A name <code>../common/validation.js</code> defined in <code>sap/myapp/controller/mycontroller.controller.js</code> will resolve to <code>sap/myapp/common/validation.js</code>. When <code>sBaseName</code> is <code>null</code> (e.g. for a <code>sap.ui.require</code> call), the resource name must not start with a relative name segment or an error will be thrown. @param {string} sResourceName Name to resolve @param {string|null} sBaseName Name of a reference module relative to which the name will be resolved @returns {string} Resolved name @throws {Error} When a relative name should be resolved but not basename is given; or when upward navigation (../) is requested on the root level or when a name segment consists of 3 or more dots only @private
[ "Normalizes", "a", "resource", "name", "by", "resolving", "any", "relative", "name", "segments", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/ui5loader.js#L431-L481
4,690
SAP/openui5
src/sap.ui.core/src/ui5loader.js
registerResourcePath
function registerResourcePath(sResourceNamePrefix, sUrlPrefix) { sResourceNamePrefix = String(sResourceNamePrefix || ""); if ( sUrlPrefix == null ) { // remove a registered URL prefix, if it wasn't for the empty resource name prefix if ( sResourceNamePrefix ) { if ( mUrlPrefixes[sResourceNamePrefix] ) { delete mUrlPrefixes[sResourceNamePrefix]; log.info("registerResourcePath ('" + sResourceNamePrefix + "') (registration removed)"); } return; } // otherwise restore the default sUrlPrefix = DEFAULT_BASE_URL; log.info("registerResourcePath ('" + sResourceNamePrefix + "') (default registration restored)"); } // cast to string and remove query parameters and/or hash sUrlPrefix = pathOnly(String(sUrlPrefix)); // ensure that the prefix ends with a '/' if ( sUrlPrefix.slice(-1) !== '/' ) { sUrlPrefix += '/'; } mUrlPrefixes[sResourceNamePrefix] = { url: sUrlPrefix, // calculate absolute URL, only to be used by 'guessResourceName' absoluteUrl: resolveURL(sUrlPrefix) }; }
javascript
function registerResourcePath(sResourceNamePrefix, sUrlPrefix) { sResourceNamePrefix = String(sResourceNamePrefix || ""); if ( sUrlPrefix == null ) { // remove a registered URL prefix, if it wasn't for the empty resource name prefix if ( sResourceNamePrefix ) { if ( mUrlPrefixes[sResourceNamePrefix] ) { delete mUrlPrefixes[sResourceNamePrefix]; log.info("registerResourcePath ('" + sResourceNamePrefix + "') (registration removed)"); } return; } // otherwise restore the default sUrlPrefix = DEFAULT_BASE_URL; log.info("registerResourcePath ('" + sResourceNamePrefix + "') (default registration restored)"); } // cast to string and remove query parameters and/or hash sUrlPrefix = pathOnly(String(sUrlPrefix)); // ensure that the prefix ends with a '/' if ( sUrlPrefix.slice(-1) !== '/' ) { sUrlPrefix += '/'; } mUrlPrefixes[sResourceNamePrefix] = { url: sUrlPrefix, // calculate absolute URL, only to be used by 'guessResourceName' absoluteUrl: resolveURL(sUrlPrefix) }; }
[ "function", "registerResourcePath", "(", "sResourceNamePrefix", ",", "sUrlPrefix", ")", "{", "sResourceNamePrefix", "=", "String", "(", "sResourceNamePrefix", "||", "\"\"", ")", ";", "if", "(", "sUrlPrefix", "==", "null", ")", "{", "// remove a registered URL prefix, if it wasn't for the empty resource name prefix", "if", "(", "sResourceNamePrefix", ")", "{", "if", "(", "mUrlPrefixes", "[", "sResourceNamePrefix", "]", ")", "{", "delete", "mUrlPrefixes", "[", "sResourceNamePrefix", "]", ";", "log", ".", "info", "(", "\"registerResourcePath ('\"", "+", "sResourceNamePrefix", "+", "\"') (registration removed)\"", ")", ";", "}", "return", ";", "}", "// otherwise restore the default", "sUrlPrefix", "=", "DEFAULT_BASE_URL", ";", "log", ".", "info", "(", "\"registerResourcePath ('\"", "+", "sResourceNamePrefix", "+", "\"') (default registration restored)\"", ")", ";", "}", "// cast to string and remove query parameters and/or hash", "sUrlPrefix", "=", "pathOnly", "(", "String", "(", "sUrlPrefix", ")", ")", ";", "// ensure that the prefix ends with a '/'", "if", "(", "sUrlPrefix", ".", "slice", "(", "-", "1", ")", "!==", "'/'", ")", "{", "sUrlPrefix", "+=", "'/'", ";", "}", "mUrlPrefixes", "[", "sResourceNamePrefix", "]", "=", "{", "url", ":", "sUrlPrefix", ",", "// calculate absolute URL, only to be used by 'guessResourceName'", "absoluteUrl", ":", "resolveURL", "(", "sUrlPrefix", ")", "}", ";", "}" ]
Adds a resource path to the resources map. @param {string} sResourceNamePrefix prefix is used as map key @param {string} sUrlPrefix path to the resource
[ "Adds", "a", "resource", "path", "to", "the", "resources", "map", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/ui5loader.js#L489-L522
4,691
SAP/openui5
src/sap.ui.core/src/ui5loader.js
getResourcePath
function getResourcePath(sResourceName, sSuffix) { var sNamePrefix = sResourceName, p = sResourceName.length, sPath; // search for a registered name prefix, starting with the full name and successively removing one segment while ( p > 0 && !mUrlPrefixes[sNamePrefix] ) { p = sNamePrefix.lastIndexOf('/'); // Note: an empty segment at p = 0 (leading slash) will be ignored sNamePrefix = p > 0 ? sNamePrefix.slice(0, p) : ''; } assert((p > 0 || sNamePrefix === '') && mUrlPrefixes[sNamePrefix], "there always must be a mapping"); sPath = mUrlPrefixes[sNamePrefix].url + sResourceName.slice(p + 1); // also skips a leading slash! //remove trailing slash if ( sPath.slice(-1) === '/' ) { sPath = sPath.slice(0, -1); } return sPath + (sSuffix || ''); }
javascript
function getResourcePath(sResourceName, sSuffix) { var sNamePrefix = sResourceName, p = sResourceName.length, sPath; // search for a registered name prefix, starting with the full name and successively removing one segment while ( p > 0 && !mUrlPrefixes[sNamePrefix] ) { p = sNamePrefix.lastIndexOf('/'); // Note: an empty segment at p = 0 (leading slash) will be ignored sNamePrefix = p > 0 ? sNamePrefix.slice(0, p) : ''; } assert((p > 0 || sNamePrefix === '') && mUrlPrefixes[sNamePrefix], "there always must be a mapping"); sPath = mUrlPrefixes[sNamePrefix].url + sResourceName.slice(p + 1); // also skips a leading slash! //remove trailing slash if ( sPath.slice(-1) === '/' ) { sPath = sPath.slice(0, -1); } return sPath + (sSuffix || ''); }
[ "function", "getResourcePath", "(", "sResourceName", ",", "sSuffix", ")", "{", "var", "sNamePrefix", "=", "sResourceName", ",", "p", "=", "sResourceName", ".", "length", ",", "sPath", ";", "// search for a registered name prefix, starting with the full name and successively removing one segment", "while", "(", "p", ">", "0", "&&", "!", "mUrlPrefixes", "[", "sNamePrefix", "]", ")", "{", "p", "=", "sNamePrefix", ".", "lastIndexOf", "(", "'/'", ")", ";", "// Note: an empty segment at p = 0 (leading slash) will be ignored", "sNamePrefix", "=", "p", ">", "0", "?", "sNamePrefix", ".", "slice", "(", "0", ",", "p", ")", ":", "''", ";", "}", "assert", "(", "(", "p", ">", "0", "||", "sNamePrefix", "===", "''", ")", "&&", "mUrlPrefixes", "[", "sNamePrefix", "]", ",", "\"there always must be a mapping\"", ")", ";", "sPath", "=", "mUrlPrefixes", "[", "sNamePrefix", "]", ".", "url", "+", "sResourceName", ".", "slice", "(", "p", "+", "1", ")", ";", "// also skips a leading slash!", "//remove trailing slash", "if", "(", "sPath", ".", "slice", "(", "-", "1", ")", "===", "'/'", ")", "{", "sPath", "=", "sPath", ".", "slice", "(", "0", ",", "-", "1", ")", ";", "}", "return", "sPath", "+", "(", "sSuffix", "||", "''", ")", ";", "}" ]
Retrieves path to a given resource by finding the longest matching prefix for the resource name @param {string} sResourceName name of the resource stored in the resources map @param {string} sSuffix url suffix @returns {string} resource path
[ "Retrieves", "path", "to", "a", "given", "resource", "by", "finding", "the", "longest", "matching", "prefix", "for", "the", "resource", "name" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/ui5loader.js#L532-L555
4,692
SAP/openui5
src/sap.ui.core/src/ui5loader.js
findMapForContext
function findMapForContext(sContext) { var p, mMap; if ( sContext != null ) { // maps are defined on module IDs, reduce URN to module ID sContext = urnToIDAndType(sContext).id; p = sContext.length; mMap = mMaps[sContext]; while ( p > 0 && mMap == null ) { p = sContext.lastIndexOf('/'); if ( p > 0 ) { // Note: an empty segment at p = 0 (leading slash) will be ignored sContext = sContext.slice(0, p); mMap = mMaps[sContext]; } } } // if none is found, fallback to '*' map return mMap || mMaps['*']; }
javascript
function findMapForContext(sContext) { var p, mMap; if ( sContext != null ) { // maps are defined on module IDs, reduce URN to module ID sContext = urnToIDAndType(sContext).id; p = sContext.length; mMap = mMaps[sContext]; while ( p > 0 && mMap == null ) { p = sContext.lastIndexOf('/'); if ( p > 0 ) { // Note: an empty segment at p = 0 (leading slash) will be ignored sContext = sContext.slice(0, p); mMap = mMaps[sContext]; } } } // if none is found, fallback to '*' map return mMap || mMaps['*']; }
[ "function", "findMapForContext", "(", "sContext", ")", "{", "var", "p", ",", "mMap", ";", "if", "(", "sContext", "!=", "null", ")", "{", "// maps are defined on module IDs, reduce URN to module ID", "sContext", "=", "urnToIDAndType", "(", "sContext", ")", ".", "id", ";", "p", "=", "sContext", ".", "length", ";", "mMap", "=", "mMaps", "[", "sContext", "]", ";", "while", "(", "p", ">", "0", "&&", "mMap", "==", "null", ")", "{", "p", "=", "sContext", ".", "lastIndexOf", "(", "'/'", ")", ";", "if", "(", "p", ">", "0", ")", "{", "// Note: an empty segment at p = 0 (leading slash) will be ignored", "sContext", "=", "sContext", ".", "slice", "(", "0", ",", "p", ")", ";", "mMap", "=", "mMaps", "[", "sContext", "]", ";", "}", "}", "}", "// if none is found, fallback to '*' map", "return", "mMap", "||", "mMaps", "[", "'*'", "]", ";", "}" ]
Find the most specific map config that matches the given context resource @param {string} sContext Resource name to be used as context @returns {Object<string,string>|undefined} Most specific map or <code>undefined</code>
[ "Find", "the", "most", "specific", "map", "config", "that", "matches", "the", "given", "context", "resource" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/ui5loader.js#L603-L620
4,693
SAP/openui5
src/sap.ui.core/src/ui5loader.js
loadSyncXHR
function loadSyncXHR(oModule) { var xhr = new XMLHttpRequest(); function enrichXHRError(error) { error = error || ensureStacktrace(new Error(xhr.status + " - " + xhr.statusText)); error.status = xhr.status; error.statusText = xhr.statusText; error.loadError = true; return error; } xhr.addEventListener('load', function(e) { // File protocol (file://) always has status code 0 if ( xhr.status === 200 || xhr.status === 0 ) { oModule.state = LOADED; oModule.data = xhr.responseText; } else { oModule.error = enrichXHRError(); } }); // Note: according to whatwg spec, error event doesn't fire for sync send(), instead an error is thrown // we register a handler, in case a browser doesn't follow the spec xhr.addEventListener('error', function(e) { oModule.error = enrichXHRError(); }); xhr.open('GET', oModule.url, false); try { xhr.send(); } catch (error) { oModule.error = enrichXHRError(error); } }
javascript
function loadSyncXHR(oModule) { var xhr = new XMLHttpRequest(); function enrichXHRError(error) { error = error || ensureStacktrace(new Error(xhr.status + " - " + xhr.statusText)); error.status = xhr.status; error.statusText = xhr.statusText; error.loadError = true; return error; } xhr.addEventListener('load', function(e) { // File protocol (file://) always has status code 0 if ( xhr.status === 200 || xhr.status === 0 ) { oModule.state = LOADED; oModule.data = xhr.responseText; } else { oModule.error = enrichXHRError(); } }); // Note: according to whatwg spec, error event doesn't fire for sync send(), instead an error is thrown // we register a handler, in case a browser doesn't follow the spec xhr.addEventListener('error', function(e) { oModule.error = enrichXHRError(); }); xhr.open('GET', oModule.url, false); try { xhr.send(); } catch (error) { oModule.error = enrichXHRError(error); } }
[ "function", "loadSyncXHR", "(", "oModule", ")", "{", "var", "xhr", "=", "new", "XMLHttpRequest", "(", ")", ";", "function", "enrichXHRError", "(", "error", ")", "{", "error", "=", "error", "||", "ensureStacktrace", "(", "new", "Error", "(", "xhr", ".", "status", "+", "\" - \"", "+", "xhr", ".", "statusText", ")", ")", ";", "error", ".", "status", "=", "xhr", ".", "status", ";", "error", ".", "statusText", "=", "xhr", ".", "statusText", ";", "error", ".", "loadError", "=", "true", ";", "return", "error", ";", "}", "xhr", ".", "addEventListener", "(", "'load'", ",", "function", "(", "e", ")", "{", "// File protocol (file://) always has status code 0", "if", "(", "xhr", ".", "status", "===", "200", "||", "xhr", ".", "status", "===", "0", ")", "{", "oModule", ".", "state", "=", "LOADED", ";", "oModule", ".", "data", "=", "xhr", ".", "responseText", ";", "}", "else", "{", "oModule", ".", "error", "=", "enrichXHRError", "(", ")", ";", "}", "}", ")", ";", "// Note: according to whatwg spec, error event doesn't fire for sync send(), instead an error is thrown", "// we register a handler, in case a browser doesn't follow the spec", "xhr", ".", "addEventListener", "(", "'error'", ",", "function", "(", "e", ")", "{", "oModule", ".", "error", "=", "enrichXHRError", "(", ")", ";", "}", ")", ";", "xhr", ".", "open", "(", "'GET'", ",", "oModule", ".", "url", ",", "false", ")", ";", "try", "{", "xhr", ".", "send", "(", ")", ";", "}", "catch", "(", "error", ")", "{", "oModule", ".", "error", "=", "enrichXHRError", "(", "error", ")", ";", "}", "}" ]
Loads the source for the given module with a sync XHR. @param {Module} oModule Module to load the source for @throws {Error} When loading failed for some reason.
[ "Loads", "the", "source", "for", "the", "given", "module", "with", "a", "sync", "XHR", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/ui5loader.js#L1144-L1175
4,694
SAP/openui5
src/sap.ui.core/src/ui5loader.js
execModule
function execModule(sModuleName, bAsync) { var oModule = mModules[sModuleName], oShim = mShims[sModuleName], bLoggable = log.isLoggable(), sOldPrefix, sScript, vAMD, oMatch, bOldForceSyncDefines; if ( oModule && oModule.state === LOADED && typeof oModule.data !== "undefined" ) { // check whether the module is known to use an existing AMD loader, remember the AMD flag vAMD = (oShim === true || (oShim && oShim.amd)) && typeof __global.define === "function" && __global.define.amd; bOldForceSyncDefines = bForceSyncDefines; try { if ( vAMD ) { // temp. remove the AMD Flag from the loader delete __global.define.amd; } bForceSyncDefines = !bAsync; if ( bLoggable ) { log.debug(sLogPrefix + "executing '" + sModuleName + "'"); sOldPrefix = sLogPrefix; sLogPrefix = sLogPrefix + ": "; } // execute the script in the __global context oModule.state = EXECUTING; _execStack.push({ name: sModuleName, used: false }); if ( typeof oModule.data === "function" ) { oModule.data.call(__global); } else if ( Array.isArray(oModule.data) ) { ui5Define.apply(null, oModule.data); } else { sScript = oModule.data; // sourceURL: Firebug, Chrome, Safari and IE11 debugging help, appending the string seems to cost ZERO performance // Note: IE11 supports sourceURL even when running in IE9 or IE10 mode // Note: make URL absolute so Chrome displays the file tree correctly // Note: do not append if there is already a sourceURL / sourceMappingURL // Note: Safari fails, if sourceURL is the same as an existing XHR URL // Note: Chrome ignores debug files when the same URL has already been load via sourcemap of the bootstrap file (sap-ui-core) // Note: sourcemap annotations URLs in eval'ed sources are resolved relative to the page, not relative to the source if (sScript ) { oMatch = /\/\/[#@] source(Mapping)?URL=(.*)$/.exec(sScript); if ( oMatch && oMatch[1] && /^[^/]+\.js\.map$/.test(oMatch[2]) ) { // found a sourcemap annotation with a typical UI5 generated relative URL sScript = sScript.slice(0, oMatch.index) + oMatch[0].slice(0, -oMatch[2].length) + resolveURL(oMatch[2], oModule.url); } // @evo-todo use only sourceMappingURL, sourceURL or both? if ( !oMatch || oMatch[1] ) { // write sourceURL if no annotation was there or when it was a sourceMappingURL sScript += "\n//# sourceURL=" + resolveURL(oModule.url) + "?eval"; } } // framework internal hook to intercept the loaded script and modify // it before executing the script - e.g. useful for client side coverage if (typeof translate === "function") { sScript = translate(sScript, sModuleName); } if (__global.execScript && (!oModule.data || oModule.data.length < MAX_EXEC_SCRIPT_LENGTH) ) { try { oModule.data && __global.execScript(sScript); // execScript fails if data is empty } catch (e) { _execStack.pop(); // eval again with different approach - should fail with a more informative exception /* eslint-disable no-eval */ eval(oModule.data); /* eslint-enable no-eval */ throw e; // rethrow err in case globalEval succeeded unexpectedly } } else { __global.eval(sScript); } } _execStack.pop(); queue.process(oModule); if ( bLoggable ) { sLogPrefix = sOldPrefix; log.debug(sLogPrefix + "finished executing '" + sModuleName + "'"); } } catch (err) { if ( bLoggable ) { sLogPrefix = sOldPrefix; } oModule.data = undefined; oModule.fail(err); } finally { // restore AMD flag if ( vAMD ) { __global.define.amd = vAMD; } bForceSyncDefines = bOldForceSyncDefines; } } }
javascript
function execModule(sModuleName, bAsync) { var oModule = mModules[sModuleName], oShim = mShims[sModuleName], bLoggable = log.isLoggable(), sOldPrefix, sScript, vAMD, oMatch, bOldForceSyncDefines; if ( oModule && oModule.state === LOADED && typeof oModule.data !== "undefined" ) { // check whether the module is known to use an existing AMD loader, remember the AMD flag vAMD = (oShim === true || (oShim && oShim.amd)) && typeof __global.define === "function" && __global.define.amd; bOldForceSyncDefines = bForceSyncDefines; try { if ( vAMD ) { // temp. remove the AMD Flag from the loader delete __global.define.amd; } bForceSyncDefines = !bAsync; if ( bLoggable ) { log.debug(sLogPrefix + "executing '" + sModuleName + "'"); sOldPrefix = sLogPrefix; sLogPrefix = sLogPrefix + ": "; } // execute the script in the __global context oModule.state = EXECUTING; _execStack.push({ name: sModuleName, used: false }); if ( typeof oModule.data === "function" ) { oModule.data.call(__global); } else if ( Array.isArray(oModule.data) ) { ui5Define.apply(null, oModule.data); } else { sScript = oModule.data; // sourceURL: Firebug, Chrome, Safari and IE11 debugging help, appending the string seems to cost ZERO performance // Note: IE11 supports sourceURL even when running in IE9 or IE10 mode // Note: make URL absolute so Chrome displays the file tree correctly // Note: do not append if there is already a sourceURL / sourceMappingURL // Note: Safari fails, if sourceURL is the same as an existing XHR URL // Note: Chrome ignores debug files when the same URL has already been load via sourcemap of the bootstrap file (sap-ui-core) // Note: sourcemap annotations URLs in eval'ed sources are resolved relative to the page, not relative to the source if (sScript ) { oMatch = /\/\/[#@] source(Mapping)?URL=(.*)$/.exec(sScript); if ( oMatch && oMatch[1] && /^[^/]+\.js\.map$/.test(oMatch[2]) ) { // found a sourcemap annotation with a typical UI5 generated relative URL sScript = sScript.slice(0, oMatch.index) + oMatch[0].slice(0, -oMatch[2].length) + resolveURL(oMatch[2], oModule.url); } // @evo-todo use only sourceMappingURL, sourceURL or both? if ( !oMatch || oMatch[1] ) { // write sourceURL if no annotation was there or when it was a sourceMappingURL sScript += "\n//# sourceURL=" + resolveURL(oModule.url) + "?eval"; } } // framework internal hook to intercept the loaded script and modify // it before executing the script - e.g. useful for client side coverage if (typeof translate === "function") { sScript = translate(sScript, sModuleName); } if (__global.execScript && (!oModule.data || oModule.data.length < MAX_EXEC_SCRIPT_LENGTH) ) { try { oModule.data && __global.execScript(sScript); // execScript fails if data is empty } catch (e) { _execStack.pop(); // eval again with different approach - should fail with a more informative exception /* eslint-disable no-eval */ eval(oModule.data); /* eslint-enable no-eval */ throw e; // rethrow err in case globalEval succeeded unexpectedly } } else { __global.eval(sScript); } } _execStack.pop(); queue.process(oModule); if ( bLoggable ) { sLogPrefix = sOldPrefix; log.debug(sLogPrefix + "finished executing '" + sModuleName + "'"); } } catch (err) { if ( bLoggable ) { sLogPrefix = sOldPrefix; } oModule.data = undefined; oModule.fail(err); } finally { // restore AMD flag if ( vAMD ) { __global.define.amd = vAMD; } bForceSyncDefines = bOldForceSyncDefines; } } }
[ "function", "execModule", "(", "sModuleName", ",", "bAsync", ")", "{", "var", "oModule", "=", "mModules", "[", "sModuleName", "]", ",", "oShim", "=", "mShims", "[", "sModuleName", "]", ",", "bLoggable", "=", "log", ".", "isLoggable", "(", ")", ",", "sOldPrefix", ",", "sScript", ",", "vAMD", ",", "oMatch", ",", "bOldForceSyncDefines", ";", "if", "(", "oModule", "&&", "oModule", ".", "state", "===", "LOADED", "&&", "typeof", "oModule", ".", "data", "!==", "\"undefined\"", ")", "{", "// check whether the module is known to use an existing AMD loader, remember the AMD flag", "vAMD", "=", "(", "oShim", "===", "true", "||", "(", "oShim", "&&", "oShim", ".", "amd", ")", ")", "&&", "typeof", "__global", ".", "define", "===", "\"function\"", "&&", "__global", ".", "define", ".", "amd", ";", "bOldForceSyncDefines", "=", "bForceSyncDefines", ";", "try", "{", "if", "(", "vAMD", ")", "{", "// temp. remove the AMD Flag from the loader", "delete", "__global", ".", "define", ".", "amd", ";", "}", "bForceSyncDefines", "=", "!", "bAsync", ";", "if", "(", "bLoggable", ")", "{", "log", ".", "debug", "(", "sLogPrefix", "+", "\"executing '\"", "+", "sModuleName", "+", "\"'\"", ")", ";", "sOldPrefix", "=", "sLogPrefix", ";", "sLogPrefix", "=", "sLogPrefix", "+", "\": \"", ";", "}", "// execute the script in the __global context", "oModule", ".", "state", "=", "EXECUTING", ";", "_execStack", ".", "push", "(", "{", "name", ":", "sModuleName", ",", "used", ":", "false", "}", ")", ";", "if", "(", "typeof", "oModule", ".", "data", "===", "\"function\"", ")", "{", "oModule", ".", "data", ".", "call", "(", "__global", ")", ";", "}", "else", "if", "(", "Array", ".", "isArray", "(", "oModule", ".", "data", ")", ")", "{", "ui5Define", ".", "apply", "(", "null", ",", "oModule", ".", "data", ")", ";", "}", "else", "{", "sScript", "=", "oModule", ".", "data", ";", "// sourceURL: Firebug, Chrome, Safari and IE11 debugging help, appending the string seems to cost ZERO performance", "// Note: IE11 supports sourceURL even when running in IE9 or IE10 mode", "// Note: make URL absolute so Chrome displays the file tree correctly", "// Note: do not append if there is already a sourceURL / sourceMappingURL", "// Note: Safari fails, if sourceURL is the same as an existing XHR URL", "// Note: Chrome ignores debug files when the same URL has already been load via sourcemap of the bootstrap file (sap-ui-core)", "// Note: sourcemap annotations URLs in eval'ed sources are resolved relative to the page, not relative to the source", "if", "(", "sScript", ")", "{", "oMatch", "=", "/", "\\/\\/[#@] source(Mapping)?URL=(.*)$", "/", ".", "exec", "(", "sScript", ")", ";", "if", "(", "oMatch", "&&", "oMatch", "[", "1", "]", "&&", "/", "^[^/]+\\.js\\.map$", "/", ".", "test", "(", "oMatch", "[", "2", "]", ")", ")", "{", "// found a sourcemap annotation with a typical UI5 generated relative URL", "sScript", "=", "sScript", ".", "slice", "(", "0", ",", "oMatch", ".", "index", ")", "+", "oMatch", "[", "0", "]", ".", "slice", "(", "0", ",", "-", "oMatch", "[", "2", "]", ".", "length", ")", "+", "resolveURL", "(", "oMatch", "[", "2", "]", ",", "oModule", ".", "url", ")", ";", "}", "// @evo-todo use only sourceMappingURL, sourceURL or both?", "if", "(", "!", "oMatch", "||", "oMatch", "[", "1", "]", ")", "{", "// write sourceURL if no annotation was there or when it was a sourceMappingURL", "sScript", "+=", "\"\\n//# sourceURL=\"", "+", "resolveURL", "(", "oModule", ".", "url", ")", "+", "\"?eval\"", ";", "}", "}", "// framework internal hook to intercept the loaded script and modify", "// it before executing the script - e.g. useful for client side coverage", "if", "(", "typeof", "translate", "===", "\"function\"", ")", "{", "sScript", "=", "translate", "(", "sScript", ",", "sModuleName", ")", ";", "}", "if", "(", "__global", ".", "execScript", "&&", "(", "!", "oModule", ".", "data", "||", "oModule", ".", "data", ".", "length", "<", "MAX_EXEC_SCRIPT_LENGTH", ")", ")", "{", "try", "{", "oModule", ".", "data", "&&", "__global", ".", "execScript", "(", "sScript", ")", ";", "// execScript fails if data is empty", "}", "catch", "(", "e", ")", "{", "_execStack", ".", "pop", "(", ")", ";", "// eval again with different approach - should fail with a more informative exception", "/* eslint-disable no-eval */", "eval", "(", "oModule", ".", "data", ")", ";", "/* eslint-enable no-eval */", "throw", "e", ";", "// rethrow err in case globalEval succeeded unexpectedly", "}", "}", "else", "{", "__global", ".", "eval", "(", "sScript", ")", ";", "}", "}", "_execStack", ".", "pop", "(", ")", ";", "queue", ".", "process", "(", "oModule", ")", ";", "if", "(", "bLoggable", ")", "{", "sLogPrefix", "=", "sOldPrefix", ";", "log", ".", "debug", "(", "sLogPrefix", "+", "\"finished executing '\"", "+", "sModuleName", "+", "\"'\"", ")", ";", "}", "}", "catch", "(", "err", ")", "{", "if", "(", "bLoggable", ")", "{", "sLogPrefix", "=", "sOldPrefix", ";", "}", "oModule", ".", "data", "=", "undefined", ";", "oModule", ".", "fail", "(", "err", ")", ";", "}", "finally", "{", "// restore AMD flag", "if", "(", "vAMD", ")", "{", "__global", ".", "define", ".", "amd", "=", "vAMD", ";", "}", "bForceSyncDefines", "=", "bOldForceSyncDefines", ";", "}", "}", "}" ]
sModuleName must be a normalized resource name of type .js
[ "sModuleName", "must", "be", "a", "normalized", "resource", "name", "of", "type", ".", "js" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/ui5loader.js#L1441-L1546
4,695
SAP/openui5
src/sap.ui.core/src/ui5loader.js
dumpInternals
function dumpInternals(iThreshold) { var states = [PRELOADED, INITIAL, LOADED, READY, FAILED, EXECUTING, LOADING]; var stateNames = {}; stateNames[PRELOADED] = 'PRELOADED'; stateNames[INITIAL] = 'INITIAL'; stateNames[LOADING] = 'LOADING'; stateNames[LOADED] = 'LOADED'; stateNames[EXECUTING] = 'EXECUTING'; stateNames[READY] = 'READY'; stateNames[FAILED] = 'FAILED'; if ( iThreshold == null ) { iThreshold = PRELOADED; } /*eslint-disable no-console */ var info = log.isLoggable('INFO') ? log.info.bind(log) : console.info.bind(console); /*eslint-enable no-console */ var aModuleNames = Object.keys(mModules).sort(); states.forEach(function(state) { if ( state < iThreshold ) { return; } var count = 0; info(stateNames[state] + ":"); aModuleNames.forEach(function(sModule, idx) { var oModule = mModules[sModule]; if ( oModule.state === state ) { var addtlInfo; if ( oModule.state === LOADING ) { var pending = oModule.pending && oModule.pending.reduce(function(acc, dep) { var oDepModule = Module.get(dep); if ( oDepModule.state !== READY ) { acc.push( dep + "(" + stateNames[oDepModule.state] + ")"); } return acc; }, []); if ( pending && pending.length > 0 ) { addtlInfo = "waiting for " + pending.join(", "); } } else if ( oModule.state === FAILED ) { addtlInfo = (oModule.error.name || "Error") + ": " + oModule.error.message; } info(" " + (idx + 1) + " " + sModule + (addtlInfo ? " (" + addtlInfo + ")" : "")); count++; } }); if ( count === 0 ) { info(" none"); } }); }
javascript
function dumpInternals(iThreshold) { var states = [PRELOADED, INITIAL, LOADED, READY, FAILED, EXECUTING, LOADING]; var stateNames = {}; stateNames[PRELOADED] = 'PRELOADED'; stateNames[INITIAL] = 'INITIAL'; stateNames[LOADING] = 'LOADING'; stateNames[LOADED] = 'LOADED'; stateNames[EXECUTING] = 'EXECUTING'; stateNames[READY] = 'READY'; stateNames[FAILED] = 'FAILED'; if ( iThreshold == null ) { iThreshold = PRELOADED; } /*eslint-disable no-console */ var info = log.isLoggable('INFO') ? log.info.bind(log) : console.info.bind(console); /*eslint-enable no-console */ var aModuleNames = Object.keys(mModules).sort(); states.forEach(function(state) { if ( state < iThreshold ) { return; } var count = 0; info(stateNames[state] + ":"); aModuleNames.forEach(function(sModule, idx) { var oModule = mModules[sModule]; if ( oModule.state === state ) { var addtlInfo; if ( oModule.state === LOADING ) { var pending = oModule.pending && oModule.pending.reduce(function(acc, dep) { var oDepModule = Module.get(dep); if ( oDepModule.state !== READY ) { acc.push( dep + "(" + stateNames[oDepModule.state] + ")"); } return acc; }, []); if ( pending && pending.length > 0 ) { addtlInfo = "waiting for " + pending.join(", "); } } else if ( oModule.state === FAILED ) { addtlInfo = (oModule.error.name || "Error") + ": " + oModule.error.message; } info(" " + (idx + 1) + " " + sModule + (addtlInfo ? " (" + addtlInfo + ")" : "")); count++; } }); if ( count === 0 ) { info(" none"); } }); }
[ "function", "dumpInternals", "(", "iThreshold", ")", "{", "var", "states", "=", "[", "PRELOADED", ",", "INITIAL", ",", "LOADED", ",", "READY", ",", "FAILED", ",", "EXECUTING", ",", "LOADING", "]", ";", "var", "stateNames", "=", "{", "}", ";", "stateNames", "[", "PRELOADED", "]", "=", "'PRELOADED'", ";", "stateNames", "[", "INITIAL", "]", "=", "'INITIAL'", ";", "stateNames", "[", "LOADING", "]", "=", "'LOADING'", ";", "stateNames", "[", "LOADED", "]", "=", "'LOADED'", ";", "stateNames", "[", "EXECUTING", "]", "=", "'EXECUTING'", ";", "stateNames", "[", "READY", "]", "=", "'READY'", ";", "stateNames", "[", "FAILED", "]", "=", "'FAILED'", ";", "if", "(", "iThreshold", "==", "null", ")", "{", "iThreshold", "=", "PRELOADED", ";", "}", "/*eslint-disable no-console */", "var", "info", "=", "log", ".", "isLoggable", "(", "'INFO'", ")", "?", "log", ".", "info", ".", "bind", "(", "log", ")", ":", "console", ".", "info", ".", "bind", "(", "console", ")", ";", "/*eslint-enable no-console */", "var", "aModuleNames", "=", "Object", ".", "keys", "(", "mModules", ")", ".", "sort", "(", ")", ";", "states", ".", "forEach", "(", "function", "(", "state", ")", "{", "if", "(", "state", "<", "iThreshold", ")", "{", "return", ";", "}", "var", "count", "=", "0", ";", "info", "(", "stateNames", "[", "state", "]", "+", "\":\"", ")", ";", "aModuleNames", ".", "forEach", "(", "function", "(", "sModule", ",", "idx", ")", "{", "var", "oModule", "=", "mModules", "[", "sModule", "]", ";", "if", "(", "oModule", ".", "state", "===", "state", ")", "{", "var", "addtlInfo", ";", "if", "(", "oModule", ".", "state", "===", "LOADING", ")", "{", "var", "pending", "=", "oModule", ".", "pending", "&&", "oModule", ".", "pending", ".", "reduce", "(", "function", "(", "acc", ",", "dep", ")", "{", "var", "oDepModule", "=", "Module", ".", "get", "(", "dep", ")", ";", "if", "(", "oDepModule", ".", "state", "!==", "READY", ")", "{", "acc", ".", "push", "(", "dep", "+", "\"(\"", "+", "stateNames", "[", "oDepModule", ".", "state", "]", "+", "\")\"", ")", ";", "}", "return", "acc", ";", "}", ",", "[", "]", ")", ";", "if", "(", "pending", "&&", "pending", ".", "length", ">", "0", ")", "{", "addtlInfo", "=", "\"waiting for \"", "+", "pending", ".", "join", "(", "\", \"", ")", ";", "}", "}", "else", "if", "(", "oModule", ".", "state", "===", "FAILED", ")", "{", "addtlInfo", "=", "(", "oModule", ".", "error", ".", "name", "||", "\"Error\"", ")", "+", "\": \"", "+", "oModule", ".", "error", ".", "message", ";", "}", "info", "(", "\" \"", "+", "(", "idx", "+", "1", ")", "+", "\" \"", "+", "sModule", "+", "(", "addtlInfo", "?", "\" (\"", "+", "addtlInfo", "+", "\")\"", ":", "\"\"", ")", ")", ";", "count", "++", ";", "}", "}", ")", ";", "if", "(", "count", "===", "0", ")", "{", "info", "(", "\" none\"", ")", ";", "}", "}", ")", ";", "}" ]
Dumps information about the current set of modules and their state. @param {int} [iThreshold=-1] Earliest module state for which odules should be reported @private
[ "Dumps", "information", "about", "the", "current", "set", "of", "modules", "and", "their", "state", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/ui5loader.js#L1946-L2000
4,696
SAP/openui5
src/sap.ui.core/src/ui5loader.js
getUrlPrefixes
function getUrlPrefixes() { var mUrlPrefixesCopy = Object.create(null); forEach(mUrlPrefixes, function(sNamePrefix, oUrlInfo) { mUrlPrefixesCopy[sNamePrefix] = oUrlInfo.url; }); return mUrlPrefixesCopy; }
javascript
function getUrlPrefixes() { var mUrlPrefixesCopy = Object.create(null); forEach(mUrlPrefixes, function(sNamePrefix, oUrlInfo) { mUrlPrefixesCopy[sNamePrefix] = oUrlInfo.url; }); return mUrlPrefixesCopy; }
[ "function", "getUrlPrefixes", "(", ")", "{", "var", "mUrlPrefixesCopy", "=", "Object", ".", "create", "(", "null", ")", ";", "forEach", "(", "mUrlPrefixes", ",", "function", "(", "sNamePrefix", ",", "oUrlInfo", ")", "{", "mUrlPrefixesCopy", "[", "sNamePrefix", "]", "=", "oUrlInfo", ".", "url", ";", "}", ")", ";", "return", "mUrlPrefixesCopy", ";", "}" ]
Returns a flat copy of the current set of URL prefixes. @private
[ "Returns", "a", "flat", "copy", "of", "the", "current", "set", "of", "URL", "prefixes", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/ui5loader.js#L2007-L2013
4,697
SAP/openui5
src/sap.ui.core/src/ui5loader.js
unloadResources
function unloadResources(sName, bPreloadGroup, bUnloadAll, bDeleteExports) { var aModules = [], sURN, oModule; if ( bPreloadGroup == null ) { bPreloadGroup = true; } if ( bPreloadGroup ) { // collect modules that belong to the given group for ( sURN in mModules ) { oModule = mModules[sURN]; if ( oModule && oModule.group === sName ) { aModules.push(sURN); } } } else { // single module if ( mModules[sName] ) { aModules.push(sName); } } aModules.forEach(function(sURN) { var oModule = mModules[sURN]; if ( oModule && bDeleteExports && sURN.match(/\.js$/) ) { // @evo-todo move to compat layer? setGlobalProperty(urnToUI5(sURN), undefined); } if ( oModule && (bUnloadAll || oModule.state === PRELOADED) ) { delete mModules[sURN]; } }); }
javascript
function unloadResources(sName, bPreloadGroup, bUnloadAll, bDeleteExports) { var aModules = [], sURN, oModule; if ( bPreloadGroup == null ) { bPreloadGroup = true; } if ( bPreloadGroup ) { // collect modules that belong to the given group for ( sURN in mModules ) { oModule = mModules[sURN]; if ( oModule && oModule.group === sName ) { aModules.push(sURN); } } } else { // single module if ( mModules[sName] ) { aModules.push(sName); } } aModules.forEach(function(sURN) { var oModule = mModules[sURN]; if ( oModule && bDeleteExports && sURN.match(/\.js$/) ) { // @evo-todo move to compat layer? setGlobalProperty(urnToUI5(sURN), undefined); } if ( oModule && (bUnloadAll || oModule.state === PRELOADED) ) { delete mModules[sURN]; } }); }
[ "function", "unloadResources", "(", "sName", ",", "bPreloadGroup", ",", "bUnloadAll", ",", "bDeleteExports", ")", "{", "var", "aModules", "=", "[", "]", ",", "sURN", ",", "oModule", ";", "if", "(", "bPreloadGroup", "==", "null", ")", "{", "bPreloadGroup", "=", "true", ";", "}", "if", "(", "bPreloadGroup", ")", "{", "// collect modules that belong to the given group", "for", "(", "sURN", "in", "mModules", ")", "{", "oModule", "=", "mModules", "[", "sURN", "]", ";", "if", "(", "oModule", "&&", "oModule", ".", "group", "===", "sName", ")", "{", "aModules", ".", "push", "(", "sURN", ")", ";", "}", "}", "}", "else", "{", "// single module", "if", "(", "mModules", "[", "sName", "]", ")", "{", "aModules", ".", "push", "(", "sName", ")", ";", "}", "}", "aModules", ".", "forEach", "(", "function", "(", "sURN", ")", "{", "var", "oModule", "=", "mModules", "[", "sURN", "]", ";", "if", "(", "oModule", "&&", "bDeleteExports", "&&", "sURN", ".", "match", "(", "/", "\\.js$", "/", ")", ")", "{", "// @evo-todo move to compat layer?", "setGlobalProperty", "(", "urnToUI5", "(", "sURN", ")", ",", "undefined", ")", ";", "}", "if", "(", "oModule", "&&", "(", "bUnloadAll", "||", "oModule", ".", "state", "===", "PRELOADED", ")", ")", "{", "delete", "mModules", "[", "sURN", "]", ";", "}", "}", ")", ";", "}" ]
Removes a set of resources from the resource cache. @param {string} sName unified resource name of a resource or the name of a preload group to be removed @param {boolean} [bPreloadGroup=true] whether the name specifies a preload group, defaults to true @param {boolean} [bUnloadAll] Whether all matching resources should be unloaded, even if they have been executed already. @param {boolean} [bDeleteExports] Whether exports (global variables) should be destroyed as well. Will be done for UI5 module names only. @experimental Since 1.16.3 API might change completely, apps must not develop against it. @private
[ "Removes", "a", "set", "of", "resources", "from", "the", "resource", "cache", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/ui5loader.js#L2025-L2060
4,698
SAP/openui5
src/sap.ui.core/src/ui5loader.js
getAllModules
function getAllModules() { var mSnapshot = Object.create(null); forEach(mModules, function(sURN, oModule) { mSnapshot[sURN] = { state: oModule.state, ui5: urnToUI5(sURN) }; }); return mSnapshot; }
javascript
function getAllModules() { var mSnapshot = Object.create(null); forEach(mModules, function(sURN, oModule) { mSnapshot[sURN] = { state: oModule.state, ui5: urnToUI5(sURN) }; }); return mSnapshot; }
[ "function", "getAllModules", "(", ")", "{", "var", "mSnapshot", "=", "Object", ".", "create", "(", "null", ")", ";", "forEach", "(", "mModules", ",", "function", "(", "sURN", ",", "oModule", ")", "{", "mSnapshot", "[", "sURN", "]", "=", "{", "state", ":", "oModule", ".", "state", ",", "ui5", ":", "urnToUI5", "(", "sURN", ")", "}", ";", "}", ")", ";", "return", "mSnapshot", ";", "}" ]
Returns an info about all known resources keyed by their URN. If the URN can be converted to a UI5 module name, then the value in the map will be that name. Otherwise it will be null or undefined. @return {Object.<string,string>} Map of all module names keyed by their resource name @see isDeclared @private
[ "Returns", "an", "info", "about", "all", "known", "resources", "keyed", "by", "their", "URN", "." ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/ui5loader.js#L2087-L2096
4,699
SAP/openui5
src/sap.ui.core/src/ui5loader.js
function(module, shim) { if ( Array.isArray(shim) ) { shim = { deps : shim }; } mShims[module + '.js'] = shim; }
javascript
function(module, shim) { if ( Array.isArray(shim) ) { shim = { deps : shim }; } mShims[module + '.js'] = shim; }
[ "function", "(", "module", ",", "shim", ")", "{", "if", "(", "Array", ".", "isArray", "(", "shim", ")", ")", "{", "shim", "=", "{", "deps", ":", "shim", "}", ";", "}", "mShims", "[", "module", "+", "'.js'", "]", "=", "shim", ";", "}" ]
has length 2
[ "has", "length", "2" ]
8a832fca01cb1cdf8df589788e0c5723e2a33c70
https://github.com/SAP/openui5/blob/8a832fca01cb1cdf8df589788e0c5723e2a33c70/src/sap.ui.core/src/ui5loader.js#L2111-L2116