id int32 0 58k | repo stringlengths 5 67 | path stringlengths 4 116 | func_name stringlengths 0 58 | original_string stringlengths 52 373k | language stringclasses 1
value | code stringlengths 52 373k | code_tokens list | docstring stringlengths 4 11.8k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 86 226 |
|---|---|---|---|---|---|---|---|---|---|---|---|
16,600 | camptocamp/ngeo | src/grid/component.js | isPlatformModifierKeyOnly | function isPlatformModifierKeyOnly(event) {
return !event.altKey &&
(olHas.MAC ? event.metaKey : event.ctrlKey) &&
!event.shiftKey;
} | javascript | function isPlatformModifierKeyOnly(event) {
return !event.altKey &&
(olHas.MAC ? event.metaKey : event.ctrlKey) &&
!event.shiftKey;
} | [
"function",
"isPlatformModifierKeyOnly",
"(",
"event",
")",
"{",
"return",
"!",
"event",
".",
"altKey",
"&&",
"(",
"olHas",
".",
"MAC",
"?",
"event",
".",
"metaKey",
":",
"event",
".",
"ctrlKey",
")",
"&&",
"!",
"event",
".",
"shiftKey",
";",
"}"
] | Same as `ol.events.condition.platformModifierKeyOnly`.
@param {JQueryEventObject} event Event.
@return {boolean} True if only the platform modifier key is pressed.
@private | [
"Same",
"as",
"ol",
".",
"events",
".",
"condition",
".",
"platformModifierKeyOnly",
"."
] | 0d9d84b70199bc3de9cf367a0b406c7b488d2077 | https://github.com/camptocamp/ngeo/blob/0d9d84b70199bc3de9cf367a0b406c7b488d2077/src/grid/component.js#L292-L296 |
16,601 | camptocamp/ngeo | src/grid/component.js | isShiftKeyOnly | function isShiftKeyOnly(event) {
return (
!event.altKey &&
!(event.metaKey || event.ctrlKey) &&
event.shiftKey);
} | javascript | function isShiftKeyOnly(event) {
return (
!event.altKey &&
!(event.metaKey || event.ctrlKey) &&
event.shiftKey);
} | [
"function",
"isShiftKeyOnly",
"(",
"event",
")",
"{",
"return",
"(",
"!",
"event",
".",
"altKey",
"&&",
"!",
"(",
"event",
".",
"metaKey",
"||",
"event",
".",
"ctrlKey",
")",
"&&",
"event",
".",
"shiftKey",
")",
";",
"}"
] | Same as `ol.events.condition.shiftKeyOnly`.
@param {JQueryEventObject} event Event.
@return {boolean} True if only the shift key is pressed.
@private | [
"Same",
"as",
"ol",
".",
"events",
".",
"condition",
".",
"shiftKeyOnly",
"."
] | 0d9d84b70199bc3de9cf367a0b406c7b488d2077 | https://github.com/camptocamp/ngeo/blob/0d9d84b70199bc3de9cf367a0b406c7b488d2077/src/grid/component.js#L305-L310 |
16,602 | camptocamp/ngeo | src/message/popoverComponent.js | messagePopoverComponent | function messagePopoverComponent() {
return {
restrict: 'A',
scope: true,
controller: 'NgeoPopoverController as popoverCtrl',
link: (scope, elem, attrs, ngeoPopoverCtrl) => {
if (!ngeoPopoverCtrl) {
throw new Error('Missing ngeoPopoverCtrl');
}
ngeoPopoverCtrl.anchorElm.on('... | javascript | function messagePopoverComponent() {
return {
restrict: 'A',
scope: true,
controller: 'NgeoPopoverController as popoverCtrl',
link: (scope, elem, attrs, ngeoPopoverCtrl) => {
if (!ngeoPopoverCtrl) {
throw new Error('Missing ngeoPopoverCtrl');
}
ngeoPopoverCtrl.anchorElm.on('... | [
"function",
"messagePopoverComponent",
"(",
")",
"{",
"return",
"{",
"restrict",
":",
"'A'",
",",
"scope",
":",
"true",
",",
"controller",
":",
"'NgeoPopoverController as popoverCtrl'",
",",
"link",
":",
"(",
"scope",
",",
"elem",
",",
"attrs",
",",
"ngeoPopov... | Provides a directive used to display a Bootstrap popover.
<div ngeo-popover>
<a ngeo-popover-anchor class="btn btn-info">anchor 1</a>
<div ngeo-popover-body>
<ul>
<li>action 1:
<input type="range"/>
</li>
</ul>
</div>
</div>
@ngdoc directive
@ngInject
@ngname ngeoPopover
@return {angular.IDirective} The Directive Def... | [
"Provides",
"a",
"directive",
"used",
"to",
"display",
"a",
"Bootstrap",
"popover",
"."
] | 0d9d84b70199bc3de9cf367a0b406c7b488d2077 | https://github.com/camptocamp/ngeo/blob/0d9d84b70199bc3de9cf367a0b406c7b488d2077/src/message/popoverComponent.js#L32-L68 |
16,603 | camptocamp/ngeo | src/message/popoverComponent.js | PopoverController | function PopoverController($scope) {
/**
* The state of the popover (displayed or not)
* @type {boolean}
*/
this.shown = false;
/**
* @type {?JQuery}
*/
this.anchorElm = null;
/**
* @type {?JQuery}
*/
this.bodyElm = null;
const clickHandler = (clickEvent) => {
if (!this.anchorE... | javascript | function PopoverController($scope) {
/**
* The state of the popover (displayed or not)
* @type {boolean}
*/
this.shown = false;
/**
* @type {?JQuery}
*/
this.anchorElm = null;
/**
* @type {?JQuery}
*/
this.bodyElm = null;
const clickHandler = (clickEvent) => {
if (!this.anchorE... | [
"function",
"PopoverController",
"(",
"$scope",
")",
"{",
"/**\n * The state of the popover (displayed or not)\n * @type {boolean}\n */",
"this",
".",
"shown",
"=",
"false",
";",
"/**\n * @type {?JQuery}\n */",
"this",
".",
"anchorElm",
"=",
"null",
";",
"/**\n * ... | The controller for the 'popover' directive.
@constructor
@ngInject
@ngdoc controller
@ngname NgeoPopoverController
@param {angular.IScope} $scope Scope.
@private
@hidden | [
"The",
"controller",
"for",
"the",
"popover",
"directive",
"."
] | 0d9d84b70199bc3de9cf367a0b406c7b488d2077 | https://github.com/camptocamp/ngeo/blob/0d9d84b70199bc3de9cf367a0b406c7b488d2077/src/message/popoverComponent.js#L119-L155 |
16,604 | camptocamp/ngeo | src/format/FeatureHash.js | encodeNumber_ | function encodeNumber_(num) {
let encodedNumber = '';
while (num >= 0x20) {
encodedNumber += CHAR64_.charAt(
0x20 | (num & 0x1f));
num >>= 5;
}
encodedNumber += CHAR64_.charAt(num);
return encodedNumber;
} | javascript | function encodeNumber_(num) {
let encodedNumber = '';
while (num >= 0x20) {
encodedNumber += CHAR64_.charAt(
0x20 | (num & 0x1f));
num >>= 5;
}
encodedNumber += CHAR64_.charAt(num);
return encodedNumber;
} | [
"function",
"encodeNumber_",
"(",
"num",
")",
"{",
"let",
"encodedNumber",
"=",
"''",
";",
"while",
"(",
"num",
">=",
"0x20",
")",
"{",
"encodedNumber",
"+=",
"CHAR64_",
".",
"charAt",
"(",
"0x20",
"|",
"(",
"num",
"&",
"0x1f",
")",
")",
";",
"num",
... | Transform a number into a logical sequence of characters.
@param {number} num Number.
@return {string} String.
@private
@hidden | [
"Transform",
"a",
"number",
"into",
"a",
"logical",
"sequence",
"of",
"characters",
"."
] | 0d9d84b70199bc3de9cf367a0b406c7b488d2077 | https://github.com/camptocamp/ngeo/blob/0d9d84b70199bc3de9cf367a0b406c7b488d2077/src/format/FeatureHash.js#L521-L530 |
16,605 | camptocamp/ngeo | src/format/FeatureHash.js | setStyleProperties_ | function setStyleProperties_(text, feature) {
const properties = getStyleProperties_(text, feature);
const geometry = feature.getGeometry();
// Deal with legacy properties
if (geometry instanceof olGeomPoint) {
if (properties.isLabel ||
properties[ngeoFormatFeatureProperties.IS_TEXT]) {
dele... | javascript | function setStyleProperties_(text, feature) {
const properties = getStyleProperties_(text, feature);
const geometry = feature.getGeometry();
// Deal with legacy properties
if (geometry instanceof olGeomPoint) {
if (properties.isLabel ||
properties[ngeoFormatFeatureProperties.IS_TEXT]) {
dele... | [
"function",
"setStyleProperties_",
"(",
"text",
",",
"feature",
")",
"{",
"const",
"properties",
"=",
"getStyleProperties_",
"(",
"text",
",",
"feature",
")",
";",
"const",
"geometry",
"=",
"feature",
".",
"getGeometry",
"(",
")",
";",
"// Deal with legacy prope... | Read a logical sequence of characters and apply the decoded result as
style properties for the feature. Legacy keys are converted to the new ones
for compatibility.
@param {string} text Text.
@param {import("ol/Feature.js").default} feature Feature.
@private
@hidden | [
"Read",
"a",
"logical",
"sequence",
"of",
"characters",
"and",
"apply",
"the",
"decoded",
"result",
"as",
"style",
"properties",
"for",
"the",
"feature",
".",
"Legacy",
"keys",
"are",
"converted",
"to",
"the",
"new",
"ones",
"for",
"compatibility",
"."
] | 0d9d84b70199bc3de9cf367a0b406c7b488d2077 | https://github.com/camptocamp/ngeo/blob/0d9d84b70199bc3de9cf367a0b406c7b488d2077/src/format/FeatureHash.js#L940-L987 |
16,606 | camptocamp/ngeo | src/format/FeatureHash.js | castValue_ | function castValue_(key, value) {
const numProperties = [
ngeoFormatFeatureProperties.ANGLE,
ngeoFormatFeatureProperties.OPACITY,
ngeoFormatFeatureProperties.SIZE,
ngeoFormatFeatureProperties.STROKE,
'pointRadius',
'strokeWidth'
];
const boolProperties = [
ngeoFormatFeatureProperties.I... | javascript | function castValue_(key, value) {
const numProperties = [
ngeoFormatFeatureProperties.ANGLE,
ngeoFormatFeatureProperties.OPACITY,
ngeoFormatFeatureProperties.SIZE,
ngeoFormatFeatureProperties.STROKE,
'pointRadius',
'strokeWidth'
];
const boolProperties = [
ngeoFormatFeatureProperties.I... | [
"function",
"castValue_",
"(",
"key",
",",
"value",
")",
"{",
"const",
"numProperties",
"=",
"[",
"ngeoFormatFeatureProperties",
".",
"ANGLE",
",",
"ngeoFormatFeatureProperties",
".",
"OPACITY",
",",
"ngeoFormatFeatureProperties",
".",
"SIZE",
",",
"ngeoFormatFeatureP... | Cast values in the correct type depending on the property.
@param {string} key Key.
@param {string} value Value.
@return {number|boolean|string} The casted value corresponding to the key.
@private
@hidden
@hidden | [
"Cast",
"values",
"in",
"the",
"correct",
"type",
"depending",
"on",
"the",
"property",
"."
] | 0d9d84b70199bc3de9cf367a0b406c7b488d2077 | https://github.com/camptocamp/ngeo/blob/0d9d84b70199bc3de9cf367a0b406c7b488d2077/src/format/FeatureHash.js#L998-L1027 |
16,607 | camptocamp/ngeo | src/format/FeatureHash.js | getStyleProperties_ | function getStyleProperties_(text, feature) {
const parts = text.split('\'');
/** @type {Object<string, boolean|number|string>} */
const properties = {};
for (let i = 0; i < parts.length; ++i) {
const part = decodeURIComponent(parts[i]);
const keyVal = part.split('*');
console.assert(keyVal.length ... | javascript | function getStyleProperties_(text, feature) {
const parts = text.split('\'');
/** @type {Object<string, boolean|number|string>} */
const properties = {};
for (let i = 0; i < parts.length; ++i) {
const part = decodeURIComponent(parts[i]);
const keyVal = part.split('*');
console.assert(keyVal.length ... | [
"function",
"getStyleProperties_",
"(",
"text",
",",
"feature",
")",
"{",
"const",
"parts",
"=",
"text",
".",
"split",
"(",
"'\\''",
")",
";",
"/** @type {Object<string, boolean|number|string>} */",
"const",
"properties",
"=",
"{",
"}",
";",
"for",
"(",
"let",
... | From a logical sequence of characters, create and return an object of
style properties for a feature. The values are cast in the correct type
depending on the property. Some properties are also deleted when they don't
match the geometry of the feature.
@param {string} text Text.
@param {import("ol/Feature.js").default}... | [
"From",
"a",
"logical",
"sequence",
"of",
"characters",
"create",
"and",
"return",
"an",
"object",
"of",
"style",
"properties",
"for",
"a",
"feature",
".",
"The",
"values",
"are",
"cast",
"in",
"the",
"correct",
"type",
"depending",
"on",
"the",
"property",
... | 0d9d84b70199bc3de9cf367a0b406c7b488d2077 | https://github.com/camptocamp/ngeo/blob/0d9d84b70199bc3de9cf367a0b406c7b488d2077/src/format/FeatureHash.js#L1040-L1056 |
16,608 | camptocamp/ngeo | contribs/gmf/src/mobile/measure/lengthComponent.js | mobileMeasureLenthComponent | function mobileMeasureLenthComponent(gmfMobileMeasureLengthTemplateUrl) {
return {
restrict: 'A',
scope: {
'active': '=gmfMobileMeasurelengthActive',
'precision': '<?gmfMobileMeasurelengthPrecision',
'map': '=gmfMobileMeasurelengthMap',
'sketchStyle': '=?gmfMobileMeasurelengthSketchsty... | javascript | function mobileMeasureLenthComponent(gmfMobileMeasureLengthTemplateUrl) {
return {
restrict: 'A',
scope: {
'active': '=gmfMobileMeasurelengthActive',
'precision': '<?gmfMobileMeasurelengthPrecision',
'map': '=gmfMobileMeasurelengthMap',
'sketchStyle': '=?gmfMobileMeasurelengthSketchsty... | [
"function",
"mobileMeasureLenthComponent",
"(",
"gmfMobileMeasureLengthTemplateUrl",
")",
"{",
"return",
"{",
"restrict",
":",
"'A'",
",",
"scope",
":",
"{",
"'active'",
":",
"'=gmfMobileMeasurelengthActive'",
",",
"'precision'",
":",
"'<?gmfMobileMeasurelengthPrecision'",
... | Provide a directive to do a length measure on the mobile devices.
Example:
<div gmf-mobile-measurelength
gmf-mobile-measurelength-active="ctrl.measureLengthActive"
gmf-mobile-measurelength-map="::ctrl.map">
</div>
@htmlAttribute {boolean} gmf-mobile-measurelength-active Used to active
or deactivate the component.
@h... | [
"Provide",
"a",
"directive",
"to",
"do",
"a",
"length",
"measure",
"on",
"the",
"mobile",
"devices",
"."
] | 0d9d84b70199bc3de9cf367a0b406c7b488d2077 | https://github.com/camptocamp/ngeo/blob/0d9d84b70199bc3de9cf367a0b406c7b488d2077/contribs/gmf/src/mobile/measure/lengthComponent.js#L57-L82 |
16,609 | camptocamp/ngeo | contribs/gmf/src/contextualdata/component.js | contextualDataComponent | function contextualDataComponent() {
return {
restrict: 'A',
scope: false,
controller: 'GmfContextualdataController as cdCtrl',
bindToController: {
'map': '<gmfContextualdataMap',
'projections': '<gmfContextualdataProjections',
'callback': '<gmfContextualdataCallback'
},
/**
... | javascript | function contextualDataComponent() {
return {
restrict: 'A',
scope: false,
controller: 'GmfContextualdataController as cdCtrl',
bindToController: {
'map': '<gmfContextualdataMap',
'projections': '<gmfContextualdataProjections',
'callback': '<gmfContextualdataCallback'
},
/**
... | [
"function",
"contextualDataComponent",
"(",
")",
"{",
"return",
"{",
"restrict",
":",
"'A'",
",",
"scope",
":",
"false",
",",
"controller",
":",
"'GmfContextualdataController as cdCtrl'",
",",
"bindToController",
":",
"{",
"'map'",
":",
"'<gmfContextualdataMap'",
",... | Provide a directive responsible of displaying contextual data after a right
click on the map.
This directive doesn't require being rendered in a visible DOM element.
It's usually added to the element where the map directive is also added.
Example:
<gmf-map gmf-map-map="mainCtrl.map"
gmf-contextualdata
gmf-contextual... | [
"Provide",
"a",
"directive",
"responsible",
"of",
"displaying",
"contextual",
"data",
"after",
"a",
"right",
"click",
"on",
"the",
"map",
"."
] | 0d9d84b70199bc3de9cf367a0b406c7b488d2077 | https://github.com/camptocamp/ngeo/blob/0d9d84b70199bc3de9cf367a0b406c7b488d2077/contribs/gmf/src/contextualdata/component.js#L51-L74 |
16,610 | camptocamp/ngeo | src/message/popupComponent.js | messagePopopComponent | function messagePopopComponent(ngeoPopupTemplateUrl) {
return {
restrict: 'A',
templateUrl: ngeoPopupTemplateUrl,
/**
* @param {angular.IScope} scope Scope.
* @param {JQuery} element Element.
* @param {angular.IAttributes} attrs Attributes.
*/
link: (scope, element, attrs) => {
... | javascript | function messagePopopComponent(ngeoPopupTemplateUrl) {
return {
restrict: 'A',
templateUrl: ngeoPopupTemplateUrl,
/**
* @param {angular.IScope} scope Scope.
* @param {JQuery} element Element.
* @param {angular.IAttributes} attrs Attributes.
*/
link: (scope, element, attrs) => {
... | [
"function",
"messagePopopComponent",
"(",
"ngeoPopupTemplateUrl",
")",
"{",
"return",
"{",
"restrict",
":",
"'A'",
",",
"templateUrl",
":",
"ngeoPopupTemplateUrl",
",",
"/**\n * @param {angular.IScope} scope Scope.\n * @param {JQuery} element Element.\n * @param {angular.... | Provides a directive used to show a popup over the page with
a title and content.
Things to know about this directive:
- This directive is intended to be used along with the popup service.
- By default the directive uses "popup.html" as its templateUrl. This can be
changed by redefining the "ngeoPopupTemplateUrl" v... | [
"Provides",
"a",
"directive",
"used",
"to",
"show",
"a",
"popup",
"over",
"the",
"page",
"with",
"a",
"title",
"and",
"content",
"."
] | 0d9d84b70199bc3de9cf367a0b406c7b488d2077 | https://github.com/camptocamp/ngeo/blob/0d9d84b70199bc3de9cf367a0b406c7b488d2077/src/message/popupComponent.js#L53-L82 |
16,611 | camptocamp/ngeo | src/query/mapQueryComponent.js | queryMapComponent | function queryMapComponent(ngeoMapQuerent, ngeoQueryKeyboard, $injector) {
return {
restrict: 'A',
scope: false,
link: (scope, elem, attrs) => {
const map = scope.$eval(attrs['ngeoMapQueryMap']);
/** @type {Array<import('ol/events.js').EventsKey>} */
const listenerKeys_ = [];
/**
... | javascript | function queryMapComponent(ngeoMapQuerent, ngeoQueryKeyboard, $injector) {
return {
restrict: 'A',
scope: false,
link: (scope, elem, attrs) => {
const map = scope.$eval(attrs['ngeoMapQueryMap']);
/** @type {Array<import('ol/events.js').EventsKey>} */
const listenerKeys_ = [];
/**
... | [
"function",
"queryMapComponent",
"(",
"ngeoMapQuerent",
",",
"ngeoQueryKeyboard",
",",
"$injector",
")",
"{",
"return",
"{",
"restrict",
":",
"'A'",
",",
"scope",
":",
"false",
",",
"link",
":",
"(",
"scope",
",",
"elem",
",",
"attrs",
")",
"=>",
"{",
"c... | Provides a "map query" directive.
This directive is responsible of binding a map and the ngeo query service
together. While active, clicks made on the map are listened by the directive
and a request gets issued to the query service.
This directive doesn't require to be rendered in a visible DOM element, but
it could ... | [
"Provides",
"a",
"map",
"query",
"directive",
"."
] | 0d9d84b70199bc3de9cf367a0b406c7b488d2077 | https://github.com/camptocamp/ngeo/blob/0d9d84b70199bc3de9cf367a0b406c7b488d2077/src/query/mapQueryComponent.js#L52-L139 |
16,612 | camptocamp/ngeo | src/query/mapQueryComponent.js | function(evt) {
if (evt instanceof MapBrowserEvent) {
const action = ngeoQueryKeyboard.action;
const coordinate = evt.coordinate;
ngeoMapQuerent.issue({
action,
coordinate,
map
});
}
} | javascript | function(evt) {
if (evt instanceof MapBrowserEvent) {
const action = ngeoQueryKeyboard.action;
const coordinate = evt.coordinate;
ngeoMapQuerent.issue({
action,
coordinate,
map
});
}
} | [
"function",
"(",
"evt",
")",
"{",
"if",
"(",
"evt",
"instanceof",
"MapBrowserEvent",
")",
"{",
"const",
"action",
"=",
"ngeoQueryKeyboard",
".",
"action",
";",
"const",
"coordinate",
"=",
"evt",
".",
"coordinate",
";",
"ngeoMapQuerent",
".",
"issue",
"(",
... | Called when the map is clicked while this controller is active. Issue
a request to the query service using the coordinate that was clicked.
@param {Event|import("ol/events/Event.js").default} evt The map browser event being fired. | [
"Called",
"when",
"the",
"map",
"is",
"clicked",
"while",
"this",
"controller",
"is",
"active",
".",
"Issue",
"a",
"request",
"to",
"the",
"query",
"service",
"using",
"the",
"coordinate",
"that",
"was",
"clicked",
"."
] | 0d9d84b70199bc3de9cf367a0b406c7b488d2077 | https://github.com/camptocamp/ngeo/blob/0d9d84b70199bc3de9cf367a0b406c7b488d2077/src/query/mapQueryComponent.js#L66-L76 | |
16,613 | camptocamp/ngeo | src/query/mapQueryComponent.js | function(evt) {
if (evt instanceof MapBrowserEvent && !evt.dragging) {
const pixel = map.getEventPixel(evt.originalEvent);
const queryable = function(layer) {
const visible = layer.get('visible');
const sourceids = layer.get('querySourceIds');
return visib... | javascript | function(evt) {
if (evt instanceof MapBrowserEvent && !evt.dragging) {
const pixel = map.getEventPixel(evt.originalEvent);
const queryable = function(layer) {
const visible = layer.get('visible');
const sourceids = layer.get('querySourceIds');
return visib... | [
"function",
"(",
"evt",
")",
"{",
"if",
"(",
"evt",
"instanceof",
"MapBrowserEvent",
"&&",
"!",
"evt",
".",
"dragging",
")",
"{",
"const",
"pixel",
"=",
"map",
".",
"getEventPixel",
"(",
"evt",
".",
"originalEvent",
")",
";",
"const",
"queryable",
"=",
... | Called when the pointer is moved while this controller is active.
Change the mouse pointer when hovering a non-transparent pixel on the
map.
@param {Event|import("ol/events/Event.js").default} evt The map browser event being fired. | [
"Called",
"when",
"the",
"pointer",
"is",
"moved",
"while",
"this",
"controller",
"is",
"active",
".",
"Change",
"the",
"mouse",
"pointer",
"when",
"hovering",
"a",
"non",
"-",
"transparent",
"pixel",
"on",
"the",
"map",
"."
] | 0d9d84b70199bc3de9cf367a0b406c7b488d2077 | https://github.com/camptocamp/ngeo/blob/0d9d84b70199bc3de9cf367a0b406c7b488d2077/src/query/mapQueryComponent.js#L84-L95 | |
16,614 | camptocamp/ngeo | src/query/mapQueryComponent.js | function() {
listenerKeys_.push(
olEventsListen(map, 'singleclick', handleMapClick_)
);
const queryOptions = /** @type {import('ngeo/query/MapQuerent.js').QueryOptions} */ (
$injector.has('ngeoQueryOptions') ? $injector.get('ngeoQueryOptions') : {}
);
if (quer... | javascript | function() {
listenerKeys_.push(
olEventsListen(map, 'singleclick', handleMapClick_)
);
const queryOptions = /** @type {import('ngeo/query/MapQuerent.js').QueryOptions} */ (
$injector.has('ngeoQueryOptions') ? $injector.get('ngeoQueryOptions') : {}
);
if (quer... | [
"function",
"(",
")",
"{",
"listenerKeys_",
".",
"push",
"(",
"olEventsListen",
"(",
"map",
",",
"'singleclick'",
",",
"handleMapClick_",
")",
")",
";",
"const",
"queryOptions",
"=",
"/** @type {import('ngeo/query/MapQuerent.js').QueryOptions} */",
"(",
"$injector",
"... | Listen to the map events. | [
"Listen",
"to",
"the",
"map",
"events",
"."
] | 0d9d84b70199bc3de9cf367a0b406c7b488d2077 | https://github.com/camptocamp/ngeo/blob/0d9d84b70199bc3de9cf367a0b406c7b488d2077/src/query/mapQueryComponent.js#L100-L112 | |
16,615 | camptocamp/ngeo | src/query/mapQueryComponent.js | function() {
for (const lk of listenerKeys_) {
olEventsUnlistenByKey(lk);
}
listenerKeys_.length = 0;
if (scope.$eval(attrs['ngeoMapQueryAutoclear']) !== false) {
ngeoMapQuerent.clear();
}
} | javascript | function() {
for (const lk of listenerKeys_) {
olEventsUnlistenByKey(lk);
}
listenerKeys_.length = 0;
if (scope.$eval(attrs['ngeoMapQueryAutoclear']) !== false) {
ngeoMapQuerent.clear();
}
} | [
"function",
"(",
")",
"{",
"for",
"(",
"const",
"lk",
"of",
"listenerKeys_",
")",
"{",
"olEventsUnlistenByKey",
"(",
"lk",
")",
";",
"}",
"listenerKeys_",
".",
"length",
"=",
"0",
";",
"if",
"(",
"scope",
".",
"$eval",
"(",
"attrs",
"[",
"'ngeoMapQuery... | Unlisten the map events. | [
"Unlisten",
"the",
"map",
"events",
"."
] | 0d9d84b70199bc3de9cf367a0b406c7b488d2077 | https://github.com/camptocamp/ngeo/blob/0d9d84b70199bc3de9cf367a0b406c7b488d2077/src/query/mapQueryComponent.js#L117-L125 | |
16,616 | camptocamp/ngeo | contribs/gmf/src/objectediting/Query.js | getQueryableLayersInfoFromThemes | function getQueryableLayersInfoFromThemes(
themes, ogcServers
) {
const queryableLayersInfo = [];
let theme;
let group;
let nodes;
for (let i = 0, ii = themes.length; i < ii; i++) {
theme = /** @type {import('gmf/themes.js').GmfTheme} */ (themes[i]);
for (let j = 0, jj = theme.children.length; j < ... | javascript | function getQueryableLayersInfoFromThemes(
themes, ogcServers
) {
const queryableLayersInfo = [];
let theme;
let group;
let nodes;
for (let i = 0, ii = themes.length; i < ii; i++) {
theme = /** @type {import('gmf/themes.js').GmfTheme} */ (themes[i]);
for (let j = 0, jj = theme.children.length; j < ... | [
"function",
"getQueryableLayersInfoFromThemes",
"(",
"themes",
",",
"ogcServers",
")",
"{",
"const",
"queryableLayersInfo",
"=",
"[",
"]",
";",
"let",
"theme",
";",
"let",
"group",
";",
"let",
"nodes",
";",
"for",
"(",
"let",
"i",
"=",
"0",
",",
"ii",
"=... | From a list of theme nodes, collect all WMS layer nodes that are queryable.
A list of OGC servers is given in order to bind each queryable layer node
to its associated server and be able to build requests.
@param {Array.<import('gmf/themes.js').GmfTheme>} themes List of theme nodes.
@param {import('gmf/themes.js').Gmf... | [
"From",
"a",
"list",
"of",
"theme",
"nodes",
"collect",
"all",
"WMS",
"layer",
"nodes",
"that",
"are",
"queryable",
".",
"A",
"list",
"of",
"OGC",
"servers",
"is",
"given",
"in",
"order",
"to",
"bind",
"each",
"queryable",
"layer",
"node",
"to",
"its",
... | 0d9d84b70199bc3de9cf367a0b406c7b488d2077 | https://github.com/camptocamp/ngeo/blob/0d9d84b70199bc3de9cf367a0b406c7b488d2077/contribs/gmf/src/objectediting/Query.js#L102-L146 |
16,617 | camptocamp/ngeo | src/misc/datepickerComponent.js | datePickerComponent | function datePickerComponent(ngeoDatePickerTemplateUrl, $timeout) {
return {
scope: {
onDateSelected: '&',
time: '='
},
bindToController: true,
controller: 'ngeoDatePickerController as datepickerCtrl',
restrict: 'AE',
templateUrl: ngeoDatePickerTemplateUrl,
link: (scope, elemen... | javascript | function datePickerComponent(ngeoDatePickerTemplateUrl, $timeout) {
return {
scope: {
onDateSelected: '&',
time: '='
},
bindToController: true,
controller: 'ngeoDatePickerController as datepickerCtrl',
restrict: 'AE',
templateUrl: ngeoDatePickerTemplateUrl,
link: (scope, elemen... | [
"function",
"datePickerComponent",
"(",
"ngeoDatePickerTemplateUrl",
",",
"$timeout",
")",
"{",
"return",
"{",
"scope",
":",
"{",
"onDateSelected",
":",
"'&'",
",",
"time",
":",
"'='",
"}",
",",
"bindToController",
":",
"true",
",",
"controller",
":",
"'ngeoDa... | Provide a directive to select a single date or a range of dates. Requires
jQuery UI for the 'datepicker' widget.
@param {string|function(!JQuery=, !angular.IAttributes=): string}
ngeoDatePickerTemplateUrl Template for the directive.
@param {angular.ITimeoutService} $timeout angular timeout service
@return {angular.IDi... | [
"Provide",
"a",
"directive",
"to",
"select",
"a",
"single",
"date",
"or",
"a",
"range",
"of",
"dates",
".",
"Requires",
"jQuery",
"UI",
"for",
"the",
"datepicker",
"widget",
"."
] | 0d9d84b70199bc3de9cf367a0b406c7b488d2077 | https://github.com/camptocamp/ngeo/blob/0d9d84b70199bc3de9cf367a0b406c7b488d2077/src/misc/datepickerComponent.js#L54-L107 |
16,618 | camptocamp/ngeo | src/misc/datepickerComponent.js | Controller | function Controller($scope, ngeoTime, gettextCatalog) {
/**
* @type {import("ngeo/misc/Time.js").Time}
* @private
*/
this.ngeoTime_ = ngeoTime;
/**
* @type {?import('ngeo/datasource/OGC.js').TimeProperty}
*/
this.time = null;
/**
* The gettext catalog
* @type {!angular.gettext.gettextC... | javascript | function Controller($scope, ngeoTime, gettextCatalog) {
/**
* @type {import("ngeo/misc/Time.js").Time}
* @private
*/
this.ngeoTime_ = ngeoTime;
/**
* @type {?import('ngeo/datasource/OGC.js').TimeProperty}
*/
this.time = null;
/**
* The gettext catalog
* @type {!angular.gettext.gettextC... | [
"function",
"Controller",
"(",
"$scope",
",",
"ngeoTime",
",",
"gettextCatalog",
")",
"{",
"/**\n * @type {import(\"ngeo/misc/Time.js\").Time}\n * @private\n */",
"this",
".",
"ngeoTime_",
"=",
"ngeoTime",
";",
"/**\n * @type {?import('ngeo/datasource/OGC.js').TimeProperty}... | DatePickerController - directive conttroller
@param {!angular.IScope} $scope Angular scope.
@param {!import("ngeo/misc/Time.js").Time} ngeoTime time service.
@param {!angular.gettext.gettextCatalog} gettextCatalog service.
@constructor
@private
@hidden
@ngInject
@ngdoc controller
@ngname ngeoDatePickerController | [
"DatePickerController",
"-",
"directive",
"conttroller"
] | 0d9d84b70199bc3de9cf367a0b406c7b488d2077 | https://github.com/camptocamp/ngeo/blob/0d9d84b70199bc3de9cf367a0b406c7b488d2077/src/misc/datepickerComponent.js#L124-L222 |
16,619 | camptocamp/ngeo | examples/elevationProfile.js | function(type, key, opt_childKey) {
return (
/**
* @param {Object} item
* @return {any}
*/
function(item) {
if (opt_childKey !== undefined) {
item = item[opt_childKey];
}
return item[key];
});
} | javascript | function(type, key, opt_childKey) {
return (
/**
* @param {Object} item
* @return {any}
*/
function(item) {
if (opt_childKey !== undefined) {
item = item[opt_childKey];
}
return item[key];
});
} | [
"function",
"(",
"type",
",",
"key",
",",
"opt_childKey",
")",
"{",
"return",
"(",
"/**\n * @param {Object} item\n * @return {any}\n */",
"function",
"(",
"item",
")",
"{",
"if",
"(",
"opt_childKey",
"!==",
"undefined",
")",
"{",
"item",
"=",
"it... | Factory for creating simple getter functions for extractors.
If the value is in a child property, the opt_childKey must be defined.
The type parameter is used by closure to type the returned function.
@param {any} type An object of the expected result type.
@param {string} key Key used for retrieving the value.
@param ... | [
"Factory",
"for",
"creating",
"simple",
"getter",
"functions",
"for",
"extractors",
".",
"If",
"the",
"value",
"is",
"in",
"a",
"child",
"property",
"the",
"opt_childKey",
"must",
"be",
"defined",
".",
"The",
"type",
"parameter",
"is",
"used",
"by",
"closure... | 0d9d84b70199bc3de9cf367a0b406c7b488d2077 | https://github.com/camptocamp/ngeo/blob/0d9d84b70199bc3de9cf367a0b406c7b488d2077/examples/elevationProfile.js#L143-L155 | |
16,620 | camptocamp/ngeo | src/profile/elevationComponent.js | profileElevationComponent | function profileElevationComponent(ngeoDebounce) {
return {
restrict: 'A',
/**
* @param {angular.IScope} scope Scope.
* @param {JQuery} element Element.
* @param {angular.IAttributes} attrs Attributes.
*/
link: (scope, element, attrs) => {
const optionsAttr = attrs['ngeoProfileO... | javascript | function profileElevationComponent(ngeoDebounce) {
return {
restrict: 'A',
/**
* @param {angular.IScope} scope Scope.
* @param {JQuery} element Element.
* @param {angular.IAttributes} attrs Attributes.
*/
link: (scope, element, attrs) => {
const optionsAttr = attrs['ngeoProfileO... | [
"function",
"profileElevationComponent",
"(",
"ngeoDebounce",
")",
"{",
"return",
"{",
"restrict",
":",
"'A'",
",",
"/**\n * @param {angular.IScope} scope Scope.\n * @param {JQuery} element Element.\n * @param {angular.IAttributes} attrs Attributes.\n */",
"link",
":",
... | Provides a directive used to insert an elevation profile chart
in the DOM.
Example:
<div ngeo-profile="ctrl.profileData"
ngeo-profile-options="ctrl.profileOptions"
ngeo-profile-pois="ctrl.profilePois">
</div>
Where `ctrl.profileOptions` is of type {@link ProfileOptions}; `ctrl.profileData` and `ctrl.profilePois`
are... | [
"Provides",
"a",
"directive",
"used",
"to",
"insert",
"an",
"elevation",
"profile",
"chart",
"in",
"the",
"DOM",
"."
] | 0d9d84b70199bc3de9cf367a0b406c7b488d2077 | https://github.com/camptocamp/ngeo/blob/0d9d84b70199bc3de9cf367a0b406c7b488d2077/src/profile/elevationComponent.js#L113-L203 |
16,621 | camptocamp/ngeo | src/misc/sortableComponent.js | sortableComponent | function sortableComponent($timeout) {
return {
restrict: 'A',
/**
* @param {angular.IScope} scope Scope.
* @param {JQuery} element Element.
* @param {angular.IAttributes} attrs Attributes.
*/
link: (scope, element, attrs) => {
const sortable = /** @type {Array} */
... | javascript | function sortableComponent($timeout) {
return {
restrict: 'A',
/**
* @param {angular.IScope} scope Scope.
* @param {JQuery} element Element.
* @param {angular.IAttributes} attrs Attributes.
*/
link: (scope, element, attrs) => {
const sortable = /** @type {Array} */
... | [
"function",
"sortableComponent",
"(",
"$timeout",
")",
"{",
"return",
"{",
"restrict",
":",
"'A'",
",",
"/**\n * @param {angular.IScope} scope Scope.\n * @param {JQuery} element Element.\n * @param {angular.IAttributes} attrs Attributes.\n */",
"link",
":",
"(",
"scop... | Provides a directive that allows drag-and-dropping DOM items between them.
It also changes the order of elements in the given array.
It is typically used together with `ng-repeat`, for example for re-ordering
layers in a map.
Example:
<ul ngeo-sortable="ctrl.layers"
ngeo-sortable-options="{handleClassName: 'ngeo-sor... | [
"Provides",
"a",
"directive",
"that",
"allows",
"drag",
"-",
"and",
"-",
"dropping",
"DOM",
"items",
"between",
"them",
".",
"It",
"also",
"changes",
"the",
"order",
"of",
"elements",
"in",
"the",
"given",
"array",
"."
] | 0d9d84b70199bc3de9cf367a0b406c7b488d2077 | https://github.com/camptocamp/ngeo/blob/0d9d84b70199bc3de9cf367a0b406c7b488d2077/src/misc/sortableComponent.js#L63-L169 |
16,622 | camptocamp/ngeo | src/misc/filters.js | NumberFilter | function NumberFilter($locale) {
const formats = $locale.NUMBER_FORMATS;
/**
* @param {number} number The number to format.
* @param {number=} opt_precision The used precision, default is 3.
* @return {string} The formatted string.
*/
const result = function(number, opt_precision) {
const groupSe... | javascript | function NumberFilter($locale) {
const formats = $locale.NUMBER_FORMATS;
/**
* @param {number} number The number to format.
* @param {number=} opt_precision The used precision, default is 3.
* @return {string} The formatted string.
*/
const result = function(number, opt_precision) {
const groupSe... | [
"function",
"NumberFilter",
"(",
"$locale",
")",
"{",
"const",
"formats",
"=",
"$locale",
".",
"NUMBER_FORMATS",
";",
"/**\n * @param {number} number The number to format.\n * @param {number=} opt_precision The used precision, default is 3.\n * @return {string} The formatted string.\... | A filter used to format a number with a precision, using the locale.
Arguments:
- opt_precision: The used precision, default is 3.
Examples:
{{0.1234 | ngeoNumber}} => 0.123
{{1.234 | ngeoNumber}} => 1.23
{{12.34 | ngeoNumber}} => 12.3
{{123.4 | ngeoNumber}} => 123
{{1234 | ngeoNumber}} => 1230
@param {angular.ILoc... | [
"A",
"filter",
"used",
"to",
"format",
"a",
"number",
"with",
"a",
"precision",
"using",
"the",
"locale",
"."
] | 0d9d84b70199bc3de9cf367a0b406c7b488d2077 | https://github.com/camptocamp/ngeo/blob/0d9d84b70199bc3de9cf367a0b406c7b488d2077/src/misc/filters.js#L126-L184 |
16,623 | camptocamp/ngeo | src/misc/filters.js | UnitPrefixFilter | function UnitPrefixFilter($filter) {
const numberFilter = $filter('ngeoNumber');
const standardPrefix = ['', 'k', 'M', 'G', 'T', 'P'];
const binaryPrefix = ['', 'Ki', 'Mi', 'Gi', 'Ti', 'Pi'];
/**
* @param {number} number The number to format.
* @param {string=} opt_unit The unit to used, default is ''.
... | javascript | function UnitPrefixFilter($filter) {
const numberFilter = $filter('ngeoNumber');
const standardPrefix = ['', 'k', 'M', 'G', 'T', 'P'];
const binaryPrefix = ['', 'Ki', 'Mi', 'Gi', 'Ti', 'Pi'];
/**
* @param {number} number The number to format.
* @param {string=} opt_unit The unit to used, default is ''.
... | [
"function",
"UnitPrefixFilter",
"(",
"$filter",
")",
"{",
"const",
"numberFilter",
"=",
"$filter",
"(",
"'ngeoNumber'",
")",
";",
"const",
"standardPrefix",
"=",
"[",
"''",
",",
"'k'",
",",
"'M'",
",",
"'G'",
",",
"'T'",
",",
"'P'",
"]",
";",
"const",
... | A filter used to format a number with the prefix and unit
Arguments:
- opt_unit: The unit to used, default is ''.
- opt_type: (unit|square|binary) the type of units, default is 'unit'.
- opt_precision: The used precision, default is 3.
Examples:
{{25000 | ngeoUnitPrefix}} => 25 k
{{25000 | ngeoUnitPrefix:'m'}} => 25... | [
"A",
"filter",
"used",
"to",
"format",
"a",
"number",
"with",
"the",
"prefix",
"and",
"unit"
] | 0d9d84b70199bc3de9cf367a0b406c7b488d2077 | https://github.com/camptocamp/ngeo/blob/0d9d84b70199bc3de9cf367a0b406c7b488d2077/src/misc/filters.js#L210-L246 |
16,624 | camptocamp/ngeo | src/misc/filters.js | NumberCoordinatesFilter | function NumberCoordinatesFilter($filter) {
/**
* @param {import("ol/coordinate.js").Coordinate} coordinates Array of two numbers.
* @param {(number|string)=} opt_fractionDigits Optional number of digit.
* Default to 0.
* @param {string=} opt_template Optional template. Default to '{x} {y}'.
* ... | javascript | function NumberCoordinatesFilter($filter) {
/**
* @param {import("ol/coordinate.js").Coordinate} coordinates Array of two numbers.
* @param {(number|string)=} opt_fractionDigits Optional number of digit.
* Default to 0.
* @param {string=} opt_template Optional template. Default to '{x} {y}'.
* ... | [
"function",
"NumberCoordinatesFilter",
"(",
"$filter",
")",
"{",
"/**\n * @param {import(\"ol/coordinate.js\").Coordinate} coordinates Array of two numbers.\n * @param {(number|string)=} opt_fractionDigits Optional number of digit.\n * Default to 0.\n * @param {string=} opt_template Optional... | Format a couple of numbers as number coordinates.
Example without parameters:
<p>{{[7.1234, 46.9876] | ngeoNumberCoordinates}}</p>
<!-- will Become 7 47 -->
Example with defined fractionDigits and template (en-US localization):
<!-- With en-US localization -->
<p>{{[7.1234, 46.9876] | ngeoNumberCoordinates:2:'co {x... | [
"Format",
"a",
"couple",
"of",
"numbers",
"as",
"number",
"coordinates",
"."
] | 0d9d84b70199bc3de9cf367a0b406c7b488d2077 | https://github.com/camptocamp/ngeo/blob/0d9d84b70199bc3de9cf367a0b406c7b488d2077/src/misc/filters.js#L278-L299 |
16,625 | camptocamp/ngeo | src/misc/filters.js | DMSCoordinatesFilter | function DMSCoordinatesFilter() {
const degreesToStringHDMS = function(degrees, hemispheres, fractionDigits) {
const normalizedDegrees = modulo(degrees + 180, 360) - 180;
const dms = Math.abs(3600 * normalizedDegrees);
const d = Math.floor(dms / 3600);
const m = Math.floor((dms / 60) % 60);
const ... | javascript | function DMSCoordinatesFilter() {
const degreesToStringHDMS = function(degrees, hemispheres, fractionDigits) {
const normalizedDegrees = modulo(degrees + 180, 360) - 180;
const dms = Math.abs(3600 * normalizedDegrees);
const d = Math.floor(dms / 3600);
const m = Math.floor((dms / 60) % 60);
const ... | [
"function",
"DMSCoordinatesFilter",
"(",
")",
"{",
"const",
"degreesToStringHDMS",
"=",
"function",
"(",
"degrees",
",",
"hemispheres",
",",
"fractionDigits",
")",
"{",
"const",
"normalizedDegrees",
"=",
"modulo",
"(",
"degrees",
"+",
"180",
",",
"360",
")",
"... | Format coordinates as DMS coordinates.
Example without parameters:
<p>{{[7.1234, 46.9876] | ngeoDMSCoordinates}}</p>
<!-- will Become 7° 07' 24'' E 46° 59' 15'' N-->
Example with defined fractionDigits and a template.
<p>{{[7.1234, 46.9876] | ngeoDMSCoordinates:2:'[{y}; {x]'}}</p>
<!-- will Become [46° 59' 15.36''... | [
"Format",
"coordinates",
"as",
"DMS",
"coordinates",
"."
] | 0d9d84b70199bc3de9cf367a0b406c7b488d2077 | https://github.com/camptocamp/ngeo/blob/0d9d84b70199bc3de9cf367a0b406c7b488d2077/src/misc/filters.js#L322-L357 |
16,626 | camptocamp/ngeo | src/misc/filters.js | trustHtmlAutoFilter | function trustHtmlAutoFilter($sce, ngeoStringToHtmlReplacements) {
return function(input) {
if (input !== undefined && input !== null) {
if (typeof input === 'string') {
for (const replacement of ngeoStringToHtmlReplacements) {
if (input.match(replacement.expression)) {
input =... | javascript | function trustHtmlAutoFilter($sce, ngeoStringToHtmlReplacements) {
return function(input) {
if (input !== undefined && input !== null) {
if (typeof input === 'string') {
for (const replacement of ngeoStringToHtmlReplacements) {
if (input.match(replacement.expression)) {
input =... | [
"function",
"trustHtmlAutoFilter",
"(",
"$sce",
",",
"ngeoStringToHtmlReplacements",
")",
"{",
"return",
"function",
"(",
"input",
")",
"{",
"if",
"(",
"input",
"!==",
"undefined",
"&&",
"input",
"!==",
"null",
")",
"{",
"if",
"(",
"typeof",
"input",
"===",
... | A filter to mark a value as trusted HTML, with the addition of
automatically converting any string that matches the
StringToHtmlReplacements list to HTML.
Usage:
<p ng-bind-html="ctrl.someValue | ngeoTrustHtmlAuto"></p>
If you use it, you don't require the "ngSanitize".
@return {function(?):string} The filter functi... | [
"A",
"filter",
"to",
"mark",
"a",
"value",
"as",
"trusted",
"HTML",
"with",
"the",
"addition",
"of",
"automatically",
"converting",
"any",
"string",
"that",
"matches",
"the",
"StringToHtmlReplacements",
"list",
"to",
"HTML",
"."
] | 0d9d84b70199bc3de9cf367a0b406c7b488d2077 | https://github.com/camptocamp/ngeo/blob/0d9d84b70199bc3de9cf367a0b406c7b488d2077/src/misc/filters.js#L407-L425 |
16,627 | camptocamp/ngeo | src/misc/filters.js | DurationFilter | function DurationFilter(gettextCatalog) {
// time unit enum
const TimeUnits = Object.freeze({
SECONDS: Symbol('seconds'),
MINUTES: Symbol('minutes'),
HOURS: Symbol('hours'),
DAYS: Symbol('days')
});
/**
* @param {number} amount Amount of time.
* @param {symbol} unit Unit of time.
* @re... | javascript | function DurationFilter(gettextCatalog) {
// time unit enum
const TimeUnits = Object.freeze({
SECONDS: Symbol('seconds'),
MINUTES: Symbol('minutes'),
HOURS: Symbol('hours'),
DAYS: Symbol('days')
});
/**
* @param {number} amount Amount of time.
* @param {symbol} unit Unit of time.
* @re... | [
"function",
"DurationFilter",
"(",
"gettextCatalog",
")",
"{",
"// time unit enum",
"const",
"TimeUnits",
"=",
"Object",
".",
"freeze",
"(",
"{",
"SECONDS",
":",
"Symbol",
"(",
"'seconds'",
")",
",",
"MINUTES",
":",
"Symbol",
"(",
"'minutes'",
")",
",",
"HOU... | A filter used to format a time duration in seconds into a more
readable form.
Only the two largest units will be shown.
Examples:
{{42 | ngeoDuration}} => 42 seconds
{{132 | ngeoDuration}} => 2 minutes 12 seconds
{{3910 | ngeoDuration}} => 1 hour 5 minutes
-> Note: the remaining 10 seconds will be dropped
@param {ang... | [
"A",
"filter",
"used",
"to",
"format",
"a",
"time",
"duration",
"in",
"seconds",
"into",
"a",
"more",
"readable",
"form",
".",
"Only",
"the",
"two",
"largest",
"units",
"will",
"be",
"shown",
"."
] | 0d9d84b70199bc3de9cf367a0b406c7b488d2077 | https://github.com/camptocamp/ngeo/blob/0d9d84b70199bc3de9cf367a0b406c7b488d2077/src/misc/filters.js#L447-L529 |
16,628 | camptocamp/ngeo | contribs/gmf/src/profile/component.js | function(item) {
if ('values' in item && layerName in item.values && item.values[layerName]) {
return parseFloat(item.values[layerName]);
}
throw new Error('Unexpected');
} | javascript | function(item) {
if ('values' in item && layerName in item.values && item.values[layerName]) {
return parseFloat(item.values[layerName]);
}
throw new Error('Unexpected');
} | [
"function",
"(",
"item",
")",
"{",
"if",
"(",
"'values'",
"in",
"item",
"&&",
"layerName",
"in",
"item",
".",
"values",
"&&",
"item",
".",
"values",
"[",
"layerName",
"]",
")",
"{",
"return",
"parseFloat",
"(",
"item",
".",
"values",
"[",
"layerName",
... | Generic GMF extractor for the 'given' value in 'values' in profileData.
@param {Object} item The item.
@return {number} The elevation.
@private | [
"Generic",
"GMF",
"extractor",
"for",
"the",
"given",
"value",
"in",
"values",
"in",
"profileData",
"."
] | 0d9d84b70199bc3de9cf367a0b406c7b488d2077 | https://github.com/camptocamp/ngeo/blob/0d9d84b70199bc3de9cf367a0b406c7b488d2077/contribs/gmf/src/profile/component.js#L636-L641 | |
16,629 | camptocamp/ngeo | contribs/gmf/src/raster/component.js | rasterComponent | function rasterComponent() {
return {
restrict: 'A',
controller: 'GmfElevationController as ctrl',
bindToController: true,
scope: {
'active': '<gmfElevationActive',
'elevation': '=gmfElevationElevation',
'layersconfig': '=gmfElevationLayersconfig',
'loading': '=?gmfElevationLoa... | javascript | function rasterComponent() {
return {
restrict: 'A',
controller: 'GmfElevationController as ctrl',
bindToController: true,
scope: {
'active': '<gmfElevationActive',
'elevation': '=gmfElevationElevation',
'layersconfig': '=gmfElevationLayersconfig',
'loading': '=?gmfElevationLoa... | [
"function",
"rasterComponent",
"(",
")",
"{",
"return",
"{",
"restrict",
":",
"'A'",
",",
"controller",
":",
"'GmfElevationController as ctrl'",
",",
"bindToController",
":",
"true",
",",
"scope",
":",
"{",
"'active'",
":",
"'<gmfElevationActive'",
",",
"'elevatio... | Provide a directive that set a value each 500ms with the elevation under the
mouse cursor position on the map. The value must come from the elevation
service of a c2cgeoportal server. The server's URL must be defined as
config value of the application.
Example:
<span gmf-elevation
gmf-elevation-active="elevationActiv... | [
"Provide",
"a",
"directive",
"that",
"set",
"a",
"value",
"each",
"500ms",
"with",
"the",
"elevation",
"under",
"the",
"mouse",
"cursor",
"position",
"on",
"the",
"map",
".",
"The",
"value",
"must",
"come",
"from",
"the",
"elevation",
"service",
"of",
"a",... | 0d9d84b70199bc3de9cf367a0b406c7b488d2077 | https://github.com/camptocamp/ngeo/blob/0d9d84b70199bc3de9cf367a0b406c7b488d2077/contribs/gmf/src/raster/component.js#L93-L121 |
16,630 | camptocamp/ngeo | src/download/service.js | factory | function factory() {
/**
* @param {string} content The file content.
* @param {string} fileName The file name.
* @param {string=} opt_fileType The file type. If not given,
* `text/plain;charset=utf-8` is used.
*/
function download(content, fileName, opt_fileType) {
// Safari does not properly ... | javascript | function factory() {
/**
* @param {string} content The file content.
* @param {string} fileName The file name.
* @param {string=} opt_fileType The file type. If not given,
* `text/plain;charset=utf-8` is used.
*/
function download(content, fileName, opt_fileType) {
// Safari does not properly ... | [
"function",
"factory",
"(",
")",
"{",
"/**\n * @param {string} content The file content.\n * @param {string} fileName The file name.\n * @param {string=} opt_fileType The file type. If not given,\n * `text/plain;charset=utf-8` is used.\n */",
"function",
"download",
"(",
"content",
... | A service to start a download for a file.
@return {Download} The download function.
@ngdoc service
@ngname ngeoDownload
@private
@hidden | [
"A",
"service",
"to",
"start",
"a",
"download",
"for",
"a",
"file",
"."
] | 0d9d84b70199bc3de9cf367a0b406c7b488d2077 | https://github.com/camptocamp/ngeo/blob/0d9d84b70199bc3de9cf367a0b406c7b488d2077/src/download/service.js#L25-L46 |
16,631 | camptocamp/ngeo | contribs/gmf/src/layertree/timeSliderComponent.js | Controller | function Controller(ngeoWMSTime) {
/**
* @type {import("ngeo/misc/WMSTime.js").WMSTime}
* @private
*/
this.ngeoWMSTime_ = ngeoWMSTime;
/**
* Function called after date(s) changed/selected
* @type {Function}
*/
this.onDateSelected = () => undefined;
/**
* A time object for directive in... | javascript | function Controller(ngeoWMSTime) {
/**
* @type {import("ngeo/misc/WMSTime.js").WMSTime}
* @private
*/
this.ngeoWMSTime_ = ngeoWMSTime;
/**
* Function called after date(s) changed/selected
* @type {Function}
*/
this.onDateSelected = () => undefined;
/**
* A time object for directive in... | [
"function",
"Controller",
"(",
"ngeoWMSTime",
")",
"{",
"/**\n * @type {import(\"ngeo/misc/WMSTime.js\").WMSTime}\n * @private\n */",
"this",
".",
"ngeoWMSTime_",
"=",
"ngeoWMSTime",
";",
"/**\n * Function called after date(s) changed/selected\n * @type {Function}\n */",
"thi... | TimeSliderController - directive controller
@param {import("ngeo/misc/WMSTime.js").WMSTime} ngeoWMSTime WMSTime service.
@constructor
@private
@hidden
@ngInject
@ngdoc controller
@ngname gmfTimeSliderController | [
"TimeSliderController",
"-",
"directive",
"controller"
] | 0d9d84b70199bc3de9cf367a0b406c7b488d2077 | https://github.com/camptocamp/ngeo/blob/0d9d84b70199bc3de9cf367a0b406c7b488d2077/contribs/gmf/src/layertree/timeSliderComponent.js#L118-L178 |
16,632 | camptocamp/ngeo | src/misc/colorpickerComponent.js | colorPickerComponent | function colorPickerComponent(ngeoColorpickerTemplateUrl) {
return {
restrict: 'A',
scope: {
colors: '<?ngeoColorpicker',
color: '=?ngeoColorpickerColor'
},
controller: 'NgeoColorpickerController as ctrl',
bindToController: true,
templateUrl: ngeoColorpickerTemplateUrl
};
} | javascript | function colorPickerComponent(ngeoColorpickerTemplateUrl) {
return {
restrict: 'A',
scope: {
colors: '<?ngeoColorpicker',
color: '=?ngeoColorpickerColor'
},
controller: 'NgeoColorpickerController as ctrl',
bindToController: true,
templateUrl: ngeoColorpickerTemplateUrl
};
} | [
"function",
"colorPickerComponent",
"(",
"ngeoColorpickerTemplateUrl",
")",
"{",
"return",
"{",
"restrict",
":",
"'A'",
",",
"scope",
":",
"{",
"colors",
":",
"'<?ngeoColorpicker'",
",",
"color",
":",
"'=?ngeoColorpickerColor'",
"}",
",",
"controller",
":",
"'Ngeo... | Provides the "ngeoColorpicker" directive, a widget for
selecting a color among predefined ones.
Example:
<div ngeo-colorpicker="ctrl.colors">
</div>
@param {string|function(!JQuery=, !angular.IAttributes=): string}
ngeoColorpickerTemplateUrl Template URL for the directive.
@return {angular.IDirective} Directive Def... | [
"Provides",
"the",
"ngeoColorpicker",
"directive",
"a",
"widget",
"for",
"selecting",
"a",
"color",
"among",
"predefined",
"ones",
"."
] | 0d9d84b70199bc3de9cf367a0b406c7b488d2077 | https://github.com/camptocamp/ngeo/blob/0d9d84b70199bc3de9cf367a0b406c7b488d2077/src/misc/colorpickerComponent.js#L46-L57 |
16,633 | camptocamp/ngeo | contribs/gmf/src/mobile/navigation/component.js | mobileNavigationComponent | function mobileNavigationComponent() {
return {
restrict: 'A',
controller: 'gmfMobileNavController as navCtrl',
bindToController: true,
scope: true,
/**
* @param {angular.IScope} scope Scope.
* @param {JQuery} element Element.
* @param {angular.IAttributes} attrs Attributes.
* ... | javascript | function mobileNavigationComponent() {
return {
restrict: 'A',
controller: 'gmfMobileNavController as navCtrl',
bindToController: true,
scope: true,
/**
* @param {angular.IScope} scope Scope.
* @param {JQuery} element Element.
* @param {angular.IAttributes} attrs Attributes.
* ... | [
"function",
"mobileNavigationComponent",
"(",
")",
"{",
"return",
"{",
"restrict",
":",
"'A'",
",",
"controller",
":",
"'gmfMobileNavController as navCtrl'",
",",
"bindToController",
":",
"true",
",",
"scope",
":",
"true",
",",
"/**\n * @param {angular.IScope} scope... | An "gmf-mobile-nav" directive defining the behavior of a tree-structured menu.
The directive is to be placed on a `nav` element, with the following
structure:
<nav gmf-mobile-nav>
<header>
<a class="gmf-mobile-nav-go-back" href="#"></a>
</header>
<div class="gmf-mobile-nav-active gmf-mobile-nav-slide">
<ul>
<li>
<a hr... | [
"An",
"gmf",
"-",
"mobile",
"-",
"nav",
"directive",
"defining",
"the",
"behavior",
"of",
"a",
"tree",
"-",
"structured",
"menu",
"."
] | 0d9d84b70199bc3de9cf367a0b406c7b488d2077 | https://github.com/camptocamp/ngeo/blob/0d9d84b70199bc3de9cf367a0b406c7b488d2077/contribs/gmf/src/mobile/navigation/component.js#L63-L82 |
16,634 | camptocamp/ngeo | contribs/gmf/src/mobile/measure/areaComponent.js | mobileMeasureAreaComponent | function mobileMeasureAreaComponent(gmfMobileMeasureAreaTemplateUrl) {
return {
restrict: 'A',
scope: {
'active': '=gmfMobileMeasureareaActive',
'precision': '<?gmfMobileMeasureareaPrecision',
'map': '=gmfMobileMeasureareaMap',
'sketchStyle': '=?gmfMobileMeasureareaSketchstyle'
},
... | javascript | function mobileMeasureAreaComponent(gmfMobileMeasureAreaTemplateUrl) {
return {
restrict: 'A',
scope: {
'active': '=gmfMobileMeasureareaActive',
'precision': '<?gmfMobileMeasureareaPrecision',
'map': '=gmfMobileMeasureareaMap',
'sketchStyle': '=?gmfMobileMeasureareaSketchstyle'
},
... | [
"function",
"mobileMeasureAreaComponent",
"(",
"gmfMobileMeasureAreaTemplateUrl",
")",
"{",
"return",
"{",
"restrict",
":",
"'A'",
",",
"scope",
":",
"{",
"'active'",
":",
"'=gmfMobileMeasureareaActive'",
",",
"'precision'",
":",
"'<?gmfMobileMeasureareaPrecision'",
",",
... | Provide a directive to do a area measure on the mobile devices.
Example:
<div gmf-mobile-measurearea
gmf-mobile-measurearea-active="ctrl.measureAreaActive"
gmf-mobile-measurearea-map="::ctrl.map">
</div>
@htmlAttribute {boolean} gmf-mobile-measurearea-active Used to active
or deactivate the component.
@htmlAttribute... | [
"Provide",
"a",
"directive",
"to",
"do",
"a",
"area",
"measure",
"on",
"the",
"mobile",
"devices",
"."
] | 0d9d84b70199bc3de9cf367a0b406c7b488d2077 | https://github.com/camptocamp/ngeo/blob/0d9d84b70199bc3de9cf367a0b406c7b488d2077/contribs/gmf/src/mobile/measure/areaComponent.js#L57-L82 |
16,635 | camptocamp/ngeo | src/misc/debounce.js | debounce | function debounce(func, wait, invokeApply, $timeout) {
/**
* @type {?angular.IPromise}
*/
let timeout = null;
return /** @type {T} */(
/**
* @this {any} The context
*/
function(...args) {
const context = this;
const later = function() {
timeout = null;
func.appl... | javascript | function debounce(func, wait, invokeApply, $timeout) {
/**
* @type {?angular.IPromise}
*/
let timeout = null;
return /** @type {T} */(
/**
* @this {any} The context
*/
function(...args) {
const context = this;
const later = function() {
timeout = null;
func.appl... | [
"function",
"debounce",
"(",
"func",
",",
"wait",
",",
"invokeApply",
",",
"$timeout",
")",
"{",
"/**\n * @type {?angular.IPromise}\n */",
"let",
"timeout",
"=",
"null",
";",
"return",
"/** @type {T} */",
"(",
"/**\n * @this {any} The context\n */",
"function"... | Provides a debounce function used to debounce calls to a user-provided function.
@template {function(?): void} T args
@typedef {function(T, number, boolean): T} miscDebounce
@template {function(?): void} T args
@param {T} func The function to debounce.
@param {number} wait The wait time in ms.
@param {boolean} invoke... | [
"Provides",
"a",
"debounce",
"function",
"used",
"to",
"debounce",
"calls",
"to",
"a",
"user",
"-",
"provided",
"function",
"."
] | 0d9d84b70199bc3de9cf367a0b406c7b488d2077 | https://github.com/camptocamp/ngeo/blob/0d9d84b70199bc3de9cf367a0b406c7b488d2077/src/misc/debounce.js#L27-L48 |
16,636 | camptocamp/ngeo | src/misc/debounce.js | factory | function factory($timeout) {
/** @type {function(T, number, boolean, angular.ITimeoutService): T} */
const deb = debounce;
return (func, wait, invokeApply) => {
return deb(func, wait, invokeApply, $timeout);
};
} | javascript | function factory($timeout) {
/** @type {function(T, number, boolean, angular.ITimeoutService): T} */
const deb = debounce;
return (func, wait, invokeApply) => {
return deb(func, wait, invokeApply, $timeout);
};
} | [
"function",
"factory",
"(",
"$timeout",
")",
"{",
"/** @type {function(T, number, boolean, angular.ITimeoutService): T} */",
"const",
"deb",
"=",
"debounce",
";",
"return",
"(",
"func",
",",
"wait",
",",
"invokeApply",
")",
"=>",
"{",
"return",
"deb",
"(",
"func",
... | Provides a debounce service. That service is a function
used to debounce calls to a user-provided function.
@template {function(?): void} T args
@param {angular.ITimeoutService} $timeout Angular timeout service.
@return {import("ngeo/misc/debounce.js").miscDebounce<T>} The debounce function.
@ngdoc service
@ngname ng... | [
"Provides",
"a",
"debounce",
"service",
".",
"That",
"service",
"is",
"a",
"function",
"used",
"to",
"debounce",
"calls",
"to",
"a",
"user",
"-",
"provided",
"function",
"."
] | 0d9d84b70199bc3de9cf367a0b406c7b488d2077 | https://github.com/camptocamp/ngeo/blob/0d9d84b70199bc3de9cf367a0b406c7b488d2077/src/misc/debounce.js#L65-L71 |
16,637 | camptocamp/ngeo | src/map/resizemap.js | mapResizeComponent | function mapResizeComponent($window) {
const /** @type {number} */ duration = 1000;
return {
restrict: 'A',
/**
* @param {angular.IScope} scope Scope.
* @param {JQuery} element Element.
* @param {angular.IAttributes} attrs Attributes.
*/
link: (scope, element, attrs) => {
cons... | javascript | function mapResizeComponent($window) {
const /** @type {number} */ duration = 1000;
return {
restrict: 'A',
/**
* @param {angular.IScope} scope Scope.
* @param {JQuery} element Element.
* @param {angular.IAttributes} attrs Attributes.
*/
link: (scope, element, attrs) => {
cons... | [
"function",
"mapResizeComponent",
"(",
"$window",
")",
"{",
"const",
"/** @type {number} */",
"duration",
"=",
"1000",
";",
"return",
"{",
"restrict",
":",
"'A'",
",",
"/**\n * @param {angular.IScope} scope Scope.\n * @param {JQuery} element Element.\n * @param {angul... | Provides a directive that resizes the map in an animation loop
during 1 second when the value of "state" changes. This is especially useful
when changing the size of other elements with a transition leads to a change
of the map size.
Example:
<div ng-class="ctrl.open ? 'open' : 'close' ngeo-resizemap="ctrl.map"
ngeo-... | [
"Provides",
"a",
"directive",
"that",
"resizes",
"the",
"map",
"in",
"an",
"animation",
"loop",
"during",
"1",
"second",
"when",
"the",
"value",
"of",
"state",
"changes",
".",
"This",
"is",
"especially",
"useful",
"when",
"changing",
"the",
"size",
"of",
"... | 0d9d84b70199bc3de9cf367a0b406c7b488d2077 | https://github.com/camptocamp/ngeo/blob/0d9d84b70199bc3de9cf367a0b406c7b488d2077/src/map/resizemap.js#L32-L79 |
16,638 | camptocamp/ngeo | src/statemanager/Location.js | LocationFactory | function LocationFactory($rootScope, $window) {
const history = $window.history;
const service = new StatemanagerLocation($window.location, $window.history);
let lastUri = service.getUriString();
$rootScope.$watch(() => {
const newUri = service.getUriString();
if (lastUri !== newUri) {
$rootScope... | javascript | function LocationFactory($rootScope, $window) {
const history = $window.history;
const service = new StatemanagerLocation($window.location, $window.history);
let lastUri = service.getUriString();
$rootScope.$watch(() => {
const newUri = service.getUriString();
if (lastUri !== newUri) {
$rootScope... | [
"function",
"LocationFactory",
"(",
"$rootScope",
",",
"$window",
")",
"{",
"const",
"history",
"=",
"$window",
".",
"history",
";",
"const",
"service",
"=",
"new",
"StatemanagerLocation",
"(",
"$window",
".",
"location",
",",
"$window",
".",
"history",
")",
... | The factory creating the ngeo Location service.
@param {angular.IScope} $rootScope The root scope.
@param {angular.IWindowService} $window Angular window service.
@return {StatemanagerLocation} The ngeo location service.
@ngInject
@private
@hidden | [
"The",
"factory",
"creating",
"the",
"ngeo",
"Location",
"service",
"."
] | 0d9d84b70199bc3de9cf367a0b406c7b488d2077 | https://github.com/camptocamp/ngeo/blob/0d9d84b70199bc3de9cf367a0b406c7b488d2077/src/statemanager/Location.js#L353-L372 |
16,639 | camptocamp/ngeo | contribs/gmf/src/objectediting/coordinate.js | toXY | function toXY(coordinates, nesting) {
if (nesting === 0) {
return /** @type {Array<T>} */(coordinatesToXY0(/** @type {Coordinate} */(coordinates)));
} else {
for (let i = 0, ii = coordinates.length; i < ii; i++) {
// @ts-ignore: TypeScript is not able to do recurtion with deferent type in generic
... | javascript | function toXY(coordinates, nesting) {
if (nesting === 0) {
return /** @type {Array<T>} */(coordinatesToXY0(/** @type {Coordinate} */(coordinates)));
} else {
for (let i = 0, ii = coordinates.length; i < ii; i++) {
// @ts-ignore: TypeScript is not able to do recurtion with deferent type in generic
... | [
"function",
"toXY",
"(",
"coordinates",
",",
"nesting",
")",
"{",
"if",
"(",
"nesting",
"===",
"0",
")",
"{",
"return",
"/** @type {Array<T>} */",
"(",
"coordinatesToXY0",
"(",
"/** @type {Coordinate} */",
"(",
"coordinates",
")",
")",
")",
";",
"}",
"else",
... | Convert a given coordinate or list of coordinates of any 'nesting' level
to XY, i.e. remove any extra dimensions to the coordinates and keep only 2.
@template {number|Coordinate|Array<Coordinate>|Array<Array<Coordinate>>} T
@param {Array<T>} coordinates Coordinates
@param {number} nesting Nesting level.
@return {Array... | [
"Convert",
"a",
"given",
"coordinate",
"or",
"list",
"of",
"coordinates",
"of",
"any",
"nesting",
"level",
"to",
"XY",
"i",
".",
"e",
".",
"remove",
"any",
"extra",
"dimensions",
"to",
"the",
"coordinates",
"and",
"keep",
"only",
"2",
"."
] | 0d9d84b70199bc3de9cf367a0b406c7b488d2077 | https://github.com/camptocamp/ngeo/blob/0d9d84b70199bc3de9cf367a0b406c7b488d2077/contribs/gmf/src/objectediting/coordinate.js#L34-L44 |
16,640 | camptocamp/ngeo | src/map/component.js | mapComponent | function mapComponent($window) {
return {
restrict: 'A',
/**
* @param {angular.IScope} scope Scope.
* @param {JQuery} element Element.
* @param {angular.IAttributes} attrs Attributes.
*/
link: (scope, element, attrs) => {
// Get the 'ol.Map' object from attributes and manage it a... | javascript | function mapComponent($window) {
return {
restrict: 'A',
/**
* @param {angular.IScope} scope Scope.
* @param {JQuery} element Element.
* @param {angular.IAttributes} attrs Attributes.
*/
link: (scope, element, attrs) => {
// Get the 'ol.Map' object from attributes and manage it a... | [
"function",
"mapComponent",
"(",
"$window",
")",
"{",
"return",
"{",
"restrict",
":",
"'A'",
",",
"/**\n * @param {angular.IScope} scope Scope.\n * @param {JQuery} element Element.\n * @param {angular.IAttributes} attrs Attributes.\n */",
"link",
":",
"(",
"scope",
... | Provides a directive used to insert a user-defined OpenLayers
map in the DOM. The directive does not create an isolate scope.
Examples:
Simple:
<div ngeo-map="ctrl.map"></div>
Manage window resizing:
<div
ngeo-map="ctrl.map"
ngeo-map-manage-resize="ctrl.manageResize"
ngeo-map-resize-transition="ctrl.resizeTransiti... | [
"Provides",
"a",
"directive",
"used",
"to",
"insert",
"a",
"user",
"-",
"defined",
"OpenLayers",
"map",
"in",
"the",
"DOM",
".",
"The",
"directive",
"does",
"not",
"create",
"an",
"isolate",
"scope",
"."
] | 0d9d84b70199bc3de9cf367a0b406c7b488d2077 | https://github.com/camptocamp/ngeo/blob/0d9d84b70199bc3de9cf367a0b406c7b488d2077/src/map/component.js#L42-L104 |
16,641 | camptocamp/ngeo | src/interaction/Measure.js | handleEvent_ | function handleEvent_(evt) {
if (evt.type != 'pointermove' || evt.dragging) {
return true;
}
const helpMsg = this.sketchFeature === null ? this.startMsg : this.continueMsg;
if (!helpMsg) {
throw new Error('Missing helpMsg');
}
if (this.displayHelpTooltip_) {
if (!this.helpTooltipElement_) {
... | javascript | function handleEvent_(evt) {
if (evt.type != 'pointermove' || evt.dragging) {
return true;
}
const helpMsg = this.sketchFeature === null ? this.startMsg : this.continueMsg;
if (!helpMsg) {
throw new Error('Missing helpMsg');
}
if (this.displayHelpTooltip_) {
if (!this.helpTooltipElement_) {
... | [
"function",
"handleEvent_",
"(",
"evt",
")",
"{",
"if",
"(",
"evt",
".",
"type",
"!=",
"'pointermove'",
"||",
"evt",
".",
"dragging",
")",
"{",
"return",
"true",
";",
"}",
"const",
"helpMsg",
"=",
"this",
".",
"sketchFeature",
"===",
"null",
"?",
"this... | Handle map browser event.
@param {import("ol/MapBrowserEvent.js").default} evt Map browser event.
@return {boolean} `false` if event propagation should be stopped.
@private
@hidden
@this {Measure} | [
"Handle",
"map",
"browser",
"event",
"."
] | 0d9d84b70199bc3de9cf367a0b406c7b488d2077 | https://github.com/camptocamp/ngeo/blob/0d9d84b70199bc3de9cf367a0b406c7b488d2077/src/interaction/Measure.js#L576-L599 |
16,642 | camptocamp/ngeo | src/misc/controlComponent.js | controlComponent | function controlComponent() {
return {
restrict: 'A',
/**
* @param {angular.IScope} scope Scope.
* @param {JQuery} element Element.
* @param {angular.IAttributes} attrs Attributes.
*/
link: (scope, element, attrs) => {
const control = /** @type {import('ol/control/Control.js').d... | javascript | function controlComponent() {
return {
restrict: 'A',
/**
* @param {angular.IScope} scope Scope.
* @param {JQuery} element Element.
* @param {angular.IAttributes} attrs Attributes.
*/
link: (scope, element, attrs) => {
const control = /** @type {import('ol/control/Control.js').d... | [
"function",
"controlComponent",
"(",
")",
"{",
"return",
"{",
"restrict",
":",
"'A'",
",",
"/**\n * @param {angular.IScope} scope Scope.\n * @param {JQuery} element Element.\n * @param {angular.IAttributes} attrs Attributes.\n */",
"link",
":",
"(",
"scope",
",",
"e... | Provides a directive that can be used to add a control to the map
using a DOM element.
Example:
<div ngeo-control="ctrl.control" ngeo-control-map="ctrl.map"></div>
The expression passed to "ngeo-control" should evaluate to a control
instance, and the expression passed to "ngeo-control-map" should
evaluate to a map i... | [
"Provides",
"a",
"directive",
"that",
"can",
"be",
"used",
"to",
"add",
"a",
"control",
"to",
"the",
"map",
"using",
"a",
"DOM",
"element",
"."
] | 0d9d84b70199bc3de9cf367a0b406c7b488d2077 | https://github.com/camptocamp/ngeo/blob/0d9d84b70199bc3de9cf367a0b406c7b488d2077/src/misc/controlComponent.js#L33-L55 |
16,643 | camptocamp/ngeo | src/query/bboxQueryComponent.js | queryBboxComponent | function queryBboxComponent($rootScope, ngeoMapQuerent, ngeoQueryKeyboard) {
return {
restrict: 'A',
scope: false,
link: (scope, elem, attrs) => {
/**
* @type {import("ol/Map.js").default}
*/
const map = scope.$eval(attrs['ngeoBboxQueryMap']);
let active;
const inte... | javascript | function queryBboxComponent($rootScope, ngeoMapQuerent, ngeoQueryKeyboard) {
return {
restrict: 'A',
scope: false,
link: (scope, elem, attrs) => {
/**
* @type {import("ol/Map.js").default}
*/
const map = scope.$eval(attrs['ngeoBboxQueryMap']);
let active;
const inte... | [
"function",
"queryBboxComponent",
"(",
"$rootScope",
",",
"ngeoMapQuerent",
",",
"ngeoQueryKeyboard",
")",
"{",
"return",
"{",
"restrict",
":",
"'A'",
",",
"scope",
":",
"false",
",",
"link",
":",
"(",
"scope",
",",
"elem",
",",
"attrs",
")",
"=>",
"{",
... | Provides a "bbox query" directive.
This directive is responsible of binding a map and the ngeo query service
together. While active, drawing a bbox while CTRL or the 'meta' key is pressed
issues a request to the query service.
This directive doesn't require to be rendered in a visible DOM element, but
it could be use... | [
"Provides",
"a",
"bbox",
"query",
"directive",
"."
] | 0d9d84b70199bc3de9cf367a0b406c7b488d2077 | https://github.com/camptocamp/ngeo/blob/0d9d84b70199bc3de9cf367a0b406c7b488d2077/src/query/bboxQueryComponent.js#L52-L136 |
16,644 | camptocamp/ngeo | src/query/bboxQueryComponent.js | function(interaction) {
const action = ngeoQueryKeyboard.action;
const extent = interaction.getGeometry().getExtent();
const limit = scope.$eval(attrs['ngeoBboxQueryLimit']);
ngeoMapQuerent.issue({
action,
extent,
limit,
map
});
} | javascript | function(interaction) {
const action = ngeoQueryKeyboard.action;
const extent = interaction.getGeometry().getExtent();
const limit = scope.$eval(attrs['ngeoBboxQueryLimit']);
ngeoMapQuerent.issue({
action,
extent,
limit,
map
});
} | [
"function",
"(",
"interaction",
")",
"{",
"const",
"action",
"=",
"ngeoQueryKeyboard",
".",
"action",
";",
"const",
"extent",
"=",
"interaction",
".",
"getGeometry",
"(",
")",
".",
"getExtent",
"(",
")",
";",
"const",
"limit",
"=",
"scope",
".",
"$eval",
... | Called when a bbox is drawn while this controller is active. Issue
a request to the query service using the extent that was drawn.
@param {!olInteractionDragBox} interaction Drag box interaction | [
"Called",
"when",
"a",
"bbox",
"is",
"drawn",
"while",
"this",
"controller",
"is",
"active",
".",
"Issue",
"a",
"request",
"to",
"the",
"query",
"service",
"using",
"the",
"extent",
"that",
"was",
"drawn",
"."
] | 0d9d84b70199bc3de9cf367a0b406c7b488d2077 | https://github.com/camptocamp/ngeo/blob/0d9d84b70199bc3de9cf367a0b406c7b488d2077/src/query/bboxQueryComponent.js#L74-L84 | |
16,645 | libp2p/js-libp2p-switch | src/transport.js | ourAddresses | function ourAddresses (peerInfo) {
const ourPeerId = peerInfo.id.toB58String()
return peerInfo.multiaddrs.toArray()
.reduce((ourAddrs, addr) => {
const peerId = addr.getPeerId()
addr = addr.toString()
const otherAddr = peerId
? addr.slice(0, addr.lastIndexOf(`/ipfs/${peerId}`))
... | javascript | function ourAddresses (peerInfo) {
const ourPeerId = peerInfo.id.toB58String()
return peerInfo.multiaddrs.toArray()
.reduce((ourAddrs, addr) => {
const peerId = addr.getPeerId()
addr = addr.toString()
const otherAddr = peerId
? addr.slice(0, addr.lastIndexOf(`/ipfs/${peerId}`))
... | [
"function",
"ourAddresses",
"(",
"peerInfo",
")",
"{",
"const",
"ourPeerId",
"=",
"peerInfo",
".",
"id",
".",
"toB58String",
"(",
")",
"return",
"peerInfo",
".",
"multiaddrs",
".",
"toArray",
"(",
")",
".",
"reduce",
"(",
"(",
"ourAddrs",
",",
"addr",
")... | Expand addresses in peer info into array of addresses with and without peer
ID suffix.
@param {PeerInfo} peerInfo Our peer info object
@returns {String[]} | [
"Expand",
"addresses",
"in",
"peer",
"info",
"into",
"array",
"of",
"addresses",
"with",
"and",
"without",
"peer",
"ID",
"suffix",
"."
] | f879cfc680521de81fef0bfc4a11e96623711712 | https://github.com/libp2p/js-libp2p-switch/blob/f879cfc680521de81fef0bfc4a11e96623711712/src/transport.js#L236-L249 |
16,646 | libp2p/js-libp2p-switch | src/get-peer-info.js | getPeerInfo | function getPeerInfo (peer, peerBook) {
let peerInfo
// Already a PeerInfo instance,
// add to the peer book and return the latest value
if (PeerInfo.isPeerInfo(peer)) {
return peerBook.put(peer)
}
// Attempt to convert from Multiaddr instance (not string)
if (multiaddr.isMultiaddr(peer)) {
cons... | javascript | function getPeerInfo (peer, peerBook) {
let peerInfo
// Already a PeerInfo instance,
// add to the peer book and return the latest value
if (PeerInfo.isPeerInfo(peer)) {
return peerBook.put(peer)
}
// Attempt to convert from Multiaddr instance (not string)
if (multiaddr.isMultiaddr(peer)) {
cons... | [
"function",
"getPeerInfo",
"(",
"peer",
",",
"peerBook",
")",
"{",
"let",
"peerInfo",
"// Already a PeerInfo instance,",
"// add to the peer book and return the latest value",
"if",
"(",
"PeerInfo",
".",
"isPeerInfo",
"(",
"peer",
")",
")",
"{",
"return",
"peerBook",
... | Helper method to check the data type of peer and convert it to PeerInfo
@param {PeerInfo|Multiaddr|PeerId} peer
@param {PeerBook} peerBook
@throws {InvalidPeerType}
@returns {PeerInfo} | [
"Helper",
"method",
"to",
"check",
"the",
"data",
"type",
"of",
"peer",
"and",
"convert",
"it",
"to",
"PeerInfo"
] | f879cfc680521de81fef0bfc4a11e96623711712 | https://github.com/libp2p/js-libp2p-switch/blob/f879cfc680521de81fef0bfc4a11e96623711712/src/get-peer-info.js#L15-L47 |
16,647 | libp2p/js-libp2p-switch | src/dialer/index.js | connect | function connect (peerInfo, options, callback) {
if (typeof options === 'function') {
callback = options
options = null
}
options = { useFSM: false, priority: PRIORITY_LOW, ...options }
_dial({ peerInfo, protocol: null, options, callback })
} | javascript | function connect (peerInfo, options, callback) {
if (typeof options === 'function') {
callback = options
options = null
}
options = { useFSM: false, priority: PRIORITY_LOW, ...options }
_dial({ peerInfo, protocol: null, options, callback })
} | [
"function",
"connect",
"(",
"peerInfo",
",",
"options",
",",
"callback",
")",
"{",
"if",
"(",
"typeof",
"options",
"===",
"'function'",
")",
"{",
"callback",
"=",
"options",
"options",
"=",
"null",
"}",
"options",
"=",
"{",
"useFSM",
":",
"false",
",",
... | Attempts to establish a connection to the given `peerInfo` at
a lower priority than a standard dial.
@param {PeerInfo} peerInfo
@param {object} options
@param {boolean} options.useFSM Whether or not to return a `ConnectionFSM`. Defaults to false.
@param {number} options.priority Lowest priority goes first. Defaults to ... | [
"Attempts",
"to",
"establish",
"a",
"connection",
"to",
"the",
"given",
"peerInfo",
"at",
"a",
"lower",
"priority",
"than",
"a",
"standard",
"dial",
"."
] | f879cfc680521de81fef0bfc4a11e96623711712 | https://github.com/libp2p/js-libp2p-switch/blob/f879cfc680521de81fef0bfc4a11e96623711712/src/dialer/index.js#L78-L85 |
16,648 | libp2p/js-libp2p-switch | src/dialer/index.js | dialFSM | function dialFSM (peerInfo, protocol, callback) {
_dial({ peerInfo, protocol, options: { useFSM: true, priority: PRIORITY_HIGH }, callback })
} | javascript | function dialFSM (peerInfo, protocol, callback) {
_dial({ peerInfo, protocol, options: { useFSM: true, priority: PRIORITY_HIGH }, callback })
} | [
"function",
"dialFSM",
"(",
"peerInfo",
",",
"protocol",
",",
"callback",
")",
"{",
"_dial",
"(",
"{",
"peerInfo",
",",
"protocol",
",",
"options",
":",
"{",
"useFSM",
":",
"true",
",",
"priority",
":",
"PRIORITY_HIGH",
"}",
",",
"callback",
"}",
")",
... | Behaves like dial, except it calls back with a ConnectionFSM
@param {PeerInfo} peerInfo
@param {string} protocol
@param {function(Error, ConnectionFSM)} callback | [
"Behaves",
"like",
"dial",
"except",
"it",
"calls",
"back",
"with",
"a",
"ConnectionFSM"
] | f879cfc680521de81fef0bfc4a11e96623711712 | https://github.com/libp2p/js-libp2p-switch/blob/f879cfc680521de81fef0bfc4a11e96623711712/src/dialer/index.js#L105-L107 |
16,649 | stevebest/passport-vkontakte | lib/errors/vkontakteauthorizationerror.js | VkontakteAuthorizationError | function VkontakteAuthorizationError(message, type, code, status) {
Error.call(this);
Error.captureStackTrace(this, arguments.callee);
this.name = 'VkontakteAuthorizationError';
this.message = message;
this.type = type;
this.code = code || 'server_error';
this.status = status || 500;
} | javascript | function VkontakteAuthorizationError(message, type, code, status) {
Error.call(this);
Error.captureStackTrace(this, arguments.callee);
this.name = 'VkontakteAuthorizationError';
this.message = message;
this.type = type;
this.code = code || 'server_error';
this.status = status || 500;
} | [
"function",
"VkontakteAuthorizationError",
"(",
"message",
",",
"type",
",",
"code",
",",
"status",
")",
"{",
"Error",
".",
"call",
"(",
"this",
")",
";",
"Error",
".",
"captureStackTrace",
"(",
"this",
",",
"arguments",
".",
"callee",
")",
";",
"this",
... | `VkontakteAuthorizationError` error.
VkontakteAuthorizationError represents an error in response to an
authorization request on Vkontakte. Note that these responses don't conform
to the OAuth 2.0 specification.
@constructor
@param {String} [message]
@param {String} [type]
@param {String} [code]
@param {Number} [stat... | [
"VkontakteAuthorizationError",
"error",
"."
] | 7a1fafc8d7fd337a96572c29c7a2a64d8dc2ddde | https://github.com/stevebest/passport-vkontakte/blob/7a1fafc8d7fd337a96572c29c7a2a64d8dc2ddde/lib/errors/vkontakteauthorizationerror.js#L15-L23 |
16,650 | MacKentoch/easyFormGenerator | src/app/dragdropway/components/common/dragAndDropList/dragAndDropList.dndlist.directive.js | isMouseInFirstHalf | function isMouseInFirstHalf(event, targetNode, relativeToParent) {
var mousePointer = horizontal ? (event.offsetX || event.layerX)
: (event.offsetY || event.layerY);
var targetSize = horizontal ? targetNode.offsetWidth : targetNode.offsetHeight;
var targetPosition =... | javascript | function isMouseInFirstHalf(event, targetNode, relativeToParent) {
var mousePointer = horizontal ? (event.offsetX || event.layerX)
: (event.offsetY || event.layerY);
var targetSize = horizontal ? targetNode.offsetWidth : targetNode.offsetHeight;
var targetPosition =... | [
"function",
"isMouseInFirstHalf",
"(",
"event",
",",
"targetNode",
",",
"relativeToParent",
")",
"{",
"var",
"mousePointer",
"=",
"horizontal",
"?",
"(",
"event",
".",
"offsetX",
"||",
"event",
".",
"layerX",
")",
":",
"(",
"event",
".",
"offsetY",
"||",
"... | Checks whether the mouse pointer is in the first half of the given target element.
In Chrome we can just use offsetY, but in Firefox we have to use layerY, which only
works if the child element has position relative. In IE the events are only triggered
on the listNode instead of the listNodeItem, therefore the mouse p... | [
"Checks",
"whether",
"the",
"mouse",
"pointer",
"is",
"in",
"the",
"first",
"half",
"of",
"the",
"given",
"target",
"element",
"."
] | d146d9ac1aba87f8730001b61a737867a1a05695 | https://github.com/MacKentoch/easyFormGenerator/blob/d146d9ac1aba87f8730001b61a737867a1a05695/src/app/dragdropway/components/common/dragAndDropList/dragAndDropList.dndlist.directive.js#L155-L162 |
16,651 | MacKentoch/easyFormGenerator | src/app/dragdropway/components/common/dragAndDropList/dragAndDropList.dndlist.directive.js | isDropAllowed | function isDropAllowed(event) {
// Disallow drop from external source unless it's allowed explicitly.
if (!dndDragTypeWorkaround.isDragging && !externalSources) return false;
// Check mimetype. Usually we would use a custom drag type instead of Text, but IE doesn't
// support that.
if (!ha... | javascript | function isDropAllowed(event) {
// Disallow drop from external source unless it's allowed explicitly.
if (!dndDragTypeWorkaround.isDragging && !externalSources) return false;
// Check mimetype. Usually we would use a custom drag type instead of Text, but IE doesn't
// support that.
if (!ha... | [
"function",
"isDropAllowed",
"(",
"event",
")",
"{",
"// Disallow drop from external source unless it's allowed explicitly.",
"if",
"(",
"!",
"dndDragTypeWorkaround",
".",
"isDragging",
"&&",
"!",
"externalSources",
")",
"return",
"false",
";",
"// Check mimetype. Usually we ... | Checks various conditions that must be fulfilled for a drop to be allowed | [
"Checks",
"various",
"conditions",
"that",
"must",
"be",
"fulfilled",
"for",
"a",
"drop",
"to",
"be",
"allowed"
] | d146d9ac1aba87f8730001b61a737867a1a05695 | https://github.com/MacKentoch/easyFormGenerator/blob/d146d9ac1aba87f8730001b61a737867a1a05695/src/app/dragdropway/components/common/dragAndDropList/dragAndDropList.dndlist.directive.js#L175-L192 |
16,652 | MacKentoch/easyFormGenerator | src/app/dragdropway/components/common/dragAndDropList/dragAndDropList.dndlist.directive.js | hasTextMimetype | function hasTextMimetype(types) {
if (!types) return true;
for (var i = 0; i < types.length; i++) {
if (types[i] === 'Text' || types[i] === 'text/plain') return true;
}
return false;
} | javascript | function hasTextMimetype(types) {
if (!types) return true;
for (var i = 0; i < types.length; i++) {
if (types[i] === 'Text' || types[i] === 'text/plain') return true;
}
return false;
} | [
"function",
"hasTextMimetype",
"(",
"types",
")",
"{",
"if",
"(",
"!",
"types",
")",
"return",
"true",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"types",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"types",
"[",
"i",
"]",
... | Check if the dataTransfer object contains a drag type that we can handle. In old versions
of IE the types collection will not even be there, so we just assume a drop is possible. | [
"Check",
"if",
"the",
"dataTransfer",
"object",
"contains",
"a",
"drag",
"type",
"that",
"we",
"can",
"handle",
".",
"In",
"old",
"versions",
"of",
"IE",
"the",
"types",
"collection",
"will",
"not",
"even",
"be",
"there",
"so",
"we",
"just",
"assume",
"a... | d146d9ac1aba87f8730001b61a737867a1a05695 | https://github.com/MacKentoch/easyFormGenerator/blob/d146d9ac1aba87f8730001b61a737867a1a05695/src/app/dragdropway/components/common/dragAndDropList/dragAndDropList.dndlist.directive.js#L220-L226 |
16,653 | tombatossals/angular-leaflet-directive | examples/js/controllers.js | getColor | function getColor(country) {
if (!country || !country["region-code"]) {
return "#FFF";
}
var colors = continentProperties[country["region-code"]].colors;
var index = country["alpha-3"].charCodeAt(0) % colors.length ;
ret... | javascript | function getColor(country) {
if (!country || !country["region-code"]) {
return "#FFF";
}
var colors = continentProperties[country["region-code"]].colors;
var index = country["alpha-3"].charCodeAt(0) % colors.length ;
ret... | [
"function",
"getColor",
"(",
"country",
")",
"{",
"if",
"(",
"!",
"country",
"||",
"!",
"country",
"[",
"\"region-code\"",
"]",
")",
"{",
"return",
"\"#FFF\"",
";",
"}",
"var",
"colors",
"=",
"continentProperties",
"[",
"country",
"[",
"\"region-code\"",
"... | Get a country paint color from the continents array of colors | [
"Get",
"a",
"country",
"paint",
"color",
"from",
"the",
"continents",
"array",
"of",
"colors"
] | 1cfbdf4a7f68bfddddc7472b5799c7b950337b2a | https://github.com/tombatossals/angular-leaflet-directive/blob/1cfbdf4a7f68bfddddc7472b5799c7b950337b2a/examples/js/controllers.js#L3875-L3882 |
16,654 | tombatossals/angular-leaflet-directive | src/services/leafletIterators.js | function(collection, cb, ignoreCollection, cbName) {
if (!ignoreCollection) {
if (!lHlp.isDefined(collection) || !lHlp.isDefined(cb)) {
return true;
}
}
if (!lHlp.isFunction(cb)) {
cbName = lHlp.defaultTo(cb, 'cb');
$log.error(errorHeader + cbName + ' is not a function');
... | javascript | function(collection, cb, ignoreCollection, cbName) {
if (!ignoreCollection) {
if (!lHlp.isDefined(collection) || !lHlp.isDefined(cb)) {
return true;
}
}
if (!lHlp.isFunction(cb)) {
cbName = lHlp.defaultTo(cb, 'cb');
$log.error(errorHeader + cbName + ' is not a function');
... | [
"function",
"(",
"collection",
",",
"cb",
",",
"ignoreCollection",
",",
"cbName",
")",
"{",
"if",
"(",
"!",
"ignoreCollection",
")",
"{",
"if",
"(",
"!",
"lHlp",
".",
"isDefined",
"(",
"collection",
")",
"||",
"!",
"lHlp",
".",
"isDefined",
"(",
"cb",
... | END COPY fron underscore | [
"END",
"COPY",
"fron",
"underscore"
] | 1cfbdf4a7f68bfddddc7472b5799c7b950337b2a | https://github.com/tombatossals/angular-leaflet-directive/blob/1cfbdf4a7f68bfddddc7472b5799c7b950337b2a/src/services/leafletIterators.js#L136-L150 | |
16,655 | tombatossals/angular-leaflet-directive | src/directives/leaflet.js | updateWidth | function updateWidth() {
if (isNaN(attrs.width)) {
element.css('width', attrs.width);
} else {
element.css('width', attrs.width + 'px');
}
} | javascript | function updateWidth() {
if (isNaN(attrs.width)) {
element.css('width', attrs.width);
} else {
element.css('width', attrs.width + 'px');
}
} | [
"function",
"updateWidth",
"(",
")",
"{",
"if",
"(",
"isNaN",
"(",
"attrs",
".",
"width",
")",
")",
"{",
"element",
".",
"css",
"(",
"'width'",
",",
"attrs",
".",
"width",
")",
";",
"}",
"else",
"{",
"element",
".",
"css",
"(",
"'width'",
",",
"a... | Set width and height utility functions | [
"Set",
"width",
"and",
"height",
"utility",
"functions"
] | 1cfbdf4a7f68bfddddc7472b5799c7b950337b2a | https://github.com/tombatossals/angular-leaflet-directive/blob/1cfbdf4a7f68bfddddc7472b5799c7b950337b2a/src/directives/leaflet.js#L46-L52 |
16,656 | marpple/partial.js | partial.js | _set | function _set(obj, key, vORf) {
obj && (obj[key] = _.is_fn(vORf) ? vORf(obj[key]) : vORf);
} | javascript | function _set(obj, key, vORf) {
obj && (obj[key] = _.is_fn(vORf) ? vORf(obj[key]) : vORf);
} | [
"function",
"_set",
"(",
"obj",
",",
"key",
",",
"vORf",
")",
"{",
"obj",
"&&",
"(",
"obj",
"[",
"key",
"]",
"=",
"_",
".",
"is_fn",
"(",
"vORf",
")",
"?",
"vORf",
"(",
"obj",
"[",
"key",
"]",
")",
":",
"vORf",
")",
";",
"}"
] | template end mutable | [
"template",
"end",
"mutable"
] | a331f891d2ba45a3a46311e5d4335474a17dae21 | https://github.com/marpple/partial.js/blob/a331f891d2ba45a3a46311e5d4335474a17dae21/partial.js#L1408-L1410 |
16,657 | wysiwygjs/wysiwyg.js | wysiwyg.js | function( popup, modify_a_href )
{
var textbox = document.createElement('input');
textbox.placeholder = 'www.example.com';
if( modify_a_href )
textbox.value = modify_a_href.href;
textbox.style.width = '20em';
textbox.style.maxWidth = pa... | javascript | function( popup, modify_a_href )
{
var textbox = document.createElement('input');
textbox.placeholder = 'www.example.com';
if( modify_a_href )
textbox.value = modify_a_href.href;
textbox.style.width = '20em';
textbox.style.maxWidth = pa... | [
"function",
"(",
"popup",
",",
"modify_a_href",
")",
"{",
"var",
"textbox",
"=",
"document",
".",
"createElement",
"(",
"'input'",
")",
";",
"textbox",
".",
"placeholder",
"=",
"'www.example.com'",
";",
"if",
"(",
"modify_a_href",
")",
"textbox",
".",
"value... | Insert-link popup | [
"Insert",
"-",
"link",
"popup"
] | 1fccde7040e0d504cd0d9cb371c88d800c733de0 | https://github.com/wysiwygjs/wysiwyg.js/blob/1fccde7040e0d504cd0d9cb371c88d800c733de0/wysiwyg.js#L363-L417 | |
16,658 | wysiwygjs/wysiwyg.js | wysiwyg.js | function( popup, left, top ) // left+top relative to container
{
// Test parents, el.getBoundingClientRect() does not work within 'position:fixed'
var node = node_container,
popup_parent = node.offsetParent;
while( node )
{
var node... | javascript | function( popup, left, top ) // left+top relative to container
{
// Test parents, el.getBoundingClientRect() does not work within 'position:fixed'
var node = node_container,
popup_parent = node.offsetParent;
while( node )
{
var node... | [
"function",
"(",
"popup",
",",
"left",
",",
"top",
")",
"// left+top relative to container",
"{",
"// Test parents, el.getBoundingClientRect() does not work within 'position:fixed'",
"var",
"node",
"=",
"node_container",
",",
"popup_parent",
"=",
"node",
".",
"offsetParent",
... | open popup and apply position | [
"open",
"popup",
"and",
"apply",
"position"
] | 1fccde7040e0d504cd0d9cb371c88d800c733de0 | https://github.com/wysiwygjs/wysiwyg.js/blob/1fccde7040e0d504cd0d9cb371c88d800c733de0/wysiwyg.js#L492-L527 | |
16,659 | wysiwygjs/wysiwyg.js | legacy/src/wysiwyg-editor.js | function( url, filename )
{
var html = '<img id="wysiwyg-insert-image" src="" alt=""' + (filename ? ' title="'+html_encode(filename)+'"' : '') + '>';
wysiwygeditor.insertHTML( html ).closePopup().collapseSelection();
var $image = $('#wysiwyg-insert-image').rem... | javascript | function( url, filename )
{
var html = '<img id="wysiwyg-insert-image" src="" alt=""' + (filename ? ' title="'+html_encode(filename)+'"' : '') + '>';
wysiwygeditor.insertHTML( html ).closePopup().collapseSelection();
var $image = $('#wysiwyg-insert-image').rem... | [
"function",
"(",
"url",
",",
"filename",
")",
"{",
"var",
"html",
"=",
"'<img id=\"wysiwyg-insert-image\" src=\"\" alt=\"\"'",
"+",
"(",
"filename",
"?",
"' title=\"'",
"+",
"html_encode",
"(",
"filename",
")",
"+",
"'\"'",
":",
"''",
")",
"+",
"'>'",
";",
"... | Add image to editor | [
"Add",
"image",
"to",
"editor"
] | 1fccde7040e0d504cd0d9cb371c88d800c733de0 | https://github.com/wysiwygjs/wysiwyg.js/blob/1fccde7040e0d504cd0d9cb371c88d800c733de0/legacy/src/wysiwyg-editor.js#L113-L146 | |
16,660 | wysiwygjs/wysiwyg.js | legacy/src/wysiwyg-editor.js | function( file )
{
// Only process image files
if( typeof(filter_imageType) === 'function' && ! filter_imageType(file) )
return;
else if( ! file.type.match(filter_imageType) )
return;
... | javascript | function( file )
{
// Only process image files
if( typeof(filter_imageType) === 'function' && ! filter_imageType(file) )
return;
else if( ! file.type.match(filter_imageType) )
return;
... | [
"function",
"(",
"file",
")",
"{",
"// Only process image files",
"if",
"(",
"typeof",
"(",
"filter_imageType",
")",
"===",
"'function'",
"&&",
"!",
"filter_imageType",
"(",
"file",
")",
")",
"return",
";",
"else",
"if",
"(",
"!",
"file",
".",
"type",
".",... | File-API | [
"File",
"-",
"API"
] | 1fccde7040e0d504cd0d9cb371c88d800c733de0 | https://github.com/wysiwygjs/wysiwyg.js/blob/1fccde7040e0d504cd0d9cb371c88d800c733de0/legacy/src/wysiwyg-editor.js#L163-L177 | |
16,661 | wysiwygjs/wysiwyg.js | legacy/src/wysiwyg-editor.js | function( url, html )
{
url = $.trim(url||'');
html = $.trim(html||'');
var website_url = false;
if( url.length && ! html.length )
website_url = url;
else if( html.indexOf('<') == -1 && html.indexOf('>') == -... | javascript | function( url, html )
{
url = $.trim(url||'');
html = $.trim(html||'');
var website_url = false;
if( url.length && ! html.length )
website_url = url;
else if( html.indexOf('<') == -1 && html.indexOf('>') == -... | [
"function",
"(",
"url",
",",
"html",
")",
"{",
"url",
"=",
"$",
".",
"trim",
"(",
"url",
"||",
"''",
")",
";",
"html",
"=",
"$",
".",
"trim",
"(",
"html",
"||",
"''",
")",
";",
"var",
"website_url",
"=",
"false",
";",
"if",
"(",
"url",
".",
... | Add video to editor | [
"Add",
"video",
"to",
"editor"
] | 1fccde7040e0d504cd0d9cb371c88d800c733de0 | https://github.com/wysiwygjs/wysiwyg.js/blob/1fccde7040e0d504cd0d9cb371c88d800c733de0/legacy/src/wysiwyg-editor.js#L238-L253 | |
16,662 | wysiwygjs/wysiwyg.js | legacy/src/wysiwyg-editor.js | function( button ) {
var $element = $('<a/>').addClass( 'wysiwyg-toolbar-icon' )
.prop('href','#')
.prop('unselectable','on')
.append(button.image);
// pass other properties as "prop()"
... | javascript | function( button ) {
var $element = $('<a/>').addClass( 'wysiwyg-toolbar-icon' )
.prop('href','#')
.prop('unselectable','on')
.append(button.image);
// pass other properties as "prop()"
... | [
"function",
"(",
"button",
")",
"{",
"var",
"$element",
"=",
"$",
"(",
"'<a/>'",
")",
".",
"addClass",
"(",
"'wysiwyg-toolbar-icon'",
")",
".",
"prop",
"(",
"'href'",
",",
"'#'",
")",
".",
"prop",
"(",
"'unselectable'",
",",
"'on'",
")",
".",
"append",... | Create the toolbar | [
"Create",
"the",
"toolbar"
] | 1fccde7040e0d504cd0d9cb371c88d800c733de0 | https://github.com/wysiwygjs/wysiwyg.js/blob/1fccde7040e0d504cd0d9cb371c88d800c733de0/legacy/src/wysiwyg-editor.js#L429-L457 | |
16,663 | wysiwygjs/wysiwyg.js | legacy/src/wysiwyg-editor.js | function()
{
var $toolbar = $('<div/>').addClass( 'wysiwyg-toolbar' ).addClass( toolbar_top ? 'wysiwyg-toolbar-top' : 'wysiwyg-toolbar-bottom' );
if( toolbar_focus )
$toolbar.hide().addClass( 'wysiwyg-toolbar-focus' );
/... | javascript | function()
{
var $toolbar = $('<div/>').addClass( 'wysiwyg-toolbar' ).addClass( toolbar_top ? 'wysiwyg-toolbar-top' : 'wysiwyg-toolbar-bottom' );
if( toolbar_focus )
$toolbar.hide().addClass( 'wysiwyg-toolbar-focus' );
/... | [
"function",
"(",
")",
"{",
"var",
"$toolbar",
"=",
"$",
"(",
"'<div/>'",
")",
".",
"addClass",
"(",
"'wysiwyg-toolbar'",
")",
".",
"addClass",
"(",
"toolbar_top",
"?",
"'wysiwyg-toolbar-top'",
":",
"'wysiwyg-toolbar-bottom'",
")",
";",
"if",
"(",
"toolbar_focu... | Callback to create toolbar on demand | [
"Callback",
"to",
"create",
"toolbar",
"on",
"demand"
] | 1fccde7040e0d504cd0d9cb371c88d800c733de0 | https://github.com/wysiwygjs/wysiwyg.js/blob/1fccde7040e0d504cd0d9cb371c88d800c733de0/legacy/src/wysiwyg-editor.js#L858-L898 | |
16,664 | a5hik/ng-sortable | source/sortable-item-handle.js | isParent | function isParent(possibleParent, elem) {
if(!elem || elem.nodeName === 'HTML') {
return false;
}
if(elem.parentNode === possibleParent) {
return true;
}
return isParent(possibleParent, elem.parentNode);
} | javascript | function isParent(possibleParent, elem) {
if(!elem || elem.nodeName === 'HTML') {
return false;
}
if(elem.parentNode === possibleParent) {
return true;
}
return isParent(possibleParent, elem.parentNode);
} | [
"function",
"isParent",
"(",
"possibleParent",
",",
"elem",
")",
"{",
"if",
"(",
"!",
"elem",
"||",
"elem",
".",
"nodeName",
"===",
"'HTML'",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"elem",
".",
"parentNode",
"===",
"possibleParent",
")",
"{"... | Check if a node is parent to another node | [
"Check",
"if",
"a",
"node",
"is",
"parent",
"to",
"another",
"node"
] | 8b5fd8f90bf7b77069ffe91812e35dcbca367510 | https://github.com/a5hik/ng-sortable/blob/8b5fd8f90bf7b77069ffe91812e35dcbca367510/source/sortable-item-handle.js#L23-L33 |
16,665 | a5hik/ng-sortable | source/sortable-item-handle.js | insertBefore | function insertBefore(targetElement, targetScope) {
// Ensure the placeholder is visible in the target (unless it's a table row)
if (placeHolder.css('display') !== 'table-row') {
placeHolder.css('display', 'block');
}
if (!targetScope.sortableScope.options.c... | javascript | function insertBefore(targetElement, targetScope) {
// Ensure the placeholder is visible in the target (unless it's a table row)
if (placeHolder.css('display') !== 'table-row') {
placeHolder.css('display', 'block');
}
if (!targetScope.sortableScope.options.c... | [
"function",
"insertBefore",
"(",
"targetElement",
",",
"targetScope",
")",
"{",
"// Ensure the placeholder is visible in the target (unless it's a table row)",
"if",
"(",
"placeHolder",
".",
"css",
"(",
"'display'",
")",
"!==",
"'table-row'",
")",
"{",
"placeHolder",
".",... | Inserts the placeHolder in to the targetScope.
@param targetElement the target element
@param targetScope the target scope | [
"Inserts",
"the",
"placeHolder",
"in",
"to",
"the",
"targetScope",
"."
] | 8b5fd8f90bf7b77069ffe91812e35dcbca367510 | https://github.com/a5hik/ng-sortable/blob/8b5fd8f90bf7b77069ffe91812e35dcbca367510/source/sortable-item-handle.js#L285-L294 |
16,666 | a5hik/ng-sortable | source/sortable-item-handle.js | insertAfter | function insertAfter(targetElement, targetScope) {
// Ensure the placeholder is visible in the target (unless it's a table row)
if (placeHolder.css('display') !== 'table-row') {
placeHolder.css('display', 'block');
}
if (!targetScope.sortableScope.options.cl... | javascript | function insertAfter(targetElement, targetScope) {
// Ensure the placeholder is visible in the target (unless it's a table row)
if (placeHolder.css('display') !== 'table-row') {
placeHolder.css('display', 'block');
}
if (!targetScope.sortableScope.options.cl... | [
"function",
"insertAfter",
"(",
"targetElement",
",",
"targetScope",
")",
"{",
"// Ensure the placeholder is visible in the target (unless it's a table row)",
"if",
"(",
"placeHolder",
".",
"css",
"(",
"'display'",
")",
"!==",
"'table-row'",
")",
"{",
"placeHolder",
".",
... | Inserts the placeHolder next to the targetScope.
@param targetElement the target element
@param targetScope the target scope | [
"Inserts",
"the",
"placeHolder",
"next",
"to",
"the",
"targetScope",
"."
] | 8b5fd8f90bf7b77069ffe91812e35dcbca367510 | https://github.com/a5hik/ng-sortable/blob/8b5fd8f90bf7b77069ffe91812e35dcbca367510/source/sortable-item-handle.js#L302-L311 |
16,667 | a5hik/ng-sortable | source/sortable-item-handle.js | fetchScope | function fetchScope(element) {
var scope;
while (!scope && element.length) {
scope = element.data('_scope');
if (!scope) {
element = element.parent();
}
}
return scope;
} | javascript | function fetchScope(element) {
var scope;
while (!scope && element.length) {
scope = element.data('_scope');
if (!scope) {
element = element.parent();
}
}
return scope;
} | [
"function",
"fetchScope",
"(",
"element",
")",
"{",
"var",
"scope",
";",
"while",
"(",
"!",
"scope",
"&&",
"element",
".",
"length",
")",
"{",
"scope",
"=",
"element",
".",
"data",
"(",
"'_scope'",
")",
";",
"if",
"(",
"!",
"scope",
")",
"{",
"elem... | Fetch scope from element or parents
@param {object} element Source element
@return {object} Scope, or null if not found | [
"Fetch",
"scope",
"from",
"element",
"or",
"parents"
] | 8b5fd8f90bf7b77069ffe91812e35dcbca367510 | https://github.com/a5hik/ng-sortable/blob/8b5fd8f90bf7b77069ffe91812e35dcbca367510/source/sortable-item-handle.js#L409-L418 |
16,668 | a5hik/ng-sortable | source/sortable-item-handle.js | rollbackDragChanges | function rollbackDragChanges() {
if (!scope.itemScope.sortableScope.cloning) {
placeElement.replaceWith(scope.itemScope.element);
}
placeHolder.remove();
dragElement.remove();
dragElement = null;
dragHandled = false;
conta... | javascript | function rollbackDragChanges() {
if (!scope.itemScope.sortableScope.cloning) {
placeElement.replaceWith(scope.itemScope.element);
}
placeHolder.remove();
dragElement.remove();
dragElement = null;
dragHandled = false;
conta... | [
"function",
"rollbackDragChanges",
"(",
")",
"{",
"if",
"(",
"!",
"scope",
".",
"itemScope",
".",
"sortableScope",
".",
"cloning",
")",
"{",
"placeElement",
".",
"replaceWith",
"(",
"scope",
".",
"itemScope",
".",
"element",
")",
";",
"}",
"placeHolder",
"... | Rollback the drag data changes. | [
"Rollback",
"the",
"drag",
"data",
"changes",
"."
] | 8b5fd8f90bf7b77069ffe91812e35dcbca367510 | https://github.com/a5hik/ng-sortable/blob/8b5fd8f90bf7b77069ffe91812e35dcbca367510/source/sortable-item-handle.js#L458-L468 |
16,669 | a5hik/ng-sortable | source/sortable-helper.js | function (event) {
var obj = event;
if (event.targetTouches !== undefined) {
obj = event.targetTouches.item(0);
} else if (event.originalEvent !== undefined && event.originalEvent.targetTouches !== undefined) {
obj = event.originalEvent.targetTouches.item(0);
... | javascript | function (event) {
var obj = event;
if (event.targetTouches !== undefined) {
obj = event.targetTouches.item(0);
} else if (event.originalEvent !== undefined && event.originalEvent.targetTouches !== undefined) {
obj = event.originalEvent.targetTouches.item(0);
... | [
"function",
"(",
"event",
")",
"{",
"var",
"obj",
"=",
"event",
";",
"if",
"(",
"event",
".",
"targetTouches",
"!==",
"undefined",
")",
"{",
"obj",
"=",
"event",
".",
"targetTouches",
".",
"item",
"(",
"0",
")",
";",
"}",
"else",
"if",
"(",
"event"... | get the event object for touch.
@param {Object} event the touch event
@return {Object} the touch event object. | [
"get",
"the",
"event",
"object",
"for",
"touch",
"."
] | 8b5fd8f90bf7b77069ffe91812e35dcbca367510 | https://github.com/a5hik/ng-sortable/blob/8b5fd8f90bf7b77069ffe91812e35dcbca367510/source/sortable-helper.js#L63-L71 | |
16,670 | a5hik/ng-sortable | source/sortable-helper.js | function (event) {
var touchInvalid = false;
if (event.touches !== undefined && event.touches.length > 1) {
touchInvalid = true;
} else if (event.originalEvent !== undefined &&
event.originalEvent.touches !== undefined && event.originalEvent.touches.length > 1) {
... | javascript | function (event) {
var touchInvalid = false;
if (event.touches !== undefined && event.touches.length > 1) {
touchInvalid = true;
} else if (event.originalEvent !== undefined &&
event.originalEvent.touches !== undefined && event.originalEvent.touches.length > 1) {
... | [
"function",
"(",
"event",
")",
"{",
"var",
"touchInvalid",
"=",
"false",
";",
"if",
"(",
"event",
".",
"touches",
"!==",
"undefined",
"&&",
"event",
".",
"touches",
".",
"length",
">",
"1",
")",
"{",
"touchInvalid",
"=",
"true",
";",
"}",
"else",
"if... | Checks whether the touch is valid and multiple.
@param event the event object.
@returns {boolean} true if touch is multiple. | [
"Checks",
"whether",
"the",
"touch",
"is",
"valid",
"and",
"multiple",
"."
] | 8b5fd8f90bf7b77069ffe91812e35dcbca367510 | https://github.com/a5hik/ng-sortable/blob/8b5fd8f90bf7b77069ffe91812e35dcbca367510/source/sortable-helper.js#L79-L89 | |
16,671 | a5hik/ng-sortable | source/sortable-helper.js | function (event, target, scrollableContainer) {
var pos = {};
pos.offsetX = event.pageX - this.offset(target, scrollableContainer).left;
pos.offsetY = event.pageY - this.offset(target, scrollableContainer).top;
pos.startX = pos.lastX = event.pageX;
pos.startY = pos.last... | javascript | function (event, target, scrollableContainer) {
var pos = {};
pos.offsetX = event.pageX - this.offset(target, scrollableContainer).left;
pos.offsetY = event.pageY - this.offset(target, scrollableContainer).top;
pos.startX = pos.lastX = event.pageX;
pos.startY = pos.last... | [
"function",
"(",
"event",
",",
"target",
",",
"scrollableContainer",
")",
"{",
"var",
"pos",
"=",
"{",
"}",
";",
"pos",
".",
"offsetX",
"=",
"event",
".",
"pageX",
"-",
"this",
".",
"offset",
"(",
"target",
",",
"scrollableContainer",
")",
".",
"left",... | Get the start position of the target element according to the provided event properties.
@param {Object} event Event
@param {Object} target Target element
@param {Object} [scrollableContainer] (optional) Scrollable container object
@returns {Object} Object with properties offsetX, offsetY. | [
"Get",
"the",
"start",
"position",
"of",
"the",
"target",
"element",
"according",
"to",
"the",
"provided",
"event",
"properties",
"."
] | 8b5fd8f90bf7b77069ffe91812e35dcbca367510 | https://github.com/a5hik/ng-sortable/blob/8b5fd8f90bf7b77069ffe91812e35dcbca367510/source/sortable-helper.js#L99-L108 | |
16,672 | a5hik/ng-sortable | source/sortable-helper.js | function (pos, event) {
// mouse position last events
pos.lastX = pos.nowX;
pos.lastY = pos.nowY;
// mouse position this events
pos.nowX = event.pageX;
pos.nowY = event.pageY;
// distance mouse moved between events
pos.distX = pos.nowX - ... | javascript | function (pos, event) {
// mouse position last events
pos.lastX = pos.nowX;
pos.lastY = pos.nowY;
// mouse position this events
pos.nowX = event.pageX;
pos.nowY = event.pageY;
// distance mouse moved between events
pos.distX = pos.nowX - ... | [
"function",
"(",
"pos",
",",
"event",
")",
"{",
"// mouse position last events",
"pos",
".",
"lastX",
"=",
"pos",
".",
"nowX",
";",
"pos",
".",
"lastY",
"=",
"pos",
".",
"nowY",
";",
"// mouse position this events",
"pos",
".",
"nowX",
"=",
"event",
".",
... | Calculates the event position and sets the direction
properties.
@param pos the current position of the element.
@param event the move event. | [
"Calculates",
"the",
"event",
"position",
"and",
"sets",
"the",
"direction",
"properties",
"."
] | 8b5fd8f90bf7b77069ffe91812e35dcbca367510 | https://github.com/a5hik/ng-sortable/blob/8b5fd8f90bf7b77069ffe91812e35dcbca367510/source/sortable-helper.js#L117-L157 | |
16,673 | a5hik/ng-sortable | source/sortable-helper.js | function (event, element, pos, container, containerPositioning, scrollableContainer) {
var bounds;
var useRelative = (containerPositioning === 'relative');
element.x = event.pageX - pos.offsetX;
element.y = event.pageY - pos.offsetY;
if (container) {
bound... | javascript | function (event, element, pos, container, containerPositioning, scrollableContainer) {
var bounds;
var useRelative = (containerPositioning === 'relative');
element.x = event.pageX - pos.offsetX;
element.y = event.pageY - pos.offsetY;
if (container) {
bound... | [
"function",
"(",
"event",
",",
"element",
",",
"pos",
",",
"container",
",",
"containerPositioning",
",",
"scrollableContainer",
")",
"{",
"var",
"bounds",
";",
"var",
"useRelative",
"=",
"(",
"containerPositioning",
"===",
"'relative'",
")",
";",
"element",
"... | Move the position by applying style.
@param event the event object
@param element - the dom element
@param pos - current position
@param container - the bounding container.
@param containerPositioning - absolute or relative positioning.
@param {Object} [scrollableContainer] (optional) Scrollable container object | [
"Move",
"the",
"position",
"by",
"applying",
"style",
"."
] | 8b5fd8f90bf7b77069ffe91812e35dcbca367510 | https://github.com/a5hik/ng-sortable/blob/8b5fd8f90bf7b77069ffe91812e35dcbca367510/source/sortable-helper.js#L169-L207 | |
16,674 | a5hik/ng-sortable | source/sortable-helper.js | function (item) {
return {
index: item.index(),
parent: item.sortableScope,
source: item,
targetElement: null,
targetElementOffset: null,
sourceInfo: {
index: item.index(),
itemScope: item.itemScope,
... | javascript | function (item) {
return {
index: item.index(),
parent: item.sortableScope,
source: item,
targetElement: null,
targetElementOffset: null,
sourceInfo: {
index: item.index(),
itemScope: item.itemScope,
... | [
"function",
"(",
"item",
")",
"{",
"return",
"{",
"index",
":",
"item",
".",
"index",
"(",
")",
",",
"parent",
":",
"item",
".",
"sortableScope",
",",
"source",
":",
"item",
",",
"targetElement",
":",
"null",
",",
"targetElementOffset",
":",
"null",
",... | The drag item info and functions.
retains the item info before and after move.
holds source item and target scope.
@param item - the drag item
@returns {{index: *, parent: *, source: *,
sourceInfo: {index: *, itemScope: (*|.dragItem.sourceInfo.itemScope|$scope.itemScope|itemScope), sortableScope: *},
moveTo: moveTo, i... | [
"The",
"drag",
"item",
"info",
"and",
"functions",
".",
"retains",
"the",
"item",
"info",
"before",
"and",
"after",
"move",
".",
"holds",
"source",
"item",
"and",
"target",
"scope",
"."
] | 8b5fd8f90bf7b77069ffe91812e35dcbca367510 | https://github.com/a5hik/ng-sortable/blob/8b5fd8f90bf7b77069ffe91812e35dcbca367510/source/sortable-helper.js#L219-L287 | |
16,675 | a5hik/ng-sortable | source/sortable-helper.js | function (el, selector) {
el = el[0];
var matches = Element.matches || Element.prototype.mozMatchesSelector || Element.prototype.msMatchesSelector || Element.prototype.oMatchesSelector || Element.prototype.webkitMatchesSelector;
while ((el = el.parentElement) && !matches.call(el, selector)... | javascript | function (el, selector) {
el = el[0];
var matches = Element.matches || Element.prototype.mozMatchesSelector || Element.prototype.msMatchesSelector || Element.prototype.oMatchesSelector || Element.prototype.webkitMatchesSelector;
while ((el = el.parentElement) && !matches.call(el, selector)... | [
"function",
"(",
"el",
",",
"selector",
")",
"{",
"el",
"=",
"el",
"[",
"0",
"]",
";",
"var",
"matches",
"=",
"Element",
".",
"matches",
"||",
"Element",
".",
"prototype",
".",
"mozMatchesSelector",
"||",
"Element",
".",
"prototype",
".",
"msMatchesSelec... | Helper function to find the first ancestor with a given selector
@param el - angular element to start looking at
@param selector - selector to find the parent
@returns {Object} - Angular element of the ancestor or body if not found
@private | [
"Helper",
"function",
"to",
"find",
"the",
"first",
"ancestor",
"with",
"a",
"given",
"selector"
] | 8b5fd8f90bf7b77069ffe91812e35dcbca367510 | https://github.com/a5hik/ng-sortable/blob/8b5fd8f90bf7b77069ffe91812e35dcbca367510/source/sortable-helper.js#L306-L312 | |
16,676 | Azure/node-red-contrib-azure | event-hub/azureeventhub2.js | printResultFor | function printResultFor(node, op) {
return function printResult(err, res) {
if (err) node.error(op + ' error: ' + err.toString());
if (res) node.log(op + ' status: ' + res.constructor.name);
};
} | javascript | function printResultFor(node, op) {
return function printResult(err, res) {
if (err) node.error(op + ' error: ' + err.toString());
if (res) node.log(op + ' status: ' + res.constructor.name);
};
} | [
"function",
"printResultFor",
"(",
"node",
",",
"op",
")",
"{",
"return",
"function",
"printResult",
"(",
"err",
",",
"res",
")",
"{",
"if",
"(",
"err",
")",
"node",
".",
"error",
"(",
"op",
"+",
"' error: '",
"+",
"err",
".",
"toString",
"(",
")",
... | Helper function to print results in the console | [
"Helper",
"function",
"to",
"print",
"results",
"in",
"the",
"console"
] | 12b117c67385b019b1dd92ff689974674c1a4e87 | https://github.com/Azure/node-red-contrib-azure/blob/12b117c67385b019b1dd92ff689974674c1a4e87/event-hub/azureeventhub2.js#L132-L137 |
16,677 | wdfe/wdui | src/utils/Scroller.js | function(factor, animate, originLeft, originTop, callback) {
let self = this
self.zoomTo(self.__zoomLevel * factor, animate, originLeft, originTop, callback)
} | javascript | function(factor, animate, originLeft, originTop, callback) {
let self = this
self.zoomTo(self.__zoomLevel * factor, animate, originLeft, originTop, callback)
} | [
"function",
"(",
"factor",
",",
"animate",
",",
"originLeft",
",",
"originTop",
",",
"callback",
")",
"{",
"let",
"self",
"=",
"this",
"self",
".",
"zoomTo",
"(",
"self",
".",
"__zoomLevel",
"*",
"factor",
",",
"animate",
",",
"originLeft",
",",
"originT... | Zooms the content by the given factor.
@param factor {Number} Zoom by given factor
@param animate {Boolean ? false} Whether to use animation
@param originLeft {Number ? 0} Zoom in at given left coordinate
@param originTop {Number ? 0} Zoom in at given top coordinate
@param callback {Function ? null} A callback that ge... | [
"Zooms",
"the",
"content",
"by",
"the",
"given",
"factor",
"."
] | 796ae53886d0db9f5acf26d5ca049eb3274002df | https://github.com/wdfe/wdui/blob/796ae53886d0db9f5acf26d5ca049eb3274002df/src/utils/Scroller.js#L728-L734 | |
16,678 | box/t3js | examples/todo/js/modules/header.js | function(event, element, elementType) {
// code to be run when a click occurs
if (elementType === 'new-todo-input') {
if (event.keyCode === ENTER_KEY) {
var todoTitle = (element.value).trim();
if (todoTitle.length) {
var newTodoId = todosDB.add(todoTitle);
context.broadcast('todoadd... | javascript | function(event, element, elementType) {
// code to be run when a click occurs
if (elementType === 'new-todo-input') {
if (event.keyCode === ENTER_KEY) {
var todoTitle = (element.value).trim();
if (todoTitle.length) {
var newTodoId = todosDB.add(todoTitle);
context.broadcast('todoadd... | [
"function",
"(",
"event",
",",
"element",
",",
"elementType",
")",
"{",
"// code to be run when a click occurs",
"if",
"(",
"elementType",
"===",
"'new-todo-input'",
")",
"{",
"if",
"(",
"event",
".",
"keyCode",
"===",
"ENTER_KEY",
")",
"{",
"var",
"todoTitle",
... | Handles the keydown event for the module.
@param {Event} event A DOM-normalized event object.
@param {HTMLElement} element The nearest HTML element with a data-type
attribute specified or null if there is none.
@param {string} elementType The value of data-type for the nearest
element with that attribute specified or n... | [
"Handles",
"the",
"keydown",
"event",
"for",
"the",
"module",
"."
] | 1cc1751650e339bd5243a0f20cc76543c834ac09 | https://github.com/box/t3js/blob/1cc1751650e339bd5243a0f20cc76543c834ac09/examples/todo/js/modules/header.js#L52-L78 | |
16,679 | box/t3js | Makefile.js | nodeExec | function nodeExec(args) {
args = arguments; // make linting happy
var code = nodeCLI.exec.apply(nodeCLI, args).code;
if (code !== 0) {
exit(code);
}
} | javascript | function nodeExec(args) {
args = arguments; // make linting happy
var code = nodeCLI.exec.apply(nodeCLI, args).code;
if (code !== 0) {
exit(code);
}
} | [
"function",
"nodeExec",
"(",
"args",
")",
"{",
"args",
"=",
"arguments",
";",
"// make linting happy",
"var",
"code",
"=",
"nodeCLI",
".",
"exec",
".",
"apply",
"(",
"nodeCLI",
",",
"args",
")",
".",
"code",
";",
"if",
"(",
"code",
"!==",
"0",
")",
"... | Executes a Node CLI and exits with a non-zero exit code if the
CLI execution returns a non-zero exit code. Otherwise, it does
not exit.
@param {...string} [args] Arguments to pass to the Node CLI utility.
@returns {void}
@private | [
"Executes",
"a",
"Node",
"CLI",
"and",
"exits",
"with",
"a",
"non",
"-",
"zero",
"exit",
"code",
"if",
"the",
"CLI",
"execution",
"returns",
"a",
"non",
"-",
"zero",
"exit",
"code",
".",
"Otherwise",
"it",
"does",
"not",
"exit",
"."
] | 1cc1751650e339bd5243a0f20cc76543c834ac09 | https://github.com/box/t3js/blob/1cc1751650e339bd5243a0f20cc76543c834ac09/Makefile.js#L75-L81 |
16,680 | box/t3js | Makefile.js | getSourceDirectories | function getSourceDirectories() {
var dirs = [ 'lib', 'src', 'app' ],
result = [];
dirs.forEach(function(dir) {
if (test('-d', dir)) {
result.push(dir);
}
});
return result;
} | javascript | function getSourceDirectories() {
var dirs = [ 'lib', 'src', 'app' ],
result = [];
dirs.forEach(function(dir) {
if (test('-d', dir)) {
result.push(dir);
}
});
return result;
} | [
"function",
"getSourceDirectories",
"(",
")",
"{",
"var",
"dirs",
"=",
"[",
"'lib'",
",",
"'src'",
",",
"'app'",
"]",
",",
"result",
"=",
"[",
"]",
";",
"dirs",
".",
"forEach",
"(",
"function",
"(",
"dir",
")",
"{",
"if",
"(",
"test",
"(",
"'-d'",
... | Determines which directories are present that might have JavaScript files.
@returns {string[]} An array of directories that exist.
@private | [
"Determines",
"which",
"directories",
"are",
"present",
"that",
"might",
"have",
"JavaScript",
"files",
"."
] | 1cc1751650e339bd5243a0f20cc76543c834ac09 | https://github.com/box/t3js/blob/1cc1751650e339bd5243a0f20cc76543c834ac09/Makefile.js#L113-L124 |
16,681 | box/t3js | Makefile.js | getVersionTags | function getVersionTags() {
var tags = exec('git tag', { silent: true }).output.trim().split(/\n/g);
return tags.reduce(function(list, tag) {
if (semver.valid(tag)) {
list.push(tag);
}
return list;
}, []).sort(semver.compare);
} | javascript | function getVersionTags() {
var tags = exec('git tag', { silent: true }).output.trim().split(/\n/g);
return tags.reduce(function(list, tag) {
if (semver.valid(tag)) {
list.push(tag);
}
return list;
}, []).sort(semver.compare);
} | [
"function",
"getVersionTags",
"(",
")",
"{",
"var",
"tags",
"=",
"exec",
"(",
"'git tag'",
",",
"{",
"silent",
":",
"true",
"}",
")",
".",
"output",
".",
"trim",
"(",
")",
".",
"split",
"(",
"/",
"\\n",
"/",
"g",
")",
";",
"return",
"tags",
".",
... | Gets the git tags that represent versions.
@returns {string[]} An array of tags in the git repo.
@private | [
"Gets",
"the",
"git",
"tags",
"that",
"represent",
"versions",
"."
] | 1cc1751650e339bd5243a0f20cc76543c834ac09 | https://github.com/box/t3js/blob/1cc1751650e339bd5243a0f20cc76543c834ac09/Makefile.js#L131-L140 |
16,682 | box/t3js | Makefile.js | generateDistFiles | function generateDistFiles(config) {
// Delete package.json from the cache since it can get updated by npm version
delete require.cache[require.resolve('./package.json')];
var pkg = require('./package.json'),
distFilename = DIST_DIR + config.name + '.js',
minDistFilename = distFilename.replace(/\.js$/, '.min.js... | javascript | function generateDistFiles(config) {
// Delete package.json from the cache since it can get updated by npm version
delete require.cache[require.resolve('./package.json')];
var pkg = require('./package.json'),
distFilename = DIST_DIR + config.name + '.js',
minDistFilename = distFilename.replace(/\.js$/, '.min.js... | [
"function",
"generateDistFiles",
"(",
"config",
")",
"{",
"// Delete package.json from the cache since it can get updated by npm version",
"delete",
"require",
".",
"cache",
"[",
"require",
".",
"resolve",
"(",
"'./package.json'",
")",
"]",
";",
"var",
"pkg",
"=",
"requ... | Generate distribution files for a single package
@param Object config The distribution configuration
@returns {void}
@private | [
"Generate",
"distribution",
"files",
"for",
"a",
"single",
"package"
] | 1cc1751650e339bd5243a0f20cc76543c834ac09 | https://github.com/box/t3js/blob/1cc1751650e339bd5243a0f20cc76543c834ac09/Makefile.js#L181-L214 |
16,683 | box/t3js | Makefile.js | dist | function dist() {
if (test('-d', DIST_DIR)) {
rm('-r', DIST_DIR + '*');
} else {
mkdir(DIST_DIR);
}
[{
name: DIST_NATIVE_NAME,
files: SRC_NATIVE_FILES,
testingFiles: TESTING_NATIVE_FILES
}, {
name: DIST_JQUERY_NAME,
files: SRC_JQUERY_FILES,
testingFiles: TESTING_JQUERY_FILES
}, {
name: DIST_NAM... | javascript | function dist() {
if (test('-d', DIST_DIR)) {
rm('-r', DIST_DIR + '*');
} else {
mkdir(DIST_DIR);
}
[{
name: DIST_NATIVE_NAME,
files: SRC_NATIVE_FILES,
testingFiles: TESTING_NATIVE_FILES
}, {
name: DIST_JQUERY_NAME,
files: SRC_JQUERY_FILES,
testingFiles: TESTING_JQUERY_FILES
}, {
name: DIST_NAM... | [
"function",
"dist",
"(",
")",
"{",
"if",
"(",
"test",
"(",
"'-d'",
",",
"DIST_DIR",
")",
")",
"{",
"rm",
"(",
"'-r'",
",",
"DIST_DIR",
"+",
"'*'",
")",
";",
"}",
"else",
"{",
"mkdir",
"(",
"DIST_DIR",
")",
";",
"}",
"[",
"{",
"name",
":",
"DI... | Generate all distribution files
@private | [
"Generate",
"all",
"distribution",
"files"
] | 1cc1751650e339bd5243a0f20cc76543c834ac09 | https://github.com/box/t3js/blob/1cc1751650e339bd5243a0f20cc76543c834ac09/Makefile.js#L220-L242 |
16,684 | box/t3js | examples/todo/js/t3-dev-build.js | reset | function reset() {
globalConfig = {};
modules = {};
services = {};
behaviors = {};
instances = {};
initialized = false;
for (var i = 0; i < exports.length; i++) {
delete application[exports[i]];
delete Box.Context.prototype[exports[i]];
}
exports = [];
} | javascript | function reset() {
globalConfig = {};
modules = {};
services = {};
behaviors = {};
instances = {};
initialized = false;
for (var i = 0; i < exports.length; i++) {
delete application[exports[i]];
delete Box.Context.prototype[exports[i]];
}
exports = [];
} | [
"function",
"reset",
"(",
")",
"{",
"globalConfig",
"=",
"{",
"}",
";",
"modules",
"=",
"{",
"}",
";",
"services",
"=",
"{",
"}",
";",
"behaviors",
"=",
"{",
"}",
";",
"instances",
"=",
"{",
"}",
";",
"initialized",
"=",
"false",
";",
"for",
"(",... | Reset all state to its default values
@returns {void}
@private | [
"Reset",
"all",
"state",
"to",
"its",
"default",
"values"
] | 1cc1751650e339bd5243a0f20cc76543c834ac09 | https://github.com/box/t3js/blob/1cc1751650e339bd5243a0f20cc76543c834ac09/examples/todo/js/t3-dev-build.js#L265-L278 |
16,685 | box/t3js | examples/todo/js/t3-dev-build.js | callModuleMethod | function callModuleMethod(instance, method) {
if (typeof instance[method] === 'function') {
// Getting the rest of the parameters (the ones other than instance and method)
instance[method].apply(instance, Array.prototype.slice.call(arguments, 2));
}
} | javascript | function callModuleMethod(instance, method) {
if (typeof instance[method] === 'function') {
// Getting the rest of the parameters (the ones other than instance and method)
instance[method].apply(instance, Array.prototype.slice.call(arguments, 2));
}
} | [
"function",
"callModuleMethod",
"(",
"instance",
",",
"method",
")",
"{",
"if",
"(",
"typeof",
"instance",
"[",
"method",
"]",
"===",
"'function'",
")",
"{",
"// Getting the rest of the parameters (the ones other than instance and method)",
"instance",
"[",
"method",
"]... | Calls a method on an object if it exists
@param {Box.Application~ModuleInstance} instance Module object to call the method on.
@param {string} method Name of method
@param {...*} [args] Any additional arguments are passed as function parameters (Optional)
@returns {void}
@private | [
"Calls",
"a",
"method",
"on",
"an",
"object",
"if",
"it",
"exists"
] | 1cc1751650e339bd5243a0f20cc76543c834ac09 | https://github.com/box/t3js/blob/1cc1751650e339bd5243a0f20cc76543c834ac09/examples/todo/js/t3-dev-build.js#L366-L371 |
16,686 | box/t3js | examples/todo/js/t3-dev-build.js | bindEventType | function bindEventType(element, type, handlers) {
function eventHandler(event) {
var targetElement = getNearestTypeElement(event.target),
elementType = targetElement ? targetElement.getAttribute('data-type') : '';
for (var i = 0; i < handlers.length; i++) {
handlers[i](event, targetElement, elementTy... | javascript | function bindEventType(element, type, handlers) {
function eventHandler(event) {
var targetElement = getNearestTypeElement(event.target),
elementType = targetElement ? targetElement.getAttribute('data-type') : '';
for (var i = 0; i < handlers.length; i++) {
handlers[i](event, targetElement, elementTy... | [
"function",
"bindEventType",
"(",
"element",
",",
"type",
",",
"handlers",
")",
"{",
"function",
"eventHandler",
"(",
"event",
")",
"{",
"var",
"targetElement",
"=",
"getNearestTypeElement",
"(",
"event",
".",
"target",
")",
",",
"elementType",
"=",
"targetEle... | Binds a user event to a DOM element with the given handler
@param {HTMLElement} element DOM element to bind the event to
@param {string} type Event type (click, mouseover, ...)
@param {Function[]} handlers Array of event callbacks to be called in that order
@returns {Function} The event handler
@private | [
"Binds",
"a",
"user",
"event",
"to",
"a",
"DOM",
"element",
"with",
"the",
"given",
"handler"
] | 1cc1751650e339bd5243a0f20cc76543c834ac09 | https://github.com/box/t3js/blob/1cc1751650e339bd5243a0f20cc76543c834ac09/examples/todo/js/t3-dev-build.js#L453-L470 |
16,687 | box/t3js | examples/todo/js/t3-dev-build.js | function(root) {
var me = this,
$root = $(root);
$root.find(MODULE_SELECTOR).each(function(idx, element) {
me.start(element);
});
} | javascript | function(root) {
var me = this,
$root = $(root);
$root.find(MODULE_SELECTOR).each(function(idx, element) {
me.start(element);
});
} | [
"function",
"(",
"root",
")",
"{",
"var",
"me",
"=",
"this",
",",
"$root",
"=",
"$",
"(",
"root",
")",
";",
"$root",
".",
"find",
"(",
"MODULE_SELECTOR",
")",
".",
"each",
"(",
"function",
"(",
"idx",
",",
"element",
")",
"{",
"me",
".",
"start",... | Starts all modules contained within an element
@param {HTMLElement} root DOM element which contains modules
@returns {void} | [
"Starts",
"all",
"modules",
"contained",
"within",
"an",
"element"
] | 1cc1751650e339bd5243a0f20cc76543c834ac09 | https://github.com/box/t3js/blob/1cc1751650e339bd5243a0f20cc76543c834ac09/examples/todo/js/t3-dev-build.js#L684-L691 | |
16,688 | box/t3js | examples/todo/js/t3-dev-build.js | function(config) {
if (initialized) {
error(new Error('Cannot set global configuration after application initialization'));
return;
}
for (var prop in config) {
if (config.hasOwnProperty(prop)) {
globalConfig[prop] = config[prop];
}
}
} | javascript | function(config) {
if (initialized) {
error(new Error('Cannot set global configuration after application initialization'));
return;
}
for (var prop in config) {
if (config.hasOwnProperty(prop)) {
globalConfig[prop] = config[prop];
}
}
} | [
"function",
"(",
"config",
")",
"{",
"if",
"(",
"initialized",
")",
"{",
"error",
"(",
"new",
"Error",
"(",
"'Cannot set global configuration after application initialization'",
")",
")",
";",
"return",
";",
"}",
"for",
"(",
"var",
"prop",
"in",
"config",
")",... | Sets the global configuration data
@param {Object} config Global configuration object
@returns {void} | [
"Sets",
"the",
"global",
"configuration",
"data"
] | 1cc1751650e339bd5243a0f20cc76543c834ac09 | https://github.com/box/t3js/blob/1cc1751650e339bd5243a0f20cc76543c834ac09/examples/todo/js/t3-dev-build.js#L945-L956 | |
16,689 | box/t3js | examples/todo/js/modules/page.js | function() {
var baseUrl = context.getGlobal('location').pathname;
routerService = context.getService('router');
routerService.init([
baseUrl,
baseUrl + 'active',
baseUrl + 'completed'
]);
} | javascript | function() {
var baseUrl = context.getGlobal('location').pathname;
routerService = context.getService('router');
routerService.init([
baseUrl,
baseUrl + 'active',
baseUrl + 'completed'
]);
} | [
"function",
"(",
")",
"{",
"var",
"baseUrl",
"=",
"context",
".",
"getGlobal",
"(",
"'location'",
")",
".",
"pathname",
";",
"routerService",
"=",
"context",
".",
"getService",
"(",
"'router'",
")",
";",
"routerService",
".",
"init",
"(",
"[",
"baseUrl",
... | Initializes the module. Caches a data store object to todos
@returns {void} | [
"Initializes",
"the",
"module",
".",
"Caches",
"a",
"data",
"store",
"object",
"to",
"todos"
] | 1cc1751650e339bd5243a0f20cc76543c834ac09 | https://github.com/box/t3js/blob/1cc1751650e339bd5243a0f20cc76543c834ac09/examples/todo/js/modules/page.js#L29-L38 | |
16,690 | box/t3js | lib/application-stub.js | function(serviceName, application) {
var serviceData = services[serviceName];
if (serviceData) {
return services[serviceName].creator(application);
}
return null;
} | javascript | function(serviceName, application) {
var serviceData = services[serviceName];
if (serviceData) {
return services[serviceName].creator(application);
}
return null;
} | [
"function",
"(",
"serviceName",
",",
"application",
")",
"{",
"var",
"serviceData",
"=",
"services",
"[",
"serviceName",
"]",
";",
"if",
"(",
"serviceData",
")",
"{",
"return",
"services",
"[",
"serviceName",
"]",
".",
"creator",
"(",
"application",
")",
"... | Will create a new instance of a service with the given application context
@param {string} serviceName The name of the service being created
@param {Object} application The application context object (usually a TestServiceProvider)
@returns {?Object} The service object | [
"Will",
"create",
"a",
"new",
"instance",
"of",
"a",
"service",
"with",
"the",
"given",
"application",
"context"
] | 1cc1751650e339bd5243a0f20cc76543c834ac09 | https://github.com/box/t3js/blob/1cc1751650e339bd5243a0f20cc76543c834ac09/lib/application-stub.js#L86-L92 | |
16,691 | box/t3js | lib/application-stub.js | function(moduleName, context) {
var module = modules[moduleName].creator(context);
if (!context.getElement) {
// Add in a default getElement function that matches the first module element
// Developer should stub this out if there are more than one instance of this module
context.getElement = fu... | javascript | function(moduleName, context) {
var module = modules[moduleName].creator(context);
if (!context.getElement) {
// Add in a default getElement function that matches the first module element
// Developer should stub this out if there are more than one instance of this module
context.getElement = fu... | [
"function",
"(",
"moduleName",
",",
"context",
")",
"{",
"var",
"module",
"=",
"modules",
"[",
"moduleName",
"]",
".",
"creator",
"(",
"context",
")",
";",
"if",
"(",
"!",
"context",
".",
"getElement",
")",
"{",
"// Add in a default getElement function that ma... | Will create a new instance of a module with a given context
@param {string} moduleName The name of the module being created
@param {Object} context The context object (usually a TestServiceProvider)
@returns {?Object} The module object | [
"Will",
"create",
"a",
"new",
"instance",
"of",
"a",
"module",
"with",
"a",
"given",
"context"
] | 1cc1751650e339bd5243a0f20cc76543c834ac09 | https://github.com/box/t3js/blob/1cc1751650e339bd5243a0f20cc76543c834ac09/lib/application-stub.js#L100-L111 | |
16,692 | box/t3js | lib/application-stub.js | function(behaviorName, context) {
var behaviorData = behaviors[behaviorName];
if (behaviorData) {
// getElement on behaviors must be stubbed
if (!context.getElement) {
context.getElement = function() {
throw new Error('You must stub `getElement` for behaviors.');
};
}
retu... | javascript | function(behaviorName, context) {
var behaviorData = behaviors[behaviorName];
if (behaviorData) {
// getElement on behaviors must be stubbed
if (!context.getElement) {
context.getElement = function() {
throw new Error('You must stub `getElement` for behaviors.');
};
}
retu... | [
"function",
"(",
"behaviorName",
",",
"context",
")",
"{",
"var",
"behaviorData",
"=",
"behaviors",
"[",
"behaviorName",
"]",
";",
"if",
"(",
"behaviorData",
")",
"{",
"// getElement on behaviors must be stubbed",
"if",
"(",
"!",
"context",
".",
"getElement",
")... | Will create a new instance of a behavior with a given context
@param {string} behaviorName The name of the behavior being created
@param {Object} context The context object (usually a TestServiceProvider)
@returns {?Object} The behavior object | [
"Will",
"create",
"a",
"new",
"instance",
"of",
"a",
"behavior",
"with",
"a",
"given",
"context"
] | 1cc1751650e339bd5243a0f20cc76543c834ac09 | https://github.com/box/t3js/blob/1cc1751650e339bd5243a0f20cc76543c834ac09/lib/application-stub.js#L119-L131 | |
16,693 | box/t3js | examples/todo/js/services/todos-db.js | function() {
var todoList = [];
Object.keys(todos).forEach(function(id) {
todoList.push(todos[id]);
});
return todoList;
} | javascript | function() {
var todoList = [];
Object.keys(todos).forEach(function(id) {
todoList.push(todos[id]);
});
return todoList;
} | [
"function",
"(",
")",
"{",
"var",
"todoList",
"=",
"[",
"]",
";",
"Object",
".",
"keys",
"(",
"todos",
")",
".",
"forEach",
"(",
"function",
"(",
"id",
")",
"{",
"todoList",
".",
"push",
"(",
"todos",
"[",
"id",
"]",
")",
";",
"}",
")",
";",
... | Returns list of all todos
@returns {Todo[]} List of todos | [
"Returns",
"list",
"of",
"all",
"todos"
] | 1cc1751650e339bd5243a0f20cc76543c834ac09 | https://github.com/box/t3js/blob/1cc1751650e339bd5243a0f20cc76543c834ac09/examples/todo/js/services/todos-db.js#L48-L56 | |
16,694 | box/t3js | examples/todo/js/services/todos-db.js | function() {
var me = this;
Object.keys(todos).forEach(function(id) {
if (todos[id].completed) {
me.remove(id);
}
});
} | javascript | function() {
var me = this;
Object.keys(todos).forEach(function(id) {
if (todos[id].completed) {
me.remove(id);
}
});
} | [
"function",
"(",
")",
"{",
"var",
"me",
"=",
"this",
";",
"Object",
".",
"keys",
"(",
"todos",
")",
".",
"forEach",
"(",
"function",
"(",
"id",
")",
"{",
"if",
"(",
"todos",
"[",
"id",
"]",
".",
"completed",
")",
"{",
"me",
".",
"remove",
"(",
... | Removes all completed tasks
@returns {void} | [
"Removes",
"all",
"completed",
"tasks"
] | 1cc1751650e339bd5243a0f20cc76543c834ac09 | https://github.com/box/t3js/blob/1cc1751650e339bd5243a0f20cc76543c834ac09/examples/todo/js/services/todos-db.js#L106-L113 | |
16,695 | box/t3js | examples/todo/js/services/todos-db.js | function(title) {
var todoId = counter++;
todos[todoId] = {
id: todoId,
title: title,
completed: false
};
return todoId;
} | javascript | function(title) {
var todoId = counter++;
todos[todoId] = {
id: todoId,
title: title,
completed: false
};
return todoId;
} | [
"function",
"(",
"title",
")",
"{",
"var",
"todoId",
"=",
"counter",
"++",
";",
"todos",
"[",
"todoId",
"]",
"=",
"{",
"id",
":",
"todoId",
",",
"title",
":",
"title",
",",
"completed",
":",
"false",
"}",
";",
"return",
"todoId",
";",
"}"
] | Adds a todo
@param {string} title The label of the todo
@returns {number} The id of the new todo | [
"Adds",
"a",
"todo"
] | 1cc1751650e339bd5243a0f20cc76543c834ac09 | https://github.com/box/t3js/blob/1cc1751650e339bd5243a0f20cc76543c834ac09/examples/todo/js/services/todos-db.js#L120-L128 | |
16,696 | box/t3js | lib/application.js | isServiceBeingInstantiated | function isServiceBeingInstantiated(serviceName) {
for (var i = 0, len = serviceStack.length; i < len; i++) {
if (serviceStack[i] === serviceName) {
return true;
}
}
return false;
} | javascript | function isServiceBeingInstantiated(serviceName) {
for (var i = 0, len = serviceStack.length; i < len; i++) {
if (serviceStack[i] === serviceName) {
return true;
}
}
return false;
} | [
"function",
"isServiceBeingInstantiated",
"(",
"serviceName",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"len",
"=",
"serviceStack",
".",
"length",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"if",
"(",
"serviceStack",
"[",
"i",
"]",
"===",... | Indicates if a given service is being instantiated. This is used to check
for circular dependencies in service instantiation. If two services
reference each other, it causes a stack overflow and is really hard to
track down, so we provide an extra check to make finding this issue
easier.
@param {string} serviceName The... | [
"Indicates",
"if",
"a",
"given",
"service",
"is",
"being",
"instantiated",
".",
"This",
"is",
"used",
"to",
"check",
"for",
"circular",
"dependencies",
"in",
"service",
"instantiation",
".",
"If",
"two",
"services",
"reference",
"each",
"other",
"it",
"causes"... | 1cc1751650e339bd5243a0f20cc76543c834ac09 | https://github.com/box/t3js/blob/1cc1751650e339bd5243a0f20cc76543c834ac09/lib/application.js#L121-L129 |
16,697 | box/t3js | lib/application.js | error | function error(exception) {
if (typeof customErrorHandler === 'function') {
customErrorHandler(exception);
return;
}
if (globalConfig.debug) {
throw exception;
} else {
application.fire('error', {
exception: exception
});
}
} | javascript | function error(exception) {
if (typeof customErrorHandler === 'function') {
customErrorHandler(exception);
return;
}
if (globalConfig.debug) {
throw exception;
} else {
application.fire('error', {
exception: exception
});
}
} | [
"function",
"error",
"(",
"exception",
")",
"{",
"if",
"(",
"typeof",
"customErrorHandler",
"===",
"'function'",
")",
"{",
"customErrorHandler",
"(",
"exception",
")",
";",
"return",
";",
"}",
"if",
"(",
"globalConfig",
".",
"debug",
")",
"{",
"throw",
"ex... | Signals that an error has occurred. If in development mode, an error
is thrown. If in production mode, an event is fired.
@param {Error} [exception] The exception object to use.
@returns {void}
@private | [
"Signals",
"that",
"an",
"error",
"has",
"occurred",
".",
"If",
"in",
"development",
"mode",
"an",
"error",
"is",
"thrown",
".",
"If",
"in",
"production",
"mode",
"an",
"event",
"is",
"fired",
"."
] | 1cc1751650e339bd5243a0f20cc76543c834ac09 | https://github.com/box/t3js/blob/1cc1751650e339bd5243a0f20cc76543c834ac09/lib/application.js#L138-L150 |
16,698 | box/t3js | lib/application.js | createAndBindEventDelegate | function createAndBindEventDelegate(eventDelegates, element, handler) {
var delegate = new Box.DOMEventDelegate(element, handler, globalConfig.eventTypes);
eventDelegates.push(delegate);
delegate.attachEvents();
} | javascript | function createAndBindEventDelegate(eventDelegates, element, handler) {
var delegate = new Box.DOMEventDelegate(element, handler, globalConfig.eventTypes);
eventDelegates.push(delegate);
delegate.attachEvents();
} | [
"function",
"createAndBindEventDelegate",
"(",
"eventDelegates",
",",
"element",
",",
"handler",
")",
"{",
"var",
"delegate",
"=",
"new",
"Box",
".",
"DOMEventDelegate",
"(",
"element",
",",
"handler",
",",
"globalConfig",
".",
"eventTypes",
")",
";",
"eventDele... | Creates a new event delegate and sets up its event handlers.
@param {Array} eventDelegates The array of event delegates to add to.
@param {HTMLElement} element The HTML element to bind to.
@param {Object} handler The handler object for the delegate (either the
module instance or behavior instance).
@returns {void}
@pri... | [
"Creates",
"a",
"new",
"event",
"delegate",
"and",
"sets",
"up",
"its",
"event",
"handlers",
"."
] | 1cc1751650e339bd5243a0f20cc76543c834ac09 | https://github.com/box/t3js/blob/1cc1751650e339bd5243a0f20cc76543c834ac09/lib/application.js#L326-L330 |
16,699 | box/t3js | lib/application.js | callMessageHandler | function callMessageHandler(instance, name, data) {
// If onmessage is an object call message handler with the matching key (if any)
if (instance.onmessage !== null && typeof instance.onmessage === 'object' && instance.onmessage.hasOwnProperty(name)) {
instance.onmessage[name].call(instance, data);
// Otherw... | javascript | function callMessageHandler(instance, name, data) {
// If onmessage is an object call message handler with the matching key (if any)
if (instance.onmessage !== null && typeof instance.onmessage === 'object' && instance.onmessage.hasOwnProperty(name)) {
instance.onmessage[name].call(instance, data);
// Otherw... | [
"function",
"callMessageHandler",
"(",
"instance",
",",
"name",
",",
"data",
")",
"{",
"// If onmessage is an object call message handler with the matching key (if any)",
"if",
"(",
"instance",
".",
"onmessage",
"!==",
"null",
"&&",
"typeof",
"instance",
".",
"onmessage",... | Gets message handlers from the provided module instance
@param {Box.Application~ModuleInstance|Box.Application~BehaviorInstance} instance Messages handlers will be retrieved from the Instance object
@param {String} name The name of the message to be handled
@param {Any} data A playload to be passed to the message handl... | [
"Gets",
"message",
"handlers",
"from",
"the",
"provided",
"module",
"instance"
] | 1cc1751650e339bd5243a0f20cc76543c834ac09 | https://github.com/box/t3js/blob/1cc1751650e339bd5243a0f20cc76543c834ac09/lib/application.js#L386-L396 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.