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 |
|---|---|---|---|---|---|---|---|
function scrollToX(destX, animate)
{
var percentScrolled = destX / (contentWidth - paneWidth);
positionDragX(percentScrolled * dragMaxX, animate);
} | `fail` will execute when the request fails | scrollToX | 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 scrollToElement(ele, stickToTop, animate)
{
var e, eleHeight, eleWidth, eleTop = 0, eleLeft = 0, viewportTop, viewportLeft, maxVisibleEleTop, maxVisibleEleLeft, destY, destX;
// Legal hash values aren't necessarily legal jQuery selectors so we need to catch any
// errors from the... | `fail` will execute when the request fails | scrollToElement | 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 contentPositionX()
{
return -pane.position().left;
} | `fail` will execute when the request fails | contentPositionX | 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 contentPositionY()
{
return -pane.position().top;
} | `fail` will execute when the request fails | contentPositionY | 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 isCloseToBottom()
{
var scrollableHeight = contentHeight - paneHeight;
return (scrollableHeight > 20) && (scrollableHeight - contentPositionY() < 10);
} | `fail` will execute when the request fails | isCloseToBottom | 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 isCloseToRight()
{
var scrollableWidth = contentWidth - paneWidth;
return (scrollableWidth > 20) && (scrollableWidth - contentPositionX() < 10);
} | `fail` will execute when the request fails | isCloseToRight | 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 initMousewheel()
{
container.unbind(mwEvent).bind(
mwEvent,
function (event, delta, deltaX, deltaY) {
var dX = horizontalDragPosition, dY = verticalDragPosition;
jsp.scrollBy(deltaX * settings.mouseWheelSpeed, -deltaY * settings.mouseWheelSpeed, false);... | `fail` will execute when the request fails | initMousewheel | 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 removeMousewheel()
{
container.unbind(mwEvent);
} | `fail` will execute when the request fails | removeMousewheel | 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 nil()
{
return false;
} | `fail` will execute when the request fails | nil | 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 initFocusHandler()
{
pane.find(':input,a').unbind('focus.jsp').bind(
'focus.jsp',
function(e)
{
scrollToElement(e.target, false);
}
);
} | `fail` will execute when the request fails | initFocusHandler | 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 removeFocusHandler()
{
pane.find(':input,a').unbind('focus.jsp');
} | `fail` will execute when the request fails | removeFocusHandler | 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 initKeyboardNav()
{
var keyDown, elementHasScrolled, validParents = [];
isScrollableH && validParents.push(horizontalBar[0]);
isScrollableV && validParents.push(verticalBar[0]);
// IE also focuses elements that don't have tabindex set.
pane.focus(
... | `fail` will execute when the request fails | initKeyboardNav | 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 keyDownHandler()
{
var dX = horizontalDragPosition, dY = verticalDragPosition;
switch(keyDown) {
case 40: // down
jsp.scrollByY(settings.keyboardSpeed, false);
break;
case 38: // up
jsp.scrollByY(-settings.keyboardSpe... | `fail` will execute when the request fails | keyDownHandler | 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 removeKeyboardNav()
{
elem.attr('tabindex', '-1')
.removeAttr('tabindex')
.unbind('keydown.jsp keypress.jsp');
} | `fail` will execute when the request fails | removeKeyboardNav | 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 observeHash()
{
if (location.hash && location.hash.length > 1) {
var e,
retryInt,
hash = escape(location.hash.substr(1)) // hash must be escaped to prevent XSS
;
try {
e = $('#' + hash + ', a[name="' + hash + '"]');
} c... | `fail` will execute when the request fails | observeHash | 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 hijackInternalLinks()
{
// only register the link handler once
if ($(document.body).data('jspHijack')) {
return;
}
// remember that the handler was bound
$(document.body).data('jspHijack', true);
// use live handler to also capture newly created... | `fail` will execute when the request fails | hijackInternalLinks | 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 initTouch()
{
var startX,
startY,
touchStartX,
touchStartY,
moved,
moving = false;
container.unbind('touchstart.jsp touchmove.jsp touchend.jsp click.jsp-touchclick').bind(
'touchstart.jsp',
function(e)
{
... | `fail` will execute when the request fails | initTouch | 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 destroy(){
var currentY = contentPositionY(),
currentX = contentPositionX();
elem.removeClass('jspScrollable').unbind('.jsp');
elem.replaceWith(originalElement.append(pane.children()));
originalElement.scrollTop(currentY);
originalElement.scrollLeft(currentX);
... | `fail` will execute when the request fails | destroy | 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 handler(event) {
var orgEvent = event || window.event, args = [].slice.call( arguments, 1 ), delta = 0, returnValue = true, deltaX = 0, deltaY = 0;
event = $.event.fix(orgEvent);
event.type = "mousewheel";
// Old school scrollwheel delta
if ( orgEvent.wheelDelta ) { delta = orgEvent.wh... | `fail` will execute when the request fails | handler | 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 decodeCssEscape(s) {
var i = parseInt(s.substring(1), 16);
// If parseInt didn't find a hex diigt, it returns NaN so return the
// escaped character.
// Otherwise, parseInt will stop at the first non-hex digit so there's no
// need to worry about trailing whitespace.
if (i > 0xffff) {
... | Decodes an escape sequence as specified in CSS3 section 4.1.
http://www.w3.org/TR/css3-syntax/#characters
@private | decodeCssEscape | 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 escapeCssString(s, replacer) {
return '"' + s.replace(/[\u0000-\u001f\\\"<>]/g, replacer) + '"';
} | Returns an equivalent CSS string literal given plain text: foo -> "foo".
@private | escapeCssString | 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 escapeCssStrChar(ch) {
return cssStrChars[ch]
|| (cssStrChars[ch] = '\\' + ch.charCodeAt(0).toString(16) + ' ');
} | Maps chars to CSS escaped equivalents: "\n" -> "\\a ".
@private | escapeCssStrChar | 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 escapeCssUrlChar(ch) {
return cssUrlChars[ch]
|| (cssUrlChars[ch] = (ch < '\x10' ? '%0' : '%')
+ ch.charCodeAt(0).toString(16));
} | Maps chars to URI escaped equivalents: "\n" -> "%0a".
@private | escapeCssUrlChar | 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 parse(uriStr) {
var m = ('' + uriStr).match(URI_RE_);
if (!m) { return null; }
return new URI(
nullIfAbsent(m[1]),
nullIfAbsent(m[2]),
nullIfAbsent(m[3]),
nullIfAbsent(m[4]),
nullIfAbsent(m[5]),
nullIfAbsent(m[6]),
nullIfAbsent(m[7]));
} | creates a uri from the string form. The parser is relaxed, so special
characters that aren't escaped but don't cause ambiguities will not cause
parse failures.
@return {URI|null} | parse | 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 create(scheme, credentials, domain, port, path, query, fragment) {
var uri = new URI(
encodeIfExists2(scheme, URI_DISALLOWED_IN_SCHEME_OR_CREDENTIALS_),
encodeIfExists2(
credentials, URI_DISALLOWED_IN_SCHEME_OR_CREDENTIALS_),
encodeIfExists(domain),
port > 0 ? port.toString(... | creates a uri from the given parts.
@param scheme {string} an unencoded scheme such as "http" or null
@param credentials {string} unencoded user credentials or null
@param domain {string} an unencoded domain name or null
@param port {number} a port number in [1, 32768].
-1 indicates no port, as does null.
@param pa... | create | 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 encodeIfExists(unescapedPart) {
if ('string' == typeof unescapedPart) {
return encodeURIComponent(unescapedPart);
}
return null;
} | creates a uri from the given parts.
@param scheme {string} an unencoded scheme such as "http" or null
@param credentials {string} unencoded user credentials or null
@param domain {string} an unencoded domain name or null
@param port {number} a port number in [1, 32768].
-1 indicates no port, as does null.
@param pa... | encodeIfExists | 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 encodeIfExists2(unescapedPart, extra) {
if ('string' == typeof unescapedPart) {
return encodeURI(unescapedPart).replace(extra, encodeOne);
}
return null;
} | if unescapedPart is non null, then escapes any characters in it that aren't
valid characters in a url and also escapes any special characters that
appear in extra.
@param unescapedPart {string}
@param extra {RegExp} a character set of characters in [\01-\177].
@return {string|null} null iff unescapedPart == null. | encodeIfExists2 | 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 encodeOne(ch) {
var n = ch.charCodeAt(0);
return '%' + '0123456789ABCDEF'.charAt((n >> 4) & 0xf) +
'0123456789ABCDEF'.charAt(n & 0xf);
} | converts a character in [\01-\177] to its url encoded equivalent. | encodeOne | 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 normPath(path) {
return path.replace(/(^|\/)\.(?:\/|$)/g, '$1').replace(/\/{2,}/g, '/');
} | {@updoc
$ normPath('foo/./bar')
# 'foo/bar'
$ normPath('./foo')
# 'foo'
$ normPath('foo/.')
# 'foo'
$ normPath('foo//bar')
# 'foo/bar'
} | normPath | 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 collapse_dots(path) {
if (path === null) { return null; }
var p = normPath(path);
// Only /../ left to flatten
var r = PARENT_DIRECTORY_HANDLER_RE;
// We replace with $1 which matches a / before the .. because this
// guarantees that:
// (1) we have at most 1 / between the adjacent place,
// (2... | Normalizes its input path and collapses all . and .. sequences except for
.. sequences that would take it above the root of the current parent
directory.
{@updoc
$ collapse_dots('foo/../bar')
# 'bar'
$ collapse_dots('foo/./bar')
# 'foo/bar'
$ collapse_dots('foo/../bar/./../../baz')
# 'baz'
$ collapse_dots('../fo... | collapse_dots | 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 resolve(baseUri, relativeUri) {
// there are several kinds of relative urls:
// 1. //foo - replaces everything from the domain on. foo is a domain name
// 2. foo - replaces the last part of the path, the whole query and fragment
// 3. /foo - replaces the the path, the query and fragment
// 4. ?foo -... | resolves a relative url string to a base uri.
@return {URI} | resolve | 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 URI(
rawScheme,
rawCredentials, rawDomain, port,
rawPath, rawQuery, rawFragment) {
this.scheme_ = rawScheme;
this.credentials_ = rawCredentials;
this.domain_ = rawDomain;
this.port_ = port;
this.path_ = rawPath;
this.query_ = rawQuery;
this.fragment_ = rawFragment;
/**
* @type {A... | a mutable URI.
This class contains setters and getters for the parts of the URI.
The <tt>getXYZ</tt>/<tt>setXYZ</tt> methods return the decoded part -- so
<code>uri.parse('/foo%20bar').getPath()</code> will return the decoded path,
<tt>/foo bar</tt>.
<p>The raw versions of fields are available too.
<code>uri.parse('/... | URI | 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 nullIfAbsent(matchPart) {
return ('string' == typeof matchPart) && (matchPart.length > 0)
? matchPart
: null;
} | returns the first value for a given cgi parameter or null if the given
parameter name does not appear in the query string.
If the given parameter name does appear, but has no '<tt>=</tt>' following
it, then the empty string will be returned.
@return {string|null} | nullIfAbsent | 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 unionArrays(arrs) {
var map = {};
for (var i = arrs.length; --i >= 0;) {
var arr = arrs[i];
for (var j = arr.length; --j >= 0;) {
map[arr[j]] = ALLOWED_LITERAL;
}
}
return map;
} | Given a series of normalized CSS tokens, applies a property schema, as
defined in CssPropertyPatterns.java, and sanitizes the tokens in place.
@param property a property name.
@param tokens as parsed by lexCss. Modified in place.
@param opt_naiveUriRewriter a URI rewriter; an object with a "rewrite"
function that ... | unionArrays | 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 sanitizeFunctionCall(tokens, start) {
var parenDepth = 1, end = start + 1, n = tokens.length;
while (end < n && parenDepth) {
var token = tokens[end++];
// Decrement if we see a close parenthesis, and increment if we
// see a function. Since url(...) are whole tok... | Recurse to apply the appropriate function schema to the function call
that starts at {@code tokens[start]}.
@param {Array.<string>} tokens an array of CSS token that is modified
in place so that all tokens involved in the function call
(from {@code tokens[start]} to a close parenthesis) are folded to
one token.
@... | sanitizeFunctionCall | 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 processComplexSelector(start, end) {
// Space around commas is not an operator.
if (selectors[start] === ' ') { ++start; }
if (end-1 !== start && selectors[end] === ' ') { --end; }
// Split the selector into element selectors, content around
// space (ancestor operator) and '>' (... | Given a series of tokens, returns a list of sanitized selectors.
@param {Array.<string>} selectors In the form produced by csslexer.js.
@param {{
containerClass: ?string,
idSuffix: string,
tagPolicy: function(string, Array.<string>): ?Array.<string>,
virtualizeAttrName: ?function(string, string): ?strin... | processComplexSelector | 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 processCompoundSelector(start, end, combinator) {
// Split the element selector into four parts.
// DIV.foo#bar[href]:hover
// ^ ^ ^
// el classes attrs pseudo
var element, classId, attrs, pseudoSelector,
tok, // The current token
//... | Given a series of tokens, returns a list of sanitized selectors.
@param {Array.<string>} selectors In the form produced by csslexer.js.
@param {{
containerClass: ?string,
idSuffix: string,
tagPolicy: function(string, Array.<string>): ?Array.<string>,
virtualizeAttrName: ?function(string, string): ?strin... | processCompoundSelector | 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 cssParseUri(candidate) {
var string1 = /^\s*["]([^"]*)["]\s*$/;
var string2 = /^\s*[']([^']*)[']\s*$/;
var url1 = /^\s*url\s*[(]["]([^"]*)["][)]\s*$/;
var url2 = /^\s*url\s*[(][']([^']*)['][)]\s*$/;
// Not officially part of the CSS2.1 grammar
// but supported by Chrome
... | Extracts a url out of an at-import rule of the form:
\@import "mystyle.css";
\@import url("mystyle.css");
Returns null if no valid url was found. | cssParseUri | 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 sanitizeStylesheetInternal(
baseUri, cssText, virtualization, naiveUriRewriter, naiveUriFetcher,
continuation, opt_importCount) {
var safeCss = void 0;
// Return a result with moreToCome===true when the last import has been
// sanitized.
var importCount = opt_importCount... | @param {string} baseUri a string against which relative urls are
resolved.
@param {string} cssText a string containing a CSS stylesheet.
@param {{
containerClass: ?string,
idSuffix: string,
tagPolicy: function(string, Array.<string>): ?Array.<string>,
virtualizeAttrName: ?function(string, string): ?s... | sanitizeStylesheetInternal | 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 checkElide() {
elide = blockStack.length && blockStack[blockStack.length-1] === null;
} | @param {string} baseUri a string against which relative urls are
resolved.
@param {string} cssText a string containing a CSS stylesheet.
@param {{
containerClass: ?string,
idSuffix: string,
tagPolicy: function(string, Array.<string>): ?Array.<string>,
virtualizeAttrName: ?function(string, string): ?s... | checkElide | 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 statement(toks, i, n, handler) {
if (i < n) {
var tok = toks[i];
if (tok.charAt(0) === '@') {
return atrule(toks, i, n, handler, true);
} else {
return ruleset(toks, i, n, handler);
}
} else {
return i;
}
} | parseCssDeclarations parses a run of declaration productions as seen in the
body of the HTML5 {@code style} attribute.
@param {string} cssText CSS3 content to parse as a run of declarations.
@param {Object} handler An object like <pre>{
declaration: function (property, valueArray) { ... },
}</pre> | statement | 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 atrule(toks, i, n, handler, blockok) {
var start = i++;
while (i < n && toks[i] !== '{' && toks[i] !== ';') {
++i;
}
if (i < n && (blockok || toks[i] === ';')) {
var s = start+1, e = i;
if (s < n && toks[s] === ' ') { ++s; }
if (e > s && toks[e-1] === ' ') { --e; }
... | parseCssDeclarations parses a run of declaration productions as seen in the
body of the HTML5 {@code style} attribute.
@param {string} cssText CSS3 content to parse as a run of declarations.
@param {Object} handler An object like <pre>{
declaration: function (property, valueArray) { ... },
}</pre> | atrule | 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 block(toks, i, n, handler) {
++i; // skip over '{'
if (handler['startBlock']) { handler['startBlock'](); }
while (i < n) {
var ch = toks[i].charAt(0);
if (ch == '}') {
++i;
break;
}
if (ch === ' ' || ch === ';') {
i = i+1;
} else if (ch === '@'... | parseCssDeclarations parses a run of declaration productions as seen in the
body of the HTML5 {@code style} attribute.
@param {string} cssText CSS3 content to parse as a run of declarations.
@param {Object} handler An object like <pre>{
declaration: function (property, valueArray) { ... },
}</pre> | block | 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 ruleset(toks, i, n, handler) {
// toks[s:e] are the selector tokens including internal whitespace.
var s = i, e = selector(toks, i, n, true);
if (e < 0) {
// Skip malformed content per selector calling convention.
e = ~e;
// Make sure we skip at least one token.
return e ===... | parseCssDeclarations parses a run of declaration productions as seen in the
body of the HTML5 {@code style} attribute.
@param {string} cssText CSS3 content to parse as a run of declarations.
@param {Object} handler An object like <pre>{
declaration: function (property, valueArray) { ... },
}</pre> | ruleset | 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 selector(toks, i, n, allowSemi) {
var s = i;
// The definition of any above can be summed up as
// "any run of token except ('[', ']', '(', ')', ':', ';', '{', '}')
// or nested runs of parenthesized tokens or square bracketed tokens".
// Spaces are significant in the selector.
// ... | parseCssDeclarations parses a run of declaration productions as seen in the
body of the HTML5 {@code style} attribute.
@param {string} cssText CSS3 content to parse as a run of declarations.
@param {Object} handler An object like <pre>{
declaration: function (property, valueArray) { ... },
}</pre> | selector | 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 skipDeclaration(toks, i, n) {
// TODO(felix8a): maybe skip balanced pairs of {}
while (i < n && toks[i] !== ';' && toks[i] !== '}') { ++i; }
return i < n && toks[i] === ';' ? i+1 : i;
} | parseCssDeclarations parses a run of declaration productions as seen in the
body of the HTML5 {@code style} attribute.
@param {string} cssText CSS3 content to parse as a run of declarations.
@param {Object} handler An object like <pre>{
declaration: function (property, valueArray) { ... },
}</pre> | skipDeclaration | 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 declaration(toks, i, n, handler) {
var property = toks[i++];
if (!ident.test(property)) {
return skipDeclaration(toks, i, n);
}
var tok;
if (i < n && toks[i] === ' ') { ++i; }
if (i == n || toks[i] !== ':') {
return skipDeclaration(toks, i, n);
}
++i;
if (i < n &... | parseCssDeclarations parses a run of declaration productions as seen in the
body of the HTML5 {@code style} attribute.
@param {string} cssText CSS3 content to parse as a run of declarations.
@param {Object} handler An object like <pre>{
declaration: function (property, valueArray) { ... },
}</pre> | declaration | 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 lookupEntity(name) {
// TODO: entity lookup as specified by HTML5 actually depends on the
// presence of the ";".
if (ENTITIES.hasOwnProperty(name)) { return ENTITIES[name]; }
var m = name.match(decimalEscapeRe);
if (m) {
return String.fromCharCode(parseInt(m[1], 10));
} else if (... | Decodes an HTML entity.
{\@updoc
$ lookupEntity('lt')
# '<'
$ lookupEntity('GT')
# '>'
$ lookupEntity('amp')
# '&'
$ lookupEntity('nbsp')
# '\xA0'
$ lookupEntity('apos')
# "'"
$ lookupEntity('quot')
# '"'
$ lookupEntity('#xa')
# '\n'
$ lookupEntity('#10')
# '\n'
$ lookupEntity('#x0a')
# '\n'
$ lookupEntity('#010')
# '... | lookupEntity | 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 decodeOneEntity(_, name) {
return lookupEntity(name);
} | Decodes an HTML entity.
{\@updoc
$ lookupEntity('lt')
# '<'
$ lookupEntity('GT')
# '>'
$ lookupEntity('amp')
# '&'
$ lookupEntity('nbsp')
# '\xA0'
$ lookupEntity('apos')
# "'"
$ lookupEntity('quot')
# '"'
$ lookupEntity('#xa')
# '\n'
$ lookupEntity('#10')
# '\n'
$ lookupEntity('#x0a')
# '\n'
$ lookupEntity('#010')
# '... | decodeOneEntity | 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 stripNULs(s) {
return s.replace(nulRe, '');
} | Decodes an HTML entity.
{\@updoc
$ lookupEntity('lt')
# '<'
$ lookupEntity('GT')
# '>'
$ lookupEntity('amp')
# '&'
$ lookupEntity('nbsp')
# '\xA0'
$ lookupEntity('apos')
# "'"
$ lookupEntity('quot')
# '"'
$ lookupEntity('#xa')
# '\n'
$ lookupEntity('#10')
# '\n'
$ lookupEntity('#x0a')
# '\n'
$ lookupEntity('#010')
# '... | stripNULs | 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 unescapeEntities(s) {
return s.replace(ENTITY_RE_1, decodeOneEntity);
} | The plain text of a chunk of HTML CDATA which possibly containing.
{\@updoc
$ unescapeEntities('')
# ''
$ unescapeEntities('hello World!')
# 'hello World!'
$ unescapeEntities('1 < 2 && 4 > 3 ')
# '1 < 2 && 4 > 3\n'
$ unescapeEntities('<< <- unfinished entity>')
# '<< <- unfinished entity>'
... | unescapeEntities | 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 escapeAttrib(s) {
return ('' + s).replace(ampRe, '&').replace(ltRe, '<')
.replace(gtRe, '>').replace(quotRe, '"');
} | Escapes HTML special characters in attribute values.
{\@updoc
$ escapeAttrib('')
# ''
$ escapeAttrib('"<<&==&>>"') // Do not just escape the first occurrence.
# '"<<&==&>>"'
$ escapeAttrib('Hello <World>!')
# 'Hello <World>!'
} | escapeAttrib | 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 normalizeRCData(rcdata) {
return rcdata
.replace(looseAmpRe, '&$1')
.replace(ltRe, '<')
.replace(gtRe, '>');
} | Escape entities in RCDATA that can be escaped without changing the meaning.
{\@updoc
$ normalizeRCData('1 < 2 && 3 > 4 && 5 < 7&8')
# '1 < 2 && 3 > 4 && 5 < 7&8'
} | normalizeRCData | 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 makeSaxParser(handler) {
// Accept quoted or unquoted keys (Closure compat)
var hcopy = {
cdata: handler.cdata || handler['cdata'],
comment: handler.comment || handler['comment'],
endDoc: handler.endDoc || handler['endDoc'],
endTag: handler.endTag || handler['endTag'],
pcd... | Given a SAX-like event handler, produce a function that feeds those
events and a parameter to the event handler.
The event handler has the form:{@code
{
// Name is an upper-case HTML tag name. Attribs is an array of
// alternating upper-case attribute names, and attribute values. The
// attribs array is reused... | makeSaxParser | 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 parse(htmlText, handler, param) {
var m, p, tagName;
var parts = htmlSplit(htmlText);
var state = {
noMoreGT: false,
noMoreEndComments: false
};
parseCPS(handler, parts, 0, state, param);
} | Given a SAX-like event handler, produce a function that feeds those
events and a parameter to the event handler.
The event handler has the form:{@code
{
// Name is an upper-case HTML tag name. Attribs is an array of
// alternating upper-case attribute names, and attribute values. The
// attribs array is reused... | parse | 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 continuationMaker(h, parts, initial, state, param) {
return function () {
parseCPS(h, parts, initial, state, param);
};
} | Given a SAX-like event handler, produce a function that feeds those
events and a parameter to the event handler.
The event handler has the form:{@code
{
// Name is an upper-case HTML tag name. Attribs is an array of
// alternating upper-case attribute names, and attribute values. The
// attribs array is reused... | continuationMaker | 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 parseCPS(h, parts, initial, state, param) {
try {
if (h.startDoc && initial == 0) { h.startDoc(param); }
var m, p, tagName;
for (var pos = initial, end = parts.length; pos < end;) {
var current = parts[pos++];
var next = parts[pos];
switch (current) {
case ... | Given a SAX-like event handler, produce a function that feeds those
events and a parameter to the event handler.
The event handler has the form:{@code
{
// Name is an upper-case HTML tag name. Attribs is an array of
// alternating upper-case attribute names, and attribute values. The
// attribs array is reused... | parseCPS | 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 htmlSplit(str) {
// can't hoist this out of the function because of the re.exec loop.
var re = /(<\/|<\!--|<[!?]|[&<>])/g;
str += '';
if (splitWillCapture) {
return str.split(re);
} else {
var parts = [];
var lastPos = 0;
var m;
while ((m = re.exec(str)) !== nu... | Given a SAX-like event handler, produce a function that feeds those
events and a parameter to the event handler.
The event handler has the form:{@code
{
// Name is an upper-case HTML tag name. Attribs is an array of
// alternating upper-case attribute names, and attribute values. The
// attribs array is reused... | htmlSplit | 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 parseEndTag(parts, pos, h, param, continuationMarker, state) {
var tag = parseTagAndAttrs(parts, pos);
// drop unclosed tags
if (!tag) { return parts.length; }
if (h.endTag) {
h.endTag(tag.name, param, continuationMarker,
continuationMaker(h, parts, pos, state, param));
}
... | Given a SAX-like event handler, produce a function that feeds those
events and a parameter to the event handler.
The event handler has the form:{@code
{
// Name is an upper-case HTML tag name. Attribs is an array of
// alternating upper-case attribute names, and attribute values. The
// attribs array is reused... | parseEndTag | 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 parseStartTag(parts, pos, h, param, continuationMarker, state) {
var tag = parseTagAndAttrs(parts, pos);
// drop unclosed tags
if (!tag) { return parts.length; }
if (h.startTag) {
h.startTag(tag.name, tag.attrs, param, continuationMarker,
continuationMaker(h, parts, tag.next, stat... | Given a SAX-like event handler, produce a function that feeds those
events and a parameter to the event handler.
The event handler has the form:{@code
{
// Name is an upper-case HTML tag name. Attribs is an array of
// alternating upper-case attribute names, and attribute values. The
// attribs array is reused... | parseStartTag | 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 parseText(parts, tag, h, param, continuationMarker, state) {
var end = parts.length;
if (!endTagRe.hasOwnProperty(tag.name)) {
endTagRe[tag.name] = new RegExp('^' + tag.name + '(?:[\\s\\/]|$)', 'i');
}
var re = endTagRe[tag.name];
var first = tag.next;
var p = tag.next + 1;
fo... | Given a SAX-like event handler, produce a function that feeds those
events and a parameter to the event handler.
The event handler has the form:{@code
{
// Name is an upper-case HTML tag name. Attribs is an array of
// alternating upper-case attribute names, and attribute values. The
// attribs array is reused... | parseText | 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 parseTagAndAttrs(parts, pos) {
var m = /^([-\w:]+)/.exec(parts[pos]);
var tag = {};
tag.name = m[1].toLowerCase();
tag.eflags = html4.ELEMENTS[tag.name];
var buf = parts[pos].substr(m[0].length);
// Find the next '>'. We optimistically assume this '>' is not in a
// quoted context,... | Given a SAX-like event handler, produce a function that feeds those
events and a parameter to the event handler.
The event handler has the form:{@code
{
// Name is an upper-case HTML tag name. Attribs is an array of
// alternating upper-case attribute names, and attribute values. The
// attribs array is reused... | parseTagAndAttrs | 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 decodeValue(v) {
var q = v.charCodeAt(0);
if (q === 0x22 || q === 0x27) { // " or '
v = v.substr(1, v.length - 2);
}
return unescapeEntities(stripNULs(v));
} | Given a SAX-like event handler, produce a function that feeds those
events and a parameter to the event handler.
The event handler has the form:{@code
{
// Name is an upper-case HTML tag name. Attribs is an array of
// alternating upper-case attribute names, and attribute values. The
// attribs array is reused... | decodeValue | 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 makeHtmlSanitizer(tagPolicy) {
var stack;
var ignoring;
var emit = function (text, out) {
if (!ignoring) { out.push(text); }
};
return makeSaxParser({
'startDoc': function(_) {
stack = [];
ignoring = false;
},
'startTag': function(tagNameOrig, attribs... | Returns a function that strips unsafe tags and attributes from html.
@param {function(string, Array.<string>): ?Array.<string>} tagPolicy
A function that takes (tagName, attribs[]), where tagName is a key in
html4.ELEMENTS and attribs is an array of alternating attribute names
and values. It should return ... | makeHtmlSanitizer | 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 |
emit = function (text, out) {
if (!ignoring) { out.push(text); }
} | Returns a function that strips unsafe tags and attributes from html.
@param {function(string, Array.<string>): ?Array.<string>} tagPolicy
A function that takes (tagName, attribs[]), where tagName is a key in
html4.ELEMENTS and attribs is an array of alternating attribute names
and values. It should return ... | emit | 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 safeUri(uri, effect, ltype, hints, naiveUriRewriter) {
if (!naiveUriRewriter) { return null; }
try {
var parsed = URI.parse('' + uri);
if (parsed) {
if (!parsed.hasScheme() ||
ALLOWED_URI_SCHEMES.test(parsed.getScheme())) {
var safe = naiveUriRewriter(parsed, e... | Returns a function that strips unsafe tags and attributes from html.
@param {function(string, Array.<string>): ?Array.<string>} tagPolicy
A function that takes (tagName, attribs[]), where tagName is a key in
html4.ELEMENTS and attribs is an array of alternating attribute names
and values. It should return ... | safeUri | 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 log(logger, tagName, attribName, oldValue, newValue) {
if (!attribName) {
logger(tagName + " removed", {
change: "removed",
tagName: tagName
});
}
if (oldValue !== newValue) {
var changed = "changed";
if (oldValue && !newValue) {
changed = "removed";
... | Returns a function that strips unsafe tags and attributes from html.
@param {function(string, Array.<string>): ?Array.<string>} tagPolicy
A function that takes (tagName, attribs[]), where tagName is a key in
html4.ELEMENTS and attribs is an array of alternating attribute names
and values. It should return ... | log | 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 lookupAttribute(map, tagName, attribName) {
var attribKey;
attribKey = tagName + '::' + attribName;
if (map.hasOwnProperty(attribKey)) {
return map[attribKey];
}
attribKey = '*::' + attribName;
if (map.hasOwnProperty(attribKey)) {
return map[attribKey];
}
return void... | Returns a function that strips unsafe tags and attributes from html.
@param {function(string, Array.<string>): ?Array.<string>} tagPolicy
A function that takes (tagName, attribs[]), where tagName is a key in
html4.ELEMENTS and attribs is an array of alternating attribute names
and values. It should return ... | lookupAttribute | 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 getAttributeType(tagName, attribName) {
return lookupAttribute(html4.ATTRIBS, tagName, attribName);
} | Returns a function that strips unsafe tags and attributes from html.
@param {function(string, Array.<string>): ?Array.<string>} tagPolicy
A function that takes (tagName, attribs[]), where tagName is a key in
html4.ELEMENTS and attribs is an array of alternating attribute names
and values. It should return ... | getAttributeType | 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 getLoaderType(tagName, attribName) {
return lookupAttribute(html4.LOADERTYPES, tagName, attribName);
} | Returns a function that strips unsafe tags and attributes from html.
@param {function(string, Array.<string>): ?Array.<string>} tagPolicy
A function that takes (tagName, attribs[]), where tagName is a key in
html4.ELEMENTS and attribs is an array of alternating attribute names
and values. It should return ... | getLoaderType | 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 getUriEffect(tagName, attribName) {
return lookupAttribute(html4.URIEFFECTS, tagName, attribName);
} | Returns a function that strips unsafe tags and attributes from html.
@param {function(string, Array.<string>): ?Array.<string>} tagPolicy
A function that takes (tagName, attribs[]), where tagName is a key in
html4.ELEMENTS and attribs is an array of alternating attribute names
and values. It should return ... | getUriEffect | 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 sanitizeWithPolicy(inputHtml, tagPolicy) {
var outputArray = [];
makeHtmlSanitizer(tagPolicy)(inputHtml, outputArray);
return outputArray.join('');
} | Sanitizes HTML tags and attributes according to a given policy.
@param {string} inputHtml The HTML to sanitize.
@param {function(string, Array.<?string>)} tagPolicy A function that
decides which tags to accept and sanitizes their attributes (see
makeHtmlSanitizer above for details).
@return {string} The sanitiz... | sanitizeWithPolicy | 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 sanitize(inputHtml,
opt_naiveUriRewriter, opt_nmTokenPolicy, opt_logger) {
var tagPolicy = makeTagPolicy(
opt_naiveUriRewriter, opt_nmTokenPolicy, opt_logger);
return sanitizeWithPolicy(inputHtml, tagPolicy);
} | Strips unsafe tags and attributes from HTML.
@param {string} inputHtml The HTML to sanitize.
@param {?function(?string): ?string} opt_naiveUriRewriter A transform to
apply to URI attributes. If not given, URI attributes are deleted.
@param {function(?string): ?string} opt_nmTokenPolicy A transform to apply
to ... | sanitize | 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 |
next = function() {
var script = document.createElement('script');
script.src = prefix + cdb.files[c];
document.body.appendChild(script);
++c;
if(c == cdb.files.length) {
if(ready) {
script.onload = ready;
}
... | load all the javascript files. For testing, do not use in production | next | 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 |
superMethod = function(method, options) {
var result = null;
if (this.parent != null) {
var currentParent = this.parent;
// we need to change the parent of "this", because
// since we are going to call the elder (super) method
// in the context of "this", if the super... | Adds .elder method to call for the same method of the parent class
usage:
insanceOfClass.elder('name_of_the_method'); | superMethod | 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 |
extend = function(protoProps, classProps) {
var child = backboneExtend.call(this, protoProps, classProps);
child.prototype.parent = this.prototype;
child.prototype.elder = function(method) {
var options = Array.prototype.slice.call(arguments, 1);
if (method) {
option... | Adds .elder method to call for the same method of the parent class
usage:
insanceOfClass.elder('name_of_the_method'); | extend | 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 |
decorate = function(objectToDecorate) {
objectToDecorate.extend = extend;
objectToDecorate.prototype.elder = function() {};
objectToDecorate.prototype.parent = null;
} | Adds .elder method to call for the same method of the parent class
usage:
insanceOfClass.elder('name_of_the_method'); | decorate | 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 Metric(name) {
this.t0 = null;
this.name = name;
this.count = 0;
} | contains all error for the application | Metric | 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 detectIE() {
var msie = ua.indexOf('MSIE ');
var trident = ua.indexOf('Trident/');
if (msie > -1 || trident > -1) return true;
return false;
} | search for views in a view and check if they are added as subviews | detectIE | 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 getIEVersion(){
if (!document.compatMode) return 5
if (!window.XMLHttpRequest) return 6
if (!document.querySelector) return 7;
if (!document.addEventListener) return 8;
if (!window.atob) return 9;
if (document.all) return 10;
else return 11;
} | search for views in a view and check if they are added as subviews | getIEVersion | 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 componentToHex(c) {
var hex = c.toString(16);
return hex.length == 1 ? "0" + hex : hex;
} | View to know which is the map zoom.
Usage:
var zoomInfo = new cdb.geo.ui.ZoomInfo({ model: map });
mapWrapper.$el.append(zoomInfo.render().$el); | componentToHex | 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 SubLayerBase(_parent, position) {
this._parent = _parent;
this._position = position;
this._added = true;
} | FullScreen widget:
var widget = new cdb.ui.common.FullScreen({
doc: ".container", // optional; if not specified, we do the fullscreen of the whole window
template: this.getTemplate("table/views/fullscreen")
}); | SubLayerBase | 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 |
_bindSignal = function(signal, signalAlias) {
signalAlias = signalAlias || signal;
self._parent.on(signal, function() {
var args = Array.prototype.slice.call(arguments);
if (parseInt(args[args.length - 1], 10) == self._position) {
self.trigger.apply(self, [signalAlias].concat(args... | FullScreen widget:
var widget = new cdb.ui.common.FullScreen({
doc: ".container", // optional; if not specified, we do the fullscreen of the whole window
template: this.getTemplate("table/views/fullscreen")
}); | _bindSignal | 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 CartoDBSubLayer(layer, position) {
SubLayerBase.call(this, layer, position);
this._bindInteraction();
var layer = this._parent.getLayer(this._position);
// TODO: Test this
if (Backbone.Model && layer) {
this.infowindow = new Backbone.Model(layer.infowindow);
this.infowindow.bind('change', fu... | FullScreen widget:
var widget = new cdb.ui.common.FullScreen({
doc: ".container", // optional; if not specified, we do the fullscreen of the whole window
template: this.getTemplate("table/views/fullscreen")
}); | CartoDBSubLayer | 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 HttpSubLayer(layer, position) {
SubLayerBase.call(this, layer, position);
} | FullScreen widget:
var widget = new cdb.ui.common.FullScreen({
doc: ".container", // optional; if not specified, we do the fullscreen of the whole window
template: this.getTemplate("table/views/fullscreen")
}); | HttpSubLayer | 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 MapProperties(mapProperties) {
this.mapProperties = mapProperties;
} | Wrapper for map properties returned by the tiler | MapProperties | 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 MapBase(options) {
var self = this;
this.options = _.defaults(options, {
ajax: window.$ ? window.$.ajax : reqwest.compat,
pngParams: ['map_key', 'api_key', 'cache_policy', 'updated_at'],
gridParams: ['map_key', 'api_key', 'cache_policy', 'updated_at'],
cors: cdb.core.util.isCORSSupported()... | Returns the index of a layer of a given type, as the tiler kwows it.
@param {string|array} types - Type or types of layers | MapBase | 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 invokeStackedCallbacks(data, err) {
var fn;
while(fn = self._createMapCallbacks.pop()) {
fn(data, err);
}
} | Returns the index of a layer of a given type, as the tiler kwows it.
@param {string|array} types - Type or types of layers | invokeStackedCallbacks | 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 LayerDefinition(layerDefinition, options) {
MapBase.call(this, options);
this.endPoint = MapBase.BASE_URL;
this.setLayerDefinition(layerDefinition, { silent: true });
} | return the layer number by index taking into
account the hidden layers. | LayerDefinition | 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 NamedMap(named_map, options) {
MapBase.call(this, options);
this.options.pngParams.push('auth_token')
this.options.gridParams.push('auth_token')
this.setLayerDefinition(named_map, options)
this.stat_tag = named_map.stat_tag;
} | adds a new sublayer to the layer with the sql and cartocss params | NamedMap | 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 CartoDBLayerCommon() {
this.visible = true;
} | adds a new sublayer to the layer with the sql and cartocss params | CartoDBLayerCommon | 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 |
LeafLetLayerView = function(layerModel, leafletLayer, leafletMap) {
this.leafletLayer = leafletLayer;
this.leafletMap = leafletMap;
this.model = layerModel;
this.setModel(layerModel);
this.type = layerModel.get('type') || layerModel.get('kind');
this.type = this.type.toLowerCase();
} | base layer for all leaflet layers | LeafLetLayerView | 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 |
stamenSubstitute = function stamenSubstitute(type) {
return {
url: 'http://{s}.basemaps.cartocdn.com/'+ type +'_all/{z}/{x}/{y}.png',
subdomains: 'abcd',
minZoom: 0,
maxZoom: 18,
attribution: 'Map designs by <a href="http://stamen.com/">Stamen</a>. Data by <a href="http://openstreetmap... | this is a dummy layer class that modifies the leaflet DOM element background
instead of creating a layer with div | stamenSubstitute | 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 |
finish = function(e) {
var s = this.tileStats && this.tileStats[e.tile.src];
s && s.end();
} | this is a dummy layer class that modifies the leaflet DOM element background
instead of creating a layer with div | finish | 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 layerView(base) {
var layerViewClass = base.extend({
includes: [
cdb.geo.LeafLetLayerView.prototype,
Backbone.Events
],
initialize: function(layerModel, leafletMap) {
var self = this;
var hovers = [];
var opts = _.clone(layerModel.attributes);
opts.map = l... | Creates an instance of a Leaflet Point | layerView | 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 |
GMapsLayerView = function(layerModel, gmapsLayer, gmapsMap) {
this.gmapsLayer = gmapsLayer;
this.map = this.gmapsMap = gmapsMap;
this.model = layerModel;
this.model.bind('change', this._update, this);
this.type = layerModel.get('type') || layerModel.get('kind');
this.type = this.type.toLowerCase();
} | base layer for all google maps | GMapsLayerView | 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 |
GMapsBaseLayerView = function(layerModel, gmapsMap) {
cdb.geo.GMapsLayerView.call(this, layerModel, null, gmapsMap);
} | remove layer from the map and unbind events | GMapsBaseLayerView | 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 |
GMapsPlainLayerView = function(layerModel, gmapsMap) {
this.color = layerModel.get('color')
cdb.geo.GMapsLayerView.call(this, layerModel, this, gmapsMap);
} | remove layer from the map and unbind events | GMapsPlainLayerView | 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 |
GMapsTiledLayerView = function(layerModel, gmapsMap) {
cdb.geo.GMapsLayerView.call(this, layerModel, this, gmapsMap);
this.tileSize = new google.maps.Size(256, 256);
this.opacity = 1.0;
this.isPng = true;
this.maxZoom = 22;
this.minZoom = 0;
this.name= 'cartodb tiled layer';
google.maps.ImageMapType.cal... | remove layer from the map and unbind events | GMapsTiledLayerView | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.