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 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train | |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train | |
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 | train | |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
angular/material | release.js | cloneRepo | function cloneRepo (repo) {
start(`Cloning ${repo.cyan} from Github...`);
exec(`rm -rf ${repo}`);
exec(`git clone git@github.com: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 git@github.com: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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train | |
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 | train | |
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 | train | |
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 | train | |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
angular/material | src/components/datepicker/js/dateUtil.js | clampDate | function clampDate(date, minDate, maxDate) {
var boundDate = date;
if (minDate && date < minDate) {
boundDate = new Date(minDate.getTime());
}
if (maxDate && date > maxDate) {
boundDate = new Date(maxDate.getTime());
}
return boundDate;
} | javascript | function clampDate(date, minDate, maxDate) {
var boundDate = date;
if (minDate && date < minDate) {
boundDate = new Date(minDate.getTime());
}
if (maxDate && date > maxDate) {
boundDate = new Date(maxDate.getTime());
}
return boundDate;
} | [
"function",
"clampDate",
"(",
"date",
",",
"minDate",
",",
"maxDate",
")",
"{",
"var",
"boundDate",
"=",
"date",
";",
"if",
"(",
"minDate",
"&&",
"date",
"<",
"minDate",
")",
"{",
"boundDate",
"=",
"new",
"Date",
"(",
"minDate",
".",
"getTime",
"(",
... | Clamps a date between a minimum and a maximum date.
@param {Date} date Date to be clamped
@param {Date=} minDate Minimum date
@param {Date=} maxDate Maximum date
@return {Date} | [
"Clamps",
"a",
"date",
"between",
"a",
"minimum",
"and",
"a",
"maximum",
"date",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/datepicker/js/dateUtil.js#L274-L283 | train |
angular/material | src/components/datepicker/js/dateUtil.js | isMonthWithinRange | function isMonthWithinRange(date, minDate, maxDate) {
var month = date.getMonth();
var year = date.getFullYear();
return (!minDate || minDate.getFullYear() < year || minDate.getMonth() <= month) &&
(!maxDate || maxDate.getFullYear() > year || maxDate.getMonth() >= month);
} | javascript | function isMonthWithinRange(date, minDate, maxDate) {
var month = date.getMonth();
var year = date.getFullYear();
return (!minDate || minDate.getFullYear() < year || minDate.getMonth() <= month) &&
(!maxDate || maxDate.getFullYear() > year || maxDate.getMonth() >= month);
} | [
"function",
"isMonthWithinRange",
"(",
"date",
",",
"minDate",
",",
"maxDate",
")",
"{",
"var",
"month",
"=",
"date",
".",
"getMonth",
"(",
")",
";",
"var",
"year",
"=",
"date",
".",
"getFullYear",
"(",
")",
";",
"return",
"(",
"!",
"minDate",
"||",
... | Checks if a month is within a min and max range, ignoring the date and time components.
If minDate or maxDate are not dates, they are ignored.
@param {Date} date
@param {Date} minDate
@param {Date} maxDate | [
"Checks",
"if",
"a",
"month",
"is",
"within",
"a",
"min",
"and",
"max",
"range",
"ignoring",
"the",
"date",
"and",
"time",
"components",
".",
"If",
"minDate",
"or",
"maxDate",
"are",
"not",
"dates",
"they",
"are",
"ignored",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/datepicker/js/dateUtil.js#L303-L309 | train |
angular/material | src/components/sticky/sticky.js | onScroll | function onScroll() {
var scrollTop = contentEl.prop('scrollTop');
var isScrollingDown = scrollTop > (onScroll.prevScrollTop || 0);
// Store the previous scroll so we know which direction we are scrolling
onScroll.prevScrollTop = scrollTop;
//
// AT TOP (not scrolling)
//
... | javascript | function onScroll() {
var scrollTop = contentEl.prop('scrollTop');
var isScrollingDown = scrollTop > (onScroll.prevScrollTop || 0);
// Store the previous scroll so we know which direction we are scrolling
onScroll.prevScrollTop = scrollTop;
//
// AT TOP (not scrolling)
//
... | [
"function",
"onScroll",
"(",
")",
"{",
"var",
"scrollTop",
"=",
"contentEl",
".",
"prop",
"(",
"'scrollTop'",
")",
";",
"var",
"isScrollingDown",
"=",
"scrollTop",
">",
"(",
"onScroll",
".",
"prevScrollTop",
"||",
"0",
")",
";",
"// Store the previous scroll s... | As we scroll, push in and select the correct sticky element. | [
"As",
"we",
"scroll",
"push",
"in",
"and",
"select",
"the",
"correct",
"sticky",
"element",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/sticky/sticky.js#L211-L269 | train |
angular/material | src/components/menu/js/menuServiceProvider.js | onRemove | function onRemove(scope, element, opts) {
opts.cleanupInteraction();
opts.cleanupBackdrop();
opts.cleanupResizing();
opts.hideBackdrop();
// Before the menu is closing remove the clickable class.
element.removeClass('md-clickable');
// For navigation $destroy events, do a qui... | javascript | function onRemove(scope, element, opts) {
opts.cleanupInteraction();
opts.cleanupBackdrop();
opts.cleanupResizing();
opts.hideBackdrop();
// Before the menu is closing remove the clickable class.
element.removeClass('md-clickable');
// For navigation $destroy events, do a qui... | [
"function",
"onRemove",
"(",
"scope",
",",
"element",
",",
"opts",
")",
"{",
"opts",
".",
"cleanupInteraction",
"(",
")",
";",
"opts",
".",
"cleanupBackdrop",
"(",
")",
";",
"opts",
".",
"cleanupResizing",
"(",
")",
";",
"opts",
".",
"hideBackdrop",
"(",... | Removing the menu element from the DOM and remove all associated event listeners
and backdrop | [
"Removing",
"the",
"menu",
"element",
"from",
"the",
"DOM",
"and",
"remove",
"all",
"associated",
"event",
"listeners",
"and",
"backdrop"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/menu/js/menuServiceProvider.js#L78-L109 | train |
angular/material | src/components/menu/js/menuServiceProvider.js | showMenu | function showMenu() {
opts.parent.append(element);
element[0].style.display = '';
return $q(function(resolve) {
var position = calculateMenuPosition(element, opts);
element.removeClass('md-leave');
// Animate the menu scaling, and opacity [from its position origi... | javascript | function showMenu() {
opts.parent.append(element);
element[0].style.display = '';
return $q(function(resolve) {
var position = calculateMenuPosition(element, opts);
element.removeClass('md-leave');
// Animate the menu scaling, and opacity [from its position origi... | [
"function",
"showMenu",
"(",
")",
"{",
"opts",
".",
"parent",
".",
"append",
"(",
"element",
")",
";",
"element",
"[",
"0",
"]",
".",
"style",
".",
"display",
"=",
"''",
";",
"return",
"$q",
"(",
"function",
"(",
"resolve",
")",
"{",
"var",
"positi... | Place the menu into the DOM and call positioning related functions | [
"Place",
"the",
"menu",
"into",
"the",
"DOM",
"and",
"call",
"positioning",
"related",
"functions"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/menu/js/menuServiceProvider.js#L149-L169 | train |
angular/material | src/components/menu/js/menuServiceProvider.js | sanitizeAndConfigure | function sanitizeAndConfigure() {
if (!opts.target) {
throw Error(
'$mdMenu.show() expected a target to animate from in options.target'
);
}
angular.extend(opts, {
alreadyOpen: false,
isRemoved: false,
target: angular.element(opts.tar... | javascript | function sanitizeAndConfigure() {
if (!opts.target) {
throw Error(
'$mdMenu.show() expected a target to animate from in options.target'
);
}
angular.extend(opts, {
alreadyOpen: false,
isRemoved: false,
target: angular.element(opts.tar... | [
"function",
"sanitizeAndConfigure",
"(",
")",
"{",
"if",
"(",
"!",
"opts",
".",
"target",
")",
"{",
"throw",
"Error",
"(",
"'$mdMenu.show() expected a target to animate from in options.target'",
")",
";",
"}",
"angular",
".",
"extend",
"(",
"opts",
",",
"{",
"al... | Check for valid opts and set some sane defaults | [
"Check",
"for",
"valid",
"opts",
"and",
"set",
"some",
"sane",
"defaults"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/menu/js/menuServiceProvider.js#L174-L187 | train |
angular/material | src/components/menu/js/menuServiceProvider.js | setupBackdrop | function setupBackdrop() {
if (!opts.backdrop) return angular.noop;
opts.backdrop.on('click', onBackdropClick);
return function() {
opts.backdrop.off('click', onBackdropClick);
};
} | javascript | function setupBackdrop() {
if (!opts.backdrop) return angular.noop;
opts.backdrop.on('click', onBackdropClick);
return function() {
opts.backdrop.off('click', onBackdropClick);
};
} | [
"function",
"setupBackdrop",
"(",
")",
"{",
"if",
"(",
"!",
"opts",
".",
"backdrop",
")",
"return",
"angular",
".",
"noop",
";",
"opts",
".",
"backdrop",
".",
"on",
"(",
"'click'",
",",
"onBackdropClick",
")",
";",
"return",
"function",
"(",
")",
"{",
... | Sets up the backdrop and listens for click elements.
Once the backdrop will be clicked, the menu will automatically close.
@returns {!Function} Function to remove the backdrop. | [
"Sets",
"up",
"the",
"backdrop",
"and",
"listens",
"for",
"click",
"elements",
".",
"Once",
"the",
"backdrop",
"will",
"be",
"clicked",
"the",
"menu",
"will",
"automatically",
"close",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/menu/js/menuServiceProvider.js#L220-L228 | train |
angular/material | src/components/menu/js/menuServiceProvider.js | onBackdropClick | function onBackdropClick(event) {
event.preventDefault();
event.stopPropagation();
scope.$apply(function() {
opts.mdMenuCtrl.close(true, { closeAll: true });
});
} | javascript | function onBackdropClick(event) {
event.preventDefault();
event.stopPropagation();
scope.$apply(function() {
opts.mdMenuCtrl.close(true, { closeAll: true });
});
} | [
"function",
"onBackdropClick",
"(",
"event",
")",
"{",
"event",
".",
"preventDefault",
"(",
")",
";",
"event",
".",
"stopPropagation",
"(",
")",
";",
"scope",
".",
"$apply",
"(",
"function",
"(",
")",
"{",
"opts",
".",
"mdMenuCtrl",
".",
"close",
"(",
... | Function to be called whenever the backdrop is clicked.
@param {!MouseEvent} event | [
"Function",
"to",
"be",
"called",
"whenever",
"the",
"backdrop",
"is",
"clicked",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/menu/js/menuServiceProvider.js#L234-L241 | train |
angular/material | src/components/menu/js/menuServiceProvider.js | captureClickListener | function captureClickListener(e) {
var target = e.target;
// Traverse up the event until we get to the menuContentEl to see if
// there is an ng-click and that the ng-click is not disabled
do {
if (target == opts.menuContentEl[0]) return;
if ((hasAnyAttrib... | javascript | function captureClickListener(e) {
var target = e.target;
// Traverse up the event until we get to the menuContentEl to see if
// there is an ng-click and that the ng-click is not disabled
do {
if (target == opts.menuContentEl[0]) return;
if ((hasAnyAttrib... | [
"function",
"captureClickListener",
"(",
"e",
")",
"{",
"var",
"target",
"=",
"e",
".",
"target",
";",
"// Traverse up the event until we get to the menuContentEl to see if",
"// there is an ng-click and that the ng-click is not disabled",
"do",
"{",
"if",
"(",
"target",
"=="... | Close menu on menu item click, if said menu-item is not disabled | [
"Close",
"menu",
"on",
"menu",
"item",
"click",
"if",
"said",
"menu",
"-",
"item",
"is",
"not",
"disabled"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/menu/js/menuServiceProvider.js#L346-L379 | train |
angular/material | src/components/menu/js/menuServiceProvider.js | firstVisibleChild | function firstVisibleChild() {
for (var i = 0; i < openMenuNode.children.length; ++i) {
if ($window.getComputedStyle(openMenuNode.children[i]).display != 'none') {
return openMenuNode.children[i];
}
}
} | javascript | function firstVisibleChild() {
for (var i = 0; i < openMenuNode.children.length; ++i) {
if ($window.getComputedStyle(openMenuNode.children[i]).display != 'none') {
return openMenuNode.children[i];
}
}
} | [
"function",
"firstVisibleChild",
"(",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"openMenuNode",
".",
"children",
".",
"length",
";",
"++",
"i",
")",
"{",
"if",
"(",
"$window",
".",
"getComputedStyle",
"(",
"openMenuNode",
".",
"childre... | Gets the first visible child in the openMenuNode
Necessary incase menu nodes are being dynamically hidden | [
"Gets",
"the",
"first",
"visible",
"child",
"in",
"the",
"openMenuNode",
"Necessary",
"incase",
"menu",
"nodes",
"are",
"being",
"dynamically",
"hidden"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/menu/js/menuServiceProvider.js#L569-L575 | train |
angular/material | docs/config/processors/componentsData.js | publicDocData | function publicDocData(doc, extraData) {
const options = _.assign(extraData || {}, { hasDemo: (doc.docType === 'directive') });
// This RegEx always retrieves the last source descriptor.
// For example it retrieves from `/opt/material/src/core/services/ripple/ripple.js` the following
// source descriptor: `src... | javascript | function publicDocData(doc, extraData) {
const options = _.assign(extraData || {}, { hasDemo: (doc.docType === 'directive') });
// This RegEx always retrieves the last source descriptor.
// For example it retrieves from `/opt/material/src/core/services/ripple/ripple.js` the following
// source descriptor: `src... | [
"function",
"publicDocData",
"(",
"doc",
",",
"extraData",
")",
"{",
"const",
"options",
"=",
"_",
".",
"assign",
"(",
"extraData",
"||",
"{",
"}",
",",
"{",
"hasDemo",
":",
"(",
"doc",
".",
"docType",
"===",
"'directive'",
")",
"}",
")",
";",
"// Th... | We don't need to publish all of a doc's data to the app, that will add many kilobytes of loading overhead. | [
"We",
"don",
"t",
"need",
"to",
"publish",
"all",
"of",
"a",
"doc",
"s",
"data",
"to",
"the",
"app",
"that",
"will",
"add",
"many",
"kilobytes",
"of",
"loading",
"overhead",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/docs/config/processors/componentsData.js#L6-L19 | train |
angular/material | src/components/bottomSheet/bottom-sheet.js | registerGestures | function registerGestures(element, parent) {
var deregister = $mdGesture.register(parent, 'drag', { horizontal: false });
parent.on('$md.dragstart', onDragStart)
.on('$md.drag', onDrag)
.on('$md.dragend', onDragEnd);
return function cleanupGestures() {
deregister();
pa... | javascript | function registerGestures(element, parent) {
var deregister = $mdGesture.register(parent, 'drag', { horizontal: false });
parent.on('$md.dragstart', onDragStart)
.on('$md.drag', onDrag)
.on('$md.dragend', onDragEnd);
return function cleanupGestures() {
deregister();
pa... | [
"function",
"registerGestures",
"(",
"element",
",",
"parent",
")",
"{",
"var",
"deregister",
"=",
"$mdGesture",
".",
"register",
"(",
"parent",
",",
"'drag'",
",",
"{",
"horizontal",
":",
"false",
"}",
")",
";",
"parent",
".",
"on",
"(",
"'$md.dragstart'"... | Adds the drag gestures to the bottom sheet. | [
"Adds",
"the",
"drag",
"gestures",
"to",
"the",
"bottom",
"sheet",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/bottomSheet/bottom-sheet.js#L307-L346 | train |
angular/material | src/components/dialog/dialog.js | MdDialogController | function MdDialogController($mdDialog, $mdConstant) {
// 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 isPrompt = this.$type == 'prompt';
if (isProm... | javascript | function MdDialogController($mdDialog, $mdConstant) {
// 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 isPrompt = this.$type == 'prompt';
if (isProm... | [
"function",
"MdDialogController",
"(",
"$mdDialog",
",",
"$mdConstant",
")",
"{",
"// 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",
"=",
"functi... | Controller for the md-dialog interim elements
@ngInject | [
"Controller",
"for",
"the",
"md",
"-",
"dialog",
"interim",
"elements"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/dialog/dialog.js#L647-L671 | train |
angular/material | src/components/dialog/dialog.js | onShow | function onShow(scope, element, options, controller) {
angular.element($document[0].body).addClass('md-dialog-is-showing');
var dialogElement = element.find('md-dialog');
// Once a dialog has `ng-cloak` applied on his template the dialog animation will not work properly.
// This is a very comm... | javascript | function onShow(scope, element, options, controller) {
angular.element($document[0].body).addClass('md-dialog-is-showing');
var dialogElement = element.find('md-dialog');
// Once a dialog has `ng-cloak` applied on his template the dialog animation will not work properly.
// This is a very comm... | [
"function",
"onShow",
"(",
"scope",
",",
"element",
",",
"options",
",",
"controller",
")",
"{",
"angular",
".",
"element",
"(",
"$document",
"[",
"0",
"]",
".",
"body",
")",
".",
"addClass",
"(",
"'md-dialog-is-showing'",
")",
";",
"var",
"dialogElement",... | Show method for dialogs | [
"Show",
"method",
"for",
"dialogs"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/dialog/dialog.js#L748-L801 | train |
angular/material | src/components/dialog/dialog.js | onRemove | function onRemove(scope, element, options) {
options.deactivateListeners();
options.unlockScreenReader();
options.hideBackdrop(options.$destroy);
// Remove the focus traps that we added earlier for keeping focus within the dialog.
if (topFocusTrap && topFocusTrap.parentNode) {
top... | javascript | function onRemove(scope, element, options) {
options.deactivateListeners();
options.unlockScreenReader();
options.hideBackdrop(options.$destroy);
// Remove the focus traps that we added earlier for keeping focus within the dialog.
if (topFocusTrap && topFocusTrap.parentNode) {
top... | [
"function",
"onRemove",
"(",
"scope",
",",
"element",
",",
"options",
")",
"{",
"options",
".",
"deactivateListeners",
"(",
")",
";",
"options",
".",
"unlockScreenReader",
"(",
")",
";",
"options",
".",
"hideBackdrop",
"(",
"options",
".",
"$destroy",
")",
... | Remove function for all dialogs | [
"Remove",
"function",
"for",
"all",
"dialogs"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/dialog/dialog.js#L806-L851 | train |
angular/material | src/components/dialog/dialog.js | detachAndClean | function detachAndClean() {
angular.element($document[0].body).removeClass('md-dialog-is-showing');
// Reverse the container stretch if using a content element.
if (options.contentElement) {
options.reverseContainerStretch();
}
// Exposed cleanup function from the $md... | javascript | function detachAndClean() {
angular.element($document[0].body).removeClass('md-dialog-is-showing');
// Reverse the container stretch if using a content element.
if (options.contentElement) {
options.reverseContainerStretch();
}
// Exposed cleanup function from the $md... | [
"function",
"detachAndClean",
"(",
")",
"{",
"angular",
".",
"element",
"(",
"$document",
"[",
"0",
"]",
".",
"body",
")",
".",
"removeClass",
"(",
"'md-dialog-is-showing'",
")",
";",
"// Reverse the container stretch if using a content element.",
"if",
"(",
"option... | Detach the element | [
"Detach",
"the",
"element"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/dialog/dialog.js#L835-L850 | train |
angular/material | src/components/dialog/dialog.js | getBoundingClientRect | function getBoundingClientRect (element, orig) {
var source = angular.element((element || {}));
if (source && source.length) {
// Compute and save the target element's bounding rect, so that if the
// element is hidden when the dialog closes, we can shrink the dialog
... | javascript | function getBoundingClientRect (element, orig) {
var source = angular.element((element || {}));
if (source && source.length) {
// Compute and save the target element's bounding rect, so that if the
// element is hidden when the dialog closes, we can shrink the dialog
... | [
"function",
"getBoundingClientRect",
"(",
"element",
",",
"orig",
")",
"{",
"var",
"source",
"=",
"angular",
".",
"element",
"(",
"(",
"element",
"||",
"{",
"}",
")",
")",
";",
"if",
"(",
"source",
"&&",
"source",
".",
"length",
")",
"{",
"// Compute a... | Identify the bounding RECT for the target element | [
"Identify",
"the",
"bounding",
"RECT",
"for",
"the",
"target",
"element"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/dialog/dialog.js#L912-L929 | train |
angular/material | src/components/dialog/dialog.js | getDomElement | function getDomElement(element, defaultElement) {
if (angular.isString(element)) {
element = $document[0].querySelector(element);
}
// If we have a reference to a raw dom element, always wrap it in jqLite
return angular.element(element || defaultElement);
... | javascript | function getDomElement(element, defaultElement) {
if (angular.isString(element)) {
element = $document[0].querySelector(element);
}
// If we have a reference to a raw dom element, always wrap it in jqLite
return angular.element(element || defaultElement);
... | [
"function",
"getDomElement",
"(",
"element",
",",
"defaultElement",
")",
"{",
"if",
"(",
"angular",
".",
"isString",
"(",
"element",
")",
")",
"{",
"element",
"=",
"$document",
"[",
"0",
"]",
".",
"querySelector",
"(",
"element",
")",
";",
"}",
"// If we... | If the specifier is a simple string selector, then query for
the DOM element. | [
"If",
"the",
"specifier",
"is",
"a",
"simple",
"string",
"selector",
"then",
"query",
"for",
"the",
"DOM",
"element",
"."
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/dialog/dialog.js#L935-L942 | train |
angular/material | src/components/dialog/dialog.js | activateListeners | function activateListeners(element, options) {
var window = angular.element($window);
var onWindowResize = $mdUtil.debounce(function() {
stretchDialogContainerToViewport(element, options);
}, 60);
var removeListeners = [];
var smartClose = function() {
// Only 'confirm' di... | javascript | function activateListeners(element, options) {
var window = angular.element($window);
var onWindowResize = $mdUtil.debounce(function() {
stretchDialogContainerToViewport(element, options);
}, 60);
var removeListeners = [];
var smartClose = function() {
// Only 'confirm' di... | [
"function",
"activateListeners",
"(",
"element",
",",
"options",
")",
"{",
"var",
"window",
"=",
"angular",
".",
"element",
"(",
"$window",
")",
";",
"var",
"onWindowResize",
"=",
"$mdUtil",
".",
"debounce",
"(",
"function",
"(",
")",
"{",
"stretchDialogCont... | Listen for escape keys and outside clicks to auto close | [
"Listen",
"for",
"escape",
"keys",
"and",
"outside",
"clicks",
"to",
"auto",
"close"
] | 84ac558674e73958be84312444c48d9f823f6684 | https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/dialog/dialog.js#L949-L1036 | train |
Subsets and Splits
SQL Console for semeru/code-text-javascript
Retrieves 20,000 non-null code samples labeled as JavaScript, providing a basic overview of the dataset.