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 list | docstring stringlengths 4 11.8k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 86 226 |
|---|---|---|---|---|---|---|---|---|---|---|---|
5,000 | angular/material | src/core/services/theming/theming.js | function (scope, el) {
if (el === undefined) { el = scope; scope = undefined; }
if (scope === undefined) { scope = $rootScope; }
applyTheme.inherit(el, el);
} | javascript | function (scope, el) {
if (el === undefined) { el = scope; scope = undefined; }
if (scope === undefined) { scope = $rootScope; }
applyTheme.inherit(el, el);
} | [
"function",
"(",
"scope",
",",
"el",
")",
"{",
"if",
"(",
"el",
"===",
"undefined",
")",
"{",
"el",
"=",
"scope",
";",
"scope",
"=",
"undefined",
";",
"}",
"if",
"(",
"scope",
"===",
"undefined",
")",
"{",
"scope",
"=",
"$rootScope",
";",
"}",
"a... | Allow us to be invoked via a linking function signature. | [
"Allow",
"us",
"to",
"be",
"invoked",
"via",
"a",
"linking",
"function",
"signature",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/theming/theming.js#L711-L715 | |
5,001 | angular/material | src/core/services/theming/theming.js | registered | function registered(themeName) {
if (themeName === undefined || themeName === '') return true;
return applyTheme.THEMES[themeName] !== undefined;
} | javascript | function registered(themeName) {
if (themeName === undefined || themeName === '') return true;
return applyTheme.THEMES[themeName] !== undefined;
} | [
"function",
"registered",
"(",
"themeName",
")",
"{",
"if",
"(",
"themeName",
"===",
"undefined",
"||",
"themeName",
"===",
"''",
")",
"return",
"true",
";",
"return",
"applyTheme",
".",
"THEMES",
"[",
"themeName",
"]",
"!==",
"undefined",
";",
"}"
] | Determine is specified theme name is a valid, registered theme | [
"Determine",
"is",
"specified",
"theme",
"name",
"is",
"a",
"valid",
"registered",
"theme"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/theming/theming.js#L768-L771 |
5,002 | angular/material | src/core/services/theming/theming.js | inheritTheme | function inheritTheme (el, parent) {
var ctrl = parent.controller('mdTheme') || el.data('$mdThemeController');
var scope = el.scope();
updateThemeClass(lookupThemeName());
if (ctrl) {
var watchTheme = alwaysWatchTheme ||
ctrl.$shouldWatch ||
... | javascript | function inheritTheme (el, parent) {
var ctrl = parent.controller('mdTheme') || el.data('$mdThemeController');
var scope = el.scope();
updateThemeClass(lookupThemeName());
if (ctrl) {
var watchTheme = alwaysWatchTheme ||
ctrl.$shouldWatch ||
... | [
"function",
"inheritTheme",
"(",
"el",
",",
"parent",
")",
"{",
"var",
"ctrl",
"=",
"parent",
".",
"controller",
"(",
"'mdTheme'",
")",
"||",
"el",
".",
"data",
"(",
"'$mdThemeController'",
")",
";",
"var",
"scope",
"=",
"el",
".",
"scope",
"(",
")",
... | Get theme name for the element, then update with Theme CSS class | [
"Get",
"theme",
"name",
"for",
"the",
"element",
"then",
"update",
"with",
"Theme",
"CSS",
"class"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/theming/theming.js#L776-L838 |
5,003 | angular/material | src/components/autocomplete/js/autocompleteController.js | init | function init () {
$mdUtil.initOptionalProperties($scope, $attrs, {
searchText: '',
selectedItem: null,
clearButton: false,
disableVirtualRepeat: false,
});
$mdTheming($element);
configureWatchers();
$mdUtil.nextTick(function () {
gatherElements();
moveDropdown... | javascript | function init () {
$mdUtil.initOptionalProperties($scope, $attrs, {
searchText: '',
selectedItem: null,
clearButton: false,
disableVirtualRepeat: false,
});
$mdTheming($element);
configureWatchers();
$mdUtil.nextTick(function () {
gatherElements();
moveDropdown... | [
"function",
"init",
"(",
")",
"{",
"$mdUtil",
".",
"initOptionalProperties",
"(",
"$scope",
",",
"$attrs",
",",
"{",
"searchText",
":",
"''",
",",
"selectedItem",
":",
"null",
",",
"clearButton",
":",
"false",
",",
"disableVirtualRepeat",
":",
"false",
",",
... | initialization methods
Initialize the controller, setup watchers, gather elements | [
"initialization",
"methods",
"Initialize",
"the",
"controller",
"setup",
"watchers",
"gather",
"elements"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/autocomplete/js/autocompleteController.js#L80-L115 |
5,004 | angular/material | src/components/autocomplete/js/autocompleteController.js | getVerticalOffset | function getVerticalOffset () {
var offset = 0;
var inputContainer = $element.find('md-input-container');
if (inputContainer.length) {
var input = inputContainer.find('input');
offset = inputContainer.prop('offsetHeight');
offset -= input.prop('offsetTop');
offset -= in... | javascript | function getVerticalOffset () {
var offset = 0;
var inputContainer = $element.find('md-input-container');
if (inputContainer.length) {
var input = inputContainer.find('input');
offset = inputContainer.prop('offsetHeight');
offset -= input.prop('offsetTop');
offset -= in... | [
"function",
"getVerticalOffset",
"(",
")",
"{",
"var",
"offset",
"=",
"0",
";",
"var",
"inputContainer",
"=",
"$element",
".",
"find",
"(",
"'md-input-container'",
")",
";",
"if",
"(",
"inputContainer",
".",
"length",
")",
"{",
"var",
"input",
"=",
"inputC... | Calculates the vertical offset for floating label examples to account for ngMessages
@returns {number} | [
"Calculates",
"the",
"vertical",
"offset",
"for",
"floating",
"label",
"examples",
"to",
"account",
"for",
"ngMessages"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/autocomplete/js/autocompleteController.js#L188-L200 |
5,005 | angular/material | src/components/autocomplete/js/autocompleteController.js | moveDropdown | function moveDropdown () {
if (!elements.$.root.length) return;
$mdTheming(elements.$.scrollContainer);
elements.$.scrollContainer.detach();
elements.$.root.append(elements.$.scrollContainer);
if ($animate.pin) $animate.pin(elements.$.scrollContainer, $rootElement);
} | javascript | function moveDropdown () {
if (!elements.$.root.length) return;
$mdTheming(elements.$.scrollContainer);
elements.$.scrollContainer.detach();
elements.$.root.append(elements.$.scrollContainer);
if ($animate.pin) $animate.pin(elements.$.scrollContainer, $rootElement);
} | [
"function",
"moveDropdown",
"(",
")",
"{",
"if",
"(",
"!",
"elements",
".",
"$",
".",
"root",
".",
"length",
")",
"return",
";",
"$mdTheming",
"(",
"elements",
".",
"$",
".",
"scrollContainer",
")",
";",
"elements",
".",
"$",
".",
"scrollContainer",
".... | Moves the dropdown menu to the body tag in order to avoid z-index and overflow issues. | [
"Moves",
"the",
"dropdown",
"menu",
"to",
"the",
"body",
"tag",
"in",
"order",
"to",
"avoid",
"z",
"-",
"index",
"and",
"overflow",
"issues",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/autocomplete/js/autocompleteController.js#L218-L224 |
5,006 | angular/material | src/components/autocomplete/js/autocompleteController.js | cleanup | function cleanup () {
if (!ctrl.hidden) {
$mdUtil.enableScrolling();
}
angular.element($window).off('resize', debouncedOnResize);
if (elements){
var items = ['ul', 'scroller', 'scrollContainer', 'input'];
angular.forEach(items, function(key){
elements.$[key].remove();
}... | javascript | function cleanup () {
if (!ctrl.hidden) {
$mdUtil.enableScrolling();
}
angular.element($window).off('resize', debouncedOnResize);
if (elements){
var items = ['ul', 'scroller', 'scrollContainer', 'input'];
angular.forEach(items, function(key){
elements.$[key].remove();
}... | [
"function",
"cleanup",
"(",
")",
"{",
"if",
"(",
"!",
"ctrl",
".",
"hidden",
")",
"{",
"$mdUtil",
".",
"enableScrolling",
"(",
")",
";",
"}",
"angular",
".",
"element",
"(",
"$window",
")",
".",
"off",
"(",
"'resize'",
",",
"debouncedOnResize",
")",
... | Removes any events or leftover elements created by this controller | [
"Removes",
"any",
"events",
"or",
"leftover",
"elements",
"created",
"by",
"this",
"controller"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/autocomplete/js/autocompleteController.js#L254-L267 |
5,007 | angular/material | src/components/autocomplete/js/autocompleteController.js | gatherSnapWrap | function gatherSnapWrap() {
var element;
var value;
for (element = $element; element.length; element = element.parent()) {
value = element.attr('md-autocomplete-snap');
if (angular.isDefined(value)) break;
}
if (element.length) {
return {
snap: element[0],
wrap: (v... | javascript | function gatherSnapWrap() {
var element;
var value;
for (element = $element; element.length; element = element.parent()) {
value = element.attr('md-autocomplete-snap');
if (angular.isDefined(value)) break;
}
if (element.length) {
return {
snap: element[0],
wrap: (v... | [
"function",
"gatherSnapWrap",
"(",
")",
"{",
"var",
"element",
";",
"var",
"value",
";",
"for",
"(",
"element",
"=",
"$element",
";",
"element",
".",
"length",
";",
"element",
"=",
"element",
".",
"parent",
"(",
")",
")",
"{",
"value",
"=",
"element",
... | Gathers the snap and wrap elements | [
"Gathers",
"the",
"snap",
"and",
"wrap",
"elements"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/autocomplete/js/autocompleteController.js#L306-L326 |
5,008 | angular/material | src/components/autocomplete/js/autocompleteController.js | getAngularElements | function getAngularElements (elements) {
var obj = {};
for (var key in elements) {
if (elements.hasOwnProperty(key)) obj[ key ] = angular.element(elements[ key ]);
}
return obj;
} | javascript | function getAngularElements (elements) {
var obj = {};
for (var key in elements) {
if (elements.hasOwnProperty(key)) obj[ key ] = angular.element(elements[ key ]);
}
return obj;
} | [
"function",
"getAngularElements",
"(",
"elements",
")",
"{",
"var",
"obj",
"=",
"{",
"}",
";",
"for",
"(",
"var",
"key",
"in",
"elements",
")",
"{",
"if",
"(",
"elements",
".",
"hasOwnProperty",
"(",
"key",
")",
")",
"obj",
"[",
"key",
"]",
"=",
"a... | Gathers angular-wrapped versions of each element
@param elements
@returns {{}} | [
"Gathers",
"angular",
"-",
"wrapped",
"versions",
"of",
"each",
"element"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/autocomplete/js/autocompleteController.js#L333-L339 |
5,009 | angular/material | src/components/autocomplete/js/autocompleteController.js | disableElementScrollEvents | function disableElementScrollEvents(element) {
function preventDefault(e) {
e.preventDefault();
}
element.on('wheel', preventDefault);
element.on('touchmove', preventDefault);
return function() {
element.off('wheel', preventDefault);
element.off('touchmove', preventDefault);
... | javascript | function disableElementScrollEvents(element) {
function preventDefault(e) {
e.preventDefault();
}
element.on('wheel', preventDefault);
element.on('touchmove', preventDefault);
return function() {
element.off('wheel', preventDefault);
element.off('touchmove', preventDefault);
... | [
"function",
"disableElementScrollEvents",
"(",
"element",
")",
"{",
"function",
"preventDefault",
"(",
"e",
")",
"{",
"e",
".",
"preventDefault",
"(",
")",
";",
"}",
"element",
".",
"on",
"(",
"'wheel'",
",",
"preventDefault",
")",
";",
"element",
".",
"on... | Disables scrolling for a specific element | [
"Disables",
"scrolling",
"for",
"a",
"specific",
"element"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/autocomplete/js/autocompleteController.js#L373-L386 |
5,010 | angular/material | src/components/autocomplete/js/autocompleteController.js | onListLeave | function onListLeave () {
if (!hasFocus && !ctrl.hidden) elements.input.focus();
noBlur = false;
ctrl.hidden = shouldHide();
} | javascript | function onListLeave () {
if (!hasFocus && !ctrl.hidden) elements.input.focus();
noBlur = false;
ctrl.hidden = shouldHide();
} | [
"function",
"onListLeave",
"(",
")",
"{",
"if",
"(",
"!",
"hasFocus",
"&&",
"!",
"ctrl",
".",
"hidden",
")",
"elements",
".",
"input",
".",
"focus",
"(",
")",
";",
"noBlur",
"=",
"false",
";",
"ctrl",
".",
"hidden",
"=",
"shouldHide",
"(",
")",
";"... | When the user's mouse leaves the menu, blur events may hide the menu again. | [
"When",
"the",
"user",
"s",
"mouse",
"leaves",
"the",
"menu",
"blur",
"events",
"may",
"hide",
"the",
"menu",
"again",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/autocomplete/js/autocompleteController.js#L398-L402 |
5,011 | angular/material | src/components/autocomplete/js/autocompleteController.js | unregisterSelectedItemWatcher | function unregisterSelectedItemWatcher (cb) {
var i = selectedItemWatchers.indexOf(cb);
if (i !== -1) {
selectedItemWatchers.splice(i, 1);
}
} | javascript | function unregisterSelectedItemWatcher (cb) {
var i = selectedItemWatchers.indexOf(cb);
if (i !== -1) {
selectedItemWatchers.splice(i, 1);
}
} | [
"function",
"unregisterSelectedItemWatcher",
"(",
"cb",
")",
"{",
"var",
"i",
"=",
"selectedItemWatchers",
".",
"indexOf",
"(",
"cb",
")",
";",
"if",
"(",
"i",
"!==",
"-",
"1",
")",
"{",
"selectedItemWatchers",
".",
"splice",
"(",
"i",
",",
"1",
")",
"... | Unregister a function previously registered for selected item changes.
@param cb | [
"Unregister",
"a",
"function",
"previously",
"registered",
"for",
"selected",
"item",
"changes",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/autocomplete/js/autocompleteController.js#L483-L488 |
5,012 | angular/material | src/components/autocomplete/js/autocompleteController.js | doBlur | function doBlur(forceBlur) {
if (forceBlur) {
noBlur = false;
hasFocus = false;
}
elements.input.blur();
} | javascript | function doBlur(forceBlur) {
if (forceBlur) {
noBlur = false;
hasFocus = false;
}
elements.input.blur();
} | [
"function",
"doBlur",
"(",
"forceBlur",
")",
"{",
"if",
"(",
"forceBlur",
")",
"{",
"noBlur",
"=",
"false",
";",
"hasFocus",
"=",
"false",
";",
"}",
"elements",
".",
"input",
".",
"blur",
"(",
")",
";",
"}"
] | Force blur on input element
@param forceBlur | [
"Force",
"blur",
"on",
"input",
"element"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/autocomplete/js/autocompleteController.js#L544-L550 |
5,013 | angular/material | src/components/autocomplete/js/autocompleteController.js | focus | function focus($event) {
hasFocus = true;
if (isSearchable() && isMinLengthMet()) {
handleQuery();
}
ctrl.hidden = shouldHide();
evalAttr('ngFocus', { $event: $event });
} | javascript | function focus($event) {
hasFocus = true;
if (isSearchable() && isMinLengthMet()) {
handleQuery();
}
ctrl.hidden = shouldHide();
evalAttr('ngFocus', { $event: $event });
} | [
"function",
"focus",
"(",
"$event",
")",
"{",
"hasFocus",
"=",
"true",
";",
"if",
"(",
"isSearchable",
"(",
")",
"&&",
"isMinLengthMet",
"(",
")",
")",
"{",
"handleQuery",
"(",
")",
";",
"}",
"ctrl",
".",
"hidden",
"=",
"shouldHide",
"(",
")",
";",
... | Handles input focus event, determines if the dropdown should show. | [
"Handles",
"input",
"focus",
"event",
"determines",
"if",
"the",
"dropdown",
"should",
"show",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/autocomplete/js/autocompleteController.js#L555-L565 |
5,014 | angular/material | src/components/autocomplete/js/autocompleteController.js | getItemAsNameVal | function getItemAsNameVal (item) {
if (!item) {
return undefined;
}
var locals = {};
if (ctrl.itemName) {
locals[ ctrl.itemName ] = item;
}
return locals;
} | javascript | function getItemAsNameVal (item) {
if (!item) {
return undefined;
}
var locals = {};
if (ctrl.itemName) {
locals[ ctrl.itemName ] = item;
}
return locals;
} | [
"function",
"getItemAsNameVal",
"(",
"item",
")",
"{",
"if",
"(",
"!",
"item",
")",
"{",
"return",
"undefined",
";",
"}",
"var",
"locals",
"=",
"{",
"}",
";",
"if",
"(",
"ctrl",
".",
"itemName",
")",
"{",
"locals",
"[",
"ctrl",
".",
"itemName",
"]"... | Returns the locals object for compiling item templates.
@param item
@returns {Object|undefined} | [
"Returns",
"the",
"locals",
"object",
"for",
"compiling",
"item",
"templates",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/autocomplete/js/autocompleteController.js#L667-L678 |
5,015 | angular/material | src/components/autocomplete/js/autocompleteController.js | isSearchable | function isSearchable() {
if (ctrl.loading && !hasMatches()) {
// No query when query is in progress.
return false;
} else if (hasSelection()) {
// No query if there is already a selection
return false;
}
else if (!hasFocus) {
// No query if the input does not have focus
... | javascript | function isSearchable() {
if (ctrl.loading && !hasMatches()) {
// No query when query is in progress.
return false;
} else if (hasSelection()) {
// No query if there is already a selection
return false;
}
else if (!hasFocus) {
// No query if the input does not have focus
... | [
"function",
"isSearchable",
"(",
")",
"{",
"if",
"(",
"ctrl",
".",
"loading",
"&&",
"!",
"hasMatches",
"(",
")",
")",
"{",
"// No query when query is in progress.",
"return",
"false",
";",
"}",
"else",
"if",
"(",
"hasSelection",
"(",
")",
")",
"{",
"// No ... | Determines whether the autocomplete is able to query within the current state.
@returns {boolean} true if the query can be run | [
"Determines",
"whether",
"the",
"autocomplete",
"is",
"able",
"to",
"query",
"within",
"the",
"current",
"state",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/autocomplete/js/autocompleteController.js#L713-L726 |
5,016 | angular/material | src/components/autocomplete/js/autocompleteController.js | select | function select (index) {
// force form to update state for validation
$mdUtil.nextTick(function () {
getDisplayValue(ctrl.matches[ index ]).then(function (val) {
var ngModel = elements.$.input.controller('ngModel');
$mdLiveAnnouncer.announce(val + ' ' + ctrl.selectedMessage, 'assertive');... | javascript | function select (index) {
// force form to update state for validation
$mdUtil.nextTick(function () {
getDisplayValue(ctrl.matches[ index ]).then(function (val) {
var ngModel = elements.$.input.controller('ngModel');
$mdLiveAnnouncer.announce(val + ' ' + ctrl.selectedMessage, 'assertive');... | [
"function",
"select",
"(",
"index",
")",
"{",
"// force form to update state for validation",
"$mdUtil",
".",
"nextTick",
"(",
"function",
"(",
")",
"{",
"getDisplayValue",
"(",
"ctrl",
".",
"matches",
"[",
"index",
"]",
")",
".",
"then",
"(",
"function",
"(",... | Selects the item at the given index.
@param {number} index to select | [
"Selects",
"the",
"item",
"at",
"the",
"given",
"index",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/autocomplete/js/autocompleteController.js#L819-L832 |
5,017 | angular/material | src/components/autocomplete/js/autocompleteController.js | reportMessages | function reportMessages(isPolite, types) {
var politeness = isPolite ? 'polite' : 'assertive';
var messages = [];
if (types & ReportType.Selected && ctrl.index !== -1) {
messages.push(getCurrentDisplayValue());
}
if (types & ReportType.Count) {
messages.push($q.resolve(getCountMessage(... | javascript | function reportMessages(isPolite, types) {
var politeness = isPolite ? 'polite' : 'assertive';
var messages = [];
if (types & ReportType.Selected && ctrl.index !== -1) {
messages.push(getCurrentDisplayValue());
}
if (types & ReportType.Count) {
messages.push($q.resolve(getCountMessage(... | [
"function",
"reportMessages",
"(",
"isPolite",
",",
"types",
")",
"{",
"var",
"politeness",
"=",
"isPolite",
"?",
"'polite'",
":",
"'assertive'",
";",
"var",
"messages",
"=",
"[",
"]",
";",
"if",
"(",
"types",
"&",
"ReportType",
".",
"Selected",
"&&",
"c... | Reports given message types to supported screen readers.
@param {boolean} isPolite Whether the announcement should be polite.
@param {!number} types Message flags to be reported to the screen reader. | [
"Reports",
"given",
"message",
"types",
"to",
"supported",
"screen",
"readers",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/autocomplete/js/autocompleteController.js#L928-L943 |
5,018 | angular/material | src/components/autocomplete/js/autocompleteController.js | handleQuery | function handleQuery () {
var searchText = $scope.searchText || '';
var term = searchText.toLowerCase();
// If caching is enabled and the current searchText is stored in the cache
if (!$scope.noCache && cache[term]) {
// The results should be handled as same as a normal un-cached request does.
... | javascript | function handleQuery () {
var searchText = $scope.searchText || '';
var term = searchText.toLowerCase();
// If caching is enabled and the current searchText is stored in the cache
if (!$scope.noCache && cache[term]) {
// The results should be handled as same as a normal un-cached request does.
... | [
"function",
"handleQuery",
"(",
")",
"{",
"var",
"searchText",
"=",
"$scope",
".",
"searchText",
"||",
"''",
";",
"var",
"term",
"=",
"searchText",
".",
"toLowerCase",
"(",
")",
";",
"// If caching is enabled and the current searchText is stored in the cache",
"if",
... | Starts the query to gather the results for the current searchText. Attempts to return cached
results first, then forwards the process to `fetchResults` if necessary. | [
"Starts",
"the",
"query",
"to",
"gather",
"the",
"results",
"for",
"the",
"current",
"searchText",
".",
"Attempts",
"to",
"return",
"cached",
"results",
"first",
"then",
"forwards",
"the",
"process",
"to",
"fetchResults",
"if",
"necessary",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/autocomplete/js/autocompleteController.js#L1023-L1036 |
5,019 | angular/material | src/components/datepicker/js/datepickerDirective.spec.js | createDatepickerInstance | function createDatepickerInstance(template) {
var outputElement = $compile(template)(pageScope);
pageScope.$apply();
ngElement = outputElement[0].tagName == 'MD-DATEPICKER' ?
outputElement : outputElement.find('md-datepicker');
element = ngElement[0];
scope = ngElement.isolateScope();
c... | javascript | function createDatepickerInstance(template) {
var outputElement = $compile(template)(pageScope);
pageScope.$apply();
ngElement = outputElement[0].tagName == 'MD-DATEPICKER' ?
outputElement : outputElement.find('md-datepicker');
element = ngElement[0];
scope = ngElement.isolateScope();
c... | [
"function",
"createDatepickerInstance",
"(",
"template",
")",
"{",
"var",
"outputElement",
"=",
"$compile",
"(",
"template",
")",
"(",
"pageScope",
")",
";",
"pageScope",
".",
"$apply",
"(",
")",
";",
"ngElement",
"=",
"outputElement",
"[",
"0",
"]",
".",
... | Compile and link the given template and store values for element, scope, and controller.
@param {string} template
@returns {angular.JQLite} The root compiled element. | [
"Compile",
"and",
"link",
"the",
"given",
"template",
"and",
"store",
"values",
"for",
"element",
"scope",
"and",
"controller",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/datepicker/js/datepickerDirective.spec.js#L58-L69 |
5,020 | angular/material | gulp/util.js | buildJs | function buildJs() {
const jsFiles = config.jsCoreFiles;
config.componentPaths.forEach(component => {
jsFiles.push(path.join(component, '*.js'));
jsFiles.push(path.join(component, '**/*.js'));
});
gutil.log("building js files...");
const jsBuildStream = gulp.src(jsFiles)
.pipe(filterNonCodeFiles()... | javascript | function buildJs() {
const jsFiles = config.jsCoreFiles;
config.componentPaths.forEach(component => {
jsFiles.push(path.join(component, '*.js'));
jsFiles.push(path.join(component, '**/*.js'));
});
gutil.log("building js files...");
const jsBuildStream = gulp.src(jsFiles)
.pipe(filterNonCodeFiles()... | [
"function",
"buildJs",
"(",
")",
"{",
"const",
"jsFiles",
"=",
"config",
".",
"jsCoreFiles",
";",
"config",
".",
"componentPaths",
".",
"forEach",
"(",
"component",
"=>",
"{",
"jsFiles",
".",
"push",
"(",
"path",
".",
"join",
"(",
"component",
",",
"'*.j... | Builds the entire component library javascript. | [
"Builds",
"the",
"entire",
"component",
"library",
"javascript",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/gulp/util.js#L43-L76 |
5,021 | angular/material | gulp/util.js | deployMaterialMocks | function deployMaterialMocks() {
return gulp.src(config.mockFiles)
.pipe(gulp.dest(config.outputDir));
} | javascript | function deployMaterialMocks() {
return gulp.src(config.mockFiles)
.pipe(gulp.dest(config.outputDir));
} | [
"function",
"deployMaterialMocks",
"(",
")",
"{",
"return",
"gulp",
".",
"src",
"(",
"config",
".",
"mockFiles",
")",
".",
"pipe",
"(",
"gulp",
".",
"dest",
"(",
"config",
".",
"outputDir",
")",
")",
";",
"}"
] | Deploy the `angular-material-mocks.js` file to the `dist` directory | [
"Deploy",
"the",
"angular",
"-",
"material",
"-",
"mocks",
".",
"js",
"file",
"to",
"the",
"dist",
"directory"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/gulp/util.js#L72-L75 |
5,022 | angular/material | gulp/util.js | themeBuildStream | function themeBuildStream() {
// Make a copy so that we don't modify the actual config that is used by other functions
var paths = config.themeBaseFiles.slice(0);
config.componentPaths.forEach(component => paths.push(path.join(component, '*-theme.scss')));
paths.push(config.themeCore);
return gulp.src(paths)... | javascript | function themeBuildStream() {
// Make a copy so that we don't modify the actual config that is used by other functions
var paths = config.themeBaseFiles.slice(0);
config.componentPaths.forEach(component => paths.push(path.join(component, '*-theme.scss')));
paths.push(config.themeCore);
return gulp.src(paths)... | [
"function",
"themeBuildStream",
"(",
")",
"{",
"// Make a copy so that we don't modify the actual config that is used by other functions",
"var",
"paths",
"=",
"config",
".",
"themeBaseFiles",
".",
"slice",
"(",
"0",
")",
";",
"config",
".",
"componentPaths",
".",
"forEac... | builds the theming related css and provides it as a JS const for angular | [
"builds",
"the",
"theming",
"related",
"css",
"and",
"provides",
"it",
"as",
"a",
"JS",
"const",
"for",
"angular"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/gulp/util.js#L235-L249 |
5,023 | angular/material | gulp/util.js | dedupeCss | function dedupeCss() {
const prefixRegex = /-(webkit|moz|ms|o)-.+/;
return insert.transform(function(contents) {
// Parse the CSS into an AST.
const parsed = postcss.parse(contents);
// Walk through all the rules, skipping comments, media queries etc.
parsed.walk(function(rule) {
// Skip ove... | javascript | function dedupeCss() {
const prefixRegex = /-(webkit|moz|ms|o)-.+/;
return insert.transform(function(contents) {
// Parse the CSS into an AST.
const parsed = postcss.parse(contents);
// Walk through all the rules, skipping comments, media queries etc.
parsed.walk(function(rule) {
// Skip ove... | [
"function",
"dedupeCss",
"(",
")",
"{",
"const",
"prefixRegex",
"=",
"/",
"-(webkit|moz|ms|o)-.+",
"/",
";",
"return",
"insert",
".",
"transform",
"(",
"function",
"(",
"contents",
")",
"{",
"// Parse the CSS into an AST.",
"const",
"parsed",
"=",
"postcss",
"."... | Removes duplicated CSS properties. | [
"Removes",
"duplicated",
"CSS",
"properties",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/gulp/util.js#L252-L294 |
5,024 | angular/material | gulp/util.js | validateProp | function validateProp(prop) {
return prop && prop.type === 'decl' && ![prop.prop, prop.value].some(function(value) {
return value.indexOf('-') > -1 && prefixRegex.test(value);
});
} | javascript | function validateProp(prop) {
return prop && prop.type === 'decl' && ![prop.prop, prop.value].some(function(value) {
return value.indexOf('-') > -1 && prefixRegex.test(value);
});
} | [
"function",
"validateProp",
"(",
"prop",
")",
"{",
"return",
"prop",
"&&",
"prop",
".",
"type",
"===",
"'decl'",
"&&",
"!",
"[",
"prop",
".",
"prop",
",",
"prop",
".",
"value",
"]",
".",
"some",
"(",
"function",
"(",
"value",
")",
"{",
"return",
"v... | Checks if a property is a style declaration and that it doesn't contain any vendor prefixes. | [
"Checks",
"if",
"a",
"property",
"is",
"a",
"style",
"declaration",
"and",
"that",
"it",
"doesn",
"t",
"contain",
"any",
"vendor",
"prefixes",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/gulp/util.js#L289-L293 |
5,025 | angular/material | src/core/util/iterator.js | add | function add(item, index) {
if (!item) return -1;
if (!angular.isNumber(index)) {
index = _items.length;
}
_items.splice(index, 0, item);
return indexOf(item);
} | javascript | function add(item, index) {
if (!item) return -1;
if (!angular.isNumber(index)) {
index = _items.length;
}
_items.splice(index, 0, item);
return indexOf(item);
} | [
"function",
"add",
"(",
"item",
",",
"index",
")",
"{",
"if",
"(",
"!",
"item",
")",
"return",
"-",
"1",
";",
"if",
"(",
"!",
"angular",
".",
"isNumber",
"(",
"index",
")",
")",
"{",
"index",
"=",
"_items",
".",
"length",
";",
"}",
"_items",
".... | Add item to list
@param item
@param index
@returns {*} | [
"Add",
"item",
"to",
"list"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/util/iterator.js#L134-L144 |
5,026 | angular/material | src/core/util/iterator.js | findSubsequentItem | function findSubsequentItem(backwards, item, validate, limit) {
validate = validate || trueFn;
var curIndex = indexOf(item);
while (true) {
if (!inRange(curIndex)) return null;
var nextIndex = curIndex + (backwards ? -1 : 1);
var foundItem = null;
if (inRange(nextInde... | javascript | function findSubsequentItem(backwards, item, validate, limit) {
validate = validate || trueFn;
var curIndex = indexOf(item);
while (true) {
if (!inRange(curIndex)) return null;
var nextIndex = curIndex + (backwards ? -1 : 1);
var foundItem = null;
if (inRange(nextInde... | [
"function",
"findSubsequentItem",
"(",
"backwards",
",",
"item",
",",
"validate",
",",
"limit",
")",
"{",
"validate",
"=",
"validate",
"||",
"trueFn",
";",
"var",
"curIndex",
"=",
"indexOf",
"(",
"item",
")",
";",
"while",
"(",
"true",
")",
"{",
"if",
... | Find the next item. If reloop is true and at the end of the list, it will go back to the
first item. If given, the `validate` callback will be used to determine whether the next item
is valid. If not valid, it will try to find the next item again.
@param {boolean} backwards Specifies the direction of searching (forwar... | [
"Find",
"the",
"next",
"item",
".",
"If",
"reloop",
"is",
"true",
"and",
"at",
"the",
"end",
"of",
"the",
"list",
"it",
"will",
"go",
"back",
"to",
"the",
"first",
"item",
".",
"If",
"given",
"the",
"validate",
"callback",
"will",
"be",
"used",
"to",... | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/util/iterator.js#L202-L225 |
5,027 | angular/material | src/components/select/select.js | preLink | function preLink(scope, element, attr, ctrls) {
var selectCtrl = ctrls[0];
element.addClass('_md'); // private md component indicator for styling
$mdTheming(element);
element.on('click', clickListener);
element.on('keypress', keyListener);
function keyListener(e) {
if (e.keyCode == ... | javascript | function preLink(scope, element, attr, ctrls) {
var selectCtrl = ctrls[0];
element.addClass('_md'); // private md component indicator for styling
$mdTheming(element);
element.on('click', clickListener);
element.on('keypress', keyListener);
function keyListener(e) {
if (e.keyCode == ... | [
"function",
"preLink",
"(",
"scope",
",",
"element",
",",
"attr",
",",
"ctrls",
")",
"{",
"var",
"selectCtrl",
"=",
"ctrls",
"[",
"0",
"]",
";",
"element",
".",
"addClass",
"(",
"'_md'",
")",
";",
"// private md component indicator for styling",
"$mdTheming",
... | We use preLink instead of postLink to ensure that the select is initialized before its child options run postLink. | [
"We",
"use",
"preLink",
"instead",
"of",
"postLink",
"to",
"ensure",
"that",
"the",
"select",
"is",
"initialized",
"before",
"its",
"child",
"options",
"run",
"postLink",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/select/select.js#L600-L643 |
5,028 | angular/material | src/components/select/select.js | cleanElement | function cleanElement() {
destroyListener();
element
.removeClass('md-active')
.attr('aria-hidden', 'true')
.css({
'display': 'none',
'top': '',
'right': '',
'bottom': '',
'left': '',
'font-size': '',
... | javascript | function cleanElement() {
destroyListener();
element
.removeClass('md-active')
.attr('aria-hidden', 'true')
.css({
'display': 'none',
'top': '',
'right': '',
'bottom': '',
'left': '',
'font-size': '',
... | [
"function",
"cleanElement",
"(",
")",
"{",
"destroyListener",
"(",
")",
";",
"element",
".",
"removeClass",
"(",
"'md-active'",
")",
".",
"attr",
"(",
"'aria-hidden'",
",",
"'true'",
")",
".",
"css",
"(",
"{",
"'display'",
":",
"'none'",
",",
"'top'",
":... | Restore the element to a closed state | [
"Restore",
"the",
"element",
"to",
"a",
"closed",
"state"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/select/select.js#L1254-L1276 |
5,029 | angular/material | src/components/select/select.js | mouseOnScrollbar | function mouseOnScrollbar() {
var clickOnScrollbar = false;
if (ev && (ev.currentTarget.children.length > 0)) {
var child = ev.currentTarget.children[0];
var hasScrollbar = child.scrollHeight > child.clientHeight;
if (hasScrollbar && child.children.lengt... | javascript | function mouseOnScrollbar() {
var clickOnScrollbar = false;
if (ev && (ev.currentTarget.children.length > 0)) {
var child = ev.currentTarget.children[0];
var hasScrollbar = child.scrollHeight > child.clientHeight;
if (hasScrollbar && child.children.lengt... | [
"function",
"mouseOnScrollbar",
"(",
")",
"{",
"var",
"clickOnScrollbar",
"=",
"false",
";",
"if",
"(",
"ev",
"&&",
"(",
"ev",
".",
"currentTarget",
".",
"children",
".",
"length",
">",
"0",
")",
")",
"{",
"var",
"child",
"=",
"ev",
".",
"currentTarget... | check if the mouseup event was on a scrollbar | [
"check",
"if",
"the",
"mouseup",
"event",
"was",
"on",
"a",
"scrollbar"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/select/select.js#L1593-L1605 |
5,030 | angular/material | src/core/services/gesture/gesture.js | register | function register(element, handlerName, options) {
var handler = HANDLERS[handlerName.replace(/^\$md./, '')];
if (!handler) {
throw new Error('Failed to register element with handler ' + handlerName + '. ' +
'Available handlers: ' + Object.keys(HANDLERS).join(', '));
}
return handler.registe... | javascript | function register(element, handlerName, options) {
var handler = HANDLERS[handlerName.replace(/^\$md./, '')];
if (!handler) {
throw new Error('Failed to register element with handler ' + handlerName + '. ' +
'Available handlers: ' + Object.keys(HANDLERS).join(', '));
}
return handler.registe... | [
"function",
"register",
"(",
"element",
",",
"handlerName",
",",
"options",
")",
"{",
"var",
"handler",
"=",
"HANDLERS",
"[",
"handlerName",
".",
"replace",
"(",
"/",
"^\\$md.",
"/",
",",
"''",
")",
"]",
";",
"if",
"(",
"!",
"handler",
")",
"{",
"thr... | Register an element to listen for a handler.
This allows an element to override the default options for a handler.
Additionally, some handlers like drag and hold only dispatch events if
the domEvent happens inside an element that's registered to listen for these events.
@see GestureHandler for how overriding of defaul... | [
"Register",
"an",
"element",
"to",
"listen",
"for",
"a",
"handler",
".",
"This",
"allows",
"an",
"element",
"to",
"override",
"the",
"default",
"options",
"for",
"a",
"handler",
".",
"Additionally",
"some",
"handlers",
"like",
"drag",
"and",
"hold",
"only",
... | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/gesture/gesture.js#L179-L186 |
5,031 | angular/material | src/core/services/gesture/gesture.js | function (ev, pointer) {
if (this.state.isRunning) return;
var parentTarget = this.getNearestParent(ev.target);
// Get the options from the nearest registered parent
var parentTargetOptions = parentTarget && parentTarget.$mdGesture[this.name] || {};
this.state = {
isRunning: true,... | javascript | function (ev, pointer) {
if (this.state.isRunning) return;
var parentTarget = this.getNearestParent(ev.target);
// Get the options from the nearest registered parent
var parentTargetOptions = parentTarget && parentTarget.$mdGesture[this.name] || {};
this.state = {
isRunning: true,... | [
"function",
"(",
"ev",
",",
"pointer",
")",
"{",
"if",
"(",
"this",
".",
"state",
".",
"isRunning",
")",
"return",
";",
"var",
"parentTarget",
"=",
"this",
".",
"getNearestParent",
"(",
"ev",
".",
"target",
")",
";",
"// Get the options from the nearest regi... | onStart sets up a new state for the handler, which includes options from the nearest registered parent element of ev.target. | [
"onStart",
"sets",
"up",
"a",
"new",
"state",
"for",
"the",
"handler",
"which",
"includes",
"options",
"from",
"the",
"nearest",
"registered",
"parent",
"element",
"of",
"ev",
".",
"target",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/gesture/gesture.js#L414-L428 | |
5,032 | angular/material | src/core/services/gesture/gesture.js | isInputEventFromLabelClick | function isInputEventFromLabelClick(event) {
return lastLabelClickPos
&& lastLabelClickPos.x == event.x
&& lastLabelClickPos.y == event.y;
} | javascript | function isInputEventFromLabelClick(event) {
return lastLabelClickPos
&& lastLabelClickPos.x == event.x
&& lastLabelClickPos.y == event.y;
} | [
"function",
"isInputEventFromLabelClick",
"(",
"event",
")",
"{",
"return",
"lastLabelClickPos",
"&&",
"lastLabelClickPos",
".",
"x",
"==",
"event",
".",
"x",
"&&",
"lastLabelClickPos",
".",
"y",
"==",
"event",
".",
"y",
";",
"}"
] | Gets whether the given event is an input event that was caused by clicking on an
associated label element.
This is necessary because the browser will, upon clicking on a label element, fire an
*extra* click event on its associated input (if any). mdGesture is able to flag the label
click as with `$material` correctly,... | [
"Gets",
"whether",
"the",
"given",
"event",
"is",
"an",
"input",
"event",
"that",
"was",
"caused",
"by",
"clicking",
"on",
"an",
"associated",
"label",
"element",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/gesture/gesture.js#L741-L745 |
5,033 | angular/material | src/core/services/gesture/gesture.js | getEventPoint | function getEventPoint(ev) {
ev = ev.originalEvent || ev; // support jQuery events
return (ev.touches && ev.touches[0]) ||
(ev.changedTouches && ev.changedTouches[0]) ||
ev;
} | javascript | function getEventPoint(ev) {
ev = ev.originalEvent || ev; // support jQuery events
return (ev.touches && ev.touches[0]) ||
(ev.changedTouches && ev.changedTouches[0]) ||
ev;
} | [
"function",
"getEventPoint",
"(",
"ev",
")",
"{",
"ev",
"=",
"ev",
".",
"originalEvent",
"||",
"ev",
";",
"// support jQuery events",
"return",
"(",
"ev",
".",
"touches",
"&&",
"ev",
".",
"touches",
"[",
"0",
"]",
")",
"||",
"(",
"ev",
".",
"changedTou... | Normalize the point where the DOM event happened whether it's touch or mouse.
@returns point event obj with pageX and pageY on it. | [
"Normalize",
"the",
"point",
"where",
"the",
"DOM",
"event",
"happened",
"whether",
"it",
"s",
"touch",
"or",
"mouse",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/gesture/gesture.js#L774-L779 |
5,034 | angular/material | src/core/services/gesture/gesture.js | canFocus | function canFocus(element) {
return (
!!element &&
element.getAttribute('tabindex') !== '-1' &&
!element.hasAttribute('disabled') &&
(
element.hasAttribute('tabindex') ||
element.hasAttribute('href') ||
element.isContentEditable ||
['INPUT', 'SELECT', 'BUTTON', 'TEXTAREA', 'VID... | javascript | function canFocus(element) {
return (
!!element &&
element.getAttribute('tabindex') !== '-1' &&
!element.hasAttribute('disabled') &&
(
element.hasAttribute('tabindex') ||
element.hasAttribute('href') ||
element.isContentEditable ||
['INPUT', 'SELECT', 'BUTTON', 'TEXTAREA', 'VID... | [
"function",
"canFocus",
"(",
"element",
")",
"{",
"return",
"(",
"!",
"!",
"element",
"&&",
"element",
".",
"getAttribute",
"(",
"'tabindex'",
")",
"!==",
"'-1'",
"&&",
"!",
"element",
".",
"hasAttribute",
"(",
"'disabled'",
")",
"&&",
"(",
"element",
".... | Checks whether an element can be focused. | [
"Checks",
"whether",
"an",
"element",
"can",
"be",
"focused",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/gesture/gesture.js#L782-L794 |
5,035 | angular/material | docs/app/js/demoInclude.js | handleDemoIndexFile | function handleDemoIndexFile() {
files.index.contentsPromise.then(function(contents) {
demoContainer = angular.element(
'<div class="demo-content ' + ngModule + '">'
);
var isStandalone = !!ngModule;
var demoScope;
var demoCompileService;
if (isStandalone... | javascript | function handleDemoIndexFile() {
files.index.contentsPromise.then(function(contents) {
demoContainer = angular.element(
'<div class="demo-content ' + ngModule + '">'
);
var isStandalone = !!ngModule;
var demoScope;
var demoCompileService;
if (isStandalone... | [
"function",
"handleDemoIndexFile",
"(",
")",
"{",
"files",
".",
"index",
".",
"contentsPromise",
".",
"then",
"(",
"function",
"(",
"contents",
")",
"{",
"demoContainer",
"=",
"angular",
".",
"element",
"(",
"'<div class=\"demo-content '",
"+",
"ngModule",
"+",
... | Fetch the index file, and if it contains its own ngModule
then bootstrap a new angular app with that ngModule. Otherwise, compile
the demo into the current ng-app. | [
"Fetch",
"the",
"index",
"file",
"and",
"if",
"it",
"contains",
"its",
"own",
"ngModule",
"then",
"bootstrap",
"a",
"new",
"angular",
"app",
"with",
"that",
"ngModule",
".",
"Otherwise",
"compile",
"the",
"demo",
"into",
"the",
"current",
"ng",
"-",
"app",... | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/docs/app/js/demoInclude.js#L25-L60 |
5,036 | angular/material | docs/app/js/demoInclude.js | handleDemoStyles | function handleDemoStyles() {
return $q.all(files.css.map(function(file) {
return file.contentsPromise;
}))
.then(function(styles) {
styles = styles.join('\n'); // join styles as one string
var styleElement = angular.element('<style>' + styles + '</style>');
document.b... | javascript | function handleDemoStyles() {
return $q.all(files.css.map(function(file) {
return file.contentsPromise;
}))
.then(function(styles) {
styles = styles.join('\n'); // join styles as one string
var styleElement = angular.element('<style>' + styles + '</style>');
document.b... | [
"function",
"handleDemoStyles",
"(",
")",
"{",
"return",
"$q",
".",
"all",
"(",
"files",
".",
"css",
".",
"map",
"(",
"function",
"(",
"file",
")",
"{",
"return",
"file",
".",
"contentsPromise",
";",
"}",
")",
")",
".",
"then",
"(",
"function",
"(",
... | Fetch the demo styles, and append them to the DOM. | [
"Fetch",
"the",
"demo",
"styles",
"and",
"append",
"them",
"to",
"the",
"DOM",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/docs/app/js/demoInclude.js#L66-L81 |
5,037 | angular/material | docs/app/js/demoInclude.js | handleDemoTemplates | function handleDemoTemplates() {
return $q.all(files.html.map(function(file) {
return file.contentsPromise.then(function(contents) {
// Get the $templateCache instance that goes with the demo's specific ng-app.
var demoTemplateCache = demoContainer.injector().get('$templateCache');
... | javascript | function handleDemoTemplates() {
return $q.all(files.html.map(function(file) {
return file.contentsPromise.then(function(contents) {
// Get the $templateCache instance that goes with the demo's specific ng-app.
var demoTemplateCache = demoContainer.injector().get('$templateCache');
... | [
"function",
"handleDemoTemplates",
"(",
")",
"{",
"return",
"$q",
".",
"all",
"(",
"files",
".",
"html",
".",
"map",
"(",
"function",
"(",
"file",
")",
"{",
"return",
"file",
".",
"contentsPromise",
".",
"then",
"(",
"function",
"(",
"contents",
")",
"... | Fetch the templates for this demo, and put the templates into
the demo app's templateCache, with a url that allows the demo apps
to reference their templates local to the demo index file.
For example, make it so the dialog demo can reference templateUrl
'my-dialog.tmpl.html' instead of having to reference the url
'gen... | [
"Fetch",
"the",
"templates",
"for",
"this",
"demo",
"and",
"put",
"the",
"templates",
"into",
"the",
"demo",
"app",
"s",
"templateCache",
"with",
"a",
"url",
"that",
"allows",
"the",
"demo",
"apps",
"to",
"reference",
"their",
"templates",
"local",
"to",
"... | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/docs/app/js/demoInclude.js#L92-L108 |
5,038 | angular/material | src/components/sidenav/sidenav.js | findInstance | function findInstance(handle, shouldWait) {
var instance = $mdComponentRegistry.get(handle);
if (!instance && !shouldWait) {
// Report missing instance
$log.error($mdUtil.supplant(errorMsg, [handle || ""]));
// The component has not registered itself... most like NOT yet created
// ret... | javascript | function findInstance(handle, shouldWait) {
var instance = $mdComponentRegistry.get(handle);
if (!instance && !shouldWait) {
// Report missing instance
$log.error($mdUtil.supplant(errorMsg, [handle || ""]));
// The component has not registered itself... most like NOT yet created
// ret... | [
"function",
"findInstance",
"(",
"handle",
",",
"shouldWait",
")",
"{",
"var",
"instance",
"=",
"$mdComponentRegistry",
".",
"get",
"(",
"handle",
")",
";",
"if",
"(",
"!",
"instance",
"&&",
"!",
"shouldWait",
")",
"{",
"// Report missing instance",
"$log",
... | Synchronously lookup the controller instance for the specified sidNav instance which has been
registered with the markup `md-component-id` | [
"Synchronously",
"lookup",
"the",
"controller",
"instance",
"for",
"the",
"specified",
"sidNav",
"instance",
"which",
"has",
"been",
"registered",
"with",
"the",
"markup",
"md",
"-",
"component",
"-",
"id"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/sidenav/sidenav.js#L131-L143 |
5,039 | angular/material | src/components/sidenav/sidenav.js | toggleOpen | function toggleOpen(isOpen) {
if (scope.isOpen === isOpen) {
return $q.when(true);
} else {
if (scope.isOpen && sidenavCtrl.onCloseCb) sidenavCtrl.onCloseCb();
return $q(function(resolve) {
// Toggle value to force an async `updateIsOpen()` to run
scope.isOpen = ... | javascript | function toggleOpen(isOpen) {
if (scope.isOpen === isOpen) {
return $q.when(true);
} else {
if (scope.isOpen && sidenavCtrl.onCloseCb) sidenavCtrl.onCloseCb();
return $q(function(resolve) {
// Toggle value to force an async `updateIsOpen()` to run
scope.isOpen = ... | [
"function",
"toggleOpen",
"(",
"isOpen",
")",
"{",
"if",
"(",
"scope",
".",
"isOpen",
"===",
"isOpen",
")",
"{",
"return",
"$q",
".",
"when",
"(",
"true",
")",
";",
"}",
"else",
"{",
"if",
"(",
"scope",
".",
"isOpen",
"&&",
"sidenavCtrl",
".",
"onC... | Toggle the sideNav view and publish a promise to be resolved when
the view animation finishes.
@param {boolean} isOpen true to open the sidenav, false to close it
@returns {*} promise to be resolved when the view animation finishes | [
"Toggle",
"the",
"sideNav",
"view",
"and",
"publish",
"a",
"promise",
"to",
"be",
"resolved",
"when",
"the",
"view",
"animation",
"finishes",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/sidenav/sidenav.js#L474-L499 |
5,040 | angular/material | src/components/sidenav/sidenav.js | onKeyDown | function onKeyDown(ev) {
var isEscape = (ev.keyCode === $mdConstant.KEY_CODE.ESCAPE);
return isEscape ? close(ev) : $q.when(true);
} | javascript | function onKeyDown(ev) {
var isEscape = (ev.keyCode === $mdConstant.KEY_CODE.ESCAPE);
return isEscape ? close(ev) : $q.when(true);
} | [
"function",
"onKeyDown",
"(",
"ev",
")",
"{",
"var",
"isEscape",
"=",
"(",
"ev",
".",
"keyCode",
"===",
"$mdConstant",
".",
"KEY_CODE",
".",
"ESCAPE",
")",
";",
"return",
"isEscape",
"?",
"close",
"(",
"ev",
")",
":",
"$q",
".",
"when",
"(",
"true",
... | Auto-close sideNav when the `escape` key is pressed.
@param {KeyboardEvent} ev keydown event | [
"Auto",
"-",
"close",
"sideNav",
"when",
"the",
"escape",
"key",
"is",
"pressed",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/sidenav/sidenav.js#L505-L508 |
5,041 | angular/material | src/components/datepicker/js/calendarMonthBody.js | mdCalendarMonthBodyDirective | function mdCalendarMonthBodyDirective($compile, $$mdSvgRegistry) {
var ARROW_ICON = $compile('<md-icon md-svg-src="' +
$$mdSvgRegistry.mdTabsArrow + '"></md-icon>')({})[0];
return {
require: ['^^mdCalendar', '^^mdCalendarMonth', 'mdCalendarMonthBody'],
scope: { offset: '=mdMonthOffset' },
... | javascript | function mdCalendarMonthBodyDirective($compile, $$mdSvgRegistry) {
var ARROW_ICON = $compile('<md-icon md-svg-src="' +
$$mdSvgRegistry.mdTabsArrow + '"></md-icon>')({})[0];
return {
require: ['^^mdCalendar', '^^mdCalendarMonth', 'mdCalendarMonthBody'],
scope: { offset: '=mdMonthOffset' },
... | [
"function",
"mdCalendarMonthBodyDirective",
"(",
"$compile",
",",
"$$mdSvgRegistry",
")",
"{",
"var",
"ARROW_ICON",
"=",
"$compile",
"(",
"'<md-icon md-svg-src=\"'",
"+",
"$$mdSvgRegistry",
".",
"mdTabsArrow",
"+",
"'\"></md-icon>'",
")",
"(",
"{",
"}",
")",
"[",
... | Private directive consumed by md-calendar-month. Having this directive lets the calender use
md-virtual-repeat and also cleanly separates the month DOM construction functions from
the rest of the calendar controller logic.
@ngInject | [
"Private",
"directive",
"consumed",
"by",
"md",
"-",
"calendar",
"-",
"month",
".",
"Having",
"this",
"directive",
"lets",
"the",
"calender",
"use",
"md",
"-",
"virtual",
"-",
"repeat",
"and",
"also",
"cleanly",
"separates",
"the",
"month",
"DOM",
"construct... | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/datepicker/js/calendarMonthBody.js#L13-L43 |
5,042 | angular/material | src/components/datepicker/js/calendarMonthBody.js | CalendarMonthBodyCtrl | function CalendarMonthBodyCtrl($element, $$mdDateUtil, $mdDateLocale) {
/** @final {!angular.JQLite} */
this.$element = $element;
/** @final */
this.dateUtil = $$mdDateUtil;
/** @final */
this.dateLocale = $mdDateLocale;
/** @type {Object} Reference to the month view. */
this.monthCtr... | javascript | function CalendarMonthBodyCtrl($element, $$mdDateUtil, $mdDateLocale) {
/** @final {!angular.JQLite} */
this.$element = $element;
/** @final */
this.dateUtil = $$mdDateUtil;
/** @final */
this.dateLocale = $mdDateLocale;
/** @type {Object} Reference to the month view. */
this.monthCtr... | [
"function",
"CalendarMonthBodyCtrl",
"(",
"$element",
",",
"$$mdDateUtil",
",",
"$mdDateLocale",
")",
"{",
"/** @final {!angular.JQLite} */",
"this",
".",
"$element",
"=",
"$element",
";",
"/** @final */",
"this",
".",
"dateUtil",
"=",
"$$mdDateUtil",
";",
"/** @final... | Controller for a single calendar month.
@ngInject @constructor | [
"Controller",
"for",
"a",
"single",
"calendar",
"month",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/datepicker/js/calendarMonthBody.js#L49-L77 |
5,043 | angular/material | src/components/datepicker/js/calendarYearBody.js | mdCalendarYearDirective | function mdCalendarYearDirective() {
return {
require: ['^^mdCalendar', '^^mdCalendarYear', 'mdCalendarYearBody'],
scope: { offset: '=mdYearOffset' },
controller: CalendarYearBodyCtrl,
controllerAs: 'mdYearBodyCtrl',
bindToController: true,
link: function(scope, element, attrs, c... | javascript | function mdCalendarYearDirective() {
return {
require: ['^^mdCalendar', '^^mdCalendarYear', 'mdCalendarYearBody'],
scope: { offset: '=mdYearOffset' },
controller: CalendarYearBodyCtrl,
controllerAs: 'mdYearBodyCtrl',
bindToController: true,
link: function(scope, element, attrs, c... | [
"function",
"mdCalendarYearDirective",
"(",
")",
"{",
"return",
"{",
"require",
":",
"[",
"'^^mdCalendar'",
",",
"'^^mdCalendarYear'",
",",
"'mdCalendarYearBody'",
"]",
",",
"scope",
":",
"{",
"offset",
":",
"'=mdYearOffset'",
"}",
",",
"controller",
":",
"Calen... | Private component, consumed by the md-calendar-year, which separates the DOM construction logic
and allows for the year view to use md-virtual-repeat. | [
"Private",
"component",
"consumed",
"by",
"the",
"md",
"-",
"calendar",
"-",
"year",
"which",
"separates",
"the",
"DOM",
"construction",
"logic",
"and",
"allows",
"for",
"the",
"year",
"view",
"to",
"use",
"md",
"-",
"virtual",
"-",
"repeat",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/datepicker/js/calendarYearBody.js#L11-L33 |
5,044 | angular/material | src/components/datepicker/js/calendarYearBody.js | CalendarYearBodyCtrl | function CalendarYearBodyCtrl($element, $$mdDateUtil, $mdDateLocale) {
/** @final {!angular.JQLite} */
this.$element = $element;
/** @final */
this.dateUtil = $$mdDateUtil;
/** @final */
this.dateLocale = $mdDateLocale;
/** @type {Object} Reference to the calendar. */
this.calendarCtr... | javascript | function CalendarYearBodyCtrl($element, $$mdDateUtil, $mdDateLocale) {
/** @final {!angular.JQLite} */
this.$element = $element;
/** @final */
this.dateUtil = $$mdDateUtil;
/** @final */
this.dateLocale = $mdDateLocale;
/** @type {Object} Reference to the calendar. */
this.calendarCtr... | [
"function",
"CalendarYearBodyCtrl",
"(",
"$element",
",",
"$$mdDateUtil",
",",
"$mdDateLocale",
")",
"{",
"/** @final {!angular.JQLite} */",
"this",
".",
"$element",
"=",
"$element",
";",
"/** @final */",
"this",
".",
"dateUtil",
"=",
"$$mdDateUtil",
";",
"/** @final ... | Controller for a single year.
@ngInject @constructor | [
"Controller",
"for",
"a",
"single",
"year",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/datepicker/js/calendarYearBody.js#L39-L67 |
5,045 | angular/material | src/core/services/interimElement/interimElement.js | setDefaults | function setDefaults(definition) {
providerConfig.optionsFactory = definition.options;
providerConfig.methods = (definition.methods || []).concat(EXPOSED_METHODS);
return provider;
} | javascript | function setDefaults(definition) {
providerConfig.optionsFactory = definition.options;
providerConfig.methods = (definition.methods || []).concat(EXPOSED_METHODS);
return provider;
} | [
"function",
"setDefaults",
"(",
"definition",
")",
"{",
"providerConfig",
".",
"optionsFactory",
"=",
"definition",
".",
"options",
";",
"providerConfig",
".",
"methods",
"=",
"(",
"definition",
".",
"methods",
"||",
"[",
"]",
")",
".",
"concat",
"(",
"EXPOS... | Save the configured defaults to be used when the factory is instantiated | [
"Save",
"the",
"configured",
"defaults",
"to",
"be",
"used",
"when",
"the",
"factory",
"is",
"instantiated"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/interimElement/interimElement.js#L65-L69 |
5,046 | angular/material | src/core/services/interimElement/interimElement.js | addPreset | function addPreset(name, definition) {
definition = definition || {};
definition.methods = definition.methods || [];
definition.options = definition.options || function() { return {}; };
if (/^cancel|hide|show$/.test(name)) {
throw new Error("Preset '" + name + "' in " + interimFactoryN... | javascript | function addPreset(name, definition) {
definition = definition || {};
definition.methods = definition.methods || [];
definition.options = definition.options || function() { return {}; };
if (/^cancel|hide|show$/.test(name)) {
throw new Error("Preset '" + name + "' in " + interimFactoryN... | [
"function",
"addPreset",
"(",
"name",
",",
"definition",
")",
"{",
"definition",
"=",
"definition",
"||",
"{",
"}",
";",
"definition",
".",
"methods",
"=",
"definition",
".",
"methods",
"||",
"[",
"]",
";",
"definition",
".",
"options",
"=",
"definition",
... | Save the configured preset to be used when the factory is instantiated | [
"Save",
"the",
"configured",
"preset",
"to",
"be",
"used",
"when",
"the",
"factory",
"is",
"instantiated"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/interimElement/interimElement.js#L83-L100 |
5,047 | angular/material | src/core/services/interimElement/interimElement.js | waitForInterim | function waitForInterim(callbackFn) {
return function() {
var fnArguments = arguments;
if (!showingInterims.length) {
// When there are still interim's opening, then wait for the first interim element to
// finish its open animation.
if (showPromises.leng... | javascript | function waitForInterim(callbackFn) {
return function() {
var fnArguments = arguments;
if (!showingInterims.length) {
// When there are still interim's opening, then wait for the first interim element to
// finish its open animation.
if (showPromises.leng... | [
"function",
"waitForInterim",
"(",
"callbackFn",
")",
"{",
"return",
"function",
"(",
")",
"{",
"var",
"fnArguments",
"=",
"arguments",
";",
"if",
"(",
"!",
"showingInterims",
".",
"length",
")",
"{",
"// When there are still interim's opening, then wait for the first... | Creates a function to wait for at least one interim element to be available.
@param callbackFn Function to be used as callback
@returns {Function} | [
"Creates",
"a",
"function",
"to",
"wait",
"for",
"at",
"least",
"one",
"interim",
"element",
"to",
"be",
"available",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/interimElement/interimElement.js#L425-L443 |
5,048 | angular/material | src/core/services/interimElement/interimElement.js | createAndTransitionIn | function createAndTransitionIn() {
return $q(function(resolve, reject) {
// Trigger onCompiling callback before the compilation starts.
// This is useful, when modifying options, which can be influenced by developers.
options.onCompiling && options.onCompiling(options);
... | javascript | function createAndTransitionIn() {
return $q(function(resolve, reject) {
// Trigger onCompiling callback before the compilation starts.
// This is useful, when modifying options, which can be influenced by developers.
options.onCompiling && options.onCompiling(options);
... | [
"function",
"createAndTransitionIn",
"(",
")",
"{",
"return",
"$q",
"(",
"function",
"(",
"resolve",
",",
"reject",
")",
"{",
"// Trigger onCompiling callback before the compilation starts.",
"// This is useful, when modifying options, which can be influenced by developers.",
"opti... | Compile, link, and show this interim element
Use optional autoHided and transition-in effects | [
"Compile",
"link",
"and",
"show",
"this",
"interim",
"element",
"Use",
"optional",
"autoHided",
"and",
"transition",
"-",
"in",
"effects"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/interimElement/interimElement.js#L492-L518 |
5,049 | angular/material | src/core/services/interimElement/interimElement.js | compileElement | function compileElement(options) {
var compiled = !options.skipCompile ? $mdCompiler.compile(options) : null;
return compiled || $q(function (resolve) {
resolve({
locals: {},
link: function () {
return options.element;
... | javascript | function compileElement(options) {
var compiled = !options.skipCompile ? $mdCompiler.compile(options) : null;
return compiled || $q(function (resolve) {
resolve({
locals: {},
link: function () {
return options.element;
... | [
"function",
"compileElement",
"(",
"options",
")",
"{",
"var",
"compiled",
"=",
"!",
"options",
".",
"skipCompile",
"?",
"$mdCompiler",
".",
"compile",
"(",
"options",
")",
":",
"null",
";",
"return",
"compiled",
"||",
"$q",
"(",
"function",
"(",
"resolve"... | Compile an element with a templateUrl, controller, and locals | [
"Compile",
"an",
"element",
"with",
"a",
"templateUrl",
"controller",
"and",
"locals"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/interimElement/interimElement.js#L605-L617 |
5,050 | angular/material | src/core/services/interimElement/interimElement.js | linkElement | function linkElement(compileData, options){
angular.extend(compileData.locals, options);
var element = compileData.link(options.scope);
// Search for parent at insertion time, if not specified
options.element = element;
options.parent = findParent(element, options);
... | javascript | function linkElement(compileData, options){
angular.extend(compileData.locals, options);
var element = compileData.link(options.scope);
// Search for parent at insertion time, if not specified
options.element = element;
options.parent = findParent(element, options);
... | [
"function",
"linkElement",
"(",
"compileData",
",",
"options",
")",
"{",
"angular",
".",
"extend",
"(",
"compileData",
".",
"locals",
",",
"options",
")",
";",
"var",
"element",
"=",
"compileData",
".",
"link",
"(",
"options",
".",
"scope",
")",
";",
"//... | Link an element with compiled configuration | [
"Link",
"an",
"element",
"with",
"compiled",
"configuration"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/interimElement/interimElement.js#L622-L633 |
5,051 | angular/material | src/core/services/interimElement/interimElement.js | findParent | function findParent(element, options) {
var parent = options.parent;
// Search for parent at insertion time, if not specified
if (angular.isFunction(parent)) {
parent = parent(options.scope, element, options);
} else if (angular.isString(parent)) {
parent... | javascript | function findParent(element, options) {
var parent = options.parent;
// Search for parent at insertion time, if not specified
if (angular.isFunction(parent)) {
parent = parent(options.scope, element, options);
} else if (angular.isString(parent)) {
parent... | [
"function",
"findParent",
"(",
"element",
",",
"options",
")",
"{",
"var",
"parent",
"=",
"options",
".",
"parent",
";",
"// Search for parent at insertion time, if not specified",
"if",
"(",
"angular",
".",
"isFunction",
"(",
"parent",
")",
")",
"{",
"parent",
... | Search for parent at insertion time, if not specified | [
"Search",
"for",
"parent",
"at",
"insertion",
"time",
"if",
"not",
"specified"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/interimElement/interimElement.js#L638-L665 |
5,052 | angular/material | src/core/services/interimElement/interimElement.js | startAutoHide | function startAutoHide() {
var autoHideTimer, cancelAutoHide = angular.noop;
if (options.hideDelay) {
autoHideTimer = $timeout(service.hide, options.hideDelay) ;
cancelAutoHide = function() {
$timeout.cancel(autoHideTimer);
};
}
... | javascript | function startAutoHide() {
var autoHideTimer, cancelAutoHide = angular.noop;
if (options.hideDelay) {
autoHideTimer = $timeout(service.hide, options.hideDelay) ;
cancelAutoHide = function() {
$timeout.cancel(autoHideTimer);
};
}
... | [
"function",
"startAutoHide",
"(",
")",
"{",
"var",
"autoHideTimer",
",",
"cancelAutoHide",
"=",
"angular",
".",
"noop",
";",
"if",
"(",
"options",
".",
"hideDelay",
")",
"{",
"autoHideTimer",
"=",
"$timeout",
"(",
"service",
".",
"hide",
",",
"options",
".... | If auto-hide is enabled, start timer and prepare cancel function | [
"If",
"auto",
"-",
"hide",
"is",
"enabled",
"start",
"timer",
"and",
"prepare",
"cancel",
"function"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/interimElement/interimElement.js#L670-L685 |
5,053 | angular/material | src/components/radioButton/radio-button.js | changeSelectedButton | function changeSelectedButton(parent, increment) {
// Coerce all child radio buttons into an array, then wrap then in an iterator
var buttons = $mdUtil.iterator(parent[0].querySelectorAll('md-radio-button'), true);
if (buttons.count()) {
var validate = function (button) {
// If disabled, then... | javascript | function changeSelectedButton(parent, increment) {
// Coerce all child radio buttons into an array, then wrap then in an iterator
var buttons = $mdUtil.iterator(parent[0].querySelectorAll('md-radio-button'), true);
if (buttons.count()) {
var validate = function (button) {
// If disabled, then... | [
"function",
"changeSelectedButton",
"(",
"parent",
",",
"increment",
")",
"{",
"// Coerce all child radio buttons into an array, then wrap then in an iterator",
"var",
"buttons",
"=",
"$mdUtil",
".",
"iterator",
"(",
"parent",
"[",
"0",
"]",
".",
"querySelectorAll",
"(",
... | Change the radio group's selected button by a given increment.
If no button is selected, select the first button. | [
"Change",
"the",
"radio",
"group",
"s",
"selected",
"button",
"by",
"a",
"given",
"increment",
".",
"If",
"no",
"button",
"is",
"selected",
"select",
"the",
"first",
"button",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/radioButton/radio-button.js#L188-L204 |
5,054 | angular/material | src/components/radioButton/radio-button.js | initialize | function initialize() {
if (!rgCtrl) {
throw 'RadioButton: No RadioGroupController could be found.';
}
rgCtrl.add(render);
attr.$observe('value', render);
element
.on('click', listener)
.on('$destroy', function() {
rgCtrl.remove(render);
});
... | javascript | function initialize() {
if (!rgCtrl) {
throw 'RadioButton: No RadioGroupController could be found.';
}
rgCtrl.add(render);
attr.$observe('value', render);
element
.on('click', listener)
.on('$destroy', function() {
rgCtrl.remove(render);
});
... | [
"function",
"initialize",
"(",
")",
"{",
"if",
"(",
"!",
"rgCtrl",
")",
"{",
"throw",
"'RadioButton: No RadioGroupController could be found.'",
";",
"}",
"rgCtrl",
".",
"add",
"(",
"render",
")",
";",
"attr",
".",
"$observe",
"(",
"'value'",
",",
"render",
"... | Initializes the component. | [
"Initializes",
"the",
"component",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/radioButton/radio-button.js#L281-L294 |
5,055 | angular/material | src/components/radioButton/radio-button.js | listener | function listener(ev) {
if (element[0].hasAttribute('disabled') || rgCtrl.isDisabled()) return;
scope.$apply(function() {
rgCtrl.setViewValue(attr.value, ev && ev.type);
});
} | javascript | function listener(ev) {
if (element[0].hasAttribute('disabled') || rgCtrl.isDisabled()) return;
scope.$apply(function() {
rgCtrl.setViewValue(attr.value, ev && ev.type);
});
} | [
"function",
"listener",
"(",
"ev",
")",
"{",
"if",
"(",
"element",
"[",
"0",
"]",
".",
"hasAttribute",
"(",
"'disabled'",
")",
"||",
"rgCtrl",
".",
"isDisabled",
"(",
")",
")",
"return",
";",
"scope",
".",
"$apply",
"(",
"function",
"(",
")",
"{",
... | On click functionality. | [
"On",
"click",
"functionality",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/radioButton/radio-button.js#L299-L305 |
5,056 | angular/material | src/components/radioButton/radio-button.js | configureAria | function configureAria(element, scope){
element.attr({
id: attr.id || 'radio_' + $mdUtil.nextUid(),
role: 'radio',
'aria-checked': 'false'
});
$mdAria.expectWithText(element, 'aria-label');
} | javascript | function configureAria(element, scope){
element.attr({
id: attr.id || 'radio_' + $mdUtil.nextUid(),
role: 'radio',
'aria-checked': 'false'
});
$mdAria.expectWithText(element, 'aria-label');
} | [
"function",
"configureAria",
"(",
"element",
",",
"scope",
")",
"{",
"element",
".",
"attr",
"(",
"{",
"id",
":",
"attr",
".",
"id",
"||",
"'radio_'",
"+",
"$mdUtil",
".",
"nextUid",
"(",
")",
",",
"role",
":",
"'radio'",
",",
"'aria-checked'",
":",
... | Inject ARIA-specific attributes appropriate for each radio button | [
"Inject",
"ARIA",
"-",
"specific",
"attributes",
"appropriate",
"for",
"each",
"radio",
"button"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/radioButton/radio-button.js#L335-L343 |
5,057 | angular/material | src/components/icon/js/iconService.js | fontSet | function fontSet(alias, className) {
config.fontSets.push({
alias: alias,
fontSet: className || alias
});
return this;
} | javascript | function fontSet(alias, className) {
config.fontSets.push({
alias: alias,
fontSet: className || alias
});
return this;
} | [
"function",
"fontSet",
"(",
"alias",
",",
"className",
")",
"{",
"config",
".",
"fontSets",
".",
"push",
"(",
"{",
"alias",
":",
"alias",
",",
"fontSet",
":",
"className",
"||",
"alias",
"}",
")",
";",
"return",
"this",
";",
"}"
] | Register an alias name associated with a font-icon library style ; | [
"Register",
"an",
"alias",
"name",
"associated",
"with",
"a",
"font",
"-",
"icon",
"library",
"style",
";"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/icon/js/iconService.js#L322-L328 |
5,058 | angular/material | src/components/icon/js/iconService.js | findRegisteredFontSet | function findRegisteredFontSet(alias) {
var useDefault = angular.isUndefined(alias) || !(alias && alias.length);
if (useDefault) {
return config.defaultFontSet;
}
var result = alias;
angular.forEach(config.fontSets, function(fontSet) {
if (fontSet.alias === alias) {
result = fon... | javascript | function findRegisteredFontSet(alias) {
var useDefault = angular.isUndefined(alias) || !(alias && alias.length);
if (useDefault) {
return config.defaultFontSet;
}
var result = alias;
angular.forEach(config.fontSets, function(fontSet) {
if (fontSet.alias === alias) {
result = fon... | [
"function",
"findRegisteredFontSet",
"(",
"alias",
")",
"{",
"var",
"useDefault",
"=",
"angular",
".",
"isUndefined",
"(",
"alias",
")",
"||",
"!",
"(",
"alias",
"&&",
"alias",
".",
"length",
")",
";",
"if",
"(",
"useDefault",
")",
"{",
"return",
"config... | Lookup a registered fontSet style using its alias.
@param {string} alias used to lookup the alias in the array of fontSets
@returns {*} matching fontSet or the defaultFontSet if that alias does not match | [
"Lookup",
"a",
"registered",
"fontSet",
"style",
"using",
"its",
"alias",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/icon/js/iconService.js#L459-L473 |
5,059 | angular/material | src/components/icon/js/iconService.js | isIcon | function isIcon(target) {
return angular.isDefined(target.element) && angular.isDefined(target.config);
} | javascript | function isIcon(target) {
return angular.isDefined(target.element) && angular.isDefined(target.config);
} | [
"function",
"isIcon",
"(",
"target",
")",
"{",
"return",
"angular",
".",
"isDefined",
"(",
"target",
".",
"element",
")",
"&&",
"angular",
".",
"isDefined",
"(",
"target",
".",
"config",
")",
";",
"}"
] | Check target signature to see if it is an Icon instance.
@param {Icon|Element} target
@returns {boolean} true if the specified target is an Icon object, false otherwise. | [
"Check",
"target",
"signature",
"to",
"see",
"if",
"it",
"is",
"an",
"Icon",
"instance",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/icon/js/iconService.js#L668-L670 |
5,060 | angular/material | src/components/icon/js/iconService.js | Icon | function Icon(el, config) {
// If the node is a <symbol>, it won't be rendered so we have to convert it into <svg>.
if (el && el.tagName.toLowerCase() === 'symbol') {
var viewbox = el.getAttribute('viewBox');
// // Check if innerHTML is supported as IE11 does not support innerHTML on SVG elements.
... | javascript | function Icon(el, config) {
// If the node is a <symbol>, it won't be rendered so we have to convert it into <svg>.
if (el && el.tagName.toLowerCase() === 'symbol') {
var viewbox = el.getAttribute('viewBox');
// // Check if innerHTML is supported as IE11 does not support innerHTML on SVG elements.
... | [
"function",
"Icon",
"(",
"el",
",",
"config",
")",
"{",
"// If the node is a <symbol>, it won't be rendered so we have to convert it into <svg>.",
"if",
"(",
"el",
"&&",
"el",
".",
"tagName",
".",
"toLowerCase",
"(",
")",
"===",
"'symbol'",
")",
"{",
"var",
"viewbox... | Define the Icon class
@param {Element} el
@param {=ConfigurationItem} config
@constructor | [
"Define",
"the",
"Icon",
"class"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/icon/js/iconService.js#L678-L706 |
5,061 | angular/material | src/components/icon/js/iconService.js | prepareAndStyle | function prepareAndStyle() {
var viewBoxSize = this.config ? this.config.viewBoxSize : config.defaultViewBoxSize;
angular.forEach({
'fit': '',
'height': '100%',
'width': '100%',
'preserveAspectRatio': 'xMidYMid meet',
'viewBox': this.element.getAttribute('viewBox') || ('0 0 ' + vie... | javascript | function prepareAndStyle() {
var viewBoxSize = this.config ? this.config.viewBoxSize : config.defaultViewBoxSize;
angular.forEach({
'fit': '',
'height': '100%',
'width': '100%',
'preserveAspectRatio': 'xMidYMid meet',
'viewBox': this.element.getAttribute('viewBox') || ('0 0 ' + vie... | [
"function",
"prepareAndStyle",
"(",
")",
"{",
"var",
"viewBoxSize",
"=",
"this",
".",
"config",
"?",
"this",
".",
"config",
".",
"viewBoxSize",
":",
"config",
".",
"defaultViewBoxSize",
";",
"angular",
".",
"forEach",
"(",
"{",
"'fit'",
":",
"''",
",",
"... | Prepare the DOM element that will be cached in the
loaded iconCache store. | [
"Prepare",
"the",
"DOM",
"element",
"that",
"will",
"be",
"cached",
"in",
"the",
"loaded",
"iconCache",
"store",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/icon/js/iconService.js#L712-L724 |
5,062 | angular/material | src/components/gridList/grid-list.js | watchMedia | function watchMedia() {
for (var mediaName in $mdConstant.MEDIA) {
$mdMedia(mediaName); // initialize
$mdMedia.getQuery($mdConstant.MEDIA[mediaName])
.addListener(invalidateLayout);
}
return $mdMedia.watchResponsiveAttributes(
['md-cols', 'md-row-height', 'md-gutt... | javascript | function watchMedia() {
for (var mediaName in $mdConstant.MEDIA) {
$mdMedia(mediaName); // initialize
$mdMedia.getQuery($mdConstant.MEDIA[mediaName])
.addListener(invalidateLayout);
}
return $mdMedia.watchResponsiveAttributes(
['md-cols', 'md-row-height', 'md-gutt... | [
"function",
"watchMedia",
"(",
")",
"{",
"for",
"(",
"var",
"mediaName",
"in",
"$mdConstant",
".",
"MEDIA",
")",
"{",
"$mdMedia",
"(",
"mediaName",
")",
";",
"// initialize",
"$mdMedia",
".",
"getQuery",
"(",
"$mdConstant",
".",
"MEDIA",
"[",
"mediaName",
... | Watches for changes in media, invalidating layout as necessary. | [
"Watches",
"for",
"changes",
"in",
"media",
"invalidating",
"layout",
"as",
"necessary",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/gridList/grid-list.js#L122-L130 |
5,063 | angular/material | src/components/gridList/grid-list.js | layoutDelegate | function layoutDelegate(tilesInvalidated) {
var tiles = getTileElements();
var props = {
tileSpans: getTileSpans(tiles),
colCount: getColumnCount(),
rowMode: getRowMode(),
rowHeight: getRowHeight(),
gutter: getGutter()
};
if (!tilesInvalidated && angular.... | javascript | function layoutDelegate(tilesInvalidated) {
var tiles = getTileElements();
var props = {
tileSpans: getTileSpans(tiles),
colCount: getColumnCount(),
rowMode: getRowMode(),
rowHeight: getRowHeight(),
gutter: getGutter()
};
if (!tilesInvalidated && angular.... | [
"function",
"layoutDelegate",
"(",
"tilesInvalidated",
")",
"{",
"var",
"tiles",
"=",
"getTileElements",
"(",
")",
";",
"var",
"props",
"=",
"{",
"tileSpans",
":",
"getTileSpans",
"(",
"tiles",
")",
",",
"colCount",
":",
"getColumnCount",
"(",
")",
",",
"r... | Invokes the layout engine, and uses its results to lay out our
tile elements.
@param {boolean} tilesInvalidated Whether tiles have been
added/removed/moved since the last layout. This is to avoid situations
where tiles are replaced with properties identical to their removed
counterparts. | [
"Invokes",
"the",
"layout",
"engine",
"and",
"uses",
"its",
"results",
"to",
"lay",
"out",
"our",
"tile",
"elements",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/gridList/grid-list.js#L167-L211 |
5,064 | angular/material | src/components/gridList/grid-list.js | getTileStyle | function getTileStyle(position, spans, colCount, rowCount, gutter, rowMode, rowHeight) {
// TODO(shyndman): There are style caching opportunities here.
// Percent of the available horizontal space that one column takes up.
var hShare = (1 / colCount) * 100;
// Fraction of the gutter size that ... | javascript | function getTileStyle(position, spans, colCount, rowCount, gutter, rowMode, rowHeight) {
// TODO(shyndman): There are style caching opportunities here.
// Percent of the available horizontal space that one column takes up.
var hShare = (1 / colCount) * 100;
// Fraction of the gutter size that ... | [
"function",
"getTileStyle",
"(",
"position",
",",
"spans",
",",
"colCount",
",",
"rowCount",
",",
"gutter",
",",
"rowMode",
",",
"rowHeight",
")",
"{",
"// TODO(shyndman): There are style caching opportunities here.",
"// Percent of the available horizontal space that one colum... | Gets the styles applied to a tile element described by the given parameters.
@param {{row: number, col: number}} position The row and column indices of the tile.
@param {{row: number, col: number}} spans The rowSpan and colSpan of the tile.
@param {number} colCount The number of columns.
@param {number} rowCount The nu... | [
"Gets",
"the",
"styles",
"applied",
"to",
"a",
"tile",
"element",
"described",
"by",
"the",
"given",
"parameters",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/gridList/grid-list.js#L259-L330 |
5,065 | angular/material | src/components/gridList/grid-list.js | getTileSpans | function getTileSpans(tileElements) {
return [].map.call(tileElements, function(ele) {
var ctrl = angular.element(ele).controller('mdGridTile');
return {
row: parseInt(
$mdMedia.getResponsiveAttribute(ctrl.$attrs, 'md-rowspan'), 10) || 1,
col: parseInt(
... | javascript | function getTileSpans(tileElements) {
return [].map.call(tileElements, function(ele) {
var ctrl = angular.element(ele).controller('mdGridTile');
return {
row: parseInt(
$mdMedia.getResponsiveAttribute(ctrl.$attrs, 'md-rowspan'), 10) || 1,
col: parseInt(
... | [
"function",
"getTileSpans",
"(",
"tileElements",
")",
"{",
"return",
"[",
"]",
".",
"map",
".",
"call",
"(",
"tileElements",
",",
"function",
"(",
"ele",
")",
"{",
"var",
"ctrl",
"=",
"angular",
".",
"element",
"(",
"ele",
")",
".",
"controller",
"(",
... | Gets an array of objects containing the rowspan and colspan for each tile.
@returns {Array<{row: number, col: number}>} | [
"Gets",
"an",
"array",
"of",
"objects",
"containing",
"the",
"rowspan",
"and",
"colspan",
"for",
"each",
"tile",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/gridList/grid-list.js#L370-L380 |
5,066 | angular/material | src/components/gridList/grid-list.js | GridLayout | function GridLayout(colCount, tileSpans) {
var self, layoutInfo, gridStyles, layoutTime, mapTime, reflowTime;
layoutTime = $mdUtil.time(function() {
layoutInfo = calculateGridFor(colCount, tileSpans);
});
return self = {
/**
* An array of objects describing each tile'... | javascript | function GridLayout(colCount, tileSpans) {
var self, layoutInfo, gridStyles, layoutTime, mapTime, reflowTime;
layoutTime = $mdUtil.time(function() {
layoutInfo = calculateGridFor(colCount, tileSpans);
});
return self = {
/**
* An array of objects describing each tile'... | [
"function",
"GridLayout",
"(",
"colCount",
",",
"tileSpans",
")",
"{",
"var",
"self",
",",
"layoutInfo",
",",
"gridStyles",
",",
"layoutTime",
",",
"mapTime",
",",
"reflowTime",
";",
"layoutTime",
"=",
"$mdUtil",
".",
"time",
"(",
"function",
"(",
")",
"{"... | Publish layout function | [
"Publish",
"layout",
"function"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/gridList/grid-list.js#L481-L537 |
5,067 | angular/material | src/components/gridList/grid-list.js | function(updateFn) {
mapTime = $mdUtil.time(function() {
var info = self.layoutInfo();
gridStyles = updateFn(info.positioning, info.rowCount);
});
return self;
} | javascript | function(updateFn) {
mapTime = $mdUtil.time(function() {
var info = self.layoutInfo();
gridStyles = updateFn(info.positioning, info.rowCount);
});
return self;
} | [
"function",
"(",
"updateFn",
")",
"{",
"mapTime",
"=",
"$mdUtil",
".",
"time",
"(",
"function",
"(",
")",
"{",
"var",
"info",
"=",
"self",
".",
"layoutInfo",
"(",
")",
";",
"gridStyles",
"=",
"updateFn",
"(",
"info",
".",
"positioning",
",",
"info",
... | Maps grid positioning to an element and a set of styles using the
provided updateFn. | [
"Maps",
"grid",
"positioning",
"to",
"an",
"element",
"and",
"a",
"set",
"of",
"styles",
"using",
"the",
"provided",
"updateFn",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/gridList/grid-list.js#L501-L507 | |
5,068 | angular/material | src/components/gridList/grid-list.js | function() {
return {
tileCount: tileSpans.length,
layoutTime: layoutTime,
mapTime: mapTime,
reflowTime: reflowTime,
totalTime: layoutTime + mapTime + reflowTime
};
} | javascript | function() {
return {
tileCount: tileSpans.length,
layoutTime: layoutTime,
mapTime: mapTime,
reflowTime: reflowTime,
totalTime: layoutTime + mapTime + reflowTime
};
} | [
"function",
"(",
")",
"{",
"return",
"{",
"tileCount",
":",
"tileSpans",
".",
"length",
",",
"layoutTime",
":",
"layoutTime",
",",
"mapTime",
":",
"mapTime",
",",
"reflowTime",
":",
"reflowTime",
",",
"totalTime",
":",
"layoutTime",
"+",
"mapTime",
"+",
"r... | Timing for the most recent layout run. | [
"Timing",
"for",
"the",
"most",
"recent",
"layout",
"run",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/gridList/grid-list.js#L527-L535 | |
5,069 | angular/material | src/components/gridList/grid-list.js | calculateGridFor | function calculateGridFor(colCount, tileSpans) {
var curCol = 0,
curRow = 0,
spaceTracker = newSpaceTracker();
return {
positioning: tileSpans.map(function(spans, i) {
return {
spans: spans,
position: reserveSpace(spans, i)
};
}),
rowCount: ... | javascript | function calculateGridFor(colCount, tileSpans) {
var curCol = 0,
curRow = 0,
spaceTracker = newSpaceTracker();
return {
positioning: tileSpans.map(function(spans, i) {
return {
spans: spans,
position: reserveSpace(spans, i)
};
}),
rowCount: ... | [
"function",
"calculateGridFor",
"(",
"colCount",
",",
"tileSpans",
")",
"{",
"var",
"curCol",
"=",
"0",
",",
"curRow",
"=",
"0",
",",
"spaceTracker",
"=",
"newSpaceTracker",
"(",
")",
";",
"return",
"{",
"positioning",
":",
"tileSpans",
".",
"map",
"(",
... | Calculates the positions of tiles.
The algorithm works as follows:
An Array<Number> with length colCount (spaceTracker) keeps track of
available tiling positions, where elements of value 0 represents an
empty position. Space for a tile is reserved by finding a sequence of
0s with length <= than the tile's colspan. Whe... | [
"Calculates",
"the",
"positions",
"of",
"tiles",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/gridList/grid-list.js#L572-L659 |
5,070 | angular/material | release.js | validate | function validate () {
if (exec('npm whoami') !== 'angular') {
err('You must be authenticated with npm as "angular" to perform a release.');
} else if (exec('git rev-parse --abbrev-ref HEAD') !== 'staging') {
err('Releases can only performed from "staging" at this time.');
} else {
return ... | javascript | function validate () {
if (exec('npm whoami') !== 'angular') {
err('You must be authenticated with npm as "angular" to perform a release.');
} else if (exec('git rev-parse --abbrev-ref HEAD') !== 'staging') {
err('Releases can only performed from "staging" at this time.');
} else {
return ... | [
"function",
"validate",
"(",
")",
"{",
"if",
"(",
"exec",
"(",
"'npm whoami'",
")",
"!==",
"'angular'",
")",
"{",
"err",
"(",
"'You must be authenticated with npm as \"angular\" to perform a release.'",
")",
";",
"}",
"else",
"if",
"(",
"exec",
"(",
"'git rev-pars... | utility methods confirms that you will be able to perform the release before attempting | [
"utility",
"methods",
"confirms",
"that",
"you",
"will",
"be",
"able",
"to",
"perform",
"the",
"release",
"before",
"attempting"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/release.js#L62-L74 |
5,071 | angular/material | release.js | checkoutVersionBranch | function checkoutVersionBranch () {
exec(`git branch -q -D release/${newVersion}`);
exec(`git checkout -q -b release/${newVersion}`);
abortCmds.push('git checkout master');
abortCmds.push(`git branch -D release/${newVersion}`);
} | javascript | function checkoutVersionBranch () {
exec(`git branch -q -D release/${newVersion}`);
exec(`git checkout -q -b release/${newVersion}`);
abortCmds.push('git checkout master');
abortCmds.push(`git branch -D release/${newVersion}`);
} | [
"function",
"checkoutVersionBranch",
"(",
")",
"{",
"exec",
"(",
"`",
"${",
"newVersion",
"}",
"`",
")",
";",
"exec",
"(",
"`",
"${",
"newVersion",
"}",
"`",
")",
";",
"abortCmds",
".",
"push",
"(",
"'git checkout master'",
")",
";",
"abortCmds",
".",
... | creates the version branch and adds abort steps | [
"creates",
"the",
"version",
"branch",
"and",
"adds",
"abort",
"steps"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/release.js#L77-L82 |
5,072 | angular/material | release.js | updateVersion | function updateVersion () {
start(`Updating ${"package.json".cyan} version from ${oldVersion.cyan} to ${newVersion.cyan}...`);
pkg.version = newVersion;
fs.writeFileSync('./package.json', JSON.stringify(pkg, null, 2));
done();
abortCmds.push('git checkout package.json');
pushCmds.push('git add p... | javascript | function updateVersion () {
start(`Updating ${"package.json".cyan} version from ${oldVersion.cyan} to ${newVersion.cyan}...`);
pkg.version = newVersion;
fs.writeFileSync('./package.json', JSON.stringify(pkg, null, 2));
done();
abortCmds.push('git checkout package.json');
pushCmds.push('git add p... | [
"function",
"updateVersion",
"(",
")",
"{",
"start",
"(",
"`",
"${",
"\"package.json\"",
".",
"cyan",
"}",
"${",
"oldVersion",
".",
"cyan",
"}",
"${",
"newVersion",
".",
"cyan",
"}",
"`",
")",
";",
"pkg",
".",
"version",
"=",
"newVersion",
";",
"fs",
... | writes the new version to package.json | [
"writes",
"the",
"new",
"version",
"to",
"package",
".",
"json"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/release.js#L85-L92 |
5,073 | angular/material | release.js | createChangelog | function createChangelog () {
start(`Generating changelog from ${oldVersion.cyan} to ${newVersion.cyan}...`);
exec(`git fetch --tags ${origin}`);
exec(`git checkout CHANGELOG.md`);
exec(`gulp changelog --sha=$(git merge-base v${lastMajorVer} HEAD)`);
done();
abortCmds.push('git checkout CHANG... | javascript | function createChangelog () {
start(`Generating changelog from ${oldVersion.cyan} to ${newVersion.cyan}...`);
exec(`git fetch --tags ${origin}`);
exec(`git checkout CHANGELOG.md`);
exec(`gulp changelog --sha=$(git merge-base v${lastMajorVer} HEAD)`);
done();
abortCmds.push('git checkout CHANG... | [
"function",
"createChangelog",
"(",
")",
"{",
"start",
"(",
"`",
"${",
"oldVersion",
".",
"cyan",
"}",
"${",
"newVersion",
".",
"cyan",
"}",
"`",
")",
";",
"exec",
"(",
"`",
"${",
"origin",
"}",
"`",
")",
";",
"exec",
"(",
"`",
"`",
")",
";",
"... | generates the changelog from the commits since the last release | [
"generates",
"the",
"changelog",
"from",
"the",
"commits",
"since",
"the",
"last",
"release"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/release.js#L95-L106 |
5,074 | angular/material | release.js | getNewVersion | function getNewVersion () {
header();
const options = getVersionOptions(oldVersion);
let key, version;
log(`The current version is ${oldVersion.cyan}.`);
log('');
log('What should the next version be?');
for (key in options) { log((+key + 1) + ') ' + options[ key ].cyan); }
log('');
... | javascript | function getNewVersion () {
header();
const options = getVersionOptions(oldVersion);
let key, version;
log(`The current version is ${oldVersion.cyan}.`);
log('');
log('What should the next version be?');
for (key in options) { log((+key + 1) + ') ' + options[ key ].cyan); }
log('');
... | [
"function",
"getNewVersion",
"(",
")",
"{",
"header",
"(",
")",
";",
"const",
"options",
"=",
"getVersionOptions",
"(",
"oldVersion",
")",
";",
"let",
"key",
",",
"version",
";",
"log",
"(",
"`",
"${",
"oldVersion",
".",
"cyan",
"}",
"`",
")",
";",
"... | prompts the user for the new version | [
"prompts",
"the",
"user",
"for",
"the",
"new",
"version"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/release.js#L114-L179 |
5,075 | angular/material | release.js | cloneRepo | function cloneRepo (repo) {
start(`Cloning ${repo.cyan} from Github...`);
exec(`rm -rf ${repo}`);
exec(`git clone [email protected]:angular/${repo}.git --depth=1`);
done();
cleanupCmds.push(`rm -rf ${repo}`);
} | javascript | function cloneRepo (repo) {
start(`Cloning ${repo.cyan} from Github...`);
exec(`rm -rf ${repo}`);
exec(`git clone [email protected]:angular/${repo}.git --depth=1`);
done();
cleanupCmds.push(`rm -rf ${repo}`);
} | [
"function",
"cloneRepo",
"(",
"repo",
")",
"{",
"start",
"(",
"`",
"${",
"repo",
".",
"cyan",
"}",
"`",
")",
";",
"exec",
"(",
"`",
"${",
"repo",
"}",
"`",
")",
";",
"exec",
"(",
"`",
"${",
"repo",
"}",
"`",
")",
";",
"done",
"(",
")",
";",... | utility method for cloning github repos | [
"utility",
"method",
"for",
"cloning",
"github",
"repos"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/release.js#L199-L205 |
5,076 | angular/material | release.js | writeScript | function writeScript (name, cmds) {
fs.writeFileSync(name, '#!/usr/bin/env bash\n\n' + cmds.join('\n'));
exec('chmod +x ' + name);
} | javascript | function writeScript (name, cmds) {
fs.writeFileSync(name, '#!/usr/bin/env bash\n\n' + cmds.join('\n'));
exec('chmod +x ' + name);
} | [
"function",
"writeScript",
"(",
"name",
",",
"cmds",
")",
"{",
"fs",
".",
"writeFileSync",
"(",
"name",
",",
"'#!/usr/bin/env bash\\n\\n'",
"+",
"cmds",
".",
"join",
"(",
"'\\n'",
")",
")",
";",
"exec",
"(",
"'chmod +x '",
"+",
"name",
")",
";",
"}"
] | writes an array of commands to a bash script | [
"writes",
"an",
"array",
"of",
"commands",
"to",
"a",
"bash",
"script"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/release.js#L208-L211 |
5,077 | angular/material | release.js | updateBowerVersion | function updateBowerVersion () {
start('Updating bower version...');
const options = { cwd: './bower-material' };
const bower = require(options.cwd + '/bower.json'),
pkg = require(options.cwd + '/package.json');
// update versions in config files
bower.version = pkg.version = newVers... | javascript | function updateBowerVersion () {
start('Updating bower version...');
const options = { cwd: './bower-material' };
const bower = require(options.cwd + '/bower.json'),
pkg = require(options.cwd + '/package.json');
// update versions in config files
bower.version = pkg.version = newVers... | [
"function",
"updateBowerVersion",
"(",
")",
"{",
"start",
"(",
"'Updating bower version...'",
")",
";",
"const",
"options",
"=",
"{",
"cwd",
":",
"'./bower-material'",
"}",
";",
"const",
"bower",
"=",
"require",
"(",
"options",
".",
"cwd",
"+",
"'/bower.json'"... | updates the version for bower-material in package.json and bower.json | [
"updates",
"the",
"version",
"for",
"bower",
"-",
"material",
"in",
"package",
".",
"json",
"and",
"bower",
".",
"json"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/release.js#L214-L258 |
5,078 | angular/material | release.js | updateSite | function updateSite () {
start('Adding new version of the docs site...');
const options = { cwd: './code.material.angularjs.org' };
writeDocsJson();
// build files for bower
exec([
'rm -rf dist',
'gulp docs'
]);
replaceFilePaths();
// copy files over to site repo
ex... | javascript | function updateSite () {
start('Adding new version of the docs site...');
const options = { cwd: './code.material.angularjs.org' };
writeDocsJson();
// build files for bower
exec([
'rm -rf dist',
'gulp docs'
]);
replaceFilePaths();
// copy files over to site repo
ex... | [
"function",
"updateSite",
"(",
")",
"{",
"start",
"(",
"'Adding new version of the docs site...'",
")",
";",
"const",
"options",
"=",
"{",
"cwd",
":",
"'./code.material.angularjs.org'",
"}",
";",
"writeDocsJson",
"(",
")",
";",
"// build files for bower",
"exec",
"(... | builds the website for the new version | [
"builds",
"the",
"website",
"for",
"the",
"new",
"version"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/release.js#L261-L331 |
5,079 | angular/material | release.js | replaceFilePaths | function replaceFilePaths () {
// handle docs.js
const filePath = path.join(__dirname, '/dist/docs/docs.js');
const file = fs.readFileSync(filePath);
const contents = file.toString()
.replace(/http:\/\/localhost:8080\/angular-material/g, 'https://gitcdn.xyz/cdn/angular/bower-material/v' + newVer... | javascript | function replaceFilePaths () {
// handle docs.js
const filePath = path.join(__dirname, '/dist/docs/docs.js');
const file = fs.readFileSync(filePath);
const contents = file.toString()
.replace(/http:\/\/localhost:8080\/angular-material/g, 'https://gitcdn.xyz/cdn/angular/bower-material/v' + newVer... | [
"function",
"replaceFilePaths",
"(",
")",
"{",
"// handle docs.js",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"'/dist/docs/docs.js'",
")",
";",
"const",
"file",
"=",
"fs",
".",
"readFileSync",
"(",
"filePath",
")",
";",
"const",
"... | replaces localhost file paths with public URLs | [
"replaces",
"localhost",
"file",
"paths",
"with",
"public",
"URLs"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/release.js#L334-L342 |
5,080 | angular/material | release.js | replaceBaseHref | function replaceBaseHref (folder) {
// handle index.html
const filePath = path.join(__dirname, '/code.material.angularjs.org/', folder, '/index.html');
const file = fs.readFileSync(filePath);
const contents = file.toString().replace(/base href="\//g, 'base href="/' + folder + '/');
fs.writeFileSync(... | javascript | function replaceBaseHref (folder) {
// handle index.html
const filePath = path.join(__dirname, '/code.material.angularjs.org/', folder, '/index.html');
const file = fs.readFileSync(filePath);
const contents = file.toString().replace(/base href="\//g, 'base href="/' + folder + '/');
fs.writeFileSync(... | [
"function",
"replaceBaseHref",
"(",
"folder",
")",
"{",
"// handle index.html",
"const",
"filePath",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"'/code.material.angularjs.org/'",
",",
"folder",
",",
"'/index.html'",
")",
";",
"const",
"file",
"=",
"fs",
".... | replaces base href in index.html for new version as well as latest | [
"replaces",
"base",
"href",
"in",
"index",
".",
"html",
"for",
"new",
"version",
"as",
"well",
"as",
"latest"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/release.js#L345-L351 |
5,081 | angular/material | release.js | updateMaster | function updateMaster () {
pushCmds.push(
comment('update package.json in master'),
'git checkout master',
`git pull --rebase ${origin} master --strategy=theirs`,
`git checkout release/${newVersion} -- CHANGELOG.md`,
`node -e "const newVersion = '${newVersion}'; ${stringifyFu... | javascript | function updateMaster () {
pushCmds.push(
comment('update package.json in master'),
'git checkout master',
`git pull --rebase ${origin} master --strategy=theirs`,
`git checkout release/${newVersion} -- CHANGELOG.md`,
`node -e "const newVersion = '${newVersion}'; ${stringifyFu... | [
"function",
"updateMaster",
"(",
")",
"{",
"pushCmds",
".",
"push",
"(",
"comment",
"(",
"'update package.json in master'",
")",
",",
"'git checkout master'",
",",
"`",
"${",
"origin",
"}",
"`",
",",
"`",
"${",
"newVersion",
"}",
"`",
",",
"`",
"${",
"newV... | copies the changelog back over to master branch | [
"copies",
"the",
"changelog",
"back",
"over",
"to",
"master",
"branch"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/release.js#L354-L385 |
5,082 | angular/material | release.js | center | function center (msg) {
msg = ' ' + msg.trim() + ' ';
const length = msg.length;
const spaces = Math.floor((lineWidth - length) / 2);
return Array(spaces + 1).join('-') + msg.green + Array(lineWidth - msg.length - spaces + 1).join('-');
} | javascript | function center (msg) {
msg = ' ' + msg.trim() + ' ';
const length = msg.length;
const spaces = Math.floor((lineWidth - length) / 2);
return Array(spaces + 1).join('-') + msg.green + Array(lineWidth - msg.length - spaces + 1).join('-');
} | [
"function",
"center",
"(",
"msg",
")",
"{",
"msg",
"=",
"' '",
"+",
"msg",
".",
"trim",
"(",
")",
"+",
"' '",
";",
"const",
"length",
"=",
"msg",
".",
"length",
";",
"const",
"spaces",
"=",
"Math",
".",
"floor",
"(",
"(",
"lineWidth",
"-",
"lengt... | outputs a centered message in the terminal | [
"outputs",
"a",
"centered",
"message",
"in",
"the",
"terminal"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/release.js#L396-L401 |
5,083 | angular/material | release.js | start | function start (msg) {
const msgLength = strip(msg).length,
diff = lineWidth - 4 - msgLength;
write(msg + Array(diff + 1).join(' '));
} | javascript | function start (msg) {
const msgLength = strip(msg).length,
diff = lineWidth - 4 - msgLength;
write(msg + Array(diff + 1).join(' '));
} | [
"function",
"start",
"(",
"msg",
")",
"{",
"const",
"msgLength",
"=",
"strip",
"(",
"msg",
")",
".",
"length",
",",
"diff",
"=",
"lineWidth",
"-",
"4",
"-",
"msgLength",
";",
"write",
"(",
"msg",
"+",
"Array",
"(",
"diff",
"+",
"1",
")",
".",
"jo... | prints the left side of a task while it is being performed | [
"prints",
"the",
"left",
"side",
"of",
"a",
"task",
"while",
"it",
"is",
"being",
"performed"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/release.js#L430-L434 |
5,084 | angular/material | src/core/util/animation/animate.js | reverseTranslate | function reverseTranslate (newFrom) {
return $animateCss(target, {
to: newFrom || from,
addClass: options.transitionOutClass,
removeClass: options.transitionInClass,
duration: options.duration
}).start();
} | javascript | function reverseTranslate (newFrom) {
return $animateCss(target, {
to: newFrom || from,
addClass: options.transitionOutClass,
removeClass: options.transitionInClass,
duration: options.duration
}).start();
} | [
"function",
"reverseTranslate",
"(",
"newFrom",
")",
"{",
"return",
"$animateCss",
"(",
"target",
",",
"{",
"to",
":",
"newFrom",
"||",
"from",
",",
"addClass",
":",
"options",
".",
"transitionOutClass",
",",
"removeClass",
":",
"options",
".",
"transitionInCl... | Specific reversal of the request translate animation above... | [
"Specific",
"reversal",
"of",
"the",
"request",
"translate",
"animation",
"above",
"..."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/util/animation/animate.js#L40-L48 |
5,085 | angular/material | src/core/util/animation/animate.js | noTransitionFound | function noTransitionFound(styles) {
styles = styles || window.getComputedStyle(element[0]);
return styles.transitionDuration == '0s' || (!styles.transition && !styles.transitionProperty);
} | javascript | function noTransitionFound(styles) {
styles = styles || window.getComputedStyle(element[0]);
return styles.transitionDuration == '0s' || (!styles.transition && !styles.transitionProperty);
} | [
"function",
"noTransitionFound",
"(",
"styles",
")",
"{",
"styles",
"=",
"styles",
"||",
"window",
".",
"getComputedStyle",
"(",
"element",
"[",
"0",
"]",
")",
";",
"return",
"styles",
".",
"transitionDuration",
"==",
"'0s'",
"||",
"(",
"!",
"styles",
".",... | Checks whether or not there is a transition.
@param styles The cached styles to use for the calculation. If null, getComputedStyle()
will be used.
@returns {boolean} True if there is no transition/duration; false otherwise. | [
"Checks",
"whether",
"or",
"not",
"there",
"is",
"a",
"transition",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/util/animation/animate.js#L94-L98 |
5,086 | angular/material | src/core/util/animation/animate.js | currentBounds | function currentBounds() {
var cntr = element ? element.parent() : null;
var parent = cntr ? cntr.parent() : null;
return parent ? self.clientRect(parent) : null;
} | javascript | function currentBounds() {
var cntr = element ? element.parent() : null;
var parent = cntr ? cntr.parent() : null;
return parent ? self.clientRect(parent) : null;
} | [
"function",
"currentBounds",
"(",
")",
"{",
"var",
"cntr",
"=",
"element",
"?",
"element",
".",
"parent",
"(",
")",
":",
"null",
";",
"var",
"parent",
"=",
"cntr",
"?",
"cntr",
".",
"parent",
"(",
")",
":",
"null",
";",
"return",
"parent",
"?",
"se... | This is a fallback if the origin information is no longer valid, then the
origin bounds simply becomes the current bounds for the dialogContainer's parent | [
"This",
"is",
"a",
"fallback",
"if",
"the",
"origin",
"information",
"is",
"no",
"longer",
"valid",
"then",
"the",
"origin",
"bounds",
"simply",
"becomes",
"the",
"current",
"bounds",
"for",
"the",
"dialogContainer",
"s",
"parent"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/util/animation/animate.js#L126-L131 |
5,087 | angular/material | src/core/util/animation/animate.js | function (element, originator) {
var zoomTemplate = "translate3d( {centerX}px, {centerY}px, 0 ) scale( {scaleX}, {scaleY} )";
var buildZoom = angular.bind(null, $mdUtil.supplant, zoomTemplate);
return buildZoom(self.calculateTransformValues(element, originator));
} | javascript | function (element, originator) {
var zoomTemplate = "translate3d( {centerX}px, {centerY}px, 0 ) scale( {scaleX}, {scaleY} )";
var buildZoom = angular.bind(null, $mdUtil.supplant, zoomTemplate);
return buildZoom(self.calculateTransformValues(element, originator));
} | [
"function",
"(",
"element",
",",
"originator",
")",
"{",
"var",
"zoomTemplate",
"=",
"\"translate3d( {centerX}px, {centerY}px, 0 ) scale( {scaleX}, {scaleY} )\"",
";",
"var",
"buildZoom",
"=",
"angular",
".",
"bind",
"(",
"null",
",",
"$mdUtil",
".",
"supplant",
",",
... | Calculate the zoom transform from dialog to origin.
We use this to set the dialog position immediately;
then the md-transition-in actually translates back to
`translate3d(0,0,0) scale(1.0)`...
NOTE: all values are rounded to the nearest integer | [
"Calculate",
"the",
"zoom",
"transform",
"from",
"dialog",
"to",
"origin",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/util/animation/animate.js#L143-L148 | |
5,088 | angular/material | src/core/util/animation/animate.js | function(raw) {
var css = { };
var lookups = 'left top right bottom width height x y min-width min-height max-width max-height';
angular.forEach(raw, function(value,key) {
if (angular.isUndefined(value)) return;
if (lookups.indexOf(key) >= 0) {
css[key] = value + 'px';
... | javascript | function(raw) {
var css = { };
var lookups = 'left top right bottom width height x y min-width min-height max-width max-height';
angular.forEach(raw, function(value,key) {
if (angular.isUndefined(value)) return;
if (lookups.indexOf(key) >= 0) {
css[key] = value + 'px';
... | [
"function",
"(",
"raw",
")",
"{",
"var",
"css",
"=",
"{",
"}",
";",
"var",
"lookups",
"=",
"'left top right bottom width height x y min-width min-height max-width max-height'",
";",
"angular",
".",
"forEach",
"(",
"raw",
",",
"function",
"(",
"value",
",",
"key",
... | Enhance raw values to represent valid css stylings... | [
"Enhance",
"raw",
"values",
"to",
"represent",
"valid",
"css",
"stylings",
"..."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/util/animation/animate.js#L164-L198 | |
5,089 | angular/material | src/core/util/animation/animate.js | function (element) {
var bounds = angular.element(element)[0].getBoundingClientRect();
var isPositiveSizeClientRect = function (rect) {
return rect && (rect.width > 0) && (rect.height > 0);
};
// If the event origin element has zero size, it has probably been hidden.
return isPosi... | javascript | function (element) {
var bounds = angular.element(element)[0].getBoundingClientRect();
var isPositiveSizeClientRect = function (rect) {
return rect && (rect.width > 0) && (rect.height > 0);
};
// If the event origin element has zero size, it has probably been hidden.
return isPosi... | [
"function",
"(",
"element",
")",
"{",
"var",
"bounds",
"=",
"angular",
".",
"element",
"(",
"element",
")",
"[",
"0",
"]",
".",
"getBoundingClientRect",
"(",
")",
";",
"var",
"isPositiveSizeClientRect",
"=",
"function",
"(",
"rect",
")",
"{",
"return",
"... | Calculate ClientRect of element; return null if hidden or zero size | [
"Calculate",
"ClientRect",
"of",
"element",
";",
"return",
"null",
"if",
"hidden",
"or",
"zero",
"size"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/util/animation/animate.js#L238-L246 | |
5,090 | angular/material | src/core/util/animation/animate.js | function (targetRect) {
return targetRect ? {
x: Math.round(targetRect.left + (targetRect.width / 2)),
y: Math.round(targetRect.top + (targetRect.height / 2))
} : { x : 0, y : 0 };
} | javascript | function (targetRect) {
return targetRect ? {
x: Math.round(targetRect.left + (targetRect.width / 2)),
y: Math.round(targetRect.top + (targetRect.height / 2))
} : { x : 0, y : 0 };
} | [
"function",
"(",
"targetRect",
")",
"{",
"return",
"targetRect",
"?",
"{",
"x",
":",
"Math",
".",
"round",
"(",
"targetRect",
".",
"left",
"+",
"(",
"targetRect",
".",
"width",
"/",
"2",
")",
")",
",",
"y",
":",
"Math",
".",
"round",
"(",
"targetRe... | Calculate 'rounded' center point of Rect | [
"Calculate",
"rounded",
"center",
"point",
"of",
"Rect"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/util/animation/animate.js#L251-L256 | |
5,091 | angular/material | src/components/toast/toast.js | MdToastController | function MdToastController($mdToast, $scope, $log) {
// For compatibility with AngularJS 1.6+, we should always use the $onInit hook in
// interimElements. The $mdCompiler simulates the $onInit hook for all versions.
this.$onInit = function() {
var self = this;
if (self.highlightAction) {
... | javascript | function MdToastController($mdToast, $scope, $log) {
// For compatibility with AngularJS 1.6+, we should always use the $onInit hook in
// interimElements. The $mdCompiler simulates the $onInit hook for all versions.
this.$onInit = function() {
var self = this;
if (self.highlightAction) {
... | [
"function",
"MdToastController",
"(",
"$mdToast",
",",
"$scope",
",",
"$log",
")",
"{",
"// For compatibility with AngularJS 1.6+, we should always use the $onInit hook in",
"// interimElements. The $mdCompiler simulates the $onInit hook for all versions.",
"this",
".",
"$onInit",
"=",... | Controller for the Toast interim elements.
@ngInject | [
"Controller",
"for",
"the",
"Toast",
"interim",
"elements",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/toast/toast.js#L381-L416 |
5,092 | angular/material | src/components/panel/panel.spec.js | attachToBody | function attachToBody(el) {
var element = angular.element(el);
angular.element(document.body).append(element);
attachedElements.push(element);
} | javascript | function attachToBody(el) {
var element = angular.element(el);
angular.element(document.body).append(element);
attachedElements.push(element);
} | [
"function",
"attachToBody",
"(",
"el",
")",
"{",
"var",
"element",
"=",
"angular",
".",
"element",
"(",
"el",
")",
";",
"angular",
".",
"element",
"(",
"document",
".",
"body",
")",
".",
"append",
"(",
"element",
")",
";",
"attachedElements",
".",
"pus... | Attached an element to document.body. Keeps track of attached elements
so that they can be removed in an afterEach.
@param el | [
"Attached",
"an",
"element",
"to",
"document",
".",
"body",
".",
"Keeps",
"track",
"of",
"attached",
"elements",
"so",
"that",
"they",
"can",
"be",
"removed",
"in",
"an",
"afterEach",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/panel/panel.spec.js#L3366-L3370 |
5,093 | angular/material | src/core/util/color.js | hexToRgba | function hexToRgba (color) {
var hex = color[ 0 ] === '#' ? color.substr(1) : color,
dig = hex.length / 3,
red = hex.substr(0, dig),
green = hex.substr(dig, dig),
blue = hex.substr(dig * 2);
if (dig === 1) {
red += red;
green += green;
blue += blue;
}
ret... | javascript | function hexToRgba (color) {
var hex = color[ 0 ] === '#' ? color.substr(1) : color,
dig = hex.length / 3,
red = hex.substr(0, dig),
green = hex.substr(dig, dig),
blue = hex.substr(dig * 2);
if (dig === 1) {
red += red;
green += green;
blue += blue;
}
ret... | [
"function",
"hexToRgba",
"(",
"color",
")",
"{",
"var",
"hex",
"=",
"color",
"[",
"0",
"]",
"===",
"'#'",
"?",
"color",
".",
"substr",
"(",
"1",
")",
":",
"color",
",",
"dig",
"=",
"hex",
".",
"length",
"/",
"3",
",",
"red",
"=",
"hex",
".",
... | Converts hex value to RGBA string
@param color {string}
@returns {string} | [
"Converts",
"hex",
"value",
"to",
"RGBA",
"string"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/util/color.js#L17-L29 |
5,094 | angular/material | src/core/util/color.js | rgbaToHex | function rgbaToHex(color) {
color = color.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i);
var hex = (color && color.length === 4) ? "#" +
("0" + parseInt(color[1],10).toString(16)).slice(-2) +
("0" + parseInt(color[2],10).toString(16)).slice(-2) +
("0" + parseInt(colo... | javascript | function rgbaToHex(color) {
color = color.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i);
var hex = (color && color.length === 4) ? "#" +
("0" + parseInt(color[1],10).toString(16)).slice(-2) +
("0" + parseInt(color[2],10).toString(16)).slice(-2) +
("0" + parseInt(colo... | [
"function",
"rgbaToHex",
"(",
"color",
")",
"{",
"color",
"=",
"color",
".",
"match",
"(",
"/",
"^rgba?[\\s+]?\\([\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?",
"/",
"i",
")",
";",
"var",
"hex",
"=",
"(",
"color",
"&&",
"color",
".",
"length",
"... | Converts rgba value to hex string
@param {string} color
@returns {string} | [
"Converts",
"rgba",
"value",
"to",
"hex",
"string"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/util/color.js#L36-L45 |
5,095 | angular/material | src/components/datepicker/js/dateUtil.js | isSameMonthAndYear | function isSameMonthAndYear(d1, d2) {
return d1.getFullYear() === d2.getFullYear() && d1.getMonth() === d2.getMonth();
} | javascript | function isSameMonthAndYear(d1, d2) {
return d1.getFullYear() === d2.getFullYear() && d1.getMonth() === d2.getMonth();
} | [
"function",
"isSameMonthAndYear",
"(",
"d1",
",",
"d2",
")",
"{",
"return",
"d1",
".",
"getFullYear",
"(",
")",
"===",
"d2",
".",
"getFullYear",
"(",
")",
"&&",
"d1",
".",
"getMonth",
"(",
")",
"===",
"d2",
".",
"getMonth",
"(",
")",
";",
"}"
] | Gets whether two dates have the same month and year.
@param {Date} d1
@param {Date} d2
@returns {boolean} | [
"Gets",
"whether",
"two",
"dates",
"have",
"the",
"same",
"month",
"and",
"year",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/datepicker/js/dateUtil.js#L77-L79 |
5,096 | angular/material | src/components/datepicker/js/dateUtil.js | getWeekOfMonth | function getWeekOfMonth(date) {
var firstDayOfMonth = getFirstDateOfMonth(date);
return Math.floor((firstDayOfMonth.getDay() + date.getDate() - 1) / 7);
} | javascript | function getWeekOfMonth(date) {
var firstDayOfMonth = getFirstDateOfMonth(date);
return Math.floor((firstDayOfMonth.getDay() + date.getDate() - 1) / 7);
} | [
"function",
"getWeekOfMonth",
"(",
"date",
")",
"{",
"var",
"firstDayOfMonth",
"=",
"getFirstDateOfMonth",
"(",
"date",
")",
";",
"return",
"Math",
".",
"floor",
"(",
"(",
"firstDayOfMonth",
".",
"getDay",
"(",
")",
"+",
"date",
".",
"getDate",
"(",
")",
... | Gets the week of the month that a given date occurs in.
@param {Date} date
@returns {number} Index of the week of the month (zero-based). | [
"Gets",
"the",
"week",
"of",
"the",
"month",
"that",
"a",
"given",
"date",
"occurs",
"in",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/datepicker/js/dateUtil.js#L128-L131 |
5,097 | angular/material | src/components/datepicker/js/dateUtil.js | incrementDays | function incrementDays(date, numberOfDays) {
return new Date(date.getFullYear(), date.getMonth(), date.getDate() + numberOfDays);
} | javascript | function incrementDays(date, numberOfDays) {
return new Date(date.getFullYear(), date.getMonth(), date.getDate() + numberOfDays);
} | [
"function",
"incrementDays",
"(",
"date",
",",
"numberOfDays",
")",
"{",
"return",
"new",
"Date",
"(",
"date",
".",
"getFullYear",
"(",
")",
",",
"date",
".",
"getMonth",
"(",
")",
",",
"date",
".",
"getDate",
"(",
")",
"+",
"numberOfDays",
")",
";",
... | Gets a new date incremented by the given number of days. Number of days can be negative.
@param {Date} date
@param {number} numberOfDays
@returns {Date} | [
"Gets",
"a",
"new",
"date",
"incremented",
"by",
"the",
"given",
"number",
"of",
"days",
".",
"Number",
"of",
"days",
"can",
"be",
"negative",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/datepicker/js/dateUtil.js#L139-L141 |
5,098 | angular/material | src/components/datepicker/js/dateUtil.js | incrementMonths | function incrementMonths(date, numberOfMonths) {
// If the same date in the target month does not actually exist, the Date object will
// automatically advance *another* month by the number of missing days.
// For example, if you try to go from Jan. 30 to Feb. 30, you'll end up on March 2.
// So... | javascript | function incrementMonths(date, numberOfMonths) {
// If the same date in the target month does not actually exist, the Date object will
// automatically advance *another* month by the number of missing days.
// For example, if you try to go from Jan. 30 to Feb. 30, you'll end up on March 2.
// So... | [
"function",
"incrementMonths",
"(",
"date",
",",
"numberOfMonths",
")",
"{",
"// If the same date in the target month does not actually exist, the Date object will",
"// automatically advance *another* month by the number of missing days.",
"// For example, if you try to go from Jan. 30 to Feb. ... | Gets a new date incremented by the given number of months. Number of months can be negative.
If the date of the given month does not match the target month, the date will be set to the
last day of the month.
@param {Date} date
@param {number} numberOfMonths
@returns {Date} | [
"Gets",
"a",
"new",
"date",
"incremented",
"by",
"the",
"given",
"number",
"of",
"months",
".",
"Number",
"of",
"months",
"can",
"be",
"negative",
".",
"If",
"the",
"date",
"of",
"the",
"given",
"month",
"does",
"not",
"match",
"the",
"target",
"month",
... | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/datepicker/js/dateUtil.js#L151-L165 |
5,099 | angular/material | src/components/datepicker/js/dateUtil.js | isDateWithinRange | function isDateWithinRange(date, minDate, maxDate) {
var dateAtMidnight = createDateAtMidnight(date);
var minDateAtMidnight = isValidDate(minDate) ? createDateAtMidnight(minDate) : null;
var maxDateAtMidnight = isValidDate(maxDate) ? createDateAtMidnight(maxDate) : null;
return (!minDateAtMi... | javascript | function isDateWithinRange(date, minDate, maxDate) {
var dateAtMidnight = createDateAtMidnight(date);
var minDateAtMidnight = isValidDate(minDate) ? createDateAtMidnight(minDate) : null;
var maxDateAtMidnight = isValidDate(maxDate) ? createDateAtMidnight(maxDate) : null;
return (!minDateAtMi... | [
"function",
"isDateWithinRange",
"(",
"date",
",",
"minDate",
",",
"maxDate",
")",
"{",
"var",
"dateAtMidnight",
"=",
"createDateAtMidnight",
"(",
"date",
")",
";",
"var",
"minDateAtMidnight",
"=",
"isValidDate",
"(",
"minDate",
")",
"?",
"createDateAtMidnight",
... | Checks if a date is within a min and max range, ignoring the time component.
If minDate or maxDate are not dates, they are ignored.
@param {Date} date
@param {Date} minDate
@param {Date} maxDate | [
"Checks",
"if",
"a",
"date",
"is",
"within",
"a",
"min",
"and",
"max",
"range",
"ignoring",
"the",
"time",
"component",
".",
"If",
"minDate",
"or",
"maxDate",
"are",
"not",
"dates",
"they",
"are",
"ignored",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/datepicker/js/dateUtil.js#L235-L241 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.