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 nicknameValid(nick) {
// Allow letters, numbers, and underscores
return /^[a-zA-Z0-9_]{1,24}$/.test(nick)
} | Sends data to all clients
channel: if not null, restricts broadcast to clients in the channel | nicknameValid | javascript | AndrewBelt/hack.chat | server.js | https://github.com/AndrewBelt/hack.chat/blob/master/server.js | MIT |
function getAddress(client) {
if (config.x_forwarded_for) {
// The remoteAddress is 127.0.0.1 since if all connections
// originate from a proxy (e.g. nginx).
// You must write the x-forwarded-for header to determine the
// client's real IP address.
return client.upgradeReq.headers['x-forwarded-for']
}
else {
return client.upgradeReq.connection.remoteAddress
}
} | Sends data to all clients
channel: if not null, restricts broadcast to clients in the channel | getAddress | javascript | AndrewBelt/hack.chat | server.js | https://github.com/AndrewBelt/hack.chat/blob/master/server.js | MIT |
function hash(password) {
var sha = crypto.createHash('sha256')
sha.update(password + config.salt)
return sha.digest('base64').substr(0, 6)
} | Sends data to all clients
channel: if not null, restricts broadcast to clients in the channel | hash | javascript | AndrewBelt/hack.chat | server.js | https://github.com/AndrewBelt/hack.chat/blob/master/server.js | MIT |
function isAdmin(client) {
return client.nick == config.admin
} | Sends data to all clients
channel: if not null, restricts broadcast to clients in the channel | isAdmin | javascript | AndrewBelt/hack.chat | server.js | https://github.com/AndrewBelt/hack.chat/blob/master/server.js | MIT |
function isMod(client) {
if (isAdmin(client)) return true
if (config.mods) {
if (client.trip && config.mods.indexOf(client.trip) > -1) {
return true
}
}
return false
} | Sends data to all clients
channel: if not null, restricts broadcast to clients in the channel | isMod | javascript | AndrewBelt/hack.chat | server.js | https://github.com/AndrewBelt/hack.chat/blob/master/server.js | MIT |
render = function(expression, baseNode, options) {
utils.clearNode(baseNode);
var settings = new Settings(options);
var tree = parseTree(expression, settings);
var node = buildTree(tree, expression, settings).toNode();
baseNode.appendChild(node);
} | Parse and build an expression, and place that expression in the DOM node
given. | render | javascript | AndrewBelt/hack.chat | client/katex/katex.js | https://github.com/AndrewBelt/hack.chat/blob/master/client/katex/katex.js | MIT |
renderToString = function(expression, options) {
var settings = new Settings(options);
var tree = parseTree(expression, settings);
return buildTree(tree, expression, settings).toMarkup();
} | Parse and build an expression, and return the markup for that. | renderToString | javascript | AndrewBelt/hack.chat | client/katex/katex.js | https://github.com/AndrewBelt/hack.chat/blob/master/client/katex/katex.js | MIT |
generateParseTree = function(expression, options) {
var settings = new Settings(options);
return parseTree(expression, settings);
} | Parse an expression and return the parse tree. | generateParseTree | javascript | AndrewBelt/hack.chat | client/katex/katex.js | https://github.com/AndrewBelt/hack.chat/blob/master/client/katex/katex.js | MIT |
function Lexer(input) {
this._input = input;
} | The Lexer class handles tokenizing the input in various ways. Since our
parser expects us to be able to backtrack, the lexer allows lexing from any
given starting point.
Its main exposed function is the `lex` function, which takes a position to
lex from and a type of token to lex. It defers to the appropriate `_innerLex`
function.
The various `_innerLex` functions perform the actual lexing of different
kinds. | Lexer | javascript | AndrewBelt/hack.chat | client/katex/katex.js | https://github.com/AndrewBelt/hack.chat/blob/master/client/katex/katex.js | MIT |
function Token(text, data, position) {
this.text = text;
this.data = data;
this.position = position;
} | The Lexer class handles tokenizing the input in various ways. Since our
parser expects us to be able to backtrack, the lexer allows lexing from any
given starting point.
Its main exposed function is the `lex` function, which takes a position to
lex from and a type of token to lex. It defers to the appropriate `_innerLex`
function.
The various `_innerLex` functions perform the actual lexing of different
kinds. | Token | javascript | AndrewBelt/hack.chat | client/katex/katex.js | https://github.com/AndrewBelt/hack.chat/blob/master/client/katex/katex.js | MIT |
function Options(data) {
this.style = data.style;
this.color = data.color;
this.size = data.size;
this.phantom = data.phantom;
this.font = data.font;
if (data.parentStyle === undefined) {
this.parentStyle = data.style;
} else {
this.parentStyle = data.parentStyle;
}
if (data.parentSize === undefined) {
this.parentSize = data.size;
} else {
this.parentSize = data.parentSize;
}
} | This is the main options class. It contains the style, size, color, and font
of the current parse level. It also contains the style and size of the parent
parse level, so size changes can be handled efficiently.
Each of the `.with*` and `.reset` functions passes its current style and size
as the parentStyle and parentSize of the new options class, so parent
handling is taken care of automatically. | Options | javascript | AndrewBelt/hack.chat | client/katex/katex.js | https://github.com/AndrewBelt/hack.chat/blob/master/client/katex/katex.js | MIT |
function ParseError(message, lexer, position) {
var error = "KaTeX parse error: " + message;
if (lexer !== undefined && position !== undefined) {
// If we have the input and a position, make the error a bit fancier
// Prepend some information
error += " at position " + position + ": ";
// Get the input
var input = lexer._input;
// Insert a combining underscore at the correct position
input = input.slice(0, position) + "\u0332" +
input.slice(position);
// Extract some context from the input and add it to the error
var begin = Math.max(0, position - 15);
var end = position + 15;
error += input.slice(begin, end);
}
// Some hackery to make ParseError a prototype of Error
// See http://stackoverflow.com/a/8460753
var self = new Error(error);
self.name = "ParseError";
self.__proto__ = ParseError.prototype;
self.position = position;
return self;
} | This is the ParseError class, which is the main error thrown by KaTeX
functions when something has gone wrong. This is used to distinguish internal
errors from errors in the expression that the user provided. | ParseError | javascript | AndrewBelt/hack.chat | client/katex/katex.js | https://github.com/AndrewBelt/hack.chat/blob/master/client/katex/katex.js | MIT |
function ParseFuncOrArgument(result, isFunction) {
this.result = result;
// Is this a function (i.e. is it something defined in functions.js)?
this.isFunction = isFunction;
} | An initial function (without its arguments), or an argument to a function.
The `result` argument should be a ParseResult. | ParseFuncOrArgument | javascript | AndrewBelt/hack.chat | client/katex/katex.js | https://github.com/AndrewBelt/hack.chat/blob/master/client/katex/katex.js | MIT |
function get(option, defaultValue) {
return option === undefined ? defaultValue : option;
} | Helper function for getting a default value if the value is undefined | get | javascript | AndrewBelt/hack.chat | client/katex/katex.js | https://github.com/AndrewBelt/hack.chat/blob/master/client/katex/katex.js | MIT |
function Settings(options) {
// allow null options
options = options || {};
this.displayMode = get(options.displayMode, false);
} | The main Settings object
The current options stored are:
- displayMode: Whether the expression should be typeset by default in
textstyle or displaystyle (default false) | Settings | javascript | AndrewBelt/hack.chat | client/katex/katex.js | https://github.com/AndrewBelt/hack.chat/blob/master/client/katex/katex.js | MIT |
function Style(id, size, multiplier, cramped) {
this.id = id;
this.size = size;
this.cramped = cramped;
this.sizeMultiplier = multiplier;
} | The main style class. Contains a unique id for the style, a size (which is
the same for cramped and uncramped version of a style), a cramped flag, and a
size multiplier, which gives the size difference between a style and
textstyle. | Style | javascript | AndrewBelt/hack.chat | client/katex/katex.js | https://github.com/AndrewBelt/hack.chat/blob/master/client/katex/katex.js | MIT |
makeSymbol = function(value, style, mode, color, classes) {
// Replace the value with its replaced value from symbol.js
if (symbols[mode][value] && symbols[mode][value].replace) {
value = symbols[mode][value].replace;
}
var metrics = fontMetrics.getCharacterMetrics(value, style);
var symbolNode;
if (metrics) {
symbolNode = new domTree.symbolNode(
value, metrics.height, metrics.depth, metrics.italic, metrics.skew,
classes);
} else {
// TODO(emily): Figure out a good way to only print this in development
typeof console !== "undefined" && console.warn(
"No character metrics for '" + value + "' in style '" +
style + "'");
symbolNode = new domTree.symbolNode(value, 0, 0, 0, 0, classes);
}
if (color) {
symbolNode.style.color = color;
}
return symbolNode;
} | Makes a symbolNode after translation via the list of symbols in symbols.js.
Correctly pulls out metrics for the character, and optionally takes a list of
classes to be attached to the node. | makeSymbol | javascript | AndrewBelt/hack.chat | client/katex/katex.js | https://github.com/AndrewBelt/hack.chat/blob/master/client/katex/katex.js | MIT |
mathsym = function(value, mode, color, classes) {
// Decide what font to render the symbol in by its entry in the symbols
// table.
if (symbols[mode][value].font === "main") {
return makeSymbol(value, "Main-Regular", mode, color, classes);
} else {
return makeSymbol(
value, "AMS-Regular", mode, color, classes.concat(["amsrm"]));
}
} | Makes a symbol in Main-Regular or AMS-Regular.
Used for rel, bin, open, close, inner, and punct. | mathsym | javascript | AndrewBelt/hack.chat | client/katex/katex.js | https://github.com/AndrewBelt/hack.chat/blob/master/client/katex/katex.js | MIT |
mathDefault = function(value, mode, color, classes, type) {
if (type === "mathord") {
return mathit(value, mode, color, classes);
} else if (type === "textord") {
return makeSymbol(
value, "Main-Regular", mode, color, classes.concat(["mathrm"]));
} else {
throw new Error("unexpected type: " + type + " in mathDefault");
}
} | Makes a symbol in the default font for mathords and textords. | mathDefault | javascript | AndrewBelt/hack.chat | client/katex/katex.js | https://github.com/AndrewBelt/hack.chat/blob/master/client/katex/katex.js | MIT |
mathit = function(value, mode, color, classes) {
if (/[0-9]/.test(value.charAt(0)) ||
utils.contains(["\u0131", "\u0237"], value) ||
utils.contains(greekCapitals, value)) {
return makeSymbol(
value, "Main-Italic", mode, color, classes.concat(["mainit"]));
} else {
return makeSymbol(
value, "Math-Italic", mode, color, classes.concat(["mathit"]));
}
} | Makes a symbol in the italic math font. | mathit | javascript | AndrewBelt/hack.chat | client/katex/katex.js | https://github.com/AndrewBelt/hack.chat/blob/master/client/katex/katex.js | MIT |
makeOrd = function(group, options, type) {
var mode = group.mode;
var value = group.value;
if (symbols[mode][value] && symbols[mode][value].replace) {
value = symbols[mode][value].replace;
}
var classes = ["mord"];
var color = options.getColor();
var font = options.font;
if (font) {
if (font === "mathit" || utils.contains(["\u0131", "\u0237"], value)) {
return mathit(value, mode, color, classes.concat(["mathit"]));
} else {
var fontName = fontMap[font].fontName;
if (fontMetrics.getCharacterMetrics(value, fontName)) {
return makeSymbol(value, fontName, mode, color, classes.concat([font]));
} else {
return mathDefault(value, mode, color, classes, type);
}
}
} else {
return mathDefault(value, mode, color, classes, type);
}
} | Makes either a mathord or textord in the correct font and color. | makeOrd | javascript | AndrewBelt/hack.chat | client/katex/katex.js | https://github.com/AndrewBelt/hack.chat/blob/master/client/katex/katex.js | MIT |
sizeElementFromChildren = function(elem) {
var height = 0;
var depth = 0;
var maxFontSize = 0;
if (elem.children) {
for (var i = 0; i < elem.children.length; i++) {
if (elem.children[i].height > height) {
height = elem.children[i].height;
}
if (elem.children[i].depth > depth) {
depth = elem.children[i].depth;
}
if (elem.children[i].maxFontSize > maxFontSize) {
maxFontSize = elem.children[i].maxFontSize;
}
}
}
elem.height = height;
elem.depth = depth;
elem.maxFontSize = maxFontSize;
} | Calculate the height, depth, and maxFontSize of an element based on its
children. | sizeElementFromChildren | javascript | AndrewBelt/hack.chat | client/katex/katex.js | https://github.com/AndrewBelt/hack.chat/blob/master/client/katex/katex.js | MIT |
makeSpan = function(classes, children, color) {
var span = new domTree.span(classes, children);
sizeElementFromChildren(span);
if (color) {
span.style.color = color;
}
return span;
} | Makes a span with the given list of classes, list of children, and color. | makeSpan | javascript | AndrewBelt/hack.chat | client/katex/katex.js | https://github.com/AndrewBelt/hack.chat/blob/master/client/katex/katex.js | MIT |
makeFragment = function(children) {
var fragment = new domTree.documentFragment(children);
sizeElementFromChildren(fragment);
return fragment;
} | Makes a document fragment with the given list of children. | makeFragment | javascript | AndrewBelt/hack.chat | client/katex/katex.js | https://github.com/AndrewBelt/hack.chat/blob/master/client/katex/katex.js | MIT |
makeFontSizer = function(options, fontSize) {
var fontSizeInner = makeSpan([], [new domTree.symbolNode("\u200b")]);
fontSizeInner.style.fontSize = (fontSize / options.style.sizeMultiplier) + "em";
var fontSizer = makeSpan(
["fontsize-ensurer", "reset-" + options.size, "size5"],
[fontSizeInner]);
return fontSizer;
} | Makes an element placed in each of the vlist elements to ensure that each
element has the same max font size. To do this, we create a zero-width space
with the correct font size. | makeFontSizer | javascript | AndrewBelt/hack.chat | client/katex/katex.js | https://github.com/AndrewBelt/hack.chat/blob/master/client/katex/katex.js | MIT |
makeVList = function(children, positionType, positionData, options) {
var depth;
var currPos;
var i;
if (positionType === "individualShift") {
var oldChildren = children;
children = [oldChildren[0]];
// Add in kerns to the list of children to get each element to be
// shifted to the correct specified shift
depth = -oldChildren[0].shift - oldChildren[0].elem.depth;
currPos = depth;
for (i = 1; i < oldChildren.length; i++) {
var diff = -oldChildren[i].shift - currPos -
oldChildren[i].elem.depth;
var size = diff -
(oldChildren[i - 1].elem.height +
oldChildren[i - 1].elem.depth);
currPos = currPos + diff;
children.push({type: "kern", size: size});
children.push(oldChildren[i]);
}
} else if (positionType === "top") {
// We always start at the bottom, so calculate the bottom by adding up
// all the sizes
var bottom = positionData;
for (i = 0; i < children.length; i++) {
if (children[i].type === "kern") {
bottom -= children[i].size;
} else {
bottom -= children[i].elem.height + children[i].elem.depth;
}
}
depth = bottom;
} else if (positionType === "bottom") {
depth = -positionData;
} else if (positionType === "shift") {
depth = -children[0].elem.depth - positionData;
} else if (positionType === "firstBaseline") {
depth = -children[0].elem.depth;
} else {
depth = 0;
}
// Make the fontSizer
var maxFontSize = 0;
for (i = 0; i < children.length; i++) {
if (children[i].type === "elem") {
maxFontSize = Math.max(maxFontSize, children[i].elem.maxFontSize);
}
}
var fontSizer = makeFontSizer(options, maxFontSize);
// Create a new list of actual children at the correct offsets
var realChildren = [];
currPos = depth;
for (i = 0; i < children.length; i++) {
if (children[i].type === "kern") {
currPos += children[i].size;
} else {
var child = children[i].elem;
var shift = -child.depth - currPos;
currPos += child.height + child.depth;
var childWrap = makeSpan([], [fontSizer, child]);
childWrap.height -= shift;
childWrap.depth += shift;
childWrap.style.top = shift + "em";
realChildren.push(childWrap);
}
}
// Add in an element at the end with no offset to fix the calculation of
// baselines in some browsers (namely IE, sometimes safari)
var baselineFix = makeSpan(
["baseline-fix"], [fontSizer, new domTree.symbolNode("\u200b")]);
realChildren.push(baselineFix);
var vlist = makeSpan(["vlist"], realChildren);
// Fix the final height and depth, in case there were kerns at the ends
// since the makeSpan calculation won't take that in to account.
vlist.height = Math.max(currPos, vlist.height);
vlist.depth = Math.max(-depth, vlist.depth);
return vlist;
} | Makes a vertical list by stacking elements and kerns on top of each other.
Allows for many different ways of specifying the positioning method.
Arguments:
- children: A list of child or kern nodes to be stacked on top of each other
(i.e. the first element will be at the bottom, and the last at
the top). Element nodes are specified as
{type: "elem", elem: node}
while kern nodes are specified as
{type: "kern", size: size}
- positionType: The method by which the vlist should be positioned. Valid
values are:
- "individualShift": The children list only contains elem
nodes, and each node contains an extra
"shift" value of how much it should be
shifted (note that shifting is always
moving downwards). positionData is
ignored.
- "top": The positionData specifies the topmost point of
the vlist (note this is expected to be a height,
so positive values move up)
- "bottom": The positionData specifies the bottommost point
of the vlist (note this is expected to be a
depth, so positive values move down
- "shift": The vlist will be positioned such that its
baseline is positionData away from the baseline
of the first child. Positive values move
downwards.
- "firstBaseline": The vlist will be positioned such that
its baseline is aligned with the
baseline of the first child.
positionData is ignored. (this is
equivalent to "shift" with
positionData=0)
- positionData: Data used in different ways depending on positionType
- options: An Options object | makeVList | javascript | AndrewBelt/hack.chat | client/katex/katex.js | https://github.com/AndrewBelt/hack.chat/blob/master/client/katex/katex.js | MIT |
buildExpression = function(expression, options, prev) {
var groups = [];
for (var i = 0; i < expression.length; i++) {
var group = expression[i];
groups.push(buildGroup(group, options, prev));
prev = group;
}
return groups;
} | Take a list of nodes, build them in order, and return a list of the built
nodes. This function handles the `prev` node correctly, and passes the
previous element from the list as the prev of the next element. | buildExpression | javascript | AndrewBelt/hack.chat | client/katex/katex.js | https://github.com/AndrewBelt/hack.chat/blob/master/client/katex/katex.js | MIT |
getTypeOfGroup = function(group) {
if (group == null) {
// Like when typesetting $^3$
return groupToType.mathord;
} else if (group.type === "supsub") {
return getTypeOfGroup(group.value.base);
} else if (group.type === "llap" || group.type === "rlap") {
return getTypeOfGroup(group.value);
} else if (group.type === "color") {
return getTypeOfGroup(group.value.value);
} else if (group.type === "sizing") {
return getTypeOfGroup(group.value.value);
} else if (group.type === "styling") {
return getTypeOfGroup(group.value.value);
} else if (group.type === "delimsizing") {
return groupToType[group.value.delimType];
} else {
return groupToType[group.type];
}
} | Gets the final math type of an expression, given its group type. This type is
used to determine spacing between elements, and affects bin elements by
causing them to change depending on what types are around them. This type
must be attached to the outermost node of an element as a CSS class so that
spacing with its surrounding elements works correctly.
Some elements can be mapped one-to-one from group type to math type, and
those are listed in the `groupToType` table.
Others (usually elements that wrap around other elements) often have
recursive definitions, and thus call `getTypeOfGroup` on their inner
elements. | getTypeOfGroup | javascript | AndrewBelt/hack.chat | client/katex/katex.js | https://github.com/AndrewBelt/hack.chat/blob/master/client/katex/katex.js | MIT |
shouldHandleSupSub = function(group, options) {
if (!group) {
return false;
} else if (group.type === "op") {
// Operators handle supsubs differently when they have limits
// (e.g. `\displaystyle\sum_2^3`)
return group.value.limits && options.style.size === Style.DISPLAY.size;
} else if (group.type === "accent") {
return isCharacterBox(group.value.base);
} else {
return null;
}
} | Sometimes, groups perform special rules when they have superscripts or
subscripts attached to them. This function lets the `supsub` group know that
its inner element should handle the superscripts and subscripts instead of
handling them itself. | shouldHandleSupSub | javascript | AndrewBelt/hack.chat | client/katex/katex.js | https://github.com/AndrewBelt/hack.chat/blob/master/client/katex/katex.js | MIT |
getBaseElem = function(group) {
if (!group) {
return false;
} else if (group.type === "ordgroup") {
if (group.value.length === 1) {
return getBaseElem(group.value[0]);
} else {
return group;
}
} else if (group.type === "color") {
if (group.value.value.length === 1) {
return getBaseElem(group.value.value[0]);
} else {
return group;
}
} else {
return group;
}
} | Sometimes we want to pull out the innermost element of a group. In most
cases, this will just be the group itself, but when ordgroups and colors have
a single element, we want to pull that out. | getBaseElem | javascript | AndrewBelt/hack.chat | client/katex/katex.js | https://github.com/AndrewBelt/hack.chat/blob/master/client/katex/katex.js | MIT |
isCharacterBox = function(group) {
var baseElem = getBaseElem(group);
// These are all they types of groups which hold single characters
return baseElem.type === "mathord" ||
baseElem.type === "textord" ||
baseElem.type === "bin" ||
baseElem.type === "rel" ||
baseElem.type === "inner" ||
baseElem.type === "open" ||
baseElem.type === "close" ||
baseElem.type === "punct";
} | TeXbook algorithms often reference "character boxes", which are simply groups
with a single character in them. To decide if something is a character box,
we find its innermost group, and see if it is a single character. | isCharacterBox | javascript | AndrewBelt/hack.chat | client/katex/katex.js | https://github.com/AndrewBelt/hack.chat/blob/master/client/katex/katex.js | MIT |
makeNullDelimiter = function(options) {
return makeSpan([
"sizing", "reset-" + options.size, "size5",
options.style.reset(), Style.TEXT.cls(),
"nulldelimiter"
]);
} | TeXbook algorithms often reference "character boxes", which are simply groups
with a single character in them. To decide if something is a character box,
we find its innermost group, and see if it is a single character. | makeNullDelimiter | javascript | AndrewBelt/hack.chat | client/katex/katex.js | https://github.com/AndrewBelt/hack.chat/blob/master/client/katex/katex.js | MIT |
buildGroup = function(group, options, prev) {
if (!group) {
return makeSpan();
}
if (groupTypes[group.type]) {
// Call the groupTypes function
var groupNode = groupTypes[group.type](group, options, prev);
var multiplier;
// If the style changed between the parent and the current group,
// account for the size difference
if (options.style !== options.parentStyle) {
multiplier = options.style.sizeMultiplier /
options.parentStyle.sizeMultiplier;
groupNode.height *= multiplier;
groupNode.depth *= multiplier;
}
// If the size changed between the parent and the current group, account
// for that size difference.
if (options.size !== options.parentSize) {
multiplier = buildCommon.sizingMultiplier[options.size] /
buildCommon.sizingMultiplier[options.parentSize];
groupNode.height *= multiplier;
groupNode.depth *= multiplier;
}
return groupNode;
} else {
throw new ParseError(
"Got group of unknown type: '" + group.type + "'");
}
} | buildGroup is the function that takes a group and calls the correct groupType
function for it. It also handles the interaction of size and style changes
between parents and children. | buildGroup | javascript | AndrewBelt/hack.chat | client/katex/katex.js | https://github.com/AndrewBelt/hack.chat/blob/master/client/katex/katex.js | MIT |
buildHTML = function(tree, settings) {
// buildExpression is destructive, so we need to make a clone
// of the incoming tree so that it isn't accidentally changed
tree = JSON.parse(JSON.stringify(tree));
var startStyle = Style.TEXT;
if (settings.displayMode) {
startStyle = Style.DISPLAY;
}
// Setup the default options
var options = new Options({
style: startStyle,
size: "size5"
});
// Build the expression contained in the tree
var expression = buildExpression(tree, options);
var body = makeSpan(["base", options.style.cls()], expression);
// Add struts, which ensure that the top of the HTML element falls at the
// height of the expression, and the bottom of the HTML element falls at the
// depth of the expression.
var topStrut = makeSpan(["strut"]);
var bottomStrut = makeSpan(["strut", "bottom"]);
topStrut.style.height = body.height + "em";
bottomStrut.style.height = (body.height + body.depth) + "em";
// We'd like to use `vertical-align: top` but in IE 9 this lowers the
// baseline of the box to the bottom of this strut (instead staying in the
// normal place) so we use an absolute value for vertical-align instead
bottomStrut.style.verticalAlign = -body.depth + "em";
// Wrap the struts and body together
var htmlNode = makeSpan(["katex-html"], [topStrut, bottomStrut, body]);
htmlNode.setAttribute("aria-hidden", "true");
return htmlNode;
} | Take an entire parse tree, and build it into an appropriate set of HTML
nodes. | buildHTML | javascript | AndrewBelt/hack.chat | client/katex/katex.js | https://github.com/AndrewBelt/hack.chat/blob/master/client/katex/katex.js | MIT |
makeText = function(text, mode) {
if (symbols[mode][text] && symbols[mode][text].replace) {
text = symbols[mode][text].replace;
}
return new mathMLTree.TextNode(text);
} | Takes a symbol and converts it into a MathML text node after performing
optional replacement from symbols.js. | makeText | javascript | AndrewBelt/hack.chat | client/katex/katex.js | https://github.com/AndrewBelt/hack.chat/blob/master/client/katex/katex.js | MIT |
getVariant = function(group, options) {
var font = options.font;
if (!font) {
return null;
}
var mode = group.mode;
if (font === "mathit") {
return "italic";
}
var value = group.value;
if (utils.contains(["\\imath", "\\jmath"], value)) {
return null;
}
if (symbols[mode][value] && symbols[mode][value].replace) {
value = symbols[mode][value].replace;
}
var fontName = fontMap[font].fontName;
if (fontMetrics.getCharacterMetrics(value, fontName)) {
return fontMap[options.font].variant;
}
return null;
} | Returns the math variant as a string or null if none is required. | getVariant | javascript | AndrewBelt/hack.chat | client/katex/katex.js | https://github.com/AndrewBelt/hack.chat/blob/master/client/katex/katex.js | MIT |
buildExpression = function(expression, options) {
var groups = [];
for (var i = 0; i < expression.length; i++) {
var group = expression[i];
groups.push(buildGroup(group, options));
}
return groups;
} | Takes a list of nodes, builds them, and returns a list of the generated
MathML nodes. A little simpler than the HTML version because we don't do any
previous-node handling. | buildExpression | javascript | AndrewBelt/hack.chat | client/katex/katex.js | https://github.com/AndrewBelt/hack.chat/blob/master/client/katex/katex.js | MIT |
buildGroup = function(group, options) {
if (!group) {
return new mathMLTree.MathNode("mrow");
}
if (groupTypes[group.type]) {
// Call the groupTypes function
return groupTypes[group.type](group, options);
} else {
throw new ParseError(
"Got group of unknown type: '" + group.type + "'");
}
} | Takes a group from the parser and calls the appropriate groupTypes function
on it to produce a MathML node. | buildGroup | javascript | AndrewBelt/hack.chat | client/katex/katex.js | https://github.com/AndrewBelt/hack.chat/blob/master/client/katex/katex.js | MIT |
buildMathML = function(tree, texExpression, settings) {
settings = settings || new Settings({});
var startStyle = Style.TEXT;
if (settings.displayMode) {
startStyle = Style.DISPLAY;
}
// Setup the default options
var options = new Options({
style: startStyle,
size: "size5"
});
var expression = buildExpression(tree, options);
// Wrap up the expression in an mrow so it is presented in the semantics
// tag correctly.
var wrapper = new mathMLTree.MathNode("mrow", expression);
// Build a TeX annotation of the source
var annotation = new mathMLTree.MathNode(
"annotation", [new mathMLTree.TextNode(texExpression)]);
annotation.setAttribute("encoding", "application/x-tex");
var semantics = new mathMLTree.MathNode(
"semantics", [wrapper, annotation]);
var math = new mathMLTree.MathNode("math", [semantics]);
// You can't style <math> nodes, so we wrap the node in a span.
return makeSpan(["katex-mathml"], [math]);
} | Takes a full parse tree and settings and builds a MathML representation of
it. In particular, we put the elements from building the parse tree into a
<semantics> tag so we can also include that TeX source as an annotation.
Note that we actually return a domTree element with a `<math>` inside it so
we can do appropriate styling. | buildMathML | javascript | AndrewBelt/hack.chat | client/katex/katex.js | https://github.com/AndrewBelt/hack.chat/blob/master/client/katex/katex.js | MIT |
buildTree = function(tree, expression, settings) {
// `buildHTML` sometimes messes with the parse tree (like turning bins ->
// ords), so we build the MathML version first.
var mathMLNode = buildMathML(tree, expression, settings);
var htmlNode = buildHTML(tree, settings);
var katexNode = makeSpan(["katex"], [
mathMLNode, htmlNode
]);
if (settings.displayMode) {
return makeSpan(["katex-display"], [katexNode]);
} else {
return katexNode;
}
} | Takes a full parse tree and settings and builds a MathML representation of
it. In particular, we put the elements from building the parse tree into a
<semantics> tag so we can also include that TeX source as an annotation.
Note that we actually return a domTree element with a `<math>` inside it so
we can do appropriate styling. | buildTree | javascript | AndrewBelt/hack.chat | client/katex/katex.js | https://github.com/AndrewBelt/hack.chat/blob/master/client/katex/katex.js | MIT |
getMetrics = function(symbol, font) {
if (symbols.math[symbol] && symbols.math[symbol].replace) {
return fontMetrics.getCharacterMetrics(
symbols.math[symbol].replace, font);
} else {
return fontMetrics.getCharacterMetrics(
symbol, font);
}
} | Get the metrics for a given symbol and font, after transformation (i.e.
after following replacement from symbols.js) | getMetrics | javascript | AndrewBelt/hack.chat | client/katex/katex.js | https://github.com/AndrewBelt/hack.chat/blob/master/client/katex/katex.js | MIT |
mathrmSize = function(value, size, mode) {
return buildCommon.makeSymbol(value, "Size" + size + "-Regular", mode);
} | Builds a symbol in the given font size (note size is an integer) | mathrmSize | javascript | AndrewBelt/hack.chat | client/katex/katex.js | https://github.com/AndrewBelt/hack.chat/blob/master/client/katex/katex.js | MIT |
createClass = function(classes) {
classes = classes.slice();
for (var i = classes.length - 1; i >= 0; i--) {
if (!classes[i]) {
classes.splice(i, 1);
}
}
return classes.join(" ");
} | Create an HTML className based on a list of classes. In addition to joining
with spaces, we also remove null or empty classes. | createClass | javascript | AndrewBelt/hack.chat | client/katex/katex.js | https://github.com/AndrewBelt/hack.chat/blob/master/client/katex/katex.js | MIT |
function span(classes, children, height, depth, maxFontSize, style) {
this.classes = classes || [];
this.children = children || [];
this.height = height || 0;
this.depth = depth || 0;
this.maxFontSize = maxFontSize || 0;
this.style = style || {};
this.attributes = {};
} | This node represents a span node, with a className, a list of children, and
an inline style. It also contains information about its height, depth, and
maxFontSize. | span | javascript | AndrewBelt/hack.chat | client/katex/katex.js | https://github.com/AndrewBelt/hack.chat/blob/master/client/katex/katex.js | MIT |
function documentFragment(children, height, depth, maxFontSize) {
this.children = children || [];
this.height = height || 0;
this.depth = depth || 0;
this.maxFontSize = maxFontSize || 0;
} | This node represents a document fragment, which contains elements, but when
placed into the DOM doesn't have any representation itself. Thus, it only
contains children and doesn't have any HTML properties. It also keeps track
of a height, depth, and maxFontSize. | documentFragment | javascript | AndrewBelt/hack.chat | client/katex/katex.js | https://github.com/AndrewBelt/hack.chat/blob/master/client/katex/katex.js | MIT |
function symbolNode(value, height, depth, italic, skew, classes, style) {
this.value = value || "";
this.height = height || 0;
this.depth = depth || 0;
this.italic = italic || 0;
this.skew = skew || 0;
this.classes = classes || [];
this.style = style || {};
this.maxFontSize = 0;
} | A symbol node contains information about a single symbol. It either renders
to a single text node, or a span with a single text node in it, depending on
whether it has CSS classes, styles, or needs italic correction. | symbolNode | javascript | AndrewBelt/hack.chat | client/katex/katex.js | https://github.com/AndrewBelt/hack.chat/blob/master/client/katex/katex.js | MIT |
getCharacterMetrics = function(character, style) {
return metricMap[style][character.charCodeAt(0)];
} | This function is a convience function for looking up information in the
metricMap table. It takes a character as a string, and a style | getCharacterMetrics | javascript | AndrewBelt/hack.chat | client/katex/katex.js | https://github.com/AndrewBelt/hack.chat/blob/master/client/katex/katex.js | MIT |
addFuncsWithData = function(funcs, data) {
for (var i = 0; i < funcs.length; i++) {
functions[funcs[i]] = data;
}
} | This function is a convience function for looking up information in the
metricMap table. It takes a character as a string, and a style | addFuncsWithData | javascript | AndrewBelt/hack.chat | client/katex/katex.js | https://github.com/AndrewBelt/hack.chat/blob/master/client/katex/katex.js | MIT |
function MathNode(type, children) {
this.type = type;
this.attributes = {};
this.children = children || [];
} | This node represents a general purpose MathML node of any type. The
constructor requires the type of node to create (for example, `"mo"` or
`"mspace"`, corresponding to `<mo>` and `<mspace>` tags). | MathNode | javascript | AndrewBelt/hack.chat | client/katex/katex.js | https://github.com/AndrewBelt/hack.chat/blob/master/client/katex/katex.js | MIT |
function TextNode(text) {
this.text = text;
} | This node represents a piece of text. | TextNode | javascript | AndrewBelt/hack.chat | client/katex/katex.js | https://github.com/AndrewBelt/hack.chat/blob/master/client/katex/katex.js | MIT |
function ParseNode(type, value, mode) {
this.type = type;
this.value = value;
this.mode = mode;
} | The resulting parse tree nodes of the parse tree. | ParseNode | javascript | AndrewBelt/hack.chat | client/katex/katex.js | https://github.com/AndrewBelt/hack.chat/blob/master/client/katex/katex.js | MIT |
function ParseResult(result, newPosition, peek) {
this.result = result;
this.position = newPosition;
} | A result and final position returned by the `.parse...` functions. | ParseResult | javascript | AndrewBelt/hack.chat | client/katex/katex.js | https://github.com/AndrewBelt/hack.chat/blob/master/client/katex/katex.js | MIT |
parseTree = function(toParse, settings) {
var parser = new Parser(toParse, settings);
return parser.parse();
} | Parses an expression using a Parser, then returns the parsed result. | parseTree | javascript | AndrewBelt/hack.chat | client/katex/katex.js | https://github.com/AndrewBelt/hack.chat/blob/master/client/katex/katex.js | MIT |
indexOf = function(list, elem) {
if (list == null) {
return -1;
}
if (nativeIndexOf && list.indexOf === nativeIndexOf) {
return list.indexOf(elem);
}
var i = 0, l = list.length;
for (; i < l; i++) {
if (list[i] === elem) {
return i;
}
}
return -1;
} | Provide an `indexOf` function which works in IE8, but defers to native if
possible. | indexOf | javascript | AndrewBelt/hack.chat | client/katex/katex.js | https://github.com/AndrewBelt/hack.chat/blob/master/client/katex/katex.js | MIT |
contains = function(list, elem) {
return indexOf(list, elem) !== -1;
} | Return whether an element is contained in a list | contains | javascript | AndrewBelt/hack.chat | client/katex/katex.js | https://github.com/AndrewBelt/hack.chat/blob/master/client/katex/katex.js | MIT |
deflt = function(setting, defaultIfUndefined) {
return setting === undefined ? defaultIfUndefined : setting;
} | Provide a default value if a setting is undefined | deflt | javascript | AndrewBelt/hack.chat | client/katex/katex.js | https://github.com/AndrewBelt/hack.chat/blob/master/client/katex/katex.js | MIT |
hyphenate = function(str) {
return str.replace(uppercase, "-$1").toLowerCase();
} | Provide a default value if a setting is undefined | hyphenate | javascript | AndrewBelt/hack.chat | client/katex/katex.js | https://github.com/AndrewBelt/hack.chat/blob/master/client/katex/katex.js | MIT |
function escaper(match) {
return ESCAPE_LOOKUP[match];
} | Provide a default value if a setting is undefined | escaper | javascript | AndrewBelt/hack.chat | client/katex/katex.js | https://github.com/AndrewBelt/hack.chat/blob/master/client/katex/katex.js | MIT |
function escape(text) {
return ("" + text).replace(ESCAPE_REGEX, escaper);
} | Escapes text to prevent scripting attacks.
@param {*} text Text value to escape.
@return {string} An escaped string. | escape | javascript | AndrewBelt/hack.chat | client/katex/katex.js | https://github.com/AndrewBelt/hack.chat/blob/master/client/katex/katex.js | MIT |
optionsToArray(obj, optionsPrefix, hasEquals) {
optionsPrefix = optionsPrefix || '--'
var ret = []
Object.keys(obj).forEach((key) => {
ret.push(optionsPrefix + key + (hasEquals ? '=' : ''))
if (obj[key]) {
ret.push(obj[key])
}
})
return ret
} | Convert an options object into a valid arguments array for the child_process.spawn method
from:
var options = {
foo: 'hello',
baz: 'world'
}
to:
['--foo=', 'hello', '--baz=','world']
@param { Object } obj - object we need to convert
@param { Array } optionsPrefix - use a prefix for the new array created
@param { Boolean } hasEquals - set the options commands using the equal
@returns { Array } - options array | optionsToArray | javascript | GianlucaGuarini/es6-project-starter-kit | tasks/_utils.js | https://github.com/GianlucaGuarini/es6-project-starter-kit/blob/master/tasks/_utils.js | MIT |
extend(obj1, obj2) {
for (var i in obj2) {
if (obj2.hasOwnProperty(i)) {
obj1[i] = obj2[i]
}
}
return obj1
} | Simple object extend function
@param { Object } obj1 - destination
@param { Object } obj2 - source
@returns { Object } - destination object | extend | javascript | GianlucaGuarini/es6-project-starter-kit | tasks/_utils.js | https://github.com/GianlucaGuarini/es6-project-starter-kit/blob/master/tasks/_utils.js | MIT |
exec(command, args, envVariables) {
var path = require('path'),
os = require('os')
return new Promise(function(resolve, reject) {
if (os.platform() == 'win32' || os.platform() == 'win64') command += '.cmd'
// extend the env variables with some other custom options
utils.extend(process.env, envVariables)
utils.print(`Executing: ${command} ${args.join(' ')} \n`, 'confirm')
var cmd = spawn(path.normalize(command), args, {
stdio: 'inherit',
cwd: process.cwd()
})
cmd.on('exit', function(code) {
if (code === 1)
reject()
else
resolve()
})
})
} | Run any system command
@param { String } command - command to execute
@param { Array } args - command arguments
@param { Object } envVariables - command environment variables
@returns { Promise } chainable promise object | exec | javascript | GianlucaGuarini/es6-project-starter-kit | tasks/_utils.js | https://github.com/GianlucaGuarini/es6-project-starter-kit/blob/master/tasks/_utils.js | MIT |
listFiles(path, mustDelete) {
utils.print(`Listing all the files in the folder: ${path}`, 'confirm')
var files = []
if (fs.existsSync(path)) {
var tmpFiles = fs.readdirSync(path)
tmpFiles.forEach((file) => {
var curPath = path + '/' + file
files.push(curPath)
if (fs.lstatSync(curPath).isDirectory()) { // recurse
utils.listFiles(curPath, mustDelete)
} else if (mustDelete) { // delete file
fs.unlinkSync(curPath)
}
})
if (mustDelete) {
fs.rmdirSync(path)
}
}
return files
} | Read all the files crawling starting from a certain folder path
@param { String } path directory path
@param { bool } mustDelete delete the files found
@returns { Array } files path list | listFiles | javascript | GianlucaGuarini/es6-project-starter-kit | tasks/_utils.js | https://github.com/GianlucaGuarini/es6-project-starter-kit/blob/master/tasks/_utils.js | MIT |
clean(path) {
var files = utils.listFiles(path, true)
utils.print(`Deleting the following files: \n ${files.join('\n')}`, 'cool')
} | Delete synchronously any folder or file
@param { String } path - path to clean | clean | javascript | GianlucaGuarini/es6-project-starter-kit | tasks/_utils.js | https://github.com/GianlucaGuarini/es6-project-starter-kit/blob/master/tasks/_utils.js | MIT |
print(msg, type) {
var color
switch (type) {
case 'error':
color = '\x1B[31m'
break
case 'warning':
color = '\x1B[33m'
break
case 'confirm':
color = '\x1B[32m'
break
case 'cool':
color = '\x1B[36m'
break
default:
color = ''
}
console.log(`${color} ${msg} \x1B[39m`)
} | Log messages in the terminal using custom colors
@param { String } msg - message to output
@param { String } type - message type to handle the right color | print | javascript | GianlucaGuarini/es6-project-starter-kit | tasks/_utils.js | https://github.com/GianlucaGuarini/es6-project-starter-kit/blob/master/tasks/_utils.js | MIT |
function markFunction( fn ) {
fn[ expando ] = true;
return fn;
} | Mark a function for special use by Sizzle
@param {Function} fn The function to mark | markFunction | javascript | lodge/lodge | public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | https://github.com/lodge/lodge/blob/master/public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | MIT |
function assert( fn ) {
var div = document.createElement("div");
try {
return !!fn( div );
} catch (e) {
return false;
} finally {
// Remove from its parent by default
if ( div.parentNode ) {
div.parentNode.removeChild( div );
}
// release memory in IE
div = null;
}
} | Support testing using an element
@param {Function} fn Passed the created div and expects a boolean result | assert | javascript | lodge/lodge | public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | https://github.com/lodge/lodge/blob/master/public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | MIT |
function addHandle( attrs, handler ) {
var arr = attrs.split("|"),
i = attrs.length;
while ( i-- ) {
Expr.attrHandle[ arr[i] ] = handler;
}
} | Adds the same handler for all of the specified attrs
@param {String} attrs Pipe-separated list of attributes
@param {Function} handler The method that will be applied | addHandle | javascript | lodge/lodge | public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | https://github.com/lodge/lodge/blob/master/public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | MIT |
function siblingCheck( a, b ) {
var cur = b && a,
diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
( ~b.sourceIndex || MAX_NEGATIVE ) -
( ~a.sourceIndex || MAX_NEGATIVE );
// Use IE sourceIndex if available on both nodes
if ( diff ) {
return diff;
}
// Check if b follows a
if ( cur ) {
while ( (cur = cur.nextSibling) ) {
if ( cur === b ) {
return -1;
}
}
}
return a ? 1 : -1;
} | Checks document order of two siblings
@param {Element} a
@param {Element} b
@returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b | siblingCheck | javascript | lodge/lodge | public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | https://github.com/lodge/lodge/blob/master/public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | MIT |
function createInputPseudo( type ) {
return function( elem ) {
var name = elem.nodeName.toLowerCase();
return name === "input" && elem.type === type;
};
} | Returns a function to use in pseudos for input types
@param {String} type | createInputPseudo | javascript | lodge/lodge | public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | https://github.com/lodge/lodge/blob/master/public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | MIT |
function createButtonPseudo( type ) {
return function( elem ) {
var name = elem.nodeName.toLowerCase();
return (name === "input" || name === "button") && elem.type === type;
};
} | Returns a function to use in pseudos for buttons
@param {String} type | createButtonPseudo | javascript | lodge/lodge | public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | https://github.com/lodge/lodge/blob/master/public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | MIT |
function createPositionalPseudo( fn ) {
return markFunction(function( argument ) {
argument = +argument;
return markFunction(function( seed, matches ) {
var j,
matchIndexes = fn( [], seed.length, argument ),
i = matchIndexes.length;
// Match elements found at the specified indexes
while ( i-- ) {
if ( seed[ (j = matchIndexes[i]) ] ) {
seed[j] = !(matches[j] = seed[j]);
}
}
});
});
} | Returns a function to use in pseudos for positionals
@param {Function} fn | createPositionalPseudo | javascript | lodge/lodge | public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | https://github.com/lodge/lodge/blob/master/public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | MIT |
function testContext( context ) {
return context && typeof context.getElementsByTagName !== strundefined && context;
} | Checks a node for validity as a Sizzle context
@param {Element|Object=} context
@returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value | testContext | javascript | lodge/lodge | public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | https://github.com/lodge/lodge/blob/master/public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | MIT |
function toSelector( tokens ) {
var i = 0,
len = tokens.length,
selector = "";
for ( ; i < len; i++ ) {
selector += tokens[i].value;
}
return selector;
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | toSelector | javascript | lodge/lodge | public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | https://github.com/lodge/lodge/blob/master/public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | MIT |
function addCombinator( matcher, combinator, base ) {
var dir = combinator.dir,
checkNonElements = base && dir === "parentNode",
doneName = done++;
return combinator.first ?
// Check against closest ancestor/preceding element
function( elem, context, xml ) {
while ( (elem = elem[ dir ]) ) {
if ( elem.nodeType === 1 || checkNonElements ) {
return matcher( elem, context, xml );
}
}
} :
// Check against all ancestor/preceding elements
function( elem, context, xml ) {
var oldCache, outerCache,
newCache = [ dirruns, doneName ];
// We can't set arbitrary data on XML nodes, so they don't benefit from dir caching
if ( xml ) {
while ( (elem = elem[ dir ]) ) {
if ( elem.nodeType === 1 || checkNonElements ) {
if ( matcher( elem, context, xml ) ) {
return true;
}
}
}
} else {
while ( (elem = elem[ dir ]) ) {
if ( elem.nodeType === 1 || checkNonElements ) {
outerCache = elem[ expando ] || (elem[ expando ] = {});
if ( (oldCache = outerCache[ dir ]) &&
oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
// Assign to newCache so results back-propagate to previous elements
return (newCache[ 2 ] = oldCache[ 2 ]);
} else {
// Reuse newcache so results back-propagate to previous elements
outerCache[ dir ] = newCache;
// A match means we're done; a fail means we have to keep checking
if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
return true;
}
}
}
}
}
};
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | addCombinator | javascript | lodge/lodge | public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | https://github.com/lodge/lodge/blob/master/public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | MIT |
function elementMatcher( matchers ) {
return matchers.length > 1 ?
function( elem, context, xml ) {
var i = matchers.length;
while ( i-- ) {
if ( !matchers[i]( elem, context, xml ) ) {
return false;
}
}
return true;
} :
matchers[0];
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | elementMatcher | javascript | lodge/lodge | public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | https://github.com/lodge/lodge/blob/master/public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | MIT |
function multipleContexts( selector, contexts, results ) {
var i = 0,
len = contexts.length;
for ( ; i < len; i++ ) {
Sizzle( selector, contexts[i], results );
}
return results;
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | multipleContexts | javascript | lodge/lodge | public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | https://github.com/lodge/lodge/blob/master/public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | MIT |
function condense( unmatched, map, filter, context, xml ) {
var elem,
newUnmatched = [],
i = 0,
len = unmatched.length,
mapped = map != null;
for ( ; i < len; i++ ) {
if ( (elem = unmatched[i]) ) {
if ( !filter || filter( elem, context, xml ) ) {
newUnmatched.push( elem );
if ( mapped ) {
map.push( i );
}
}
}
}
return newUnmatched;
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | condense | javascript | lodge/lodge | public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | https://github.com/lodge/lodge/blob/master/public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | MIT |
function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
if ( postFilter && !postFilter[ expando ] ) {
postFilter = setMatcher( postFilter );
}
if ( postFinder && !postFinder[ expando ] ) {
postFinder = setMatcher( postFinder, postSelector );
}
return markFunction(function( seed, results, context, xml ) {
var temp, i, elem,
preMap = [],
postMap = [],
preexisting = results.length,
// Get initial elements from seed or context
elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
// Prefilter to get matcher input, preserving a map for seed-results synchronization
matcherIn = preFilter && ( seed || !selector ) ?
condense( elems, preMap, preFilter, context, xml ) :
elems,
matcherOut = matcher ?
// If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
// ...intermediate processing is necessary
[] :
// ...otherwise use results directly
results :
matcherIn;
// Find primary matches
if ( matcher ) {
matcher( matcherIn, matcherOut, context, xml );
}
// Apply postFilter
if ( postFilter ) {
temp = condense( matcherOut, postMap );
postFilter( temp, [], context, xml );
// Un-match failing elements by moving them back to matcherIn
i = temp.length;
while ( i-- ) {
if ( (elem = temp[i]) ) {
matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
}
}
}
if ( seed ) {
if ( postFinder || preFilter ) {
if ( postFinder ) {
// Get the final matcherOut by condensing this intermediate into postFinder contexts
temp = [];
i = matcherOut.length;
while ( i-- ) {
if ( (elem = matcherOut[i]) ) {
// Restore matcherIn since elem is not yet a final match
temp.push( (matcherIn[i] = elem) );
}
}
postFinder( null, (matcherOut = []), temp, xml );
}
// Move matched elements from seed to results to keep them synchronized
i = matcherOut.length;
while ( i-- ) {
if ( (elem = matcherOut[i]) &&
(temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) {
seed[temp] = !(results[temp] = elem);
}
}
}
// Add elements to results, through postFinder if defined
} else {
matcherOut = condense(
matcherOut === results ?
matcherOut.splice( preexisting, matcherOut.length ) :
matcherOut
);
if ( postFinder ) {
postFinder( null, results, matcherOut, xml );
} else {
push.apply( results, matcherOut );
}
}
});
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | setMatcher | javascript | lodge/lodge | public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | https://github.com/lodge/lodge/blob/master/public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | MIT |
function matcherFromTokens( tokens ) {
var checkContext, matcher, j,
len = tokens.length,
leadingRelative = Expr.relative[ tokens[0].type ],
implicitRelative = leadingRelative || Expr.relative[" "],
i = leadingRelative ? 1 : 0,
// The foundational matcher ensures that elements are reachable from top-level context(s)
matchContext = addCombinator( function( elem ) {
return elem === checkContext;
}, implicitRelative, true ),
matchAnyContext = addCombinator( function( elem ) {
return indexOf.call( checkContext, elem ) > -1;
}, implicitRelative, true ),
matchers = [ function( elem, context, xml ) {
return ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
(checkContext = context).nodeType ?
matchContext( elem, context, xml ) :
matchAnyContext( elem, context, xml ) );
} ];
for ( ; i < len; i++ ) {
if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
} else {
matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
// Return special upon seeing a positional matcher
if ( matcher[ expando ] ) {
// Find the next relative operator (if any) for proper handling
j = ++i;
for ( ; j < len; j++ ) {
if ( Expr.relative[ tokens[j].type ] ) {
break;
}
}
return setMatcher(
i > 1 && elementMatcher( matchers ),
i > 1 && toSelector(
// If the preceding token was a descendant combinator, insert an implicit any-element `*`
tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
).replace( rtrim, "$1" ),
matcher,
i < j && matcherFromTokens( tokens.slice( i, j ) ),
j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
j < len && toSelector( tokens )
);
}
matchers.push( matcher );
}
}
return elementMatcher( matchers );
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | matcherFromTokens | javascript | lodge/lodge | public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | https://github.com/lodge/lodge/blob/master/public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | MIT |
function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
var bySet = setMatchers.length > 0,
byElement = elementMatchers.length > 0,
superMatcher = function( seed, context, xml, results, outermost ) {
var elem, j, matcher,
matchedCount = 0,
i = "0",
unmatched = seed && [],
setMatched = [],
contextBackup = outermostContext,
// We must always have either seed elements or outermost context
elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
// Use integer dirruns iff this is the outermost matcher
dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
len = elems.length;
if ( outermost ) {
outermostContext = context !== document && context;
}
// Add elements passing elementMatchers directly to results
// Keep `i` a string if there are no elements so `matchedCount` will be "00" below
// Support: IE<9, Safari
// Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
if ( byElement && elem ) {
j = 0;
while ( (matcher = elementMatchers[j++]) ) {
if ( matcher( elem, context, xml ) ) {
results.push( elem );
break;
}
}
if ( outermost ) {
dirruns = dirrunsUnique;
}
}
// Track unmatched elements for set filters
if ( bySet ) {
// They will have gone through all possible matchers
if ( (elem = !matcher && elem) ) {
matchedCount--;
}
// Lengthen the array for every element, matched or not
if ( seed ) {
unmatched.push( elem );
}
}
}
// Apply set filters to unmatched elements
matchedCount += i;
if ( bySet && i !== matchedCount ) {
j = 0;
while ( (matcher = setMatchers[j++]) ) {
matcher( unmatched, setMatched, context, xml );
}
if ( seed ) {
// Reintegrate element matches to eliminate the need for sorting
if ( matchedCount > 0 ) {
while ( i-- ) {
if ( !(unmatched[i] || setMatched[i]) ) {
setMatched[i] = pop.call( results );
}
}
}
// Discard index placeholder values to get only actual matches
setMatched = condense( setMatched );
}
// Add matches to results
push.apply( results, setMatched );
// Seedless set matches succeeding multiple successful matchers stipulate sorting
if ( outermost && !seed && setMatched.length > 0 &&
( matchedCount + setMatchers.length ) > 1 ) {
Sizzle.uniqueSort( results );
}
}
// Override manipulation of globals by nested matchers
if ( outermost ) {
dirruns = dirrunsUnique;
outermostContext = contextBackup;
}
return unmatched;
};
return bySet ?
markFunction( superMatcher ) :
superMatcher;
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | matcherFromGroupMatchers | javascript | lodge/lodge | public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | https://github.com/lodge/lodge/blob/master/public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | MIT |
superMatcher = function( seed, context, xml, results, outermost ) {
var elem, j, matcher,
matchedCount = 0,
i = "0",
unmatched = seed && [],
setMatched = [],
contextBackup = outermostContext,
// We must always have either seed elements or outermost context
elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
// Use integer dirruns iff this is the outermost matcher
dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
len = elems.length;
if ( outermost ) {
outermostContext = context !== document && context;
}
// Add elements passing elementMatchers directly to results
// Keep `i` a string if there are no elements so `matchedCount` will be "00" below
// Support: IE<9, Safari
// Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
if ( byElement && elem ) {
j = 0;
while ( (matcher = elementMatchers[j++]) ) {
if ( matcher( elem, context, xml ) ) {
results.push( elem );
break;
}
}
if ( outermost ) {
dirruns = dirrunsUnique;
}
}
// Track unmatched elements for set filters
if ( bySet ) {
// They will have gone through all possible matchers
if ( (elem = !matcher && elem) ) {
matchedCount--;
}
// Lengthen the array for every element, matched or not
if ( seed ) {
unmatched.push( elem );
}
}
}
// Apply set filters to unmatched elements
matchedCount += i;
if ( bySet && i !== matchedCount ) {
j = 0;
while ( (matcher = setMatchers[j++]) ) {
matcher( unmatched, setMatched, context, xml );
}
if ( seed ) {
// Reintegrate element matches to eliminate the need for sorting
if ( matchedCount > 0 ) {
while ( i-- ) {
if ( !(unmatched[i] || setMatched[i]) ) {
setMatched[i] = pop.call( results );
}
}
}
// Discard index placeholder values to get only actual matches
setMatched = condense( setMatched );
}
// Add matches to results
push.apply( results, setMatched );
// Seedless set matches succeeding multiple successful matchers stipulate sorting
if ( outermost && !seed && setMatched.length > 0 &&
( matchedCount + setMatchers.length ) > 1 ) {
Sizzle.uniqueSort( results );
}
}
// Override manipulation of globals by nested matchers
if ( outermost ) {
dirruns = dirrunsUnique;
outermostContext = contextBackup;
}
return unmatched;
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | superMatcher | javascript | lodge/lodge | public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | https://github.com/lodge/lodge/blob/master/public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | MIT |
function winnow( elements, qualifier, not ) {
if ( jQuery.isFunction( qualifier ) ) {
return jQuery.grep( elements, function( elem, i ) {
/* jshint -W018 */
return !!qualifier.call( elem, i, elem ) !== not;
});
}
if ( qualifier.nodeType ) {
return jQuery.grep( elements, function( elem ) {
return ( elem === qualifier ) !== not;
});
}
if ( typeof qualifier === "string" ) {
if ( risSimple.test( qualifier ) ) {
return jQuery.filter( qualifier, elements, not );
}
qualifier = jQuery.filter( qualifier, elements );
}
return jQuery.grep( elements, function( elem ) {
return ( jQuery.inArray( elem, qualifier ) >= 0 ) !== not;
});
} | A low-level selection function that works with Sizzle's compiled
selector functions
@param {String|Function} selector A selector or a pre-compiled
selector function built with Sizzle.compile
@param {Element} context
@param {Array} [results]
@param {Array} [seed] A set of elements to match against | winnow | javascript | lodge/lodge | public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | https://github.com/lodge/lodge/blob/master/public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | MIT |
function sibling( cur, dir ) {
do {
cur = cur[ dir ];
} while ( cur && cur.nodeType !== 1 );
return cur;
} | A low-level selection function that works with Sizzle's compiled
selector functions
@param {String|Function} selector A selector or a pre-compiled
selector function built with Sizzle.compile
@param {Element} context
@param {Array} [results]
@param {Array} [seed] A set of elements to match against | sibling | javascript | lodge/lodge | public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | https://github.com/lodge/lodge/blob/master/public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | MIT |
function createOptions( options ) {
var object = optionsCache[ options ] = {};
jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) {
object[ flag ] = true;
});
return object;
} | A low-level selection function that works with Sizzle's compiled
selector functions
@param {String|Function} selector A selector or a pre-compiled
selector function built with Sizzle.compile
@param {Element} context
@param {Array} [results]
@param {Array} [seed] A set of elements to match against | createOptions | javascript | lodge/lodge | public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | https://github.com/lodge/lodge/blob/master/public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | MIT |
fire = function( data ) {
memory = options.memory && data;
fired = true;
firingIndex = firingStart || 0;
firingStart = 0;
firingLength = list.length;
firing = true;
for ( ; list && firingIndex < firingLength; firingIndex++ ) {
if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) {
memory = false; // To prevent further calls using add
break;
}
}
firing = false;
if ( list ) {
if ( stack ) {
if ( stack.length ) {
fire( stack.shift() );
}
} else if ( memory ) {
list = [];
} else {
self.disable();
}
}
} | A low-level selection function that works with Sizzle's compiled
selector functions
@param {String|Function} selector A selector or a pre-compiled
selector function built with Sizzle.compile
@param {Element} context
@param {Array} [results]
@param {Array} [seed] A set of elements to match against | fire | javascript | lodge/lodge | public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | https://github.com/lodge/lodge/blob/master/public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | MIT |
updateFunc = function( i, contexts, values ) {
return function( value ) {
contexts[ i ] = this;
values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
if ( values === progressValues ) {
deferred.notifyWith( contexts, values );
} else if ( !(--remaining) ) {
deferred.resolveWith( contexts, values );
}
};
} | A low-level selection function that works with Sizzle's compiled
selector functions
@param {String|Function} selector A selector or a pre-compiled
selector function built with Sizzle.compile
@param {Element} context
@param {Array} [results]
@param {Array} [seed] A set of elements to match against | updateFunc | javascript | lodge/lodge | public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | https://github.com/lodge/lodge/blob/master/public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | MIT |
function detach() {
if ( document.addEventListener ) {
document.removeEventListener( "DOMContentLoaded", completed, false );
window.removeEventListener( "load", completed, false );
} else {
document.detachEvent( "onreadystatechange", completed );
window.detachEvent( "onload", completed );
}
} | Clean-up method for dom ready events | detach | javascript | lodge/lodge | public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | https://github.com/lodge/lodge/blob/master/public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | MIT |
function completed() {
// readyState === "complete" is good enough for us to call the dom ready in oldIE
if ( document.addEventListener || event.type === "load" || document.readyState === "complete" ) {
detach();
jQuery.ready();
}
} | The ready event handler and self cleanup method | completed | javascript | lodge/lodge | public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | https://github.com/lodge/lodge/blob/master/public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | MIT |
function dataAttr( elem, key, data ) {
// If nothing was found internally, try to fetch any
// data from the HTML5 data-* attribute
if ( data === undefined && elem.nodeType === 1 ) {
var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
data = elem.getAttribute( name );
if ( typeof data === "string" ) {
try {
data = data === "true" ? true :
data === "false" ? false :
data === "null" ? null :
// Only convert to a number if it doesn't change the string
+data + "" === data ? +data :
rbrace.test( data ) ? jQuery.parseJSON( data ) :
data;
} catch( e ) {}
// Make sure we set the data so it isn't changed later
jQuery.data( elem, key, data );
} else {
data = undefined;
}
}
return data;
} | Determines whether an object can have data | dataAttr | javascript | lodge/lodge | public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | https://github.com/lodge/lodge/blob/master/public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | MIT |
function isEmptyDataObject( obj ) {
var name;
for ( name in obj ) {
// if the public data object is empty, the private is still empty
if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) {
continue;
}
if ( name !== "toJSON" ) {
return false;
}
}
return true;
} | Determines whether an object can have data | isEmptyDataObject | javascript | lodge/lodge | public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | https://github.com/lodge/lodge/blob/master/public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | MIT |
function internalData( elem, name, data, pvt /* Internal Use Only */ ) {
if ( !jQuery.acceptData( elem ) ) {
return;
}
var ret, thisCache,
internalKey = jQuery.expando,
// We have to handle DOM nodes and JS objects differently because IE6-7
// can't GC object references properly across the DOM-JS boundary
isNode = elem.nodeType,
// Only DOM nodes need the global jQuery cache; JS object data is
// attached directly to the object so GC can occur automatically
cache = isNode ? jQuery.cache : elem,
// Only defining an ID for JS objects if its cache already exists allows
// the code to shortcut on the same path as a DOM node with no cache
id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey;
// Avoid doing any more work than we need to when trying to get data on an
// object that has no data at all
if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && data === undefined && typeof name === "string" ) {
return;
}
if ( !id ) {
// Only DOM nodes need a new unique ID for each element since their data
// ends up in the global cache
if ( isNode ) {
id = elem[ internalKey ] = deletedIds.pop() || jQuery.guid++;
} else {
id = internalKey;
}
}
if ( !cache[ id ] ) {
// Avoid exposing jQuery metadata on plain JS objects when the object
// is serialized using JSON.stringify
cache[ id ] = isNode ? {} : { toJSON: jQuery.noop };
}
// An object can be passed to jQuery.data instead of a key/value pair; this gets
// shallow copied over onto the existing cache
if ( typeof name === "object" || typeof name === "function" ) {
if ( pvt ) {
cache[ id ] = jQuery.extend( cache[ id ], name );
} else {
cache[ id ].data = jQuery.extend( cache[ id ].data, name );
}
}
thisCache = cache[ id ];
// jQuery data() is stored in a separate object inside the object's internal data
// cache in order to avoid key collisions between internal data and user-defined
// data.
if ( !pvt ) {
if ( !thisCache.data ) {
thisCache.data = {};
}
thisCache = thisCache.data;
}
if ( data !== undefined ) {
thisCache[ jQuery.camelCase( name ) ] = data;
}
// Check for both converted-to-camel and non-converted data property names
// If a data property was specified
if ( typeof name === "string" ) {
// First Try to find as-is property data
ret = thisCache[ name ];
// Test for null|undefined property data
if ( ret == null ) {
// Try to find the camelCased property
ret = thisCache[ jQuery.camelCase( name ) ];
}
} else {
ret = thisCache;
}
return ret;
} | Determines whether an object can have data | internalData | javascript | lodge/lodge | public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | https://github.com/lodge/lodge/blob/master/public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | MIT |
function internalRemoveData( elem, name, pvt ) {
if ( !jQuery.acceptData( elem ) ) {
return;
}
var thisCache, i,
isNode = elem.nodeType,
// See jQuery.data for more information
cache = isNode ? jQuery.cache : elem,
id = isNode ? elem[ jQuery.expando ] : jQuery.expando;
// If there is already no cache entry for this object, there is no
// purpose in continuing
if ( !cache[ id ] ) {
return;
}
if ( name ) {
thisCache = pvt ? cache[ id ] : cache[ id ].data;
if ( thisCache ) {
// Support array or space separated string names for data keys
if ( !jQuery.isArray( name ) ) {
// try the string as a key before any manipulation
if ( name in thisCache ) {
name = [ name ];
} else {
// split the camel cased version by spaces unless a key with the spaces exists
name = jQuery.camelCase( name );
if ( name in thisCache ) {
name = [ name ];
} else {
name = name.split(" ");
}
}
} else {
// If "name" is an array of keys...
// When data is initially created, via ("key", "val") signature,
// keys will be converted to camelCase.
// Since there is no way to tell _how_ a key was added, remove
// both plain key and camelCase key. #12786
// This will only penalize the array argument path.
name = name.concat( jQuery.map( name, jQuery.camelCase ) );
}
i = name.length;
while ( i-- ) {
delete thisCache[ name[i] ];
}
// If there is no data left in the cache, we want to continue
// and let the cache object itself get destroyed
if ( pvt ? !isEmptyDataObject(thisCache) : !jQuery.isEmptyObject(thisCache) ) {
return;
}
}
}
// See jQuery.data for more information
if ( !pvt ) {
delete cache[ id ].data;
// Don't destroy the parent cache unless the internal data object
// had been the only thing left in it
if ( !isEmptyDataObject( cache[ id ] ) ) {
return;
}
}
// Destroy the cache
if ( isNode ) {
jQuery.cleanData( [ elem ], true );
// Use delete when supported for expandos or `cache` is not a window per isWindow (#10080)
/* jshint eqeqeq: false */
} else if ( support.deleteExpando || cache != cache.window ) {
/* jshint eqeqeq: true */
delete cache[ id ];
// When all else fails, null
} else {
cache[ id ] = null;
}
} | Determines whether an object can have data | internalRemoveData | javascript | lodge/lodge | public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | https://github.com/lodge/lodge/blob/master/public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | MIT |
next = function() {
jQuery.dequeue( elem, type );
} | Determines whether an object can have data | next | javascript | lodge/lodge | public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | https://github.com/lodge/lodge/blob/master/public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | MIT |
resolve = function() {
if ( !( --count ) ) {
defer.resolveWith( elements, [ elements ] );
}
} | Determines whether an object can have data | resolve | javascript | lodge/lodge | public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | https://github.com/lodge/lodge/blob/master/public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | MIT |
isHidden = function( elem, el ) {
// isHidden might be called from jQuery#filter function;
// in that case, element will be second argument
elem = el || elem;
return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem );
} | Determines whether an object can have data | isHidden | javascript | lodge/lodge | public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | https://github.com/lodge/lodge/blob/master/public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | MIT |
function returnTrue() {
return true;
} | Determines whether an object can have data | returnTrue | javascript | lodge/lodge | public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | https://github.com/lodge/lodge/blob/master/public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | MIT |
function returnFalse() {
return false;
} | Determines whether an object can have data | returnFalse | javascript | lodge/lodge | public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | https://github.com/lodge/lodge/blob/master/public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | MIT |
function safeActiveElement() {
try {
return document.activeElement;
} catch ( err ) { }
} | Determines whether an object can have data | safeActiveElement | javascript | lodge/lodge | public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | https://github.com/lodge/lodge/blob/master/public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | MIT |
handler = function( event ) {
jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
} | Determines whether an object can have data | handler | javascript | lodge/lodge | public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | https://github.com/lodge/lodge/blob/master/public/assets/application-ad2df1dd7a2bc3c99128f6e5716010ee.js | MIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.