_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3
values | text stringlengths 52 373k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q46100 | date_jsonSchema | train | function date_jsonSchema(name) {
var result = simpleType_jsonSchema.call(this, name);
result.type = 'string';
result.format = 'date-time';
return result;
} | javascript | {
"resource": ""
} |
q46101 | array_jsonSchema | train | function array_jsonSchema(name) {
var result = {};
var itemName;
itemName = 'itemOf_' + name;
result.type = 'array';
if (this.options.required) result.__required = true;
if (this.schema) {
result.items = this.schema.jsonSchema(itemName);
} else {
result.items = this.caster.jsonSchem... | javascript | {
"resource": ""
} |
q46102 | mixed_jsonSchema | train | function mixed_jsonSchema(name) {
var result = __describe(name, this.options.type);
__processOptions(result, this.options);
return result;
} | javascript | {
"resource": ""
} |
q46103 | model_jsonSchema | train | function model_jsonSchema(fields, populate, readonly) {
var jsonSchema = this.schema.jsonSchema(this.modelName);
if (populate != null) {
jsonSchema = __populate.call(this, jsonSchema, populate);
};
__excludedPaths(this.schema, fields).forEach(
__delPath.bind(null, jsonSchema)
);
if (re... | javascript | {
"resource": ""
} |
q46104 | query_jsonSchema | train | function query_jsonSchema() {
let populate = this._mongooseOptions.populate;
if (populate) {
populate = Object.keys(populate).map(k => populate[k]);
}
let jsonSchema = this.model.jsonSchema(
this._fields, populate
);
delete jsonSchema.required;
if (this.op.indexOf('findOne') === 0) re... | javascript | {
"resource": ""
} |
q46105 | callbackified | train | function callbackified() {
var args = [];
for (var i = 0; i < arguments.length; i++) {
args.push(arguments[i]);
}
var maybeCb = args.pop();
if (typeof maybeCb !== 'function') {
throw new TypeError('The last argument must be of type Function');
}
var self = this;
var cb = fun... | javascript | {
"resource": ""
} |
q46106 | typeFromSchemaResponse | train | function typeFromSchemaResponse(schema, parseOptions) {
var schemaType = avro.parse(schema);
//check if the schema has been previouisly parsed and added to the registry
if(typeof parseOptions.registry === 'object' && typeof parseOptions.registry[schemaType.name] !== 'undefined'){
return parseOptions.registry... | javascript | {
"resource": ""
} |
q46107 | train | function() {
var content = '', files = [];
if (this.$element[0].files === undefined) {
files[0] = {
'name' : this.$element[0] && this.$element[0].value
};
} else {
files = this.$element[0].files;
}
for (var i = 0; i < files.length; i++) {
content += files[i].name.split("\\").pop() +... | javascript | {
"resource": ""
} | |
q46108 | Edge | train | function Edge(current, next) {
/**
* @type {Object}
*/
this.current = current;
/**
* @type {Object}
*/
this.next = next;
/**
* @type {Object}
*/
this._inNormal = this.inwardsNormal();
/**
* @type {Object}
*/
this._outNormal = this.outwardsNormal();
} | javascript | {
"resource": ""
} |
q46109 | isPlatformModifierKeyOnly | train | function isPlatformModifierKeyOnly(event) {
return !event.altKey &&
(olHas.MAC ? event.metaKey : event.ctrlKey) &&
!event.shiftKey;
} | javascript | {
"resource": ""
} |
q46110 | isShiftKeyOnly | train | function isShiftKeyOnly(event) {
return (
!event.altKey &&
!(event.metaKey || event.ctrlKey) &&
event.shiftKey);
} | javascript | {
"resource": ""
} |
q46111 | messagePopoverComponent | train | 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 | {
"resource": ""
} |
q46112 | PopoverController | train | 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 | {
"resource": ""
} |
q46113 | encodeNumber_ | train | function encodeNumber_(num) {
let encodedNumber = '';
while (num >= 0x20) {
encodedNumber += CHAR64_.charAt(
0x20 | (num & 0x1f));
num >>= 5;
}
encodedNumber += CHAR64_.charAt(num);
return encodedNumber;
} | javascript | {
"resource": ""
} |
q46114 | setStyleProperties_ | train | 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 | {
"resource": ""
} |
q46115 | castValue_ | train | function castValue_(key, value) {
const numProperties = [
ngeoFormatFeatureProperties.ANGLE,
ngeoFormatFeatureProperties.OPACITY,
ngeoFormatFeatureProperties.SIZE,
ngeoFormatFeatureProperties.STROKE,
'pointRadius',
'strokeWidth'
];
const boolProperties = [
ngeoFormatFeatureProperties.I... | javascript | {
"resource": ""
} |
q46116 | getStyleProperties_ | train | 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 | {
"resource": ""
} |
q46117 | mobileMeasureLenthComponent | train | function mobileMeasureLenthComponent(gmfMobileMeasureLengthTemplateUrl) {
return {
restrict: 'A',
scope: {
'active': '=gmfMobileMeasurelengthActive',
'precision': '<?gmfMobileMeasurelengthPrecision',
'map': '=gmfMobileMeasurelengthMap',
'sketchStyle': '=?gmfMobileMeasurelengthSketchsty... | javascript | {
"resource": ""
} |
q46118 | contextualDataComponent | train | function contextualDataComponent() {
return {
restrict: 'A',
scope: false,
controller: 'GmfContextualdataController as cdCtrl',
bindToController: {
'map': '<gmfContextualdataMap',
'projections': '<gmfContextualdataProjections',
'callback': '<gmfContextualdataCallback'
},
/**
... | javascript | {
"resource": ""
} |
q46119 | messagePopopComponent | train | 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 | {
"resource": ""
} |
q46120 | queryMapComponent | train | 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 | {
"resource": ""
} |
q46121 | train | function(evt) {
if (evt instanceof MapBrowserEvent) {
const action = ngeoQueryKeyboard.action;
const coordinate = evt.coordinate;
ngeoMapQuerent.issue({
action,
coordinate,
map
});
}
} | javascript | {
"resource": ""
} | |
q46122 | train | 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 | {
"resource": ""
} | |
q46123 | train | 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 | {
"resource": ""
} | |
q46124 | train | function() {
for (const lk of listenerKeys_) {
olEventsUnlistenByKey(lk);
}
listenerKeys_.length = 0;
if (scope.$eval(attrs['ngeoMapQueryAutoclear']) !== false) {
ngeoMapQuerent.clear();
}
} | javascript | {
"resource": ""
} | |
q46125 | getQueryableLayersInfoFromThemes | train | 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 | {
"resource": ""
} |
q46126 | datePickerComponent | train | function datePickerComponent(ngeoDatePickerTemplateUrl, $timeout) {
return {
scope: {
onDateSelected: '&',
time: '='
},
bindToController: true,
controller: 'ngeoDatePickerController as datepickerCtrl',
restrict: 'AE',
templateUrl: ngeoDatePickerTemplateUrl,
link: (scope, elemen... | javascript | {
"resource": ""
} |
q46127 | Controller | train | 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 | {
"resource": ""
} |
q46128 | train | 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 | {
"resource": ""
} | |
q46129 | profileElevationComponent | train | 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 | {
"resource": ""
} |
q46130 | sortableComponent | train | 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 | {
"resource": ""
} |
q46131 | NumberFilter | train | 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 | {
"resource": ""
} |
q46132 | UnitPrefixFilter | train | 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 | {
"resource": ""
} |
q46133 | NumberCoordinatesFilter | train | 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 | {
"resource": ""
} |
q46134 | DMSCoordinatesFilter | train | 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 | {
"resource": ""
} |
q46135 | trustHtmlAutoFilter | train | 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 | {
"resource": ""
} |
q46136 | DurationFilter | train | 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 | {
"resource": ""
} |
q46137 | train | function(item) {
if ('values' in item && layerName in item.values && item.values[layerName]) {
return parseFloat(item.values[layerName]);
}
throw new Error('Unexpected');
} | javascript | {
"resource": ""
} | |
q46138 | rasterComponent | train | function rasterComponent() {
return {
restrict: 'A',
controller: 'GmfElevationController as ctrl',
bindToController: true,
scope: {
'active': '<gmfElevationActive',
'elevation': '=gmfElevationElevation',
'layersconfig': '=gmfElevationLayersconfig',
'loading': '=?gmfElevationLoa... | javascript | {
"resource": ""
} |
q46139 | factory | train | 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 | {
"resource": ""
} |
q46140 | Controller | train | 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 | {
"resource": ""
} |
q46141 | colorPickerComponent | train | function colorPickerComponent(ngeoColorpickerTemplateUrl) {
return {
restrict: 'A',
scope: {
colors: '<?ngeoColorpicker',
color: '=?ngeoColorpickerColor'
},
controller: 'NgeoColorpickerController as ctrl',
bindToController: true,
templateUrl: ngeoColorpickerTemplateUrl
};
} | javascript | {
"resource": ""
} |
q46142 | mobileNavigationComponent | train | 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 | {
"resource": ""
} |
q46143 | mobileMeasureAreaComponent | train | function mobileMeasureAreaComponent(gmfMobileMeasureAreaTemplateUrl) {
return {
restrict: 'A',
scope: {
'active': '=gmfMobileMeasureareaActive',
'precision': '<?gmfMobileMeasureareaPrecision',
'map': '=gmfMobileMeasureareaMap',
'sketchStyle': '=?gmfMobileMeasureareaSketchstyle'
},
... | javascript | {
"resource": ""
} |
q46144 | debounce | train | 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 | {
"resource": ""
} |
q46145 | factory | train | 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 | {
"resource": ""
} |
q46146 | mapResizeComponent | train | 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 | {
"resource": ""
} |
q46147 | LocationFactory | train | 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 | {
"resource": ""
} |
q46148 | toXY | train | 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 | {
"resource": ""
} |
q46149 | mapComponent | train | 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 | {
"resource": ""
} |
q46150 | handleEvent_ | train | 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 | {
"resource": ""
} |
q46151 | controlComponent | train | 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 | {
"resource": ""
} |
q46152 | queryBboxComponent | train | 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 | {
"resource": ""
} |
q46153 | train | function(interaction) {
const action = ngeoQueryKeyboard.action;
const extent = interaction.getGeometry().getExtent();
const limit = scope.$eval(attrs['ngeoBboxQueryLimit']);
ngeoMapQuerent.issue({
action,
extent,
limit,
map
});
} | javascript | {
"resource": ""
} | |
q46154 | ourAddresses | train | 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 | {
"resource": ""
} |
q46155 | getPeerInfo | train | 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 | {
"resource": ""
} |
q46156 | connect | train | 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 | {
"resource": ""
} |
q46157 | dialFSM | train | function dialFSM (peerInfo, protocol, callback) {
_dial({ peerInfo, protocol, options: { useFSM: true, priority: PRIORITY_HIGH }, callback })
} | javascript | {
"resource": ""
} |
q46158 | VkontakteAuthorizationError | train | 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 | {
"resource": ""
} |
q46159 | isMouseInFirstHalf | train | 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 | {
"resource": ""
} |
q46160 | isDropAllowed | train | 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 | {
"resource": ""
} |
q46161 | hasTextMimetype | train | 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 | {
"resource": ""
} |
q46162 | getColor | train | 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 | {
"resource": ""
} |
q46163 | train | 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 | {
"resource": ""
} | |
q46164 | updateWidth | train | function updateWidth() {
if (isNaN(attrs.width)) {
element.css('width', attrs.width);
} else {
element.css('width', attrs.width + 'px');
}
} | javascript | {
"resource": ""
} |
q46165 | _set | train | function _set(obj, key, vORf) {
obj && (obj[key] = _.is_fn(vORf) ? vORf(obj[key]) : vORf);
} | javascript | {
"resource": ""
} |
q46166 | train | 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 | {
"resource": ""
} | |
q46167 | train | 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 | {
"resource": ""
} | |
q46168 | train | 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 | {
"resource": ""
} | |
q46169 | train | function( file )
{
// Only process image files
if( typeof(filter_imageType) === 'function' && ! filter_imageType(file) )
return;
else if( ! file.type.match(filter_imageType) )
return;
... | javascript | {
"resource": ""
} | |
q46170 | train | 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 | {
"resource": ""
} | |
q46171 | train | function( button ) {
var $element = $('<a/>').addClass( 'wysiwyg-toolbar-icon' )
.prop('href','#')
.prop('unselectable','on')
.append(button.image);
// pass other properties as "prop()"
... | javascript | {
"resource": ""
} | |
q46172 | train | 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 | {
"resource": ""
} | |
q46173 | isParent | train | function isParent(possibleParent, elem) {
if(!elem || elem.nodeName === 'HTML') {
return false;
}
if(elem.parentNode === possibleParent) {
return true;
}
return isParent(possibleParent, elem.parentNode);
} | javascript | {
"resource": ""
} |
q46174 | insertBefore | train | 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 | {
"resource": ""
} |
q46175 | insertAfter | train | 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 | {
"resource": ""
} |
q46176 | fetchScope | train | function fetchScope(element) {
var scope;
while (!scope && element.length) {
scope = element.data('_scope');
if (!scope) {
element = element.parent();
}
}
return scope;
} | javascript | {
"resource": ""
} |
q46177 | rollbackDragChanges | train | function rollbackDragChanges() {
if (!scope.itemScope.sortableScope.cloning) {
placeElement.replaceWith(scope.itemScope.element);
}
placeHolder.remove();
dragElement.remove();
dragElement = null;
dragHandled = false;
conta... | javascript | {
"resource": ""
} |
q46178 | train | 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 | {
"resource": ""
} | |
q46179 | train | 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 | {
"resource": ""
} | |
q46180 | train | 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 | {
"resource": ""
} | |
q46181 | train | 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 | {
"resource": ""
} | |
q46182 | train | 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 | {
"resource": ""
} | |
q46183 | train | function (item) {
return {
index: item.index(),
parent: item.sortableScope,
source: item,
targetElement: null,
targetElementOffset: null,
sourceInfo: {
index: item.index(),
itemScope: item.itemScope,
... | javascript | {
"resource": ""
} | |
q46184 | train | 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 | {
"resource": ""
} | |
q46185 | printResultFor | train | 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 | {
"resource": ""
} |
q46186 | train | function(factor, animate, originLeft, originTop, callback) {
let self = this
self.zoomTo(self.__zoomLevel * factor, animate, originLeft, originTop, callback)
} | javascript | {
"resource": ""
} | |
q46187 | train | 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 | {
"resource": ""
} | |
q46188 | nodeExec | train | function nodeExec(args) {
args = arguments; // make linting happy
var code = nodeCLI.exec.apply(nodeCLI, args).code;
if (code !== 0) {
exit(code);
}
} | javascript | {
"resource": ""
} |
q46189 | getSourceDirectories | train | function getSourceDirectories() {
var dirs = [ 'lib', 'src', 'app' ],
result = [];
dirs.forEach(function(dir) {
if (test('-d', dir)) {
result.push(dir);
}
});
return result;
} | javascript | {
"resource": ""
} |
q46190 | getVersionTags | train | 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 | {
"resource": ""
} |
q46191 | generateDistFiles | train | 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 | {
"resource": ""
} |
q46192 | dist | train | 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 | {
"resource": ""
} |
q46193 | reset | train | 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 | {
"resource": ""
} |
q46194 | callModuleMethod | train | 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 | {
"resource": ""
} |
q46195 | bindEventType | train | 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 | {
"resource": ""
} |
q46196 | train | function(root) {
var me = this,
$root = $(root);
$root.find(MODULE_SELECTOR).each(function(idx, element) {
me.start(element);
});
} | javascript | {
"resource": ""
} | |
q46197 | train | 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 | {
"resource": ""
} | |
q46198 | train | function() {
var baseUrl = context.getGlobal('location').pathname;
routerService = context.getService('router');
routerService.init([
baseUrl,
baseUrl + 'active',
baseUrl + 'completed'
]);
} | javascript | {
"resource": ""
} | |
q46199 | train | function(serviceName, application) {
var serviceData = services[serviceName];
if (serviceData) {
return services[serviceName].creator(application);
}
return null;
} | javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.