code stringlengths 24 2.07M | docstring stringlengths 25 85.3k | func_name stringlengths 1 92 | language stringclasses 1
value | repo stringlengths 5 64 | path stringlengths 4 172 | url stringlengths 44 218 | license stringclasses 7
values |
|---|---|---|---|---|---|---|---|
CartoDBNamedMap = function(opts) {
this.options = _.defaults(opts, default_options);
this.tiles = 0;
this.tilejson = null;
this.interaction = [];
if (!opts.named_map && !opts.sublayers) {
throw new Error('cartodb-gmaps needs at least the named_map');
}
// Add CartoDB logo
if (this.options.carto... | remove layer from the map and unbind events | CartoDBNamedMap | javascript | CartoDB/cartodb | vendor/assets/javascripts/cartodb.uncompressed.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/cartodb.uncompressed.js | BSD-3-Clause |
CartoDBLayerGroup = function(opts) {
this.options = _.defaults(opts, default_options);
this.tiles = 0;
this.tilejson = null;
this.interaction = [];
if (!opts.layer_definition && !opts.sublayers) {
throw new Error('cartodb-leaflet needs at least the layer_definition or sublayer list');
}
// if onl... | remove layer from the map and unbind events | CartoDBLayerGroup | javascript | CartoDB/cartodb | vendor/assets/javascripts/cartodb.uncompressed.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/cartodb.uncompressed.js | BSD-3-Clause |
function setImageOpacityIE8(img, opacity) {
var v = Math.round(opacity*100);
if (v >= 99) {
img.style.filter = OPACITY_FILTER;
} else {
img.style.filter = "alpha(opacity=" + (opacity) + ");";
}
} | remove layer from the map and unbind events | setImageOpacityIE8 | javascript | CartoDB/cartodb | vendor/assets/javascripts/cartodb.uncompressed.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/cartodb.uncompressed.js | BSD-3-Clause |
finished = function() {
loadTime.end();
self.tiles--;
if (self.tiles === 0) {
self.finishLoading && self.finishLoading();
}
} | remove layer from the map and unbind events | finished | javascript | CartoDB/cartodb | vendor/assets/javascripts/cartodb.uncompressed.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/cartodb.uncompressed.js | BSD-3-Clause |
function LayerGroupView(base) {
var GMapsCartoDBLayerGroupView = function(layerModel, gmapsMap) {
var self = this;
var hovers = [];
_.bindAll(this, 'featureOut', 'featureOver', 'featureClick');
var opts = _.clone(layerModel.attributes);
opts.map = gmapsMap;
var // preserve the user's call... | Creates an instance of a google.maps Point | LayerGroupView | javascript | CartoDB/cartodb | vendor/assets/javascripts/cartodb.uncompressed.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/cartodb.uncompressed.js | BSD-3-Clause |
GMapsCartoDBLayerGroupView = function(layerModel, gmapsMap) {
var self = this;
var hovers = [];
_.bindAll(this, 'featureOut', 'featureOver', 'featureClick');
var opts = _.clone(layerModel.attributes);
opts.map = gmapsMap;
var // preserve the user's callbacks
_featureOver = opts.feature... | Creates an instance of a google.maps Point | GMapsCartoDBLayerGroupView | javascript | CartoDB/cartodb | vendor/assets/javascripts/cartodb.uncompressed.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/cartodb.uncompressed.js | BSD-3-Clause |
function PathView(geometryModel) {
var self = this;
// events to link
var events = [
'click',
'dblclick',
'mousedown',
'mouseover',
'mouseout',
];
this._eventHandlers = {};
this.model = geometryModel;
this.points = [];
var style = _.clone(geometryModel.get('style')) || {};
thi... | view for other geometries (polygons/lines) | PathView | javascript | CartoDB/cartodb | vendor/assets/javascripts/cartodb.uncompressed.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/cartodb.uncompressed.js | BSD-3-Clause |
function bindPath(p) {
google.maps.event.addListener(p, 'insert_at', self._updateModel);
/*
google.maps.event.addListener(p, 'remove_at', this._updateModel);
google.maps.event.addListener(p, 'set_at', this._updateModel);
*/
} | view for other geometries (polygons/lines) | bindPath | javascript | CartoDB/cartodb | vendor/assets/javascripts/cartodb.uncompressed.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/cartodb.uncompressed.js | BSD-3-Clause |
function _coord(latlng) {
return [latlng.lng(), latlng.lat()];
} | view for other geometries (polygons/lines) | _coord | javascript | CartoDB/cartodb | vendor/assets/javascripts/cartodb.uncompressed.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/cartodb.uncompressed.js | BSD-3-Clause |
function _coords(latlngs) {
var c = [];
for(var i = 0; i < latlngs.length; ++i) {
c.push(_coord(latlngs.getAt(i)));
}
return c;
} | view for other geometries (polygons/lines) | _coords | javascript | CartoDB/cartodb | vendor/assets/javascripts/cartodb.uncompressed.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/cartodb.uncompressed.js | BSD-3-Clause |
function loaded () {
if (self.checkModules(layers)) {
cdb.config.unbind('moduleLoaded', loaded);
done();
}
} | check if all the modules needed to create layers are loaded | loaded | javascript | CartoDB/cartodb | vendor/assets/javascripts/cartodb.uncompressed.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/cartodb.uncompressed.js | BSD-3-Clause |
function BackboneActions(model) {
var actions = {
set: function() {
var args = arguments;
return O.Action({
enter: function() {
model.set.apply(model, args);
}
});
},
reset: function() {
va... | check if all the modules needed to create layers are loaded | BackboneActions | javascript | CartoDB/cartodb | vendor/assets/javascripts/cartodb.uncompressed.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/cartodb.uncompressed.js | BSD-3-Clause |
function SetStepAction(vis, step) {
return O.Action(function() {
vis.setAnimationStep(step);
});
} | check if all the modules needed to create layers are loaded | SetStepAction | javascript | CartoDB/cartodb | vendor/assets/javascripts/cartodb.uncompressed.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/cartodb.uncompressed.js | BSD-3-Clause |
function AnimationTrigger(vis, step) {
var t = O.Trigger();
vis.on('change:step', function (layer, currentStep) {
if (currentStep === step) {
t.trigger();
}
});
return t;
} | check if all the modules needed to create layers are loaded | AnimationTrigger | javascript | CartoDB/cartodb | vendor/assets/javascripts/cartodb.uncompressed.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/cartodb.uncompressed.js | BSD-3-Clause |
function PrevTrigger(seq, step) {
var t = O.Trigger();
var c = PrevTrigger._callbacks;
if (!c) {
c = PrevTrigger._callbacks = []
O.Keys().left().then(function() {
for (var i = 0; i < c.length; ++i) {
if (c[i] === seq.current()) {
t.tr... | check if all the modules needed to create layers are loaded | PrevTrigger | javascript | CartoDB/cartodb | vendor/assets/javascripts/cartodb.uncompressed.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/cartodb.uncompressed.js | BSD-3-Clause |
function NextTrigger(seq, step) {
var t = O.Trigger();
var c = NextTrigger._callbacks;
if (!c) {
c = NextTrigger._callbacks = []
O.Keys().right().then(function() {
for (var i = 0; i < c.length; ++i) {
if (c[i] === seq.current()) {
t.t... | check if all the modules needed to create layers are loaded | NextTrigger | javascript | CartoDB/cartodb | vendor/assets/javascripts/cartodb.uncompressed.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/cartodb.uncompressed.js | BSD-3-Clause |
function WaitAction(seq, ms) {
return O.Step(O.Sleep(ms), O.Action(function() {
seq.next();
}));
} | check if all the modules needed to create layers are loaded | WaitAction | javascript | CartoDB/cartodb | vendor/assets/javascripts/cartodb.uncompressed.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/cartodb.uncompressed.js | BSD-3-Clause |
function goTo(seq, i) {
return function() {
seq.current(i);
}
} | check if all the modules needed to create layers are loaded | goTo | javascript | CartoDB/cartodb | vendor/assets/javascripts/cartodb.uncompressed.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/cartodb.uncompressed.js | BSD-3-Clause |
function search_overlay(name) {
if (!vizjson.overlays) return null;
for(var i = 0; i < vizjson.overlays.length; ++i) {
if (vizjson.overlays[i].type === name) {
return vizjson.overlays[i];
}
}
} | check if all the modules needed to create layers are loaded | search_overlay | javascript | CartoDB/cartodb | vendor/assets/javascripts/cartodb.uncompressed.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/cartodb.uncompressed.js | BSD-3-Clause |
function remove_overlay(name) {
if (!vizjson.overlays) return;
for(var i = 0; i < vizjson.overlays.length; ++i) {
if (vizjson.overlays[i].type === name) {
vizjson.overlays.splice(i, 1);
return;
}
}
} | check if all the modules needed to create layers are loaded | remove_overlay | javascript | CartoDB/cartodb | vendor/assets/javascripts/cartodb.uncompressed.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/cartodb.uncompressed.js | BSD-3-Clause |
function _applyLayerOptions(layers) {
for(var i = 1; i < layers.length; ++i) {
var o = layers[i].options;
o.no_cdn = opt.no_cdn;
o.force_cors = opt.force_cors;
if(token) {
o.auth_token = token;
}
}
} | check if all the modules needed to create layers are loaded | _applyLayerOptions | javascript | CartoDB/cartodb | vendor/assets/javascripts/cartodb.uncompressed.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/cartodb.uncompressed.js | BSD-3-Clause |
S4 = function() {
return (((1+Math.random())*0x10000)|0).toString(16).substring(1);
} | adds an infowindow to the map controlled by layer events.
it enables interaction and overrides the layer interacivity
``fields`` array of column names
``map`` native map object, leaflet of gmaps
``layer`` cartodb layer (or sublayer) | S4 | javascript | CartoDB/cartodb | vendor/assets/javascripts/cartodb.uncompressed.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/cartodb.uncompressed.js | BSD-3-Clause |
function transformToHTTP(tilesTemplate) {
for(var url in HTTPS_TO_HTTP) {
if(tilesTemplate.indexOf(url) !== -1) {
return tilesTemplate.replace(url, HTTPS_TO_HTTP[url])
}
}
return tilesTemplate;
} | adds an infowindow to the map controlled by layer events.
it enables interaction and overrides the layer interacivity
``fields`` array of column names
``map`` native map object, leaflet of gmaps
``layer`` cartodb layer (or sublayer) | transformToHTTP | javascript | CartoDB/cartodb | vendor/assets/javascripts/cartodb.uncompressed.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/cartodb.uncompressed.js | BSD-3-Clause |
function transformToHTTPS(tilesTemplate) {
for(var url in HTTPS_TO_HTTP) {
var httpsUrl = HTTPS_TO_HTTP[url];
if(tilesTemplate.indexOf(httpsUrl) !== -1) {
return tilesTemplate.replace(httpsUrl, url);
}
}
return tilesTemplate;
} | adds an infowindow to the map controlled by layer events.
it enables interaction and overrides the layer interacivity
``fields`` array of column names
``map`` native map object, leaflet of gmaps
``layer`` cartodb layer (or sublayer) | transformToHTTPS | javascript | CartoDB/cartodb | vendor/assets/javascripts/cartodb.uncompressed.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/cartodb.uncompressed.js | BSD-3-Clause |
function normalizeOptions(vis, data) {
if(data.infowindow && data.infowindow.fields) {
if(data.interactivity) {
if(data.interactivity.indexOf('cartodb_id') === -1) {
data.interactivity = data.interactivity + ",cartodb_id";
}
} else {
data.interactivity = 'cartodb_id';
}
}
// ... | adds an infowindow to the map controlled by layer events.
it enables interaction and overrides the layer interacivity
``fields`` array of column names
``map`` native map object, leaflet of gmaps
``layer`` cartodb layer (or sublayer) | normalizeOptions | javascript | CartoDB/cartodb | vendor/assets/javascripts/cartodb.uncompressed.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/cartodb.uncompressed.js | BSD-3-Clause |
cartoLayer = function(vis, data) {
normalizeOptions(vis, data);
// if sublayers are included that means a layergroup should
// be created
if(data.sublayers) {
data.type = 'layergroup';
return new cdb.geo.CartoDBGroupLayer(data);
}
return new cdb.geo.CartoDBLayer(data);
} | adds an infowindow to the map controlled by layer events.
it enables interaction and overrides the layer interacivity
``fields`` array of column names
``map`` native map object, leaflet of gmaps
``layer`` cartodb layer (or sublayer) | cartoLayer | javascript | CartoDB/cartodb | vendor/assets/javascripts/cartodb.uncompressed.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/cartodb.uncompressed.js | BSD-3-Clause |
function _getLayerJson(layer, callback) {
var url = null;
if(layer.layers !== undefined || ((layer.kind || layer.type) !== undefined)) {
// layer object contains the layer data
_.defer(function() { callback(layer); });
return;
} else if(layer.table !== undefined && layer.user !== undefined... | given layer params fetchs the layer json | _getLayerJson | javascript | CartoDB/cartodb | vendor/assets/javascripts/cartodb.uncompressed.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/cartodb.uncompressed.js | BSD-3-Clause |
function createLayer() {
layerView = viz.createLayer(layerData, { no_base_layer: true });
var torqueLayer;
var mobileEnabled = /Android|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
var addMobileLayout = (options.mobile_layout && mobileEnabled) || options... | create a layer for the specified map
@param map should be a L.Map object, or equivalent depending on what provider you have.
@param layer should be an url or a javascript object with the data to create the layer
@param options layer options | createLayer | javascript | CartoDB/cartodb | vendor/assets/javascripts/cartodb.uncompressed.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/cartodb.uncompressed.js | BSD-3-Clause |
function SQL(options) {
if(cartodb === this || window === this) {
return new SQL(options);
}
if(!options.user) {
throw new Error("user should be provided");
}
var loc = new String(window.location.protocol);
loc = loc.slice(0, loc.length - 1);
if(loc == 'file') {
loc = 'http... | create a layer for the specified map
@param map should be a L.Map object, or equivalent depending on what provider you have.
@param layer should be an url or a javascript object with the data to create the layer
@param options layer options | SQL | javascript | CartoDB/cartodb | vendor/assets/javascripts/cartodb.uncompressed.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/cartodb.uncompressed.js | BSD-3-Clause |
clamp = function(x, min, max) {
return x < min ? min : x > max ? max : x;
} | var sql = new SQL('cartodb_username');
sql.execute("select * from {{ table }} where id = {{ id }}", {
table: 'test',
id: '1'
}) | clamp | javascript | CartoDB/cartodb | vendor/assets/javascripts/cartodb.uncompressed.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/cartodb.uncompressed.js | BSD-3-Clause |
function PathView(geometryModel) {
var self = this;
// events to link
var events = [
'click',
'dblclick',
'mousedown',
'mouseover',
'mouseout',
];
this._eventHandlers = {};
this.model = geometryModel;
this.points = [];
this.geom = L.GeoJSON.geometryToLayer(geometryModel.get('geojs... | view for other geometries (polygons/lines) | PathView | javascript | CartoDB/cartodb | vendor/assets/javascripts/cartodb.uncompressed.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/cartodb.uncompressed.js | BSD-3-Clause |
function PathView(geometryModel) {
var self = this;
// events to link
var events = [
'click',
'dblclick',
'mousedown',
'mouseover',
'mouseout',
];
this._eventHandlers = {};
this.model = geometryModel;
this.points = [];
var style = _.clone(geometryModel.get('style')) || {};
thi... | view for other geometries (polygons/lines) | PathView | javascript | CartoDB/cartodb | vendor/assets/javascripts/cartodb.uncompressed.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/cartodb.uncompressed.js | BSD-3-Clause |
function bindPath(p) {
google.maps.event.addListener(p, 'insert_at', self._updateModel);
/*
google.maps.event.addListener(p, 'remove_at', this._updateModel);
google.maps.event.addListener(p, 'set_at', this._updateModel);
*/
} | view for other geometries (polygons/lines) | bindPath | javascript | CartoDB/cartodb | vendor/assets/javascripts/cartodb.uncompressed.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/cartodb.uncompressed.js | BSD-3-Clause |
function _coord(latlng) {
return [latlng.lng(), latlng.lat()];
} | view for other geometries (polygons/lines) | _coord | javascript | CartoDB/cartodb | vendor/assets/javascripts/cartodb.uncompressed.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/cartodb.uncompressed.js | BSD-3-Clause |
function _coords(latlngs) {
var c = [];
for(var i = 0; i < latlngs.length; ++i) {
c.push(_coord(latlngs.getAt(i)));
}
return c;
} | view for other geometries (polygons/lines) | _coords | javascript | CartoDB/cartodb | vendor/assets/javascripts/cartodb.uncompressed.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/cartodb.uncompressed.js | BSD-3-Clause |
function mousePosition(evt) {
// IE:
if (window.event && window.event.contentOverflow !== undefined) {
return {
x: window.event.offsetX,
y: window.event.offsetY
};
}
// Webkit:
if (evt.offsetX !== undefined && evt.offsetY !=... | Return mouse position relative to the element el. | mousePosition | javascript | CartoDB/cartodb | vendor/assets/javascripts/colorpicker.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/colorpicker.js | BSD-3-Clause |
function hsv2rgb(hsv) {
var R, G, B, X, C;
var h = (hsv.h % 360) / 60;
C = hsv.v * hsv.s;
X = C * (1 - Math.abs(h % 2 - 1));
R = G = B = hsv.v - C;
h = ~~h;
R += [C, X, 0, 0, X, C][h];
G += [X, C, C, X, 0, 0][h];
B += [0, 0, X, C, C, X][h];
... | Convert HSV representation to RGB HEX string.
Credits to http://www.raphaeljs.com | hsv2rgb | javascript | CartoDB/cartodb | vendor/assets/javascripts/colorpicker.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/colorpicker.js | BSD-3-Clause |
function rgb2hsv(rgb) {
var r = rgb.r;
var g = rgb.g;
var b = rgb.b;
if (rgb.r > 1 || rgb.g > 1 || rgb.b > 1) {
r /= 255;
g /= 255;
b /= 255;
}
var H, S, V, C;
V = Math.max(r, g, b);
C = V - Math.min(r, g, b);
... | Convert RGB representation to HSV.
r, g, b can be either in <0,1> range or <0,255> range.
Credits to http://www.raphaeljs.com | rgb2hsv | javascript | CartoDB/cartodb | vendor/assets/javascripts/colorpicker.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/colorpicker.js | BSD-3-Clause |
function slideListener(ctx, slideElement, pickerElement) {
return function(evt) {
evt = evt || window.event;
var mouse = mousePosition(evt);
ctx.h = mouse.y / slideElement.offsetHeight * 360 + hueOffset;
ctx.s = ctx.v = 1;
var c = hsv2rgb({
... | Return click event handler for the slider.
Sets picker background color and calls ctx.callback if provided. | slideListener | javascript | CartoDB/cartodb | vendor/assets/javascripts/colorpicker.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/colorpicker.js | BSD-3-Clause |
function pickerListener(ctx, pickerElement) {
return function(evt) {
evt = evt || window.event;
var mouse = mousePosition(evt),
width = pickerElement.offsetWidth,
height = pickerElement.offsetHeight;
ctx.s = mouse.x / width;
ctx.v ... | Return click event handler for the picker.
Calls ctx.callback if provided. | pickerListener | javascript | CartoDB/cartodb | vendor/assets/javascripts/colorpicker.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/colorpicker.js | BSD-3-Clause |
function ColorPicker(slideElement, pickerElement, callback) {
if (!(this instanceof ColorPicker)) return new ColorPicker(slideElement, pickerElement, callback);
this.h = 0;
this.s = 1;
this.v = 1;
if (!callback) {
// call of the form ColorPicker(element, funtion(he... | ColorPicker.
@param {DOMElement} slideElement HSV slide element.
@param {DOMElement} pickerElement HSV picker element.
@param {Function} callback Called whenever the color is changed provided chosen color in RGB HEX format as the only argument. | ColorPicker | javascript | CartoDB/cartodb | vendor/assets/javascripts/colorpicker.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/colorpicker.js | BSD-3-Clause |
function addEventListener(element, event, listener) {
if (element.attachEvent) {
element.attachEvent('on' + event, listener);
} else if (element.addEventListener) {
element.addEventListener(event, listener, false);
}
} | ColorPicker.
@param {DOMElement} slideElement HSV slide element.
@param {DOMElement} pickerElement HSV picker element.
@param {Function} callback Called whenever the color is changed provided chosen color in RGB HEX format as the only argument. | addEventListener | javascript | CartoDB/cartodb | vendor/assets/javascripts/colorpicker.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/colorpicker.js | BSD-3-Clause |
function removeEventListener(element, event, listener) {
if (element.attachEvent) {
element.detachEvent('on' + event, listener);
} else if (element.addEventListener) {
element.removeEventListener(event, listener, false);
}
} | ColorPicker.
@param {DOMElement} slideElement HSV slide element.
@param {DOMElement} pickerElement HSV picker element.
@param {Function} callback Called whenever the color is changed provided chosen color in RGB HEX format as the only argument. | removeEventListener | javascript | CartoDB/cartodb | vendor/assets/javascripts/colorpicker.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/colorpicker.js | BSD-3-Clause |
function enableDragging(ctx, element, listener) {
var mousedown = false;
addEventListener(element, 'mousedown', function(evt) {
mousedown = true;
});
addEventListener(element, 'mouseup', function(evt) {
mousedown = false;
});
addEventListener(ele... | Enable drag&drop color selection.
@param {object} ctx ColorPicker instance.
@param {DOMElement} element HSV slide element or HSV picker element.
@param {Function} listener Function that will be called whenever mouse is dragged over the element with event object as argument. | enableDragging | javascript | CartoDB/cartodb | vendor/assets/javascripts/colorpicker.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/colorpicker.js | BSD-3-Clause |
function disableDragging(ctx, element, listener) {
removeEventListener(element, 'mousedown');
removeEventListener(element, 'mouseup');
removeEventListener(element, 'mouseout');
removeEventListener(element, 'mousemove');
} | Enable drag&drop color selection.
@param {object} ctx ColorPicker instance.
@param {DOMElement} element HSV slide element or HSV picker element.
@param {Function} listener Function that will be called whenever mouse is dragged over the element with event object as argument. | disableDragging | javascript | CartoDB/cartodb | vendor/assets/javascripts/colorpicker.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/colorpicker.js | BSD-3-Clause |
function setColor(ctx, hsv, rgb, hex) {
ctx.h = hsv.h % 360;
ctx.s = hsv.s;
ctx.v = hsv.v;
var c = hsv2rgb(ctx);
var mouseSlide = {
y: (ctx.h * ctx.slideElement.offsetHeight) / 360,
x: 0 // not important
};
var pickerHeight = ctx.pickerE... | Sets color of the picker in hsv/rgb/hex format.
@param {object} ctx ColorPicker instance.
@param {object} hsv Object of the form: { h: <hue>, s: <saturation>, v: <value> }.
@param {object} rgb Object of the form: { r: <red>, g: <green>, b: <blue> }.
@param {string} hex String of the form: #RRGGBB. | setColor | javascript | CartoDB/cartodb | vendor/assets/javascripts/colorpicker.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/colorpicker.js | BSD-3-Clause |
function path(d, i) {
if (typeof pointRadius === "function") pointCircle = d3_path_circle(pointRadius.apply(this, arguments));
pathType(d);
var result = buffer.length ? buffer.join("") : null;
buffer = [];
return result;
} | Returns a function that, given a GeoJSON object (e.g., a feature), returns
the corresponding SVG path. The function can be customized by overriding the
projection. Point features are mapped to circles with a default radius of
4.5px; the radius can be specified either as a constant or a function that
is evaluated per ob... | path | javascript | CartoDB/cartodb | vendor/assets/javascripts/d3.v2.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/d3.v2.js | BSD-3-Clause |
function project(coordinates) {
return projection(coordinates).join(",");
} | Returns a function that, given a GeoJSON object (e.g., a feature), returns
the corresponding SVG path. The function can be customized by overriding the
projection. Point features are mapped to circles with a default radius of
4.5px; the radius can be specified either as a constant or a function that
is evaluated per ob... | project | javascript | CartoDB/cartodb | vendor/assets/javascripts/d3.v2.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/d3.v2.js | BSD-3-Clause |
function polygonArea(coordinates) {
var sum = area(coordinates[0]), // exterior ring
i = 0, // coordinates.index
n = coordinates.length;
while (++i < n) sum -= area(coordinates[i]); // holes
return sum;
} | Returns a function that, given a GeoJSON object (e.g., a feature), returns
the corresponding SVG path. The function can be customized by overriding the
projection. Point features are mapped to circles with a default radius of
4.5px; the radius can be specified either as a constant or a function that
is evaluated per ob... | polygonArea | javascript | CartoDB/cartodb | vendor/assets/javascripts/d3.v2.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/d3.v2.js | BSD-3-Clause |
function polygonCentroid(coordinates) {
var polygon = d3.geom.polygon(coordinates[0].map(projection)), // exterior ring
area = polygon.area(),
centroid = polygon.centroid(area < 0 ? (area *= -1, 1) : -1),
x = centroid[0],
y = centroid[1],
z = area,
i = 0, // coordinat... | Returns a function that, given a GeoJSON object (e.g., a feature), returns
the corresponding SVG path. The function can be customized by overriding the
projection. Point features are mapped to circles with a default radius of
4.5px; the radius can be specified either as a constant or a function that
is evaluated per ob... | polygonCentroid | javascript | CartoDB/cartodb | vendor/assets/javascripts/d3.v2.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/d3.v2.js | BSD-3-Clause |
function area(coordinates) {
return Math.abs(d3.geom.polygon(coordinates.map(projection)).area());
} | Returns a function that, given a GeoJSON object (e.g., a feature), returns
the corresponding SVG path. The function can be customized by overriding the
projection. Point features are mapped to circles with a default radius of
4.5px; the radius can be specified either as a constant or a function that
is evaluated per ob... | area | javascript | CartoDB/cartodb | vendor/assets/javascripts/d3.v2.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/d3.v2.js | BSD-3-Clause |
function d3_path_circle(radius) {
return "m0," + radius
+ "a" + radius + "," + radius + " 0 1,1 0," + (-2 * radius)
+ "a" + radius + "," + radius + " 0 1,1 0," + (+2 * radius)
+ "z";
} | Returns a function that, given a GeoJSON object (e.g., a feature), returns
the corresponding SVG path. The function can be customized by overriding the
projection. Point features are mapped to circles with a default radius of
4.5px; the radius can be specified either as a constant or a function that
is evaluated per ob... | d3_path_circle | javascript | CartoDB/cartodb | vendor/assets/javascripts/d3.v2.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/d3.v2.js | BSD-3-Clause |
function d3_geo_bounds(o, f) {
if (d3_geo_boundsTypes.hasOwnProperty(o.type)) d3_geo_boundsTypes[o.type](o, f);
} | Given a GeoJSON object, returns the corresponding bounding box. The bounding
box is represented by a two-dimensional array: [[left, bottom], [right,
top]], where left is the minimum longitude, bottom is the minimum latitude,
right is maximum longitude, and top is the maximum latitude. | d3_geo_bounds | javascript | CartoDB/cartodb | vendor/assets/javascripts/d3.v2.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/d3.v2.js | BSD-3-Clause |
function d3_geo_boundsFeature(o, f) {
d3_geo_bounds(o.geometry, f);
} | Given a GeoJSON object, returns the corresponding bounding box. The bounding
box is represented by a two-dimensional array: [[left, bottom], [right,
top]], where left is the minimum longitude, bottom is the minimum latitude,
right is maximum longitude, and top is the maximum latitude. | d3_geo_boundsFeature | javascript | CartoDB/cartodb | vendor/assets/javascripts/d3.v2.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/d3.v2.js | BSD-3-Clause |
function d3_geo_boundsFeatureCollection(o, f) {
for (var a = o.features, i = 0, n = a.length; i < n; i++) {
d3_geo_bounds(a[i].geometry, f);
}
} | Given a GeoJSON object, returns the corresponding bounding box. The bounding
box is represented by a two-dimensional array: [[left, bottom], [right,
top]], where left is the minimum longitude, bottom is the minimum latitude,
right is maximum longitude, and top is the maximum latitude. | d3_geo_boundsFeatureCollection | javascript | CartoDB/cartodb | vendor/assets/javascripts/d3.v2.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/d3.v2.js | BSD-3-Clause |
function d3_geo_boundsGeometryCollection(o, f) {
for (var a = o.geometries, i = 0, n = a.length; i < n; i++) {
d3_geo_bounds(a[i], f);
}
} | Given a GeoJSON object, returns the corresponding bounding box. The bounding
box is represented by a two-dimensional array: [[left, bottom], [right,
top]], where left is the minimum longitude, bottom is the minimum latitude,
right is maximum longitude, and top is the maximum latitude. | d3_geo_boundsGeometryCollection | javascript | CartoDB/cartodb | vendor/assets/javascripts/d3.v2.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/d3.v2.js | BSD-3-Clause |
function d3_geo_boundsLineString(o, f) {
for (var a = o.coordinates, i = 0, n = a.length; i < n; i++) {
f.apply(null, a[i]);
}
} | Given a GeoJSON object, returns the corresponding bounding box. The bounding
box is represented by a two-dimensional array: [[left, bottom], [right,
top]], where left is the minimum longitude, bottom is the minimum latitude,
right is maximum longitude, and top is the maximum latitude. | d3_geo_boundsLineString | javascript | CartoDB/cartodb | vendor/assets/javascripts/d3.v2.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/d3.v2.js | BSD-3-Clause |
function d3_geo_boundsMultiLineString(o, f) {
for (var a = o.coordinates, i = 0, n = a.length; i < n; i++) {
for (var b = a[i], j = 0, m = b.length; j < m; j++) {
f.apply(null, b[j]);
}
}
} | Given a GeoJSON object, returns the corresponding bounding box. The bounding
box is represented by a two-dimensional array: [[left, bottom], [right,
top]], where left is the minimum longitude, bottom is the minimum latitude,
right is maximum longitude, and top is the maximum latitude. | d3_geo_boundsMultiLineString | javascript | CartoDB/cartodb | vendor/assets/javascripts/d3.v2.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/d3.v2.js | BSD-3-Clause |
function d3_geo_boundsMultiPolygon(o, f) {
for (var a = o.coordinates, i = 0, n = a.length; i < n; i++) {
for (var b = a[i][0], j = 0, m = b.length; j < m; j++) {
f.apply(null, b[j]);
}
}
} | Given a GeoJSON object, returns the corresponding bounding box. The bounding
box is represented by a two-dimensional array: [[left, bottom], [right,
top]], where left is the minimum longitude, bottom is the minimum latitude,
right is maximum longitude, and top is the maximum latitude. | d3_geo_boundsMultiPolygon | javascript | CartoDB/cartodb | vendor/assets/javascripts/d3.v2.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/d3.v2.js | BSD-3-Clause |
function d3_geo_boundsPoint(o, f) {
f.apply(null, o.coordinates);
} | Given a GeoJSON object, returns the corresponding bounding box. The bounding
box is represented by a two-dimensional array: [[left, bottom], [right,
top]], where left is the minimum longitude, bottom is the minimum latitude,
right is maximum longitude, and top is the maximum latitude. | d3_geo_boundsPoint | javascript | CartoDB/cartodb | vendor/assets/javascripts/d3.v2.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/d3.v2.js | BSD-3-Clause |
function d3_geo_boundsPolygon(o, f) {
for (var a = o.coordinates[0], i = 0, n = a.length; i < n; i++) {
f.apply(null, a[i]);
}
} | Given a GeoJSON object, returns the corresponding bounding box. The bounding
box is represented by a two-dimensional array: [[left, bottom], [right,
top]], where left is the minimum longitude, bottom is the minimum latitude,
right is maximum longitude, and top is the maximum latitude. | d3_geo_boundsPolygon | javascript | CartoDB/cartodb | vendor/assets/javascripts/d3.v2.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/d3.v2.js | BSD-3-Clause |
function circle() {
// TODO render a circle as a Polygon
} | Given a GeoJSON object, returns the corresponding bounding box. The bounding
box is represented by a two-dimensional array: [[left, bottom], [right,
top]], where left is the minimum longitude, bottom is the minimum latitude,
right is maximum longitude, and top is the maximum latitude. | circle | javascript | CartoDB/cartodb | vendor/assets/javascripts/d3.v2.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/d3.v2.js | BSD-3-Clause |
function visible(point) {
return arc.distance(point) < radians;
} | Given a GeoJSON object, returns the corresponding bounding box. The bounding
box is represented by a two-dimensional array: [[left, bottom], [right,
top]], where left is the minimum longitude, bottom is the minimum latitude,
right is maximum longitude, and top is the maximum latitude. | visible | javascript | CartoDB/cartodb | vendor/assets/javascripts/d3.v2.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/d3.v2.js | BSD-3-Clause |
function clip(coordinates) {
var i = -1,
n = coordinates.length,
clipped = [],
p0,
p1,
p2,
d0,
d1;
while (++i < n) {
d1 = arc.distance(p2 = coordinates[i]);
if (d1 < radians) {
if (p1) clipped.push(d3_geo_greatArcInterpolate(p1, p2)((d... | Given a GeoJSON object, returns the corresponding bounding box. The bounding
box is represented by a two-dimensional array: [[left, bottom], [right,
top]], where left is the minimum longitude, bottom is the minimum latitude,
right is maximum longitude, and top is the maximum latitude. | clip | javascript | CartoDB/cartodb | vendor/assets/javascripts/d3.v2.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/d3.v2.js | BSD-3-Clause |
function resample(coordinates) {
var i = 0,
n = coordinates.length,
j,
m,
resampled = n ? [coordinates[0]] : coordinates,
resamples,
origin = arc.source();
while (++i < n) {
resamples = arc.source(coordinates[i - 1])(coordinates[i]).coordinates;
for (... | Given a GeoJSON object, returns the corresponding bounding box. The bounding
box is represented by a two-dimensional array: [[left, bottom], [right,
top]], where left is the minimum longitude, bottom is the minimum latitude,
right is maximum longitude, and top is the maximum latitude. | resample | javascript | CartoDB/cartodb | vendor/assets/javascripts/d3.v2.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/d3.v2.js | BSD-3-Clause |
function greatArc() {
var d = greatArc.distance.apply(this, arguments), // initializes the interpolator, too
t = 0,
dt = precision / d,
coordinates = [p0];
while ((t += dt) < 1) coordinates.push(interpolate(t));
coordinates.push(p1);
return {type: "LineString", coordinates: coord... | Given a GeoJSON object, returns the corresponding bounding box. The bounding
box is represented by a two-dimensional array: [[left, bottom], [right,
top]], where left is the minimum longitude, bottom is the minimum latitude,
right is maximum longitude, and top is the maximum latitude. | greatArc | javascript | CartoDB/cartodb | vendor/assets/javascripts/d3.v2.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/d3.v2.js | BSD-3-Clause |
function d3_geo_greatArcSource(d) {
return d.source;
} | Given a GeoJSON object, returns the corresponding bounding box. The bounding
box is represented by a two-dimensional array: [[left, bottom], [right,
top]], where left is the minimum longitude, bottom is the minimum latitude,
right is maximum longitude, and top is the maximum latitude. | d3_geo_greatArcSource | javascript | CartoDB/cartodb | vendor/assets/javascripts/d3.v2.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/d3.v2.js | BSD-3-Clause |
function d3_geo_greatArcTarget(d) {
return d.target;
} | Given a GeoJSON object, returns the corresponding bounding box. The bounding
box is represented by a two-dimensional array: [[left, bottom], [right,
top]], where left is the minimum longitude, bottom is the minimum latitude,
right is maximum longitude, and top is the maximum latitude. | d3_geo_greatArcTarget | javascript | CartoDB/cartodb | vendor/assets/javascripts/d3.v2.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/d3.v2.js | BSD-3-Clause |
function d3_geo_greatArcInterpolator() {
var x0, y0, cy0, sy0, kx0, ky0,
x1, y1, cy1, sy1, kx1, ky1,
d,
k;
function interpolate(t) {
var B = Math.sin(t *= d) * k,
A = Math.sin(d - t) * k,
x = A * kx0 + B * kx1,
y = A * ky0 + B * ky1,
z = A * sy0 + B * sy1;
... | Given a GeoJSON object, returns the corresponding bounding box. The bounding
box is represented by a two-dimensional array: [[left, bottom], [right,
top]], where left is the minimum longitude, bottom is the minimum latitude,
right is maximum longitude, and top is the maximum latitude. | d3_geo_greatArcInterpolator | javascript | CartoDB/cartodb | vendor/assets/javascripts/d3.v2.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/d3.v2.js | BSD-3-Clause |
function interpolate(t) {
var B = Math.sin(t *= d) * k,
A = Math.sin(d - t) * k,
x = A * kx0 + B * kx1,
y = A * ky0 + B * ky1,
z = A * sy0 + B * sy1;
return [
Math.atan2(y, x) / d3_geo_radians,
Math.atan2(z, Math.sqrt(x * x + y * y)) / d3_geo_radians
];
} | Given a GeoJSON object, returns the corresponding bounding box. The bounding
box is represented by a two-dimensional array: [[left, bottom], [right,
top]], where left is the minimum longitude, bottom is the minimum latitude,
right is maximum longitude, and top is the maximum latitude. | interpolate | javascript | CartoDB/cartodb | vendor/assets/javascripts/d3.v2.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/d3.v2.js | BSD-3-Clause |
function d3_geo_greatArcInterpolate(a, b) {
var i = d3_geo_greatArcInterpolator().source(a).target(b);
i.distance();
return i;
} | Given a GeoJSON object, returns the corresponding bounding box. The bounding
box is represented by a two-dimensional array: [[left, bottom], [right,
top]], where left is the minimum longitude, bottom is the minimum latitude,
right is maximum longitude, and top is the maximum latitude. | d3_geo_greatArcInterpolate | javascript | CartoDB/cartodb | vendor/assets/javascripts/d3.v2.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/d3.v2.js | BSD-3-Clause |
function error(type) {
throw RangeError(errors[type]);
} | A generic error utility function.
@private
@param {String} type The error type.
@returns {Error} Throws a `RangeError` with the applicable error message. | error | javascript | CartoDB/cartodb | vendor/assets/javascripts/html2canvas.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/html2canvas.js | BSD-3-Clause |
function map(array, fn) {
var length = array.length;
var result = [];
while (length--) {
result[length] = fn(array[length]);
}
return result;
} | A generic `Array#map` utility function.
@private
@param {Array} array The array to iterate over.
@param {Function} callback The function that gets called for every array
item.
@returns {Array} A new array of values returned by the callback function. | map | javascript | CartoDB/cartodb | vendor/assets/javascripts/html2canvas.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/html2canvas.js | BSD-3-Clause |
function mapDomain(string, fn) {
var parts = string.split('@');
var result = '';
if (parts.length > 1) {
// In email addresses, only the domain name should be punycoded. Leave
// the local part (i.e. everything up to `@`) intact.
result = parts[0] + '@';
string = parts[1];
}
var labels = string.sp... | A simple `Array#map`-like wrapper to work with domain name strings or email
addresses.
@private
@param {String} domain The domain name or email address.
@param {Function} callback The function that gets called for every
character.
@returns {Array} A new string of characters returned by the callback
function. | mapDomain | javascript | CartoDB/cartodb | vendor/assets/javascripts/html2canvas.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/html2canvas.js | BSD-3-Clause |
function ucs2decode(string) {
var output = [],
counter = 0,
length = string.length,
value,
extra;
while (counter < length) {
value = string.charCodeAt(counter++);
if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
// high surrogate, and there is a next character
extr... | Creates an array containing the numeric code points of each Unicode
character in the string. While JavaScript uses UCS-2 internally,
this function will convert a pair of surrogate halves (each of which
UCS-2 exposes as separate characters) into a single code point,
matching UTF-16.
@see `punycode.ucs2.encode`
@see <htt... | ucs2decode | javascript | CartoDB/cartodb | vendor/assets/javascripts/html2canvas.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/html2canvas.js | BSD-3-Clause |
function ucs2encode(array) {
return map(array, function(value) {
var output = '';
if (value > 0xFFFF) {
value -= 0x10000;
output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);
value = 0xDC00 | value & 0x3FF;
}
output += stringFromCharCode(value);
return output;
}).join('');
} | Creates a string based on an array of numeric code points.
@see `punycode.ucs2.decode`
@memberOf punycode.ucs2
@name encode
@param {Array} codePoints The array of numeric code points.
@returns {String} The new Unicode string (UCS-2). | ucs2encode | javascript | CartoDB/cartodb | vendor/assets/javascripts/html2canvas.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/html2canvas.js | BSD-3-Clause |
function basicToDigit(codePoint) {
if (codePoint - 48 < 10) {
return codePoint - 22;
}
if (codePoint - 65 < 26) {
return codePoint - 65;
}
if (codePoint - 97 < 26) {
return codePoint - 97;
}
return base;
} | Converts a basic code point into a digit/integer.
@see `digitToBasic()`
@private
@param {Number} codePoint The basic numeric code point value.
@returns {Number} The numeric value of a basic code point (for use in
representing integers) in the range `0` to `base - 1`, or `base` if
the code point does not represent a val... | basicToDigit | javascript | CartoDB/cartodb | vendor/assets/javascripts/html2canvas.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/html2canvas.js | BSD-3-Clause |
function digitToBasic(digit, flag) {
// 0..25 map to ASCII a..z or A..Z
// 26..35 map to ASCII 0..9
return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
} | Converts a digit/integer into a basic code point.
@see `basicToDigit()`
@private
@param {Number} digit The numeric value of a basic code point.
@returns {Number} The basic code point whose value (when used for
representing integers) is `digit`, which needs to be in the range
`0` to `base - 1`. If `flag` is non-zero, th... | digitToBasic | javascript | CartoDB/cartodb | vendor/assets/javascripts/html2canvas.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/html2canvas.js | BSD-3-Clause |
function adapt(delta, numPoints, firstTime) {
var k = 0;
delta = firstTime ? floor(delta / damp) : delta >> 1;
delta += floor(delta / numPoints);
for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {
delta = floor(delta / baseMinusTMin);
}
return floor(k + (baseMinusTMin + 1) * de... | Bias adaptation function as per section 3.4 of RFC 3492.
http://tools.ietf.org/html/rfc3492#section-3.4
@private | adapt | javascript | CartoDB/cartodb | vendor/assets/javascripts/html2canvas.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/html2canvas.js | BSD-3-Clause |
function decode(input) {
// Don't use UCS-2
var output = [],
inputLength = input.length,
out,
i = 0,
n = initialN,
bias = initialBias,
basic,
j,
index,
oldi,
w,
k,
digit,
t,
/** Cached calculation results */
baseMinusT;
// ... | Converts a Punycode string of ASCII-only symbols to a string of Unicode
symbols.
@memberOf punycode
@param {String} input The Punycode string of ASCII-only symbols.
@returns {String} The resulting string of Unicode symbols. | decode | javascript | CartoDB/cartodb | vendor/assets/javascripts/html2canvas.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/html2canvas.js | BSD-3-Clause |
function encode(input) {
var n,
delta,
handledCPCount,
basicLength,
bias,
j,
m,
q,
k,
t,
currentValue,
output = [],
/** `inputLength` will hold the number of code points in `input`. */
inputLength,
/** Cached calculation results */
... | Converts a string of Unicode symbols (e.g. a domain name label) to a
Punycode string of ASCII-only symbols.
@memberOf punycode
@param {String} input The string of Unicode symbols.
@returns {String} The resulting Punycode string of ASCII-only symbols. | encode | javascript | CartoDB/cartodb | vendor/assets/javascripts/html2canvas.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/html2canvas.js | BSD-3-Clause |
function toUnicode(input) {
return mapDomain(input, function(string) {
return regexPunycode.test(string)
? decode(string.slice(4).toLowerCase())
: string;
});
} | Converts a Punycode string representing a domain name or an email address
to Unicode. Only the Punycoded parts of the input will be converted, i.e.
it doesn't matter if you call it on a string that has already been
converted to Unicode.
@memberOf punycode
@param {String} input The Punycoded domain name or email address... | toUnicode | javascript | CartoDB/cartodb | vendor/assets/javascripts/html2canvas.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/html2canvas.js | BSD-3-Clause |
function toASCII(input) {
return mapDomain(input, function(string) {
return regexNonASCII.test(string)
? 'xn--' + encode(string)
: string;
});
} | Converts a Unicode string representing a domain name or an email address to
Punycode. Only the non-ASCII parts of the domain name will be converted,
i.e. it doesn't matter if you call it with a domain that's already in
ASCII.
@memberOf punycode
@param {String} input The domain name or email address to convert, as a
Uni... | toASCII | javascript | CartoDB/cartodb | vendor/assets/javascripts/html2canvas.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/html2canvas.js | BSD-3-Clause |
function mk_block_toSource() {
return "Markdown.mk_block( " +
uneval(this.toString()) +
", " +
uneval(this.trailing) +
", " +
uneval(this.lineNumber) +
" )";
} | toHTMLTree( markdown, [dialect] ) -> JsonML
toHTMLTree( md_tree ) -> JsonML
- markdown (String): markdown string to parse
- dialect (String | Dialect): the dialect to use, defaults to gruber
- md_tree (Markdown.JsonML): parsed markdown tree
Turn markdown into HTML, represented as a JsonML tree. If a string is giv... | mk_block_toSource | javascript | CartoDB/cartodb | vendor/assets/javascripts/markdown.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/markdown.js | BSD-3-Clause |
function mk_block_inspect() {
var util = require("util");
return "Markdown.mk_block( " +
util.inspect(this.toString()) +
", " +
util.inspect(this.trailing) +
", " +
util.inspect(this.lineNumber) +
" )";
} | toHTMLTree( markdown, [dialect] ) -> JsonML
toHTMLTree( md_tree ) -> JsonML
- markdown (String): markdown string to parse
- dialect (String | Dialect): the dialect to use, defaults to gruber
- md_tree (Markdown.JsonML): parsed markdown tree
Turn markdown into HTML, represented as a JsonML tree. If a string is giv... | mk_block_inspect | javascript | CartoDB/cartodb | vendor/assets/javascripts/markdown.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/markdown.js | BSD-3-Clause |
function count_lines( str ) {
var n = 0, i = -1;
while ( ( i = str.indexOf("\n", i + 1) ) !== -1 ) n++;
return n;
} | toHTMLTree( markdown, [dialect] ) -> JsonML
toHTMLTree( md_tree ) -> JsonML
- markdown (String): markdown string to parse
- dialect (String | Dialect): the dialect to use, defaults to gruber
- md_tree (Markdown.JsonML): parsed markdown tree
Turn markdown into HTML, represented as a JsonML tree. If a string is giv... | count_lines | javascript | CartoDB/cartodb | vendor/assets/javascripts/markdown.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/markdown.js | BSD-3-Clause |
function regex_for_depth( depth ) {
return new RegExp(
// m[1] = indent, m[2] = list_type
"(?:^(" + indent_re + "{0," + depth + "} {0,3})(" + any_list + ")\\s+)|" +
// m[3] = cont
"(^" + indent_re + "{0," + (depth-1) + "}[ ]{0,4})"
);
} | Markdown.dialects.Gruber
The default dialect that follows the rules set out by John Gruber's
markdown.pl as closely as possible. Well actually we follow the behaviour of
that script which in some places is not exactly what the syntax web page
says. | regex_for_depth | javascript | CartoDB/cartodb | vendor/assets/javascripts/markdown.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/markdown.js | BSD-3-Clause |
function expand_tab( input ) {
return input.replace( / {0,3}\t/g, " " );
} | Markdown.dialects.Gruber
The default dialect that follows the rules set out by John Gruber's
markdown.pl as closely as possible. Well actually we follow the behaviour of
that script which in some places is not exactly what the syntax web page
says. | expand_tab | javascript | CartoDB/cartodb | vendor/assets/javascripts/markdown.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/markdown.js | BSD-3-Clause |
function add(li, loose, inline, nl) {
if ( loose ) {
li.push( [ "para" ].concat(inline) );
return;
}
// Hmmm, should this be any block level element or just paras?
var add_to = li[li.length -1] instanceof Array && li[li.length - 1][0] == "para"
? li... | Markdown.dialects.Gruber
The default dialect that follows the rules set out by John Gruber's
markdown.pl as closely as possible. Well actually we follow the behaviour of
that script which in some places is not exactly what the syntax web page
says. | add | javascript | CartoDB/cartodb | vendor/assets/javascripts/markdown.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/markdown.js | BSD-3-Clause |
function get_contained_blocks( depth, blocks ) {
var re = new RegExp( "^(" + indent_re + "{" + depth + "}.*?\\n?)*$" ),
replace = new RegExp("^" + indent_re + "{" + depth + "}", "gm"),
ret = [];
while ( blocks.length > 0 ) {
if ( re.exec( blocks[0] ) ) {
v... | Markdown.dialects.Gruber
The default dialect that follows the rules set out by John Gruber's
markdown.pl as closely as possible. Well actually we follow the behaviour of
that script which in some places is not exactly what the syntax web page
says. | get_contained_blocks | javascript | CartoDB/cartodb | vendor/assets/javascripts/markdown.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/markdown.js | BSD-3-Clause |
function paragraphify(s, i, stack) {
var list = s.list;
var last_li = list[list.length-1];
if ( last_li[1] instanceof Array && last_li[1][0] == "para" ) {
return;
}
if ( i + 1 == stack.length ) {
// Last stack frame
// Keep the same array, but repla... | Markdown.dialects.Gruber
The default dialect that follows the rules set out by John Gruber's
markdown.pl as closely as possible. Well actually we follow the behaviour of
that script which in some places is not exactly what the syntax web page
says. | paragraphify | javascript | CartoDB/cartodb | vendor/assets/javascripts/markdown.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/markdown.js | BSD-3-Clause |
function make_list( m ) {
var list = bullet_list.exec( m[2] )
? ["bulletlist"]
: ["numberlist"];
stack.push( { list: list, indent: m[1] } );
return list;
} | Markdown.dialects.Gruber
The default dialect that follows the rules set out by John Gruber's
markdown.pl as closely as possible. Well actually we follow the behaviour of
that script which in some places is not exactly what the syntax web page
says. | make_list | javascript | CartoDB/cartodb | vendor/assets/javascripts/markdown.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/markdown.js | BSD-3-Clause |
function add(x) {
//D:self.debug(" adding output", uneval(x));
if ( typeof x == "string" && typeof out[out.length-1] == "string" )
out[ out.length-1 ] += x;
else
out.push(x);
} | Markdown.dialects.Gruber
The default dialect that follows the rules set out by John Gruber's
markdown.pl as closely as possible. Well actually we follow the behaviour of
that script which in some places is not exactly what the syntax web page
says. | add | javascript | CartoDB/cartodb | vendor/assets/javascripts/markdown.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/markdown.js | BSD-3-Clause |
function strong_em( tag, md ) {
var state_slot = tag + "_state",
other_slot = tag == "strong" ? "em_state" : "strong_state";
function CloseTag(len) {
this.len_after = len;
this.name = "close_" + md;
}
return function ( text, orig_match ) {
if ( this[state_slot][0] == md ) {
// Most r... | Markdown.dialects.Gruber
The default dialect that follows the rules set out by John Gruber's
markdown.pl as closely as possible. Well actually we follow the behaviour of
that script which in some places is not exactly what the syntax web page
says. | strong_em | javascript | CartoDB/cartodb | vendor/assets/javascripts/markdown.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/markdown.js | BSD-3-Clause |
function CloseTag(len) {
this.len_after = len;
this.name = "close_" + md;
} | Markdown.dialects.Gruber
The default dialect that follows the rules set out by John Gruber's
markdown.pl as closely as possible. Well actually we follow the behaviour of
that script which in some places is not exactly what the syntax web page
says. | CloseTag | javascript | CartoDB/cartodb | vendor/assets/javascripts/markdown.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/markdown.js | BSD-3-Clause |
function split_meta_hash( meta_string ) {
var meta = meta_string.split( "" ),
parts = [ "" ],
in_quotes = false;
while ( meta.length ) {
var letter = meta.shift();
switch ( letter ) {
case " " :
// if we're in a quoted section, keep it
if ( in_quotes ) {
parts[ p... | Markdown.dialects.Gruber
The default dialect that follows the rules set out by John Gruber's
markdown.pl as closely as possible. Well actually we follow the behaviour of
that script which in some places is not exactly what the syntax web page
says. | split_meta_hash | javascript | CartoDB/cartodb | vendor/assets/javascripts/markdown.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/markdown.js | BSD-3-Clause |
_split_on_unescaped = function(s, ch) {
ch = ch || '\\s';
if (ch.match(/^[\\|\[\]{}?*.+^$]$/)) { ch = '\\' + ch; }
var res = [ ],
r = new RegExp('^((?:\\\\.|[^\\\\' + ch + '])*)' + ch + '(.*)'),
m;
while(m = s.match(r)) {
res.push(m[1]);
s ... | Markdown.dialects.Gruber
The default dialect that follows the rules set out by John Gruber's
markdown.pl as closely as possible. Well actually we follow the behaviour of
that script which in some places is not exactly what the syntax web page
says. | _split_on_unescaped | javascript | CartoDB/cartodb | vendor/assets/javascripts/markdown.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/markdown.js | BSD-3-Clause |
isEmpty = function( obj ) {
for ( var key in obj ) {
if ( hasOwnProperty.call( obj, key ) ) {
return false;
}
}
return true;
} | Markdown.dialects.Gruber
The default dialect that follows the rules set out by John Gruber's
markdown.pl as closely as possible. Well actually we follow the behaviour of
that script which in some places is not exactly what the syntax web page
says. | isEmpty | javascript | CartoDB/cartodb | vendor/assets/javascripts/markdown.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/markdown.js | BSD-3-Clause |
function extract_attr( jsonml ) {
return isArray(jsonml)
&& jsonml.length > 1
&& typeof jsonml[ 1 ] === "object"
&& !( isArray(jsonml[ 1 ]) )
? jsonml[ 1 ]
: undefined;
} | Markdown.dialects.Gruber
The default dialect that follows the rules set out by John Gruber's
markdown.pl as closely as possible. Well actually we follow the behaviour of
that script which in some places is not exactly what the syntax web page
says. | extract_attr | javascript | CartoDB/cartodb | vendor/assets/javascripts/markdown.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/markdown.js | BSD-3-Clause |
function escapeHTML( text ) {
return text.replace( /&/g, "&" )
.replace( /</g, "<" )
.replace( />/g, ">" )
.replace( /"/g, """ )
.replace( /'/g, "'" );
} | renderJsonML( jsonml[, options] ) -> String
- jsonml (Array): JsonML array to render to XML
- options (Object): options
Converts the given JsonML into well-formed XML.
The options currently understood are:
- root (Boolean): wether or not the root node should be included in the
output, or just its children. T... | escapeHTML | javascript | CartoDB/cartodb | vendor/assets/javascripts/markdown.js | https://github.com/CartoDB/cartodb/blob/master/vendor/assets/javascripts/markdown.js | BSD-3-Clause |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.