repo stringlengths 5 67 | path stringlengths 4 116 | func_name stringlengths 0 58 | original_string stringlengths 52 373k | language stringclasses 1
value | code stringlengths 52 373k | code_tokens list | docstring stringlengths 4 11.8k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 86 226 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
dthree/vorpal | dist/autocomplete.js | parseInput | function parseInput(str, idx) {
var raw = String(str || '');
var sliced = raw.slice(0, idx);
var sections = sliced.split('|');
var prefix = sections.slice(0, sections.length - 1) || [];
prefix.push('');
prefix = prefix.join('|');
var suffix = getSuffix(raw.slice(idx));
var context = sections[sections.le... | javascript | function parseInput(str, idx) {
var raw = String(str || '');
var sliced = raw.slice(0, idx);
var sections = sliced.split('|');
var prefix = sections.slice(0, sections.length - 1) || [];
prefix.push('');
prefix = prefix.join('|');
var suffix = getSuffix(raw.slice(idx));
var context = sections[sections.le... | [
"function",
"parseInput",
"(",
"str",
",",
"idx",
")",
"{",
"var",
"raw",
"=",
"String",
"(",
"str",
"||",
"''",
")",
";",
"var",
"sliced",
"=",
"raw",
".",
"slice",
"(",
"0",
",",
"idx",
")",
";",
"var",
"sections",
"=",
"sliced",
".",
"split",
... | Takes the user's current prompt
string and breaks it into its
integral parts for analysis and
modification.
@param {String} str
@param {Integer} idx
@return {Object}
@api private | [
"Takes",
"the",
"user",
"s",
"current",
"prompt",
"string",
"and",
"breaks",
"it",
"into",
"its",
"integral",
"parts",
"for",
"analysis",
"and",
"modification",
"."
] | 51f5e2b545631b6a86c9781c274a1b0916a67ee8 | https://github.com/dthree/vorpal/blob/51f5e2b545631b6a86c9781c274a1b0916a67ee8/dist/autocomplete.js#L239-L254 | train |
dthree/vorpal | dist/autocomplete.js | parseMatchSection | function parseMatchSection(input) {
var parts = (input.context || '').split(' ');
var last = parts.pop();
var beforeLast = strip(parts[parts.length - 1] || '').trim();
if (beforeLast.slice(0, 1) === '-') {
input.option = beforeLast;
}
input.context = last;
input.prefix = (input.prefix || '') + parts.j... | javascript | function parseMatchSection(input) {
var parts = (input.context || '').split(' ');
var last = parts.pop();
var beforeLast = strip(parts[parts.length - 1] || '').trim();
if (beforeLast.slice(0, 1) === '-') {
input.option = beforeLast;
}
input.context = last;
input.prefix = (input.prefix || '') + parts.j... | [
"function",
"parseMatchSection",
"(",
"input",
")",
"{",
"var",
"parts",
"=",
"(",
"input",
".",
"context",
"||",
"''",
")",
".",
"split",
"(",
"' '",
")",
";",
"var",
"last",
"=",
"parts",
".",
"pop",
"(",
")",
";",
"var",
"beforeLast",
"=",
"stri... | Takes the context after a
matched command and figures
out the applicable context,
including assigning its role
such as being an option
parameter, etc.
@param {Object} input
@return {Object}
@api private | [
"Takes",
"the",
"context",
"after",
"a",
"matched",
"command",
"and",
"figures",
"out",
"the",
"applicable",
"context",
"including",
"assigning",
"its",
"role",
"such",
"as",
"being",
"an",
"option",
"parameter",
"etc",
"."
] | 51f5e2b545631b6a86c9781c274a1b0916a67ee8 | https://github.com/dthree/vorpal/blob/51f5e2b545631b6a86c9781c274a1b0916a67ee8/dist/autocomplete.js#L269-L279 | train |
dthree/vorpal | dist/autocomplete.js | getCommandNames | function getCommandNames(cmds) {
var commands = _.map(cmds, '_name');
commands = commands.concat.apply(commands, _.map(cmds, '_aliases'));
commands.sort();
return commands;
} | javascript | function getCommandNames(cmds) {
var commands = _.map(cmds, '_name');
commands = commands.concat.apply(commands, _.map(cmds, '_aliases'));
commands.sort();
return commands;
} | [
"function",
"getCommandNames",
"(",
"cmds",
")",
"{",
"var",
"commands",
"=",
"_",
".",
"map",
"(",
"cmds",
",",
"'_name'",
")",
";",
"commands",
"=",
"commands",
".",
"concat",
".",
"apply",
"(",
"commands",
",",
"_",
".",
"map",
"(",
"cmds",
",",
... | Compile all available commands and aliases
in alphabetical order.
@param {Array} cmds
@return {Array}
@api private | [
"Compile",
"all",
"available",
"commands",
"and",
"aliases",
"in",
"alphabetical",
"order",
"."
] | 51f5e2b545631b6a86c9781c274a1b0916a67ee8 | https://github.com/dthree/vorpal/blob/51f5e2b545631b6a86c9781c274a1b0916a67ee8/dist/autocomplete.js#L305-L310 | train |
dthree/vorpal | dist/autocomplete.js | getMatchData | function getMatchData(input, cb) {
var string = input.context;
var cmd = input.match;
var midOption = String(string).trim().slice(0, 1) === '-';
var afterOption = input.option !== undefined;
if (midOption === true && !cmd._allowUnknownOptions) {
var results = [];
for (var i = 0; i < cmd.options.length... | javascript | function getMatchData(input, cb) {
var string = input.context;
var cmd = input.match;
var midOption = String(string).trim().slice(0, 1) === '-';
var afterOption = input.option !== undefined;
if (midOption === true && !cmd._allowUnknownOptions) {
var results = [];
for (var i = 0; i < cmd.options.length... | [
"function",
"getMatchData",
"(",
"input",
",",
"cb",
")",
"{",
"var",
"string",
"=",
"input",
".",
"context",
";",
"var",
"cmd",
"=",
"input",
".",
"match",
";",
"var",
"midOption",
"=",
"String",
"(",
"string",
")",
".",
"trim",
"(",
")",
".",
"sl... | Takes a known matched command, and reads
the applicable data by calling its autocompletion
instructions, whether it is the command's
autocompletion or one of its options.
@param {Object} input
@param {Function} cb
@return {Array}
@api private | [
"Takes",
"a",
"known",
"matched",
"command",
"and",
"reads",
"the",
"applicable",
"data",
"by",
"calling",
"its",
"autocompletion",
"instructions",
"whether",
"it",
"is",
"the",
"command",
"s",
"autocompletion",
"or",
"one",
"of",
"its",
"options",
"."
] | 51f5e2b545631b6a86c9781c274a1b0916a67ee8 | https://github.com/dthree/vorpal/blob/51f5e2b545631b6a86c9781c274a1b0916a67ee8/dist/autocomplete.js#L383-L443 | train |
dthree/vorpal | lib/autocomplete.js | function (str, cb) {
var self = this;
var input = parseInput(str, this.parent.ui._activePrompt.screen.rl.cursor);
var commands = getCommandNames(this.parent.commands);
var vorpalMatch = getMatch(input.context, commands, {ignoreSlashes: true});
var freezeTabs = false;
function end(str) {
v... | javascript | function (str, cb) {
var self = this;
var input = parseInput(str, this.parent.ui._activePrompt.screen.rl.cursor);
var commands = getCommandNames(this.parent.commands);
var vorpalMatch = getMatch(input.context, commands, {ignoreSlashes: true});
var freezeTabs = false;
function end(str) {
v... | [
"function",
"(",
"str",
",",
"cb",
")",
"{",
"var",
"self",
"=",
"this",
";",
"var",
"input",
"=",
"parseInput",
"(",
"str",
",",
"this",
".",
"parent",
".",
"ui",
".",
"_activePrompt",
".",
"screen",
".",
"rl",
".",
"cursor",
")",
";",
"var",
"c... | Handles tabbed autocompletion.
- Initial tabbing lists all registered commands.
- Completes a command halfway typed.
- Recognizes options and lists all possible options.
- Recognizes option arguments and lists them.
- Supports cursor positions anywhere in the string.
- Supports piping.
@param {String} str
@return {St... | [
"Handles",
"tabbed",
"autocompletion",
"."
] | 51f5e2b545631b6a86c9781c274a1b0916a67ee8 | https://github.com/dthree/vorpal/blob/51f5e2b545631b6a86c9781c274a1b0916a67ee8/lib/autocomplete.js#L23-L64 | train | |
dthree/vorpal | lib/autocomplete.js | filterData | function filterData(str, data) {
data = data || [];
var ctx = String(str || '').trim();
var slashParts = ctx.split('/');
ctx = slashParts.pop();
var wordParts = String(ctx).trim().split(' ');
var res = data.filter(function (item) {
return (strip(item).slice(0, ctx.length) === ctx);
});
res = res.map... | javascript | function filterData(str, data) {
data = data || [];
var ctx = String(str || '').trim();
var slashParts = ctx.split('/');
ctx = slashParts.pop();
var wordParts = String(ctx).trim().split(' ');
var res = data.filter(function (item) {
return (strip(item).slice(0, ctx.length) === ctx);
});
res = res.map... | [
"function",
"filterData",
"(",
"str",
",",
"data",
")",
"{",
"data",
"=",
"data",
"||",
"[",
"]",
";",
"var",
"ctx",
"=",
"String",
"(",
"str",
"||",
"''",
")",
".",
"trim",
"(",
")",
";",
"var",
"slashParts",
"=",
"ctx",
".",
"split",
"(",
"'/... | Reduces an array of possible
matches to list based on a given
string.
@param {String} str
@param {Array} data
@return {Array}
@api private | [
"Reduces",
"an",
"array",
"of",
"possible",
"matches",
"to",
"list",
"based",
"on",
"a",
"given",
"string",
"."
] | 51f5e2b545631b6a86c9781c274a1b0916a67ee8 | https://github.com/dthree/vorpal/blob/51f5e2b545631b6a86c9781c274a1b0916a67ee8/lib/autocomplete.js#L211-L229 | train |
dthree/vorpal | lib/autocomplete.js | getSuffix | function getSuffix(suffix) {
suffix = (suffix.slice(0, 1) === ' ') ?
suffix :
suffix.replace(/.+?(?=\s)/, '');
suffix = suffix.slice(1, suffix.length);
return suffix;
} | javascript | function getSuffix(suffix) {
suffix = (suffix.slice(0, 1) === ' ') ?
suffix :
suffix.replace(/.+?(?=\s)/, '');
suffix = suffix.slice(1, suffix.length);
return suffix;
} | [
"function",
"getSuffix",
"(",
"suffix",
")",
"{",
"suffix",
"=",
"(",
"suffix",
".",
"slice",
"(",
"0",
",",
"1",
")",
"===",
"' '",
")",
"?",
"suffix",
":",
"suffix",
".",
"replace",
"(",
"/",
".+?(?=\\s)",
"/",
",",
"''",
")",
";",
"suffix",
"=... | Returns a cleaned up version of the
remaining text to the right of the cursor.
@param {String} suffix
@return {String}
@api private | [
"Returns",
"a",
"cleaned",
"up",
"version",
"of",
"the",
"remaining",
"text",
"to",
"the",
"right",
"of",
"the",
"cursor",
"."
] | 51f5e2b545631b6a86c9781c274a1b0916a67ee8 | https://github.com/dthree/vorpal/blob/51f5e2b545631b6a86c9781c274a1b0916a67ee8/lib/autocomplete.js#L294-L300 | train |
dthree/vorpal | lib/autocomplete.js | getMatchObject | function getMatchObject(input, commands) {
var len = input.context.length;
var trimmed = String(input.context).replace(/^\s+/g, '');
var prefix = new Array((len - trimmed.length) + 1).join(' ');
var match;
var suffix;
commands.forEach(function (cmd) {
var nextChar = trimmed.substr(cmd.length, 1);
if... | javascript | function getMatchObject(input, commands) {
var len = input.context.length;
var trimmed = String(input.context).replace(/^\s+/g, '');
var prefix = new Array((len - trimmed.length) + 1).join(' ');
var match;
var suffix;
commands.forEach(function (cmd) {
var nextChar = trimmed.substr(cmd.length, 1);
if... | [
"function",
"getMatchObject",
"(",
"input",
",",
"commands",
")",
"{",
"var",
"len",
"=",
"input",
".",
"context",
".",
"length",
";",
"var",
"trimmed",
"=",
"String",
"(",
"input",
".",
"context",
")",
".",
"replace",
"(",
"/",
"^\\s+",
"/",
"g",
",... | When we know that we've
exceeded a known command, grab
on to that command and return it,
fixing the overall input context
at the same time.
@param {Object} input
@param {Array} commands
@return {Object}
@api private | [
"When",
"we",
"know",
"that",
"we",
"ve",
"exceeded",
"a",
"known",
"command",
"grab",
"on",
"to",
"that",
"command",
"and",
"return",
"it",
"fixing",
"the",
"overall",
"input",
"context",
"at",
"the",
"same",
"time",
"."
] | 51f5e2b545631b6a86c9781c274a1b0916a67ee8 | https://github.com/dthree/vorpal/blob/51f5e2b545631b6a86c9781c274a1b0916a67ee8/lib/autocomplete.js#L331-L377 | train |
Microsoft/maker.js | docs/demos/js/pixel-heart.js | PixelWalker | function PixelWalker(firstPoint, pixel_path) {
// go clockwise starting first point
var points = [];
points.push(firstPoint);
var moveHorizontal = true; // alternate horizontal and vertical movements to form pixel heart
pixel_path.forEach(function (p) {
var previous_point = points[points... | javascript | function PixelWalker(firstPoint, pixel_path) {
// go clockwise starting first point
var points = [];
points.push(firstPoint);
var moveHorizontal = true; // alternate horizontal and vertical movements to form pixel heart
pixel_path.forEach(function (p) {
var previous_point = points[points... | [
"function",
"PixelWalker",
"(",
"firstPoint",
",",
"pixel_path",
")",
"{",
"// go clockwise starting first point",
"var",
"points",
"=",
"[",
"]",
";",
"points",
".",
"push",
"(",
"firstPoint",
")",
";",
"var",
"moveHorizontal",
"=",
"true",
";",
"// alternate h... | starting point so the heart is located properly in space
Builds an array of points that define a model by generating points
from the `path` defined above. | [
"starting",
"point",
"so",
"the",
"heart",
"is",
"located",
"properly",
"in",
"space",
"Builds",
"an",
"array",
"of",
"points",
"that",
"define",
"a",
"model",
"by",
"generating",
"points",
"from",
"the",
"path",
"defined",
"above",
"."
] | 22cc3b46abb1997b301dd3b2b300aa848d431efd | https://github.com/Microsoft/maker.js/blob/22cc3b46abb1997b301dd3b2b300aa848d431efd/docs/demos/js/pixel-heart.js#L37-L63 | train |
Microsoft/maker.js | docs/demos/js/pixel-heart.js | Heart | function Heart(desired_width) {
var points = PixelWalker(STARTING_POINT, path);
var pathModel = new makerjs.models.ConnectTheDots(true, points);
if (typeof desired_width != 'undefined') {
var scale = desired_width / HEART_WIDTH;
makerjs.model.scale(pathModel, scale);
}
return pathMo... | javascript | function Heart(desired_width) {
var points = PixelWalker(STARTING_POINT, path);
var pathModel = new makerjs.models.ConnectTheDots(true, points);
if (typeof desired_width != 'undefined') {
var scale = desired_width / HEART_WIDTH;
makerjs.model.scale(pathModel, scale);
}
return pathMo... | [
"function",
"Heart",
"(",
"desired_width",
")",
"{",
"var",
"points",
"=",
"PixelWalker",
"(",
"STARTING_POINT",
",",
"path",
")",
";",
"var",
"pathModel",
"=",
"new",
"makerjs",
".",
"models",
".",
"ConnectTheDots",
"(",
"true",
",",
"points",
")",
";",
... | Builds a pixel heart model and scale it to the specified input width. | [
"Builds",
"a",
"pixel",
"heart",
"model",
"and",
"scale",
"it",
"to",
"the",
"specified",
"input",
"width",
"."
] | 22cc3b46abb1997b301dd3b2b300aa848d431efd | https://github.com/Microsoft/maker.js/blob/22cc3b46abb1997b301dd3b2b300aa848d431efd/docs/demos/js/pixel-heart.js#L68-L77 | train |
Microsoft/maker.js | docs/playground/js/require-iframe.js | complete2 | function complete2() {
//reset any calls to document.write
resetLog();
//reinstate alert
window.alert = originalAlert;
var originalFn = parent.makerjs.exporter.toSVG;
var captureExportedModel;
parent.makerjs.exporter.toSVG = function (i... | javascript | function complete2() {
//reset any calls to document.write
resetLog();
//reinstate alert
window.alert = originalAlert;
var originalFn = parent.makerjs.exporter.toSVG;
var captureExportedModel;
parent.makerjs.exporter.toSVG = function (i... | [
"function",
"complete2",
"(",
")",
"{",
"//reset any calls to document.write",
"resetLog",
"(",
")",
";",
"//reinstate alert",
"window",
".",
"alert",
"=",
"originalAlert",
";",
"var",
"originalFn",
"=",
"parent",
".",
"makerjs",
".",
"exporter",
".",
"toSVG",
"... | run the code in 2 passes, first - to cache all required libraries, secondly the actual execution | [
"run",
"the",
"code",
"in",
"2",
"passes",
"first",
"-",
"to",
"cache",
"all",
"required",
"libraries",
"secondly",
"the",
"actual",
"execution"
] | 22cc3b46abb1997b301dd3b2b300aa848d431efd | https://github.com/Microsoft/maker.js/blob/22cc3b46abb1997b301dd3b2b300aa848d431efd/docs/playground/js/require-iframe.js#L175-L241 | train |
ghettovoice/vuelayers | src/index.js | plugin | function plugin (Vue, options = {}) {
if (plugin.installed) {
return
}
plugin.installed = true
// install components
Vue.use(ArcgisRestSource, options)
Vue.use(BingmapsSource, options)
Vue.use(CircleGeom, options)
Vue.use(CircleStyle, options)
Vue.use(ClusterSource, options)
Vue.use(DrawInterac... | javascript | function plugin (Vue, options = {}) {
if (plugin.installed) {
return
}
plugin.installed = true
// install components
Vue.use(ArcgisRestSource, options)
Vue.use(BingmapsSource, options)
Vue.use(CircleGeom, options)
Vue.use(CircleStyle, options)
Vue.use(ClusterSource, options)
Vue.use(DrawInterac... | [
"function",
"plugin",
"(",
"Vue",
",",
"options",
"=",
"{",
"}",
")",
"{",
"if",
"(",
"plugin",
".",
"installed",
")",
"{",
"return",
"}",
"plugin",
".",
"installed",
"=",
"true",
"// install components",
"Vue",
".",
"use",
"(",
"ArcgisRestSource",
",",
... | Registers all VueLayers components.
@param {Vue|VueConstructor} Vue
@param {VueLayersOptions} [options] | [
"Registers",
"all",
"VueLayers",
"components",
"."
] | 73bf8aa6fb08c4a683324706d54177552808a32d | https://github.com/ghettovoice/vuelayers/blob/73bf8aa6fb08c4a683324706d54177552808a32d/src/index.js#L56-L106 | train |
anvaka/panzoom | index.js | getBoundingBox | function getBoundingBox() {
if (!bounds) return // client does not want to restrict movement
if (typeof bounds === 'boolean') {
// for boolean type we use parent container bounds
var ownerRect = owner.getBoundingClientRect()
var sceneWidth = ownerRect.width
var sceneHeight = ownerRect.h... | javascript | function getBoundingBox() {
if (!bounds) return // client does not want to restrict movement
if (typeof bounds === 'boolean') {
// for boolean type we use parent container bounds
var ownerRect = owner.getBoundingClientRect()
var sceneWidth = ownerRect.width
var sceneHeight = ownerRect.h... | [
"function",
"getBoundingBox",
"(",
")",
"{",
"if",
"(",
"!",
"bounds",
")",
"return",
"// client does not want to restrict movement",
"if",
"(",
"typeof",
"bounds",
"===",
"'boolean'",
")",
"{",
"// for boolean type we use parent container bounds",
"var",
"ownerRect",
"... | Returns bounding box that should be used to restrict scene movement. | [
"Returns",
"bounding",
"box",
"that",
"should",
"be",
"used",
"to",
"restrict",
"scene",
"movement",
"."
] | 57bb78383a371eccea115035d24c631e0e6819bb | https://github.com/anvaka/panzoom/blob/57bb78383a371eccea115035d24c631e0e6819bb/index.js#L280-L298 | train |
zeroclipboard/zeroclipboard | dist/ZeroClipboard.js | function(source) {
var copy, i, len, prop;
if (typeof source !== "object" || source == null || typeof source.nodeType === "number") {
copy = source;
} else if (typeof source.length === "number") {
copy = [];
for (i = 0, len = source.length; i < len; i++) {
if (_hasOwn.call(source, ... | javascript | function(source) {
var copy, i, len, prop;
if (typeof source !== "object" || source == null || typeof source.nodeType === "number") {
copy = source;
} else if (typeof source.length === "number") {
copy = [];
for (i = 0, len = source.length; i < len; i++) {
if (_hasOwn.call(source, ... | [
"function",
"(",
"source",
")",
"{",
"var",
"copy",
",",
"i",
",",
"len",
",",
"prop",
";",
"if",
"(",
"typeof",
"source",
"!==",
"\"object\"",
"||",
"source",
"==",
"null",
"||",
"typeof",
"source",
".",
"nodeType",
"===",
"\"number\"",
")",
"{",
"c... | Return a deep copy of the source object or array.
@returns Object or Array
@private | [
"Return",
"a",
"deep",
"copy",
"of",
"the",
"source",
"object",
"or",
"array",
"."
] | 09660421dd377fda5bd66ce9bb69c916470bfbb5 | https://github.com/zeroclipboard/zeroclipboard/blob/09660421dd377fda5bd66ce9bb69c916470bfbb5/dist/ZeroClipboard.js#L68-L88 | train | |
zeroclipboard/zeroclipboard | dist/ZeroClipboard.js | function(obj) {
if (obj) {
for (var prop in obj) {
if (_hasOwn.call(obj, prop)) {
delete obj[prop];
}
}
}
return obj;
} | javascript | function(obj) {
if (obj) {
for (var prop in obj) {
if (_hasOwn.call(obj, prop)) {
delete obj[prop];
}
}
}
return obj;
} | [
"function",
"(",
"obj",
")",
"{",
"if",
"(",
"obj",
")",
"{",
"for",
"(",
"var",
"prop",
"in",
"obj",
")",
"{",
"if",
"(",
"_hasOwn",
".",
"call",
"(",
"obj",
",",
"prop",
")",
")",
"{",
"delete",
"obj",
"[",
"prop",
"]",
";",
"}",
"}",
"}"... | Remove all owned, enumerable properties from an object.
@returns The original object without its owned, enumerable properties.
@private | [
"Remove",
"all",
"owned",
"enumerable",
"properties",
"from",
"an",
"object",
"."
] | 09660421dd377fda5bd66ce9bb69c916470bfbb5 | https://github.com/zeroclipboard/zeroclipboard/blob/09660421dd377fda5bd66ce9bb69c916470bfbb5/dist/ZeroClipboard.js#L128-L137 | train | |
zeroclipboard/zeroclipboard | dist/ZeroClipboard.js | function(el, ancestorEl) {
if (el && el.nodeType === 1 && el.ownerDocument && ancestorEl && (ancestorEl.nodeType === 1 && ancestorEl.ownerDocument && ancestorEl.ownerDocument === el.ownerDocument || ancestorEl.nodeType === 9 && !ancestorEl.ownerDocument && ancestorEl === el.ownerDocument)) {
do {
if (... | javascript | function(el, ancestorEl) {
if (el && el.nodeType === 1 && el.ownerDocument && ancestorEl && (ancestorEl.nodeType === 1 && ancestorEl.ownerDocument && ancestorEl.ownerDocument === el.ownerDocument || ancestorEl.nodeType === 9 && !ancestorEl.ownerDocument && ancestorEl === el.ownerDocument)) {
do {
if (... | [
"function",
"(",
"el",
",",
"ancestorEl",
")",
"{",
"if",
"(",
"el",
"&&",
"el",
".",
"nodeType",
"===",
"1",
"&&",
"el",
".",
"ownerDocument",
"&&",
"ancestorEl",
"&&",
"(",
"ancestorEl",
".",
"nodeType",
"===",
"1",
"&&",
"ancestorEl",
".",
"ownerDoc... | Determine if an element is contained within another element.
@returns Boolean
@private | [
"Determine",
"if",
"an",
"element",
"is",
"contained",
"within",
"another",
"element",
"."
] | 09660421dd377fda5bd66ce9bb69c916470bfbb5 | https://github.com/zeroclipboard/zeroclipboard/blob/09660421dd377fda5bd66ce9bb69c916470bfbb5/dist/ZeroClipboard.js#L144-L154 | train | |
zeroclipboard/zeroclipboard | dist/ZeroClipboard.js | function(url) {
var dir;
if (typeof url === "string" && url) {
dir = url.split("#")[0].split("?")[0];
dir = url.slice(0, url.lastIndexOf("/") + 1);
}
return dir;
} | javascript | function(url) {
var dir;
if (typeof url === "string" && url) {
dir = url.split("#")[0].split("?")[0];
dir = url.slice(0, url.lastIndexOf("/") + 1);
}
return dir;
} | [
"function",
"(",
"url",
")",
"{",
"var",
"dir",
";",
"if",
"(",
"typeof",
"url",
"===",
"\"string\"",
"&&",
"url",
")",
"{",
"dir",
"=",
"url",
".",
"split",
"(",
"\"#\"",
")",
"[",
"0",
"]",
".",
"split",
"(",
"\"?\"",
")",
"[",
"0",
"]",
";... | Get the URL path's parent directory.
@returns String or `undefined`
@private | [
"Get",
"the",
"URL",
"path",
"s",
"parent",
"directory",
"."
] | 09660421dd377fda5bd66ce9bb69c916470bfbb5 | https://github.com/zeroclipboard/zeroclipboard/blob/09660421dd377fda5bd66ce9bb69c916470bfbb5/dist/ZeroClipboard.js#L161-L168 | train | |
zeroclipboard/zeroclipboard | dist/ZeroClipboard.js | function() {
var jsPath, scripts, i;
if (_document.currentScript && (jsPath = _document.currentScript.src)) {
return jsPath;
}
scripts = _document.getElementsByTagName("script");
if (scripts.length === 1) {
return scripts[0].src || undefined;
}
if ("readyState" in (scripts[0] || ... | javascript | function() {
var jsPath, scripts, i;
if (_document.currentScript && (jsPath = _document.currentScript.src)) {
return jsPath;
}
scripts = _document.getElementsByTagName("script");
if (scripts.length === 1) {
return scripts[0].src || undefined;
}
if ("readyState" in (scripts[0] || ... | [
"function",
"(",
")",
"{",
"var",
"jsPath",
",",
"scripts",
",",
"i",
";",
"if",
"(",
"_document",
".",
"currentScript",
"&&",
"(",
"jsPath",
"=",
"_document",
".",
"currentScript",
".",
"src",
")",
")",
"{",
"return",
"jsPath",
";",
"}",
"scripts",
... | Get the current script's URL.
@returns String or `undefined`
@private | [
"Get",
"the",
"current",
"script",
"s",
"URL",
"."
] | 09660421dd377fda5bd66ce9bb69c916470bfbb5 | https://github.com/zeroclipboard/zeroclipboard/blob/09660421dd377fda5bd66ce9bb69c916470bfbb5/dist/ZeroClipboard.js#L214-L237 | train | |
zeroclipboard/zeroclipboard | dist/ZeroClipboard.js | function() {
var isWindowsRegex = /win(dows|[\s]?(nt|me|ce|xp|vista|[\d]+))/i;
return !!_navigator && (isWindowsRegex.test(_navigator.appVersion || "") || isWindowsRegex.test(_navigator.platform || "") || (_navigator.userAgent || "").indexOf("Windows") !== -1);
} | javascript | function() {
var isWindowsRegex = /win(dows|[\s]?(nt|me|ce|xp|vista|[\d]+))/i;
return !!_navigator && (isWindowsRegex.test(_navigator.appVersion || "") || isWindowsRegex.test(_navigator.platform || "") || (_navigator.userAgent || "").indexOf("Windows") !== -1);
} | [
"function",
"(",
")",
"{",
"var",
"isWindowsRegex",
"=",
"/",
"win(dows|[\\s]?(nt|me|ce|xp|vista|[\\d]+))",
"/",
"i",
";",
"return",
"!",
"!",
"_navigator",
"&&",
"(",
"isWindowsRegex",
".",
"test",
"(",
"_navigator",
".",
"appVersion",
"||",
"\"\"",
")",
"||"... | Is the client's operating system some version of Windows?
@returns Boolean
@private | [
"Is",
"the",
"client",
"s",
"operating",
"system",
"some",
"version",
"of",
"Windows?"
] | 09660421dd377fda5bd66ce9bb69c916470bfbb5 | https://github.com/zeroclipboard/zeroclipboard/blob/09660421dd377fda5bd66ce9bb69c916470bfbb5/dist/ZeroClipboard.js#L280-L283 | train | |
zeroclipboard/zeroclipboard | dist/ZeroClipboard.js | function(options) {
if (typeof options === "object" && options && !("length" in options)) {
_keys(options).forEach(function(prop) {
if (/^(?:forceHandCursor|title|zIndex|bubbleEvents|fixLineEndings)$/.test(prop)) {
_globalConfig[prop] = options[prop];
} else if (_flashState.bridge ==... | javascript | function(options) {
if (typeof options === "object" && options && !("length" in options)) {
_keys(options).forEach(function(prop) {
if (/^(?:forceHandCursor|title|zIndex|bubbleEvents|fixLineEndings)$/.test(prop)) {
_globalConfig[prop] = options[prop];
} else if (_flashState.bridge ==... | [
"function",
"(",
"options",
")",
"{",
"if",
"(",
"typeof",
"options",
"===",
"\"object\"",
"&&",
"options",
"&&",
"!",
"(",
"\"length\"",
"in",
"options",
")",
")",
"{",
"_keys",
"(",
"options",
")",
".",
"forEach",
"(",
"function",
"(",
"prop",
")",
... | The underlying implementation of `ZeroClipboard.config`.
@private | [
"The",
"underlying",
"implementation",
"of",
"ZeroClipboard",
".",
"config",
"."
] | 09660421dd377fda5bd66ce9bb69c916470bfbb5 | https://github.com/zeroclipboard/zeroclipboard/blob/09660421dd377fda5bd66ce9bb69c916470bfbb5/dist/ZeroClipboard.js#L437-L462 | train | |
zeroclipboard/zeroclipboard | dist/ZeroClipboard.js | function() {
_detectSandbox();
return {
browser: _extend(_pick(_navigator, [ "userAgent", "platform", "appName", "appVersion" ]), {
isSupported: _isBrowserSupported()
}),
flash: _omit(_flashState, [ "bridge" ]),
zeroclipboard: {
version: ZeroClipboard.version,
con... | javascript | function() {
_detectSandbox();
return {
browser: _extend(_pick(_navigator, [ "userAgent", "platform", "appName", "appVersion" ]), {
isSupported: _isBrowserSupported()
}),
flash: _omit(_flashState, [ "bridge" ]),
zeroclipboard: {
version: ZeroClipboard.version,
con... | [
"function",
"(",
")",
"{",
"_detectSandbox",
"(",
")",
";",
"return",
"{",
"browser",
":",
"_extend",
"(",
"_pick",
"(",
"_navigator",
",",
"[",
"\"userAgent\"",
",",
"\"platform\"",
",",
"\"appName\"",
",",
"\"appVersion\"",
"]",
")",
",",
"{",
"isSupport... | The underlying implementation of `ZeroClipboard.state`.
@private | [
"The",
"underlying",
"implementation",
"of",
"ZeroClipboard",
".",
"state",
"."
] | 09660421dd377fda5bd66ce9bb69c916470bfbb5 | https://github.com/zeroclipboard/zeroclipboard/blob/09660421dd377fda5bd66ce9bb69c916470bfbb5/dist/ZeroClipboard.js#L467-L479 | train | |
zeroclipboard/zeroclipboard | dist/ZeroClipboard.js | function() {
return !!(_flashState.sandboxed || _flashState.disabled || _flashState.outdated || _flashState.unavailable || _flashState.degraded || _flashState.deactivated);
} | javascript | function() {
return !!(_flashState.sandboxed || _flashState.disabled || _flashState.outdated || _flashState.unavailable || _flashState.degraded || _flashState.deactivated);
} | [
"function",
"(",
")",
"{",
"return",
"!",
"!",
"(",
"_flashState",
".",
"sandboxed",
"||",
"_flashState",
".",
"disabled",
"||",
"_flashState",
".",
"outdated",
"||",
"_flashState",
".",
"unavailable",
"||",
"_flashState",
".",
"degraded",
"||",
"_flashState",... | The underlying implementation of `ZeroClipboard.isFlashUnusable`.
@private | [
"The",
"underlying",
"implementation",
"of",
"ZeroClipboard",
".",
"isFlashUnusable",
"."
] | 09660421dd377fda5bd66ce9bb69c916470bfbb5 | https://github.com/zeroclipboard/zeroclipboard/blob/09660421dd377fda5bd66ce9bb69c916470bfbb5/dist/ZeroClipboard.js#L491-L493 | train | |
zeroclipboard/zeroclipboard | dist/ZeroClipboard.js | function(eventType, listener) {
var i, len, events, added = {};
if (typeof eventType === "string" && eventType) {
events = eventType.toLowerCase().split(/\s+/);
} else if (typeof eventType === "object" && eventType && !("length" in eventType) && typeof listener === "undefined") {
_keys(eventType... | javascript | function(eventType, listener) {
var i, len, events, added = {};
if (typeof eventType === "string" && eventType) {
events = eventType.toLowerCase().split(/\s+/);
} else if (typeof eventType === "object" && eventType && !("length" in eventType) && typeof listener === "undefined") {
_keys(eventType... | [
"function",
"(",
"eventType",
",",
"listener",
")",
"{",
"var",
"i",
",",
"len",
",",
"events",
",",
"added",
"=",
"{",
"}",
";",
"if",
"(",
"typeof",
"eventType",
"===",
"\"string\"",
"&&",
"eventType",
")",
"{",
"events",
"=",
"eventType",
".",
"to... | The underlying implementation of `ZeroClipboard.on`.
@private | [
"The",
"underlying",
"implementation",
"of",
"ZeroClipboard",
".",
"on",
"."
] | 09660421dd377fda5bd66ce9bb69c916470bfbb5 | https://github.com/zeroclipboard/zeroclipboard/blob/09660421dd377fda5bd66ce9bb69c916470bfbb5/dist/ZeroClipboard.js#L498-L551 | train | |
zeroclipboard/zeroclipboard | dist/ZeroClipboard.js | function(eventType, listener) {
var i, len, foundIndex, events, perEventHandlers;
if (arguments.length === 0) {
events = _keys(_handlers);
} else if (typeof eventType === "string" && eventType) {
events = eventType.toLowerCase().split(/\s+/);
} else if (typeof eventType === "object" && event... | javascript | function(eventType, listener) {
var i, len, foundIndex, events, perEventHandlers;
if (arguments.length === 0) {
events = _keys(_handlers);
} else if (typeof eventType === "string" && eventType) {
events = eventType.toLowerCase().split(/\s+/);
} else if (typeof eventType === "object" && event... | [
"function",
"(",
"eventType",
",",
"listener",
")",
"{",
"var",
"i",
",",
"len",
",",
"foundIndex",
",",
"events",
",",
"perEventHandlers",
";",
"if",
"(",
"arguments",
".",
"length",
"===",
"0",
")",
"{",
"events",
"=",
"_keys",
"(",
"_handlers",
")",... | The underlying implementation of `ZeroClipboard.off`.
@private | [
"The",
"underlying",
"implementation",
"of",
"ZeroClipboard",
".",
"off",
"."
] | 09660421dd377fda5bd66ce9bb69c916470bfbb5 | https://github.com/zeroclipboard/zeroclipboard/blob/09660421dd377fda5bd66ce9bb69c916470bfbb5/dist/ZeroClipboard.js#L556-L588 | train | |
zeroclipboard/zeroclipboard | dist/ZeroClipboard.js | function(eventType) {
var copy;
if (typeof eventType === "string" && eventType) {
copy = _deepCopy(_handlers[eventType]) || null;
} else {
copy = _deepCopy(_handlers);
}
return copy;
} | javascript | function(eventType) {
var copy;
if (typeof eventType === "string" && eventType) {
copy = _deepCopy(_handlers[eventType]) || null;
} else {
copy = _deepCopy(_handlers);
}
return copy;
} | [
"function",
"(",
"eventType",
")",
"{",
"var",
"copy",
";",
"if",
"(",
"typeof",
"eventType",
"===",
"\"string\"",
"&&",
"eventType",
")",
"{",
"copy",
"=",
"_deepCopy",
"(",
"_handlers",
"[",
"eventType",
"]",
")",
"||",
"null",
";",
"}",
"else",
"{",... | The underlying implementation of `ZeroClipboard.handlers`.
@private | [
"The",
"underlying",
"implementation",
"of",
"ZeroClipboard",
".",
"handlers",
"."
] | 09660421dd377fda5bd66ce9bb69c916470bfbb5 | https://github.com/zeroclipboard/zeroclipboard/blob/09660421dd377fda5bd66ce9bb69c916470bfbb5/dist/ZeroClipboard.js#L593-L601 | train | |
zeroclipboard/zeroclipboard | dist/ZeroClipboard.js | function(event) {
var eventCopy, returnVal, tmp;
event = _createEvent(event);
if (!event) {
return;
}
if (_preprocessEvent(event)) {
return;
}
if (event.type === "ready" && _flashState.overdue === true) {
return ZeroClipboard.emit({
type: "error",
name: "fla... | javascript | function(event) {
var eventCopy, returnVal, tmp;
event = _createEvent(event);
if (!event) {
return;
}
if (_preprocessEvent(event)) {
return;
}
if (event.type === "ready" && _flashState.overdue === true) {
return ZeroClipboard.emit({
type: "error",
name: "fla... | [
"function",
"(",
"event",
")",
"{",
"var",
"eventCopy",
",",
"returnVal",
",",
"tmp",
";",
"event",
"=",
"_createEvent",
"(",
"event",
")",
";",
"if",
"(",
"!",
"event",
")",
"{",
"return",
";",
"}",
"if",
"(",
"_preprocessEvent",
"(",
"event",
")",
... | The underlying implementation of `ZeroClipboard.emit`.
@private | [
"The",
"underlying",
"implementation",
"of",
"ZeroClipboard",
".",
"emit",
"."
] | 09660421dd377fda5bd66ce9bb69c916470bfbb5 | https://github.com/zeroclipboard/zeroclipboard/blob/09660421dd377fda5bd66ce9bb69c916470bfbb5/dist/ZeroClipboard.js#L606-L629 | train | |
zeroclipboard/zeroclipboard | dist/ZeroClipboard.js | function() {
var swfPath = _globalConfig.swfPath || "", swfPathFirstTwoChars = swfPath.slice(0, 2), swfProtocol = swfPath.slice(0, swfPath.indexOf("://") + 1);
return swfPathFirstTwoChars === "\\\\" ? "file:" : swfPathFirstTwoChars === "//" || swfProtocol === "" ? _window.location.protocol : swfProtocol;
} | javascript | function() {
var swfPath = _globalConfig.swfPath || "", swfPathFirstTwoChars = swfPath.slice(0, 2), swfProtocol = swfPath.slice(0, swfPath.indexOf("://") + 1);
return swfPathFirstTwoChars === "\\\\" ? "file:" : swfPathFirstTwoChars === "//" || swfProtocol === "" ? _window.location.protocol : swfProtocol;
} | [
"function",
"(",
")",
"{",
"var",
"swfPath",
"=",
"_globalConfig",
".",
"swfPath",
"||",
"\"\"",
",",
"swfPathFirstTwoChars",
"=",
"swfPath",
".",
"slice",
"(",
"0",
",",
"2",
")",
",",
"swfProtocol",
"=",
"swfPath",
".",
"slice",
"(",
"0",
",",
"swfPa... | Get the protocol of the configured SWF path.
@private | [
"Get",
"the",
"protocol",
"of",
"the",
"configured",
"SWF",
"path",
"."
] | 09660421dd377fda5bd66ce9bb69c916470bfbb5 | https://github.com/zeroclipboard/zeroclipboard/blob/09660421dd377fda5bd66ce9bb69c916470bfbb5/dist/ZeroClipboard.js#L634-L637 | train | |
zeroclipboard/zeroclipboard | dist/ZeroClipboard.js | function() {
var maxWait, swfProtocol, previousState = _flashState.sandboxed;
if (!_isBrowserSupported()) {
_flashState.ready = false;
ZeroClipboard.emit({
type: "error",
name: "browser-unsupported"
});
return;
}
_detectSandbox();
if (typeof _flashState.ready ... | javascript | function() {
var maxWait, swfProtocol, previousState = _flashState.sandboxed;
if (!_isBrowserSupported()) {
_flashState.ready = false;
ZeroClipboard.emit({
type: "error",
name: "browser-unsupported"
});
return;
}
_detectSandbox();
if (typeof _flashState.ready ... | [
"function",
"(",
")",
"{",
"var",
"maxWait",
",",
"swfProtocol",
",",
"previousState",
"=",
"_flashState",
".",
"sandboxed",
";",
"if",
"(",
"!",
"_isBrowserSupported",
"(",
")",
")",
"{",
"_flashState",
".",
"ready",
"=",
"false",
";",
"ZeroClipboard",
".... | The underlying implementation of `ZeroClipboard.create`.
@private | [
"The",
"underlying",
"implementation",
"of",
"ZeroClipboard",
".",
"create",
"."
] | 09660421dd377fda5bd66ce9bb69c916470bfbb5 | https://github.com/zeroclipboard/zeroclipboard/blob/09660421dd377fda5bd66ce9bb69c916470bfbb5/dist/ZeroClipboard.js#L642-L688 | train | |
zeroclipboard/zeroclipboard | dist/ZeroClipboard.js | function(format, data) {
var dataObj;
if (typeof format === "object" && format && typeof data === "undefined") {
dataObj = format;
ZeroClipboard.clearData();
} else if (typeof format === "string" && format) {
dataObj = {};
dataObj[format] = data;
} else {
return;
}
... | javascript | function(format, data) {
var dataObj;
if (typeof format === "object" && format && typeof data === "undefined") {
dataObj = format;
ZeroClipboard.clearData();
} else if (typeof format === "string" && format) {
dataObj = {};
dataObj[format] = data;
} else {
return;
}
... | [
"function",
"(",
"format",
",",
"data",
")",
"{",
"var",
"dataObj",
";",
"if",
"(",
"typeof",
"format",
"===",
"\"object\"",
"&&",
"format",
"&&",
"typeof",
"data",
"===",
"\"undefined\"",
")",
"{",
"dataObj",
"=",
"format",
";",
"ZeroClipboard",
".",
"c... | The underlying implementation of `ZeroClipboard.setData`.
@private | [
"The",
"underlying",
"implementation",
"of",
"ZeroClipboard",
".",
"setData",
"."
] | 09660421dd377fda5bd66ce9bb69c916470bfbb5 | https://github.com/zeroclipboard/zeroclipboard/blob/09660421dd377fda5bd66ce9bb69c916470bfbb5/dist/ZeroClipboard.js#L704-L720 | train | |
zeroclipboard/zeroclipboard | dist/ZeroClipboard.js | function(format) {
if (typeof format === "undefined") {
_deleteOwnProperties(_clipData);
_clipDataFormatMap = null;
} else if (typeof format === "string" && _hasOwn.call(_clipData, format)) {
delete _clipData[format];
}
} | javascript | function(format) {
if (typeof format === "undefined") {
_deleteOwnProperties(_clipData);
_clipDataFormatMap = null;
} else if (typeof format === "string" && _hasOwn.call(_clipData, format)) {
delete _clipData[format];
}
} | [
"function",
"(",
"format",
")",
"{",
"if",
"(",
"typeof",
"format",
"===",
"\"undefined\"",
")",
"{",
"_deleteOwnProperties",
"(",
"_clipData",
")",
";",
"_clipDataFormatMap",
"=",
"null",
";",
"}",
"else",
"if",
"(",
"typeof",
"format",
"===",
"\"string\"",... | The underlying implementation of `ZeroClipboard.clearData`.
@private | [
"The",
"underlying",
"implementation",
"of",
"ZeroClipboard",
".",
"clearData",
"."
] | 09660421dd377fda5bd66ce9bb69c916470bfbb5 | https://github.com/zeroclipboard/zeroclipboard/blob/09660421dd377fda5bd66ce9bb69c916470bfbb5/dist/ZeroClipboard.js#L725-L732 | train | |
zeroclipboard/zeroclipboard | dist/ZeroClipboard.js | function(format) {
if (typeof format === "undefined") {
return _deepCopy(_clipData);
} else if (typeof format === "string" && _hasOwn.call(_clipData, format)) {
return _clipData[format];
}
} | javascript | function(format) {
if (typeof format === "undefined") {
return _deepCopy(_clipData);
} else if (typeof format === "string" && _hasOwn.call(_clipData, format)) {
return _clipData[format];
}
} | [
"function",
"(",
"format",
")",
"{",
"if",
"(",
"typeof",
"format",
"===",
"\"undefined\"",
")",
"{",
"return",
"_deepCopy",
"(",
"_clipData",
")",
";",
"}",
"else",
"if",
"(",
"typeof",
"format",
"===",
"\"string\"",
"&&",
"_hasOwn",
".",
"call",
"(",
... | The underlying implementation of `ZeroClipboard.getData`.
@private | [
"The",
"underlying",
"implementation",
"of",
"ZeroClipboard",
".",
"getData",
"."
] | 09660421dd377fda5bd66ce9bb69c916470bfbb5 | https://github.com/zeroclipboard/zeroclipboard/blob/09660421dd377fda5bd66ce9bb69c916470bfbb5/dist/ZeroClipboard.js#L737-L743 | train | |
zeroclipboard/zeroclipboard | dist/ZeroClipboard.js | function(event) {
var eventType;
if (typeof event === "string" && event) {
eventType = event;
event = {};
} else if (typeof event === "object" && event && typeof event.type === "string" && event.type) {
eventType = event.type;
}
if (!eventType) {
return;
}
eventType =... | javascript | function(event) {
var eventType;
if (typeof event === "string" && event) {
eventType = event;
event = {};
} else if (typeof event === "object" && event && typeof event.type === "string" && event.type) {
eventType = event.type;
}
if (!eventType) {
return;
}
eventType =... | [
"function",
"(",
"event",
")",
"{",
"var",
"eventType",
";",
"if",
"(",
"typeof",
"event",
"===",
"\"string\"",
"&&",
"event",
")",
"{",
"eventType",
"=",
"event",
";",
"event",
"=",
"{",
"}",
";",
"}",
"else",
"if",
"(",
"typeof",
"event",
"===",
... | Create or update an `event` object, based on the `eventType`.
@private | [
"Create",
"or",
"update",
"an",
"event",
"object",
"based",
"on",
"the",
"eventType",
"."
] | 09660421dd377fda5bd66ce9bb69c916470bfbb5 | https://github.com/zeroclipboard/zeroclipboard/blob/09660421dd377fda5bd66ce9bb69c916470bfbb5/dist/ZeroClipboard.js#L808-L875 | train | |
zeroclipboard/zeroclipboard | dist/ZeroClipboard.js | function(targetEl) {
var relatedTargetId = targetEl && targetEl.getAttribute && targetEl.getAttribute("data-clipboard-target");
return relatedTargetId ? _document.getElementById(relatedTargetId) : null;
} | javascript | function(targetEl) {
var relatedTargetId = targetEl && targetEl.getAttribute && targetEl.getAttribute("data-clipboard-target");
return relatedTargetId ? _document.getElementById(relatedTargetId) : null;
} | [
"function",
"(",
"targetEl",
")",
"{",
"var",
"relatedTargetId",
"=",
"targetEl",
"&&",
"targetEl",
".",
"getAttribute",
"&&",
"targetEl",
".",
"getAttribute",
"(",
"\"data-clipboard-target\"",
")",
";",
"return",
"relatedTargetId",
"?",
"_document",
".",
"getElem... | Get a relatedTarget from the target's `data-clipboard-target` attribute
@private | [
"Get",
"a",
"relatedTarget",
"from",
"the",
"target",
"s",
"data",
"-",
"clipboard",
"-",
"target",
"attribute"
] | 09660421dd377fda5bd66ce9bb69c916470bfbb5 | https://github.com/zeroclipboard/zeroclipboard/blob/09660421dd377fda5bd66ce9bb69c916470bfbb5/dist/ZeroClipboard.js#L880-L883 | train | |
zeroclipboard/zeroclipboard | dist/ZeroClipboard.js | function(event) {
if (event && /^_(?:click|mouse(?:over|out|down|up|move))$/.test(event.type)) {
var srcElement = event.target;
var fromElement = event.type === "_mouseover" && event.relatedTarget ? event.relatedTarget : undefined;
var toElement = event.type === "_mouseout" && event.relatedTarget ... | javascript | function(event) {
if (event && /^_(?:click|mouse(?:over|out|down|up|move))$/.test(event.type)) {
var srcElement = event.target;
var fromElement = event.type === "_mouseover" && event.relatedTarget ? event.relatedTarget : undefined;
var toElement = event.type === "_mouseout" && event.relatedTarget ... | [
"function",
"(",
"event",
")",
"{",
"if",
"(",
"event",
"&&",
"/",
"^_(?:click|mouse(?:over|out|down|up|move))$",
"/",
".",
"test",
"(",
"event",
".",
"type",
")",
")",
"{",
"var",
"srcElement",
"=",
"event",
".",
"target",
";",
"var",
"fromElement",
"=",
... | Add element and position data to `MouseEvent` instances
@private | [
"Add",
"element",
"and",
"position",
"data",
"to",
"MouseEvent",
"instances"
] | 09660421dd377fda5bd66ce9bb69c916470bfbb5 | https://github.com/zeroclipboard/zeroclipboard/blob/09660421dd377fda5bd66ce9bb69c916470bfbb5/dist/ZeroClipboard.js#L888-L929 | train | |
zeroclipboard/zeroclipboard | dist/ZeroClipboard.js | function(func, context, args, async) {
if (async) {
_setTimeout(function() {
func.apply(context, args);
}, 0);
} else {
func.apply(context, args);
}
} | javascript | function(func, context, args, async) {
if (async) {
_setTimeout(function() {
func.apply(context, args);
}, 0);
} else {
func.apply(context, args);
}
} | [
"function",
"(",
"func",
",",
"context",
",",
"args",
",",
"async",
")",
"{",
"if",
"(",
"async",
")",
"{",
"_setTimeout",
"(",
"function",
"(",
")",
"{",
"func",
".",
"apply",
"(",
"context",
",",
"args",
")",
";",
"}",
",",
"0",
")",
";",
"}"... | Control if a callback should be executed asynchronously or not.
@returns `undefined`
@private | [
"Control",
"if",
"a",
"callback",
"should",
"be",
"executed",
"asynchronously",
"or",
"not",
"."
] | 09660421dd377fda5bd66ce9bb69c916470bfbb5 | https://github.com/zeroclipboard/zeroclipboard/blob/09660421dd377fda5bd66ce9bb69c916470bfbb5/dist/ZeroClipboard.js#L946-L954 | train | |
zeroclipboard/zeroclipboard | dist/ZeroClipboard.js | function(event) {
var isSandboxed = null;
if (_pageIsFramed === false || event && event.type === "error" && event.name && _errorsThatOnlyOccurAfterFlashLoads.indexOf(event.name) !== -1) {
isSandboxed = false;
}
return isSandboxed;
} | javascript | function(event) {
var isSandboxed = null;
if (_pageIsFramed === false || event && event.type === "error" && event.name && _errorsThatOnlyOccurAfterFlashLoads.indexOf(event.name) !== -1) {
isSandboxed = false;
}
return isSandboxed;
} | [
"function",
"(",
"event",
")",
"{",
"var",
"isSandboxed",
"=",
"null",
";",
"if",
"(",
"_pageIsFramed",
"===",
"false",
"||",
"event",
"&&",
"event",
".",
"type",
"===",
"\"error\"",
"&&",
"event",
".",
"name",
"&&",
"_errorsThatOnlyOccurAfterFlashLoads",
".... | Check an `error` event's `name` property to see if Flash has
already loaded, which rules out possible `iframe` sandboxing.
@private | [
"Check",
"an",
"error",
"event",
"s",
"name",
"property",
"to",
"see",
"if",
"Flash",
"has",
"already",
"loaded",
"which",
"rules",
"out",
"possible",
"iframe",
"sandboxing",
"."
] | 09660421dd377fda5bd66ce9bb69c916470bfbb5 | https://github.com/zeroclipboard/zeroclipboard/blob/09660421dd377fda5bd66ce9bb69c916470bfbb5/dist/ZeroClipboard.js#L994-L1000 | train | |
zeroclipboard/zeroclipboard | dist/ZeroClipboard.js | function(aftercopyEvent) {
if (aftercopyEvent.errors && aftercopyEvent.errors.length > 0) {
var errorEvent = _deepCopy(aftercopyEvent);
_extend(errorEvent, {
type: "error",
name: "clipboard-error"
});
delete errorEvent.success;
_setTimeout(function() {
ZeroClipb... | javascript | function(aftercopyEvent) {
if (aftercopyEvent.errors && aftercopyEvent.errors.length > 0) {
var errorEvent = _deepCopy(aftercopyEvent);
_extend(errorEvent, {
type: "error",
name: "clipboard-error"
});
delete errorEvent.success;
_setTimeout(function() {
ZeroClipb... | [
"function",
"(",
"aftercopyEvent",
")",
"{",
"if",
"(",
"aftercopyEvent",
".",
"errors",
"&&",
"aftercopyEvent",
".",
"errors",
".",
"length",
">",
"0",
")",
"{",
"var",
"errorEvent",
"=",
"_deepCopy",
"(",
"aftercopyEvent",
")",
";",
"_extend",
"(",
"erro... | Check an "aftercopy" event for clipboard errors and emit a corresponding "error" event.
@private | [
"Check",
"an",
"aftercopy",
"event",
"for",
"clipboard",
"errors",
"and",
"emit",
"a",
"corresponding",
"error",
"event",
"."
] | 09660421dd377fda5bd66ce9bb69c916470bfbb5 | https://github.com/zeroclipboard/zeroclipboard/blob/09660421dd377fda5bd66ce9bb69c916470bfbb5/dist/ZeroClipboard.js#L1171-L1183 | train | |
zeroclipboard/zeroclipboard | dist/ZeroClipboard.js | function(event) {
if (!(event && typeof event.type === "string" && event)) {
return;
}
var e, target = event.target || null, doc = target && target.ownerDocument || _document, defaults = {
view: doc.defaultView || _window,
canBubble: true,
cancelable: true,
detail: event.type =... | javascript | function(event) {
if (!(event && typeof event.type === "string" && event)) {
return;
}
var e, target = event.target || null, doc = target && target.ownerDocument || _document, defaults = {
view: doc.defaultView || _window,
canBubble: true,
cancelable: true,
detail: event.type =... | [
"function",
"(",
"event",
")",
"{",
"if",
"(",
"!",
"(",
"event",
"&&",
"typeof",
"event",
".",
"type",
"===",
"\"string\"",
"&&",
"event",
")",
")",
"{",
"return",
";",
"}",
"var",
"e",
",",
"target",
"=",
"event",
".",
"target",
"||",
"null",
"... | Dispatch a synthetic MouseEvent.
@returns `undefined`
@private | [
"Dispatch",
"a",
"synthetic",
"MouseEvent",
"."
] | 09660421dd377fda5bd66ce9bb69c916470bfbb5 | https://github.com/zeroclipboard/zeroclipboard/blob/09660421dd377fda5bd66ce9bb69c916470bfbb5/dist/ZeroClipboard.js#L1190-L1213 | train | |
zeroclipboard/zeroclipboard | dist/ZeroClipboard.js | function() {
var container = _document.createElement("div");
container.id = _globalConfig.containerId;
container.className = _globalConfig.containerClass;
container.style.position = "absolute";
container.style.left = "0px";
container.style.top = "-9999px";
container.style.width = "1px";
... | javascript | function() {
var container = _document.createElement("div");
container.id = _globalConfig.containerId;
container.className = _globalConfig.containerClass;
container.style.position = "absolute";
container.style.left = "0px";
container.style.top = "-9999px";
container.style.width = "1px";
... | [
"function",
"(",
")",
"{",
"var",
"container",
"=",
"_document",
".",
"createElement",
"(",
"\"div\"",
")",
";",
"container",
".",
"id",
"=",
"_globalConfig",
".",
"containerId",
";",
"container",
".",
"className",
"=",
"_globalConfig",
".",
"containerClass",
... | Create the HTML bridge element to embed the Flash object into.
@private | [
"Create",
"the",
"HTML",
"bridge",
"element",
"to",
"embed",
"the",
"Flash",
"object",
"into",
"."
] | 09660421dd377fda5bd66ce9bb69c916470bfbb5 | https://github.com/zeroclipboard/zeroclipboard/blob/09660421dd377fda5bd66ce9bb69c916470bfbb5/dist/ZeroClipboard.js#L1252-L1263 | train | |
zeroclipboard/zeroclipboard | dist/ZeroClipboard.js | function() {
var len, flashBridge = _flashState.bridge, container = _getHtmlBridge(flashBridge);
if (!flashBridge) {
var allowScriptAccess = _determineScriptAccess(_window.location.host, _globalConfig);
var allowNetworking = allowScriptAccess === "never" ? "none" : "all";
var flashvars = _vars... | javascript | function() {
var len, flashBridge = _flashState.bridge, container = _getHtmlBridge(flashBridge);
if (!flashBridge) {
var allowScriptAccess = _determineScriptAccess(_window.location.host, _globalConfig);
var allowNetworking = allowScriptAccess === "never" ? "none" : "all";
var flashvars = _vars... | [
"function",
"(",
")",
"{",
"var",
"len",
",",
"flashBridge",
"=",
"_flashState",
".",
"bridge",
",",
"container",
"=",
"_getHtmlBridge",
"(",
"flashBridge",
")",
";",
"if",
"(",
"!",
"flashBridge",
")",
"{",
"var",
"allowScriptAccess",
"=",
"_determineScript... | Create the SWF object.
@returns The SWF object reference.
@private | [
"Create",
"the",
"SWF",
"object",
"."
] | 09660421dd377fda5bd66ce9bb69c916470bfbb5 | https://github.com/zeroclipboard/zeroclipboard/blob/09660421dd377fda5bd66ce9bb69c916470bfbb5/dist/ZeroClipboard.js#L1311-L1347 | train | |
zeroclipboard/zeroclipboard | dist/ZeroClipboard.js | function() {
var flashBridge = _flashState.bridge;
if (flashBridge) {
var htmlBridge = _getHtmlBridge(flashBridge);
if (htmlBridge) {
if (_flashState.pluginType === "activex" && "readyState" in flashBridge) {
flashBridge.style.display = "none";
(function removeSwfFromIE()... | javascript | function() {
var flashBridge = _flashState.bridge;
if (flashBridge) {
var htmlBridge = _getHtmlBridge(flashBridge);
if (htmlBridge) {
if (_flashState.pluginType === "activex" && "readyState" in flashBridge) {
flashBridge.style.display = "none";
(function removeSwfFromIE()... | [
"function",
"(",
")",
"{",
"var",
"flashBridge",
"=",
"_flashState",
".",
"bridge",
";",
"if",
"(",
"flashBridge",
")",
"{",
"var",
"htmlBridge",
"=",
"_getHtmlBridge",
"(",
"flashBridge",
")",
";",
"if",
"(",
"htmlBridge",
")",
"{",
"if",
"(",
"_flashSt... | Destroy the SWF object.
@private | [
"Destroy",
"the",
"SWF",
"object",
"."
] | 09660421dd377fda5bd66ce9bb69c916470bfbb5 | https://github.com/zeroclipboard/zeroclipboard/blob/09660421dd377fda5bd66ce9bb69c916470bfbb5/dist/ZeroClipboard.js#L1352-L1392 | train | |
zeroclipboard/zeroclipboard | dist/ZeroClipboard.js | function(clipData) {
var newClipData = {}, formatMap = {};
if (!(typeof clipData === "object" && clipData)) {
return;
}
for (var dataFormat in clipData) {
if (dataFormat && _hasOwn.call(clipData, dataFormat) && typeof clipData[dataFormat] === "string" && clipData[dataFormat]) {
switc... | javascript | function(clipData) {
var newClipData = {}, formatMap = {};
if (!(typeof clipData === "object" && clipData)) {
return;
}
for (var dataFormat in clipData) {
if (dataFormat && _hasOwn.call(clipData, dataFormat) && typeof clipData[dataFormat] === "string" && clipData[dataFormat]) {
switc... | [
"function",
"(",
"clipData",
")",
"{",
"var",
"newClipData",
"=",
"{",
"}",
",",
"formatMap",
"=",
"{",
"}",
";",
"if",
"(",
"!",
"(",
"typeof",
"clipData",
"===",
"\"object\"",
"&&",
"clipData",
")",
")",
"{",
"return",
";",
"}",
"for",
"(",
"var"... | Map the data format names of the "clipData" to Flash-friendly names.
@returns A new transformed object.
@private | [
"Map",
"the",
"data",
"format",
"names",
"of",
"the",
"clipData",
"to",
"Flash",
"-",
"friendly",
"names",
"."
] | 09660421dd377fda5bd66ce9bb69c916470bfbb5 | https://github.com/zeroclipboard/zeroclipboard/blob/09660421dd377fda5bd66ce9bb69c916470bfbb5/dist/ZeroClipboard.js#L1399-L1442 | train | |
zeroclipboard/zeroclipboard | dist/ZeroClipboard.js | function(options) {
var i, len, domain, domains, str = "", trustedOriginsExpanded = [];
if (options.trustedDomains) {
if (typeof options.trustedDomains === "string") {
domains = [ options.trustedDomains ];
} else if (typeof options.trustedDomains === "object" && "length" in options.trustedDo... | javascript | function(options) {
var i, len, domain, domains, str = "", trustedOriginsExpanded = [];
if (options.trustedDomains) {
if (typeof options.trustedDomains === "string") {
domains = [ options.trustedDomains ];
} else if (typeof options.trustedDomains === "object" && "length" in options.trustedDo... | [
"function",
"(",
"options",
")",
"{",
"var",
"i",
",",
"len",
",",
"domain",
",",
"domains",
",",
"str",
"=",
"\"\"",
",",
"trustedOriginsExpanded",
"=",
"[",
"]",
";",
"if",
"(",
"options",
".",
"trustedDomains",
")",
"{",
"if",
"(",
"typeof",
"opti... | Creates a query string for the FlashVars param.
Does NOT include the cache-busting query param.
@returns FlashVars query string
@private | [
"Creates",
"a",
"query",
"string",
"for",
"the",
"FlashVars",
"param",
".",
"Does",
"NOT",
"include",
"the",
"cache",
"-",
"busting",
"query",
"param",
"."
] | 09660421dd377fda5bd66ce9bb69c916470bfbb5 | https://github.com/zeroclipboard/zeroclipboard/blob/09660421dd377fda5bd66ce9bb69c916470bfbb5/dist/ZeroClipboard.js#L1499-L1537 | train | |
zeroclipboard/zeroclipboard | dist/ZeroClipboard.js | function(element, value) {
var c, cl, className, classNames = [];
if (typeof value === "string" && value) {
classNames = value.split(/\s+/);
}
if (element && element.nodeType === 1 && classNames.length > 0) {
className = (" " + (element.className || "") + " ").replace(/[\t\r\n\f]/g, " ");
... | javascript | function(element, value) {
var c, cl, className, classNames = [];
if (typeof value === "string" && value) {
classNames = value.split(/\s+/);
}
if (element && element.nodeType === 1 && classNames.length > 0) {
className = (" " + (element.className || "") + " ").replace(/[\t\r\n\f]/g, " ");
... | [
"function",
"(",
"element",
",",
"value",
")",
"{",
"var",
"c",
",",
"cl",
",",
"className",
",",
"classNames",
"=",
"[",
"]",
";",
"if",
"(",
"typeof",
"value",
"===",
"\"string\"",
"&&",
"value",
")",
"{",
"classNames",
"=",
"value",
".",
"split",
... | Add a class to an element, if it doesn't already have it.
@returns The element, with its new class added.
@private | [
"Add",
"a",
"class",
"to",
"an",
"element",
"if",
"it",
"doesn",
"t",
"already",
"have",
"it",
"."
] | 09660421dd377fda5bd66ce9bb69c916470bfbb5 | https://github.com/zeroclipboard/zeroclipboard/blob/09660421dd377fda5bd66ce9bb69c916470bfbb5/dist/ZeroClipboard.js#L1631-L1649 | train | |
zeroclipboard/zeroclipboard | dist/ZeroClipboard.js | function(el) {
var pos = {
left: 0,
top: 0,
width: 0,
height: 0
};
if (el.getBoundingClientRect) {
var elRect = el.getBoundingClientRect();
var pageXOffset = _window.pageXOffset;
var pageYOffset = _window.pageYOffset;
var leftBorderWidth = _document.documentEl... | javascript | function(el) {
var pos = {
left: 0,
top: 0,
width: 0,
height: 0
};
if (el.getBoundingClientRect) {
var elRect = el.getBoundingClientRect();
var pageXOffset = _window.pageXOffset;
var pageYOffset = _window.pageYOffset;
var leftBorderWidth = _document.documentEl... | [
"function",
"(",
"el",
")",
"{",
"var",
"pos",
"=",
"{",
"left",
":",
"0",
",",
"top",
":",
"0",
",",
"width",
":",
"0",
",",
"height",
":",
"0",
"}",
";",
"if",
"(",
"el",
".",
"getBoundingClientRect",
")",
"{",
"var",
"elRect",
"=",
"el",
"... | Get the absolutely positioned coordinates of a DOM element.
@returns Object containing the element's position, width, and height.
@private | [
"Get",
"the",
"absolutely",
"positioned",
"coordinates",
"of",
"a",
"DOM",
"element",
"."
] | 09660421dd377fda5bd66ce9bb69c916470bfbb5 | https://github.com/zeroclipboard/zeroclipboard/blob/09660421dd377fda5bd66ce9bb69c916470bfbb5/dist/ZeroClipboard.js#L1700-L1727 | train | |
zeroclipboard/zeroclipboard | dist/ZeroClipboard.js | function() {
var htmlBridge;
if (_currentElement && (htmlBridge = _getHtmlBridge(_flashState.bridge))) {
var pos = _getElementPosition(_currentElement);
_extend(htmlBridge.style, {
width: pos.width + "px",
height: pos.height + "px",
top: pos.top + "px",
left: pos.left... | javascript | function() {
var htmlBridge;
if (_currentElement && (htmlBridge = _getHtmlBridge(_flashState.bridge))) {
var pos = _getElementPosition(_currentElement);
_extend(htmlBridge.style, {
width: pos.width + "px",
height: pos.height + "px",
top: pos.top + "px",
left: pos.left... | [
"function",
"(",
")",
"{",
"var",
"htmlBridge",
";",
"if",
"(",
"_currentElement",
"&&",
"(",
"htmlBridge",
"=",
"_getHtmlBridge",
"(",
"_flashState",
".",
"bridge",
")",
")",
")",
"{",
"var",
"pos",
"=",
"_getElementPosition",
"(",
"_currentElement",
")",
... | Reposition the Flash object to cover the currently activated element.
@returns `undefined`
@private | [
"Reposition",
"the",
"Flash",
"object",
"to",
"cover",
"the",
"currently",
"activated",
"element",
"."
] | 09660421dd377fda5bd66ce9bb69c916470bfbb5 | https://github.com/zeroclipboard/zeroclipboard/blob/09660421dd377fda5bd66ce9bb69c916470bfbb5/dist/ZeroClipboard.js#L1769-L1781 | train | |
zeroclipboard/zeroclipboard | dist/ZeroClipboard.js | function(enabled) {
if (_flashState.ready === true) {
if (_flashState.bridge && typeof _flashState.bridge.setHandCursor === "function") {
_flashState.bridge.setHandCursor(enabled);
} else {
_flashState.ready = false;
}
}
} | javascript | function(enabled) {
if (_flashState.ready === true) {
if (_flashState.bridge && typeof _flashState.bridge.setHandCursor === "function") {
_flashState.bridge.setHandCursor(enabled);
} else {
_flashState.ready = false;
}
}
} | [
"function",
"(",
"enabled",
")",
"{",
"if",
"(",
"_flashState",
".",
"ready",
"===",
"true",
")",
"{",
"if",
"(",
"_flashState",
".",
"bridge",
"&&",
"typeof",
"_flashState",
".",
"bridge",
".",
"setHandCursor",
"===",
"\"function\"",
")",
"{",
"_flashStat... | Sends a signal to the Flash object to display the hand cursor if `true`.
@returns `undefined`
@private | [
"Sends",
"a",
"signal",
"to",
"the",
"Flash",
"object",
"to",
"display",
"the",
"hand",
"cursor",
"if",
"true",
"."
] | 09660421dd377fda5bd66ce9bb69c916470bfbb5 | https://github.com/zeroclipboard/zeroclipboard/blob/09660421dd377fda5bd66ce9bb69c916470bfbb5/dist/ZeroClipboard.js#L1788-L1796 | train | |
zeroclipboard/zeroclipboard | dist/ZeroClipboard.js | function(val) {
if (/^(?:auto|inherit)$/.test(val)) {
return val;
}
var zIndex;
if (typeof val === "number" && !_isNaN(val)) {
zIndex = val;
} else if (typeof val === "string") {
zIndex = _getSafeZIndex(_parseInt(val, 10));
}
return typeof zIndex === "number" ? zIndex : "au... | javascript | function(val) {
if (/^(?:auto|inherit)$/.test(val)) {
return val;
}
var zIndex;
if (typeof val === "number" && !_isNaN(val)) {
zIndex = val;
} else if (typeof val === "string") {
zIndex = _getSafeZIndex(_parseInt(val, 10));
}
return typeof zIndex === "number" ? zIndex : "au... | [
"function",
"(",
"val",
")",
"{",
"if",
"(",
"/",
"^(?:auto|inherit)$",
"/",
".",
"test",
"(",
"val",
")",
")",
"{",
"return",
"val",
";",
"}",
"var",
"zIndex",
";",
"if",
"(",
"typeof",
"val",
"===",
"\"number\"",
"&&",
"!",
"_isNaN",
"(",
"val",
... | Get a safe value for `zIndex`
@returns an integer, or "auto"
@private | [
"Get",
"a",
"safe",
"value",
"for",
"zIndex"
] | 09660421dd377fda5bd66ce9bb69c916470bfbb5 | https://github.com/zeroclipboard/zeroclipboard/blob/09660421dd377fda5bd66ce9bb69c916470bfbb5/dist/ZeroClipboard.js#L1803-L1814 | train | |
zeroclipboard/zeroclipboard | dist/ZeroClipboard.js | function(content) {
var replaceRegex = /(\r\n|\r|\n)/g;
if (typeof content === "string" && _globalConfig.fixLineEndings === true) {
if (_isWindows()) {
if (/((^|[^\r])\n|\r([^\n]|$))/.test(content)) {
content = content.replace(replaceRegex, "\r\n");
}
} else if (/\r/.test(c... | javascript | function(content) {
var replaceRegex = /(\r\n|\r|\n)/g;
if (typeof content === "string" && _globalConfig.fixLineEndings === true) {
if (_isWindows()) {
if (/((^|[^\r])\n|\r([^\n]|$))/.test(content)) {
content = content.replace(replaceRegex, "\r\n");
}
} else if (/\r/.test(c... | [
"function",
"(",
"content",
")",
"{",
"var",
"replaceRegex",
"=",
"/",
"(\\r\\n|\\r|\\n)",
"/",
"g",
";",
"if",
"(",
"typeof",
"content",
"===",
"\"string\"",
"&&",
"_globalConfig",
".",
"fixLineEndings",
"===",
"true",
")",
"{",
"if",
"(",
"_isWindows",
"... | Ensure OS-compliant line endings, i.e. "\r\n" on Windows, "\n" elsewhere
@returns string
@private | [
"Ensure",
"OS",
"-",
"compliant",
"line",
"endings",
"i",
".",
"e",
".",
"\\",
"r",
"\\",
"n",
"on",
"Windows",
"\\",
"n",
"elsewhere"
] | 09660421dd377fda5bd66ce9bb69c916470bfbb5 | https://github.com/zeroclipboard/zeroclipboard/blob/09660421dd377fda5bd66ce9bb69c916470bfbb5/dist/ZeroClipboard.js#L1821-L1833 | train | |
zeroclipboard/zeroclipboard | dist/ZeroClipboard.js | function(doNotReassessFlashSupport) {
var effectiveScriptOrigin, frame, frameError, previousState = _flashState.sandboxed, isSandboxed = null;
doNotReassessFlashSupport = doNotReassessFlashSupport === true;
if (_pageIsFramed === false) {
isSandboxed = false;
} else {
try {
frame = wi... | javascript | function(doNotReassessFlashSupport) {
var effectiveScriptOrigin, frame, frameError, previousState = _flashState.sandboxed, isSandboxed = null;
doNotReassessFlashSupport = doNotReassessFlashSupport === true;
if (_pageIsFramed === false) {
isSandboxed = false;
} else {
try {
frame = wi... | [
"function",
"(",
"doNotReassessFlashSupport",
")",
"{",
"var",
"effectiveScriptOrigin",
",",
"frame",
",",
"frameError",
",",
"previousState",
"=",
"_flashState",
".",
"sandboxed",
",",
"isSandboxed",
"=",
"null",
";",
"doNotReassessFlashSupport",
"=",
"doNotReassessF... | Attempt to detect if ZeroClipboard is executing inside of a sandboxed iframe.
If it is, Flash Player cannot be used, so ZeroClipboard is dead in the water.
@see {@link http://lists.w3.org/Archives/Public/public-whatwg-archive/2014Dec/0002.html}
@see {@link https://github.com/zeroclipboard/zeroclipboard/issues/511}
@se... | [
"Attempt",
"to",
"detect",
"if",
"ZeroClipboard",
"is",
"executing",
"inside",
"of",
"a",
"sandboxed",
"iframe",
".",
"If",
"it",
"is",
"Flash",
"Player",
"cannot",
"be",
"used",
"so",
"ZeroClipboard",
"is",
"dead",
"in",
"the",
"water",
"."
] | 09660421dd377fda5bd66ce9bb69c916470bfbb5 | https://github.com/zeroclipboard/zeroclipboard/blob/09660421dd377fda5bd66ce9bb69c916470bfbb5/dist/ZeroClipboard.js#L1845-L1881 | train | |
zeroclipboard/zeroclipboard | dist/ZeroClipboard.js | parseFlashVersion | function parseFlashVersion(desc) {
var matches = desc.match(/[\d]+/g);
matches.length = 3;
return matches.join(".");
} | javascript | function parseFlashVersion(desc) {
var matches = desc.match(/[\d]+/g);
matches.length = 3;
return matches.join(".");
} | [
"function",
"parseFlashVersion",
"(",
"desc",
")",
"{",
"var",
"matches",
"=",
"desc",
".",
"match",
"(",
"/",
"[\\d]+",
"/",
"g",
")",
";",
"matches",
".",
"length",
"=",
"3",
";",
"return",
"matches",
".",
"join",
"(",
"\".\"",
")",
";",
"}"
] | Derived from Apple's suggested sniffer.
@param {String} desc e.g. "Shockwave Flash 7.0 r61"
@returns {String} "7.0.61"
@private | [
"Derived",
"from",
"Apple",
"s",
"suggested",
"sniffer",
"."
] | 09660421dd377fda5bd66ce9bb69c916470bfbb5 | https://github.com/zeroclipboard/zeroclipboard/blob/09660421dd377fda5bd66ce9bb69c916470bfbb5/dist/ZeroClipboard.js#L1899-L1903 | train |
zeroclipboard/zeroclipboard | dist/ZeroClipboard.js | function(elements) {
var meta, client = this;
client.id = "" + _clientIdCounter++;
meta = {
instance: client,
elements: [],
handlers: {},
coreWildcardHandler: function(event) {
return client.emit(event);
}
};
_clientMeta[client.id] = meta;
if (elements) {
... | javascript | function(elements) {
var meta, client = this;
client.id = "" + _clientIdCounter++;
meta = {
instance: client,
elements: [],
handlers: {},
coreWildcardHandler: function(event) {
return client.emit(event);
}
};
_clientMeta[client.id] = meta;
if (elements) {
... | [
"function",
"(",
"elements",
")",
"{",
"var",
"meta",
",",
"client",
"=",
"this",
";",
"client",
".",
"id",
"=",
"\"\"",
"+",
"_clientIdCounter",
"++",
";",
"meta",
"=",
"{",
"instance",
":",
"client",
",",
"elements",
":",
"[",
"]",
",",
"handlers",... | The real constructor for `ZeroClipboard` client instances.
@private | [
"The",
"real",
"constructor",
"for",
"ZeroClipboard",
"client",
"instances",
"."
] | 09660421dd377fda5bd66ce9bb69c916470bfbb5 | https://github.com/zeroclipboard/zeroclipboard/blob/09660421dd377fda5bd66ce9bb69c916470bfbb5/dist/ZeroClipboard.js#L2183-L2203 | train | |
zeroclipboard/zeroclipboard | dist/ZeroClipboard.js | function(eventType, listener) {
var i, len, events, added = {}, client = this, meta = _clientMeta[client.id], handlers = meta && meta.handlers;
if (!meta) {
throw new Error("Attempted to add new listener(s) to a destroyed ZeroClipboard client instance");
}
if (typeof eventType === "string" && even... | javascript | function(eventType, listener) {
var i, len, events, added = {}, client = this, meta = _clientMeta[client.id], handlers = meta && meta.handlers;
if (!meta) {
throw new Error("Attempted to add new listener(s) to a destroyed ZeroClipboard client instance");
}
if (typeof eventType === "string" && even... | [
"function",
"(",
"eventType",
",",
"listener",
")",
"{",
"var",
"i",
",",
"len",
",",
"events",
",",
"added",
"=",
"{",
"}",
",",
"client",
"=",
"this",
",",
"meta",
"=",
"_clientMeta",
"[",
"client",
".",
"id",
"]",
",",
"handlers",
"=",
"meta",
... | The underlying implementation of `ZeroClipboard.Client.prototype.on`.
@private | [
"The",
"underlying",
"implementation",
"of",
"ZeroClipboard",
".",
"Client",
".",
"prototype",
".",
"on",
"."
] | 09660421dd377fda5bd66ce9bb69c916470bfbb5 | https://github.com/zeroclipboard/zeroclipboard/blob/09660421dd377fda5bd66ce9bb69c916470bfbb5/dist/ZeroClipboard.js#L2208-L2260 | train | |
zeroclipboard/zeroclipboard | dist/ZeroClipboard.js | function(eventType, listener) {
var i, len, foundIndex, events, perEventHandlers, client = this, meta = _clientMeta[client.id], handlers = meta && meta.handlers;
if (!handlers) {
return client;
}
if (arguments.length === 0) {
events = _keys(handlers);
} else if (typeof eventType === "str... | javascript | function(eventType, listener) {
var i, len, foundIndex, events, perEventHandlers, client = this, meta = _clientMeta[client.id], handlers = meta && meta.handlers;
if (!handlers) {
return client;
}
if (arguments.length === 0) {
events = _keys(handlers);
} else if (typeof eventType === "str... | [
"function",
"(",
"eventType",
",",
"listener",
")",
"{",
"var",
"i",
",",
"len",
",",
"foundIndex",
",",
"events",
",",
"perEventHandlers",
",",
"client",
"=",
"this",
",",
"meta",
"=",
"_clientMeta",
"[",
"client",
".",
"id",
"]",
",",
"handlers",
"="... | The underlying implementation of `ZeroClipboard.Client.prototype.off`.
@private | [
"The",
"underlying",
"implementation",
"of",
"ZeroClipboard",
".",
"Client",
".",
"prototype",
".",
"off",
"."
] | 09660421dd377fda5bd66ce9bb69c916470bfbb5 | https://github.com/zeroclipboard/zeroclipboard/blob/09660421dd377fda5bd66ce9bb69c916470bfbb5/dist/ZeroClipboard.js#L2265-L2300 | train | |
zeroclipboard/zeroclipboard | dist/ZeroClipboard.js | function(eventType) {
var copy = null, handlers = _clientMeta[this.id] && _clientMeta[this.id].handlers;
if (handlers) {
if (typeof eventType === "string" && eventType) {
copy = handlers[eventType] ? handlers[eventType].slice(0) : [];
} else {
copy = _deepCopy(handlers);
}
... | javascript | function(eventType) {
var copy = null, handlers = _clientMeta[this.id] && _clientMeta[this.id].handlers;
if (handlers) {
if (typeof eventType === "string" && eventType) {
copy = handlers[eventType] ? handlers[eventType].slice(0) : [];
} else {
copy = _deepCopy(handlers);
}
... | [
"function",
"(",
"eventType",
")",
"{",
"var",
"copy",
"=",
"null",
",",
"handlers",
"=",
"_clientMeta",
"[",
"this",
".",
"id",
"]",
"&&",
"_clientMeta",
"[",
"this",
".",
"id",
"]",
".",
"handlers",
";",
"if",
"(",
"handlers",
")",
"{",
"if",
"("... | The underlying implementation of `ZeroClipboard.Client.prototype.handlers`.
@private | [
"The",
"underlying",
"implementation",
"of",
"ZeroClipboard",
".",
"Client",
".",
"prototype",
".",
"handlers",
"."
] | 09660421dd377fda5bd66ce9bb69c916470bfbb5 | https://github.com/zeroclipboard/zeroclipboard/blob/09660421dd377fda5bd66ce9bb69c916470bfbb5/dist/ZeroClipboard.js#L2305-L2315 | train | |
zeroclipboard/zeroclipboard | dist/ZeroClipboard.js | function(event) {
var eventCopy, client = this;
if (_clientShouldEmit.call(client, event)) {
if (typeof event === "object" && event && typeof event.type === "string" && event.type) {
event = _extend({}, event);
}
eventCopy = _extend({}, _createEvent(event), {
client: client
... | javascript | function(event) {
var eventCopy, client = this;
if (_clientShouldEmit.call(client, event)) {
if (typeof event === "object" && event && typeof event.type === "string" && event.type) {
event = _extend({}, event);
}
eventCopy = _extend({}, _createEvent(event), {
client: client
... | [
"function",
"(",
"event",
")",
"{",
"var",
"eventCopy",
",",
"client",
"=",
"this",
";",
"if",
"(",
"_clientShouldEmit",
".",
"call",
"(",
"client",
",",
"event",
")",
")",
"{",
"if",
"(",
"typeof",
"event",
"===",
"\"object\"",
"&&",
"event",
"&&",
... | The underlying implementation of `ZeroClipboard.Client.prototype.emit`.
@private | [
"The",
"underlying",
"implementation",
"of",
"ZeroClipboard",
".",
"Client",
".",
"prototype",
".",
"emit",
"."
] | 09660421dd377fda5bd66ce9bb69c916470bfbb5 | https://github.com/zeroclipboard/zeroclipboard/blob/09660421dd377fda5bd66ce9bb69c916470bfbb5/dist/ZeroClipboard.js#L2320-L2332 | train | |
zeroclipboard/zeroclipboard | dist/ZeroClipboard.js | function(elements) {
if (!_clientMeta[this.id]) {
throw new Error("Attempted to clip element(s) to a destroyed ZeroClipboard client instance");
}
elements = _prepClip(elements);
for (var i = 0; i < elements.length; i++) {
if (_hasOwn.call(elements, i) && elements[i] && elements[i].nodeType =... | javascript | function(elements) {
if (!_clientMeta[this.id]) {
throw new Error("Attempted to clip element(s) to a destroyed ZeroClipboard client instance");
}
elements = _prepClip(elements);
for (var i = 0; i < elements.length; i++) {
if (_hasOwn.call(elements, i) && elements[i] && elements[i].nodeType =... | [
"function",
"(",
"elements",
")",
"{",
"if",
"(",
"!",
"_clientMeta",
"[",
"this",
".",
"id",
"]",
")",
"{",
"throw",
"new",
"Error",
"(",
"\"Attempted to clip element(s) to a destroyed ZeroClipboard client instance\"",
")",
";",
"}",
"elements",
"=",
"_prepClip",... | The underlying implementation of `ZeroClipboard.Client.prototype.clip`.
@private | [
"The",
"underlying",
"implementation",
"of",
"ZeroClipboard",
".",
"Client",
".",
"prototype",
".",
"clip",
"."
] | 09660421dd377fda5bd66ce9bb69c916470bfbb5 | https://github.com/zeroclipboard/zeroclipboard/blob/09660421dd377fda5bd66ce9bb69c916470bfbb5/dist/ZeroClipboard.js#L2337-L2360 | train | |
zeroclipboard/zeroclipboard | dist/ZeroClipboard.js | function(elements) {
var meta = _clientMeta[this.id];
if (!meta) {
return this;
}
var clippedElements = meta.elements;
var arrayIndex;
if (typeof elements === "undefined") {
elements = clippedElements.slice(0);
} else {
elements = _prepClip(elements);
}
for (var i =... | javascript | function(elements) {
var meta = _clientMeta[this.id];
if (!meta) {
return this;
}
var clippedElements = meta.elements;
var arrayIndex;
if (typeof elements === "undefined") {
elements = clippedElements.slice(0);
} else {
elements = _prepClip(elements);
}
for (var i =... | [
"function",
"(",
"elements",
")",
"{",
"var",
"meta",
"=",
"_clientMeta",
"[",
"this",
".",
"id",
"]",
";",
"if",
"(",
"!",
"meta",
")",
"{",
"return",
"this",
";",
"}",
"var",
"clippedElements",
"=",
"meta",
".",
"elements",
";",
"var",
"arrayIndex"... | The underlying implementation of `ZeroClipboard.Client.prototype.unclip`.
@private | [
"The",
"underlying",
"implementation",
"of",
"ZeroClipboard",
".",
"Client",
".",
"prototype",
".",
"unclip",
"."
] | 09660421dd377fda5bd66ce9bb69c916470bfbb5 | https://github.com/zeroclipboard/zeroclipboard/blob/09660421dd377fda5bd66ce9bb69c916470bfbb5/dist/ZeroClipboard.js#L2365-L2399 | train | |
zeroclipboard/zeroclipboard | dist/ZeroClipboard.js | function() {
var meta = _clientMeta[this.id];
if (!meta) {
return;
}
this.unclip();
this.off();
ZeroClipboard.off("*", meta.coreWildcardHandler);
delete _clientMeta[this.id];
} | javascript | function() {
var meta = _clientMeta[this.id];
if (!meta) {
return;
}
this.unclip();
this.off();
ZeroClipboard.off("*", meta.coreWildcardHandler);
delete _clientMeta[this.id];
} | [
"function",
"(",
")",
"{",
"var",
"meta",
"=",
"_clientMeta",
"[",
"this",
".",
"id",
"]",
";",
"if",
"(",
"!",
"meta",
")",
"{",
"return",
";",
"}",
"this",
".",
"unclip",
"(",
")",
";",
"this",
".",
"off",
"(",
")",
";",
"ZeroClipboard",
".",... | The underlying implementation of `ZeroClipboard.Client.prototype.destroy`.
@private | [
"The",
"underlying",
"implementation",
"of",
"ZeroClipboard",
".",
"Client",
".",
"prototype",
".",
"destroy",
"."
] | 09660421dd377fda5bd66ce9bb69c916470bfbb5 | https://github.com/zeroclipboard/zeroclipboard/blob/09660421dd377fda5bd66ce9bb69c916470bfbb5/dist/ZeroClipboard.js#L2412-L2421 | train | |
zeroclipboard/zeroclipboard | dist/ZeroClipboard.js | function(event) {
var meta = _clientMeta[this.id];
if (!(typeof event === "object" && event && event.type && meta)) {
return;
}
var async = _shouldPerformAsync(event);
var wildcardTypeHandlers = meta && meta.handlers["*"] || [];
var specificTypeHandlers = meta && meta.handlers[event.type] ... | javascript | function(event) {
var meta = _clientMeta[this.id];
if (!(typeof event === "object" && event && event.type && meta)) {
return;
}
var async = _shouldPerformAsync(event);
var wildcardTypeHandlers = meta && meta.handlers["*"] || [];
var specificTypeHandlers = meta && meta.handlers[event.type] ... | [
"function",
"(",
"event",
")",
"{",
"var",
"meta",
"=",
"_clientMeta",
"[",
"this",
".",
"id",
"]",
";",
"if",
"(",
"!",
"(",
"typeof",
"event",
"===",
"\"object\"",
"&&",
"event",
"&&",
"event",
".",
"type",
"&&",
"meta",
")",
")",
"{",
"return",
... | Handle the actual dispatching of events to a client instance.
@returns `undefined`
@private | [
"Handle",
"the",
"actual",
"dispatching",
"of",
"events",
"to",
"a",
"client",
"instance",
"."
] | 09660421dd377fda5bd66ce9bb69c916470bfbb5 | https://github.com/zeroclipboard/zeroclipboard/blob/09660421dd377fda5bd66ce9bb69c916470bfbb5/dist/ZeroClipboard.js#L2450-L2477 | train | |
zeroclipboard/zeroclipboard | dist/ZeroClipboard.js | function(element) {
if (!(element && element.nodeType === 1)) {
return;
}
var _suppressMouseEvents = function(event) {
if (!(event || (event = _window.event))) {
return;
}
if (event._source !== "js") {
event.stopImmediatePropagation();
event.preventDefault();
... | javascript | function(element) {
if (!(element && element.nodeType === 1)) {
return;
}
var _suppressMouseEvents = function(event) {
if (!(event || (event = _window.event))) {
return;
}
if (event._source !== "js") {
event.stopImmediatePropagation();
event.preventDefault();
... | [
"function",
"(",
"element",
")",
"{",
"if",
"(",
"!",
"(",
"element",
"&&",
"element",
".",
"nodeType",
"===",
"1",
")",
")",
"{",
"return",
";",
"}",
"var",
"_suppressMouseEvents",
"=",
"function",
"(",
"event",
")",
"{",
"if",
"(",
"!",
"(",
"eve... | Add a `mouseover` handler function for a clipped element.
@returns `undefined`
@private | [
"Add",
"a",
"mouseover",
"handler",
"function",
"for",
"a",
"clipped",
"element",
"."
] | 09660421dd377fda5bd66ce9bb69c916470bfbb5 | https://github.com/zeroclipboard/zeroclipboard/blob/09660421dd377fda5bd66ce9bb69c916470bfbb5/dist/ZeroClipboard.js#L2496-L2529 | train | |
zeroclipboard/zeroclipboard | dist/ZeroClipboard.js | function(element) {
if (!(element && element.nodeType === 1)) {
return;
}
var mouseHandlers = _mouseHandlers[element.zcClippingId];
if (!(typeof mouseHandlers === "object" && mouseHandlers)) {
return;
}
var key, val, mouseEvents = [ "move", "leave", "enter", "out", "over" ];
for ... | javascript | function(element) {
if (!(element && element.nodeType === 1)) {
return;
}
var mouseHandlers = _mouseHandlers[element.zcClippingId];
if (!(typeof mouseHandlers === "object" && mouseHandlers)) {
return;
}
var key, val, mouseEvents = [ "move", "leave", "enter", "out", "over" ];
for ... | [
"function",
"(",
"element",
")",
"{",
"if",
"(",
"!",
"(",
"element",
"&&",
"element",
".",
"nodeType",
"===",
"1",
")",
")",
"{",
"return",
";",
"}",
"var",
"mouseHandlers",
"=",
"_mouseHandlers",
"[",
"element",
".",
"zcClippingId",
"]",
";",
"if",
... | Remove a `mouseover` handler function for a clipped element.
@returns `undefined`
@private | [
"Remove",
"a",
"mouseover",
"handler",
"function",
"for",
"a",
"clipped",
"element",
"."
] | 09660421dd377fda5bd66ce9bb69c916470bfbb5 | https://github.com/zeroclipboard/zeroclipboard/blob/09660421dd377fda5bd66ce9bb69c916470bfbb5/dist/ZeroClipboard.js#L2536-L2553 | train | |
whitedogg13/react-native-nfc-manager | ndef-lib/ndef-text.js | decode | function decode(data) {
var languageCodeLength = (data[0] & 0x3F), // 6 LSBs
languageCode = data.slice(1, 1 + languageCodeLength),
utf16 = (data[0] & 0x80) !== 0; // assuming UTF-16BE
// TODO need to deal with UTF in the future
// console.log("lang " + languageCode + (utf16 ? " utf16" : " ... | javascript | function decode(data) {
var languageCodeLength = (data[0] & 0x3F), // 6 LSBs
languageCode = data.slice(1, 1 + languageCodeLength),
utf16 = (data[0] & 0x80) !== 0; // assuming UTF-16BE
// TODO need to deal with UTF in the future
// console.log("lang " + languageCode + (utf16 ? " utf16" : " ... | [
"function",
"decode",
"(",
"data",
")",
"{",
"var",
"languageCodeLength",
"=",
"(",
"data",
"[",
"0",
"]",
"&",
"0x3F",
")",
",",
"// 6 LSBs",
"languageCode",
"=",
"data",
".",
"slice",
"(",
"1",
",",
"1",
"+",
"languageCodeLength",
")",
",",
"utf16",
... | decode text bytes from ndef record payload @returns a string | [
"decode",
"text",
"bytes",
"from",
"ndef",
"record",
"payload"
] | 77ad9a17be20c89e0a45956870c4e9d732981dee | https://github.com/whitedogg13/react-native-nfc-manager/blob/77ad9a17be20c89e0a45956870c4e9d732981dee/ndef-lib/ndef-text.js#L5-L15 | train |
whitedogg13/react-native-nfc-manager | ndef-lib/ndef-text.js | encode | function encode(text, lang, encoding) {
// ISO/IANA language code, but we're not enforcing
if (!lang) { lang = 'en'; }
var encoded = util.stringToBytes(lang + text);
encoded.unshift(lang.length);
return encoded;
} | javascript | function encode(text, lang, encoding) {
// ISO/IANA language code, but we're not enforcing
if (!lang) { lang = 'en'; }
var encoded = util.stringToBytes(lang + text);
encoded.unshift(lang.length);
return encoded;
} | [
"function",
"encode",
"(",
"text",
",",
"lang",
",",
"encoding",
")",
"{",
"// ISO/IANA language code, but we're not enforcing",
"if",
"(",
"!",
"lang",
")",
"{",
"lang",
"=",
"'en'",
";",
"}",
"var",
"encoded",
"=",
"util",
".",
"stringToBytes",
"(",
"lang"... | encode text payload @returns an array of bytes | [
"encode",
"text",
"payload"
] | 77ad9a17be20c89e0a45956870c4e9d732981dee | https://github.com/whitedogg13/react-native-nfc-manager/blob/77ad9a17be20c89e0a45956870c4e9d732981dee/ndef-lib/ndef-text.js#L19-L28 | train |
whitedogg13/react-native-nfc-manager | ndef-lib/index.js | function (text, languageCode, id) {
var payload = textHelper.encodePayload(text, languageCode);
if (!id) { id = []; }
return ndef.record(ndef.TNF_WELL_KNOWN, ndef.RTD_TEXT, id, payload);
} | javascript | function (text, languageCode, id) {
var payload = textHelper.encodePayload(text, languageCode);
if (!id) { id = []; }
return ndef.record(ndef.TNF_WELL_KNOWN, ndef.RTD_TEXT, id, payload);
} | [
"function",
"(",
"text",
",",
"languageCode",
",",
"id",
")",
"{",
"var",
"payload",
"=",
"textHelper",
".",
"encodePayload",
"(",
"text",
",",
"languageCode",
")",
";",
"if",
"(",
"!",
"id",
")",
"{",
"id",
"=",
"[",
"]",
";",
"}",
"return",
"ndef... | Helper that creates an NDEF record containing plain text.
@text String of text to encode
@languageCode ISO/IANA language code. Examples: “fi”, “en-US”, “fr-CA”, “jp”. (optional)
@id byte[] (optional) | [
"Helper",
"that",
"creates",
"an",
"NDEF",
"record",
"containing",
"plain",
"text",
"."
] | 77ad9a17be20c89e0a45956870c4e9d732981dee | https://github.com/whitedogg13/react-native-nfc-manager/blob/77ad9a17be20c89e0a45956870c4e9d732981dee/ndef-lib/index.js#L96-L101 | train | |
whitedogg13/react-native-nfc-manager | ndef-lib/index.js | function (uri, id) {
var payload = uriHelper.encodePayload(uri);
if (!id) { id = []; }
return ndef.record(ndef.TNF_WELL_KNOWN, ndef.RTD_URI, id, payload);
} | javascript | function (uri, id) {
var payload = uriHelper.encodePayload(uri);
if (!id) { id = []; }
return ndef.record(ndef.TNF_WELL_KNOWN, ndef.RTD_URI, id, payload);
} | [
"function",
"(",
"uri",
",",
"id",
")",
"{",
"var",
"payload",
"=",
"uriHelper",
".",
"encodePayload",
"(",
"uri",
")",
";",
"if",
"(",
"!",
"id",
")",
"{",
"id",
"=",
"[",
"]",
";",
"}",
"return",
"ndef",
".",
"record",
"(",
"ndef",
".",
"TNF_... | Helper that creates a NDEF record containing a URI.
@uri String
@id byte[] (optional) | [
"Helper",
"that",
"creates",
"a",
"NDEF",
"record",
"containing",
"a",
"URI",
"."
] | 77ad9a17be20c89e0a45956870c4e9d732981dee | https://github.com/whitedogg13/react-native-nfc-manager/blob/77ad9a17be20c89e0a45956870c4e9d732981dee/ndef-lib/index.js#L109-L113 | train | |
whitedogg13/react-native-nfc-manager | ndef-lib/index.js | function (uri, payload, id) {
if (!id) { id = []; }
if (!payload) { payload = []; }
return ndef.record(ndef.TNF_ABSOLUTE_URI, uri, id, payload);
} | javascript | function (uri, payload, id) {
if (!id) { id = []; }
if (!payload) { payload = []; }
return ndef.record(ndef.TNF_ABSOLUTE_URI, uri, id, payload);
} | [
"function",
"(",
"uri",
",",
"payload",
",",
"id",
")",
"{",
"if",
"(",
"!",
"id",
")",
"{",
"id",
"=",
"[",
"]",
";",
"}",
"if",
"(",
"!",
"payload",
")",
"{",
"payload",
"=",
"[",
"]",
";",
"}",
"return",
"ndef",
".",
"record",
"(",
"ndef... | Helper that creates a NDEF record containing an absolute URI.
An Absolute URI record means the URI describes the payload of the record.
For example a SOAP message could use "http://schemas.xmlsoap.org/soap/envelope/"
as the type and XML content for the payload.
Absolute URI can also be used to write LaunchApp record... | [
"Helper",
"that",
"creates",
"a",
"NDEF",
"record",
"containing",
"an",
"absolute",
"URI",
"."
] | 77ad9a17be20c89e0a45956870c4e9d732981dee | https://github.com/whitedogg13/react-native-nfc-manager/blob/77ad9a17be20c89e0a45956870c4e9d732981dee/ndef-lib/index.js#L138-L142 | train | |
whitedogg13/react-native-nfc-manager | ndef-lib/index.js | function (mimeType, payload, id) {
if (!id) { id = []; }
return ndef.record(ndef.TNF_MIME_MEDIA, mimeType, id, payload);
} | javascript | function (mimeType, payload, id) {
if (!id) { id = []; }
return ndef.record(ndef.TNF_MIME_MEDIA, mimeType, id, payload);
} | [
"function",
"(",
"mimeType",
",",
"payload",
",",
"id",
")",
"{",
"if",
"(",
"!",
"id",
")",
"{",
"id",
"=",
"[",
"]",
";",
"}",
"return",
"ndef",
".",
"record",
"(",
"ndef",
".",
"TNF_MIME_MEDIA",
",",
"mimeType",
",",
"id",
",",
"payload",
")",... | Helper that creates a NDEF record containing an mimeMediaRecord.
@mimeType String
@payload byte[]
@id byte[] (optional) | [
"Helper",
"that",
"creates",
"a",
"NDEF",
"record",
"containing",
"an",
"mimeMediaRecord",
"."
] | 77ad9a17be20c89e0a45956870c4e9d732981dee | https://github.com/whitedogg13/react-native-nfc-manager/blob/77ad9a17be20c89e0a45956870c4e9d732981dee/ndef-lib/index.js#L151-L154 | train | |
whitedogg13/react-native-nfc-manager | ndef-lib/index.js | function (ndefRecords, id) {
var payload = [];
if (!id) { id = []; }
if (ndefRecords)
{
// make sure we have an array of something like NDEF records before encoding
if (ndefRecords[0] instanceof Object && ndefRecords[0].hasOwnProperty('tnf')) {
p... | javascript | function (ndefRecords, id) {
var payload = [];
if (!id) { id = []; }
if (ndefRecords)
{
// make sure we have an array of something like NDEF records before encoding
if (ndefRecords[0] instanceof Object && ndefRecords[0].hasOwnProperty('tnf')) {
p... | [
"function",
"(",
"ndefRecords",
",",
"id",
")",
"{",
"var",
"payload",
"=",
"[",
"]",
";",
"if",
"(",
"!",
"id",
")",
"{",
"id",
"=",
"[",
"]",
";",
"}",
"if",
"(",
"ndefRecords",
")",
"{",
"// make sure we have an array of something like NDEF records befo... | Helper that creates an NDEF record containing an Smart Poster.
@ndefRecords array of NDEF Records
@id byte[] (optional) | [
"Helper",
"that",
"creates",
"an",
"NDEF",
"record",
"containing",
"an",
"Smart",
"Poster",
"."
] | 77ad9a17be20c89e0a45956870c4e9d732981dee | https://github.com/whitedogg13/react-native-nfc-manager/blob/77ad9a17be20c89e0a45956870c4e9d732981dee/ndef-lib/index.js#L162-L181 | train | |
whitedogg13/react-native-nfc-manager | ndef-lib/index.js | function (ndefRecords) {
var encoded = [],
tnf_byte,
record_type,
payload_length,
id_length,
i,
mb, me, // messageBegin, messageEnd
cf = false, // chunkFlag TODO implement
sr, // boolean shortRecord
il; ... | javascript | function (ndefRecords) {
var encoded = [],
tnf_byte,
record_type,
payload_length,
id_length,
i,
mb, me, // messageBegin, messageEnd
cf = false, // chunkFlag TODO implement
sr, // boolean shortRecord
il; ... | [
"function",
"(",
"ndefRecords",
")",
"{",
"var",
"encoded",
"=",
"[",
"]",
",",
"tnf_byte",
",",
"record_type",
",",
"payload_length",
",",
"id_length",
",",
"i",
",",
"mb",
",",
"me",
",",
"// messageBegin, messageEnd",
"cf",
"=",
"false",
",",
"// chunkF... | Encodes an NDEF Message into bytes that can be written to a NFC tag.
@ndefRecords an Array of NDEF Records
@returns byte array
@see NFC Data Exchange Format (NDEF) http://www.nfc-forum.org/specs/spec_list/ | [
"Encodes",
"an",
"NDEF",
"Message",
"into",
"bytes",
"that",
"can",
"be",
"written",
"to",
"a",
"NFC",
"tag",
"."
] | 77ad9a17be20c89e0a45956870c4e9d732981dee | https://github.com/whitedogg13/react-native-nfc-manager/blob/77ad9a17be20c89e0a45956870c4e9d732981dee/ndef-lib/index.js#L210-L263 | train | |
whitedogg13/react-native-nfc-manager | ndef-lib/index.js | function (ndefBytes) {
// ndefBytes can be an array of bytes e.g. [0x03, 0x31, 0xd1] or a Buffer
var bytes;
// if (ndefBytes instanceof Buffer) {
// // get an array of bytes
// bytes = Array.prototype.slice.call(ndefBytes, 0);
// } else if (ndefBytes instanceof A... | javascript | function (ndefBytes) {
// ndefBytes can be an array of bytes e.g. [0x03, 0x31, 0xd1] or a Buffer
var bytes;
// if (ndefBytes instanceof Buffer) {
// // get an array of bytes
// bytes = Array.prototype.slice.call(ndefBytes, 0);
// } else if (ndefBytes instanceof A... | [
"function",
"(",
"ndefBytes",
")",
"{",
"// ndefBytes can be an array of bytes e.g. [0x03, 0x31, 0xd1] or a Buffer",
"var",
"bytes",
";",
"// if (ndefBytes instanceof Buffer) {",
"// // get an array of bytes",
"// bytes = Array.prototype.slice.call(ndefBytes, 0);",
"// } else if (nde... | Decodes an array bytes into an NDEF Message
@ndefBytes an array bytes or Buffer that was read from a NFC tag
@returns array of NDEF Records
@see NFC Data Exchange Format (NDEF) http://www.nfc-forum.org/specs/spec_list/ | [
"Decodes",
"an",
"array",
"bytes",
"into",
"an",
"NDEF",
"Message"
] | 77ad9a17be20c89e0a45956870c4e9d732981dee | https://github.com/whitedogg13/react-native-nfc-manager/blob/77ad9a17be20c89e0a45956870c4e9d732981dee/ndef-lib/index.js#L274-L330 | train | |
whitedogg13/react-native-nfc-manager | ndef-lib/index.js | function (tnf_byte) {
return {
mb: (tnf_byte & 0x80) !== 0,
me: (tnf_byte & 0x40) !== 0,
cf: (tnf_byte & 0x20) !== 0,
sr: (tnf_byte & 0x10) !== 0,
il: (tnf_byte & 0x8) !== 0,
tnf: (tnf_byte & 0x7)
};
} | javascript | function (tnf_byte) {
return {
mb: (tnf_byte & 0x80) !== 0,
me: (tnf_byte & 0x40) !== 0,
cf: (tnf_byte & 0x20) !== 0,
sr: (tnf_byte & 0x10) !== 0,
il: (tnf_byte & 0x8) !== 0,
tnf: (tnf_byte & 0x7)
};
} | [
"function",
"(",
"tnf_byte",
")",
"{",
"return",
"{",
"mb",
":",
"(",
"tnf_byte",
"&",
"0x80",
")",
"!==",
"0",
",",
"me",
":",
"(",
"tnf_byte",
"&",
"0x40",
")",
"!==",
"0",
",",
"cf",
":",
"(",
"tnf_byte",
"&",
"0x20",
")",
"!==",
"0",
",",
... | Decode the bit flags from a TNF Byte.
@returns object with decoded data
See NFC Data Exchange Format (NDEF) Specification Section 3.2 RecordLayout | [
"Decode",
"the",
"bit",
"flags",
"from",
"a",
"TNF",
"Byte",
"."
] | 77ad9a17be20c89e0a45956870c4e9d732981dee | https://github.com/whitedogg13/react-native-nfc-manager/blob/77ad9a17be20c89e0a45956870c4e9d732981dee/ndef-lib/index.js#L339-L348 | train | |
whitedogg13/react-native-nfc-manager | ndef-lib/index.js | function (mb, me, cf, sr, il, tnf) {
var value = tnf;
if (mb) {
value = value | 0x80;
}
if (me) {
value = value | 0x40;
}
// note if cf: me, mb, li must be false and tnf must be 0x6
if (cf) {
value = value | 0x20;
}
... | javascript | function (mb, me, cf, sr, il, tnf) {
var value = tnf;
if (mb) {
value = value | 0x80;
}
if (me) {
value = value | 0x40;
}
// note if cf: me, mb, li must be false and tnf must be 0x6
if (cf) {
value = value | 0x20;
}
... | [
"function",
"(",
"mb",
",",
"me",
",",
"cf",
",",
"sr",
",",
"il",
",",
"tnf",
")",
"{",
"var",
"value",
"=",
"tnf",
";",
"if",
"(",
"mb",
")",
"{",
"value",
"=",
"value",
"|",
"0x80",
";",
"}",
"if",
"(",
"me",
")",
"{",
"value",
"=",
"v... | Encode NDEF bit flags into a TNF Byte.
@returns tnf byte
See NFC Data Exchange Format (NDEF) Specification Section 3.2 RecordLayout | [
"Encode",
"NDEF",
"bit",
"flags",
"into",
"a",
"TNF",
"Byte",
"."
] | 77ad9a17be20c89e0a45956870c4e9d732981dee | https://github.com/whitedogg13/react-native-nfc-manager/blob/77ad9a17be20c89e0a45956870c4e9d732981dee/ndef-lib/index.js#L357-L383 | train | |
whitedogg13/react-native-nfc-manager | ndef-lib/index.js | s | function s(bytes) {
if (typeof(bytes) === 'string') {
return bytes;
}
return bytes.reduce(function (acc, byte) {
return acc + String.fromCharCode(byte);
}, '')
// return new Buffer(bytes).toString();
} | javascript | function s(bytes) {
if (typeof(bytes) === 'string') {
return bytes;
}
return bytes.reduce(function (acc, byte) {
return acc + String.fromCharCode(byte);
}, '')
// return new Buffer(bytes).toString();
} | [
"function",
"s",
"(",
"bytes",
")",
"{",
"if",
"(",
"typeof",
"(",
"bytes",
")",
"===",
"'string'",
")",
"{",
"return",
"bytes",
";",
"}",
"return",
"bytes",
".",
"reduce",
"(",
"function",
"(",
"acc",
",",
"byte",
")",
"{",
"return",
"acc",
"+",
... | convert bytes to a String | [
"convert",
"bytes",
"to",
"a",
"String"
] | 77ad9a17be20c89e0a45956870c4e9d732981dee | https://github.com/whitedogg13/react-native-nfc-manager/blob/77ad9a17be20c89e0a45956870c4e9d732981dee/ndef-lib/index.js#L552-L561 | train |
whitedogg13/react-native-nfc-manager | ndef-lib/ndef-uri.js | decode | function decode(data) {
var prefix = protocols[data[0]];
if (!prefix) { // 36 to 255 should be ""
prefix = "";
}
return prefix + util.bytesToString(data.slice(1));
} | javascript | function decode(data) {
var prefix = protocols[data[0]];
if (!prefix) { // 36 to 255 should be ""
prefix = "";
}
return prefix + util.bytesToString(data.slice(1));
} | [
"function",
"decode",
"(",
"data",
")",
"{",
"var",
"prefix",
"=",
"protocols",
"[",
"data",
"[",
"0",
"]",
"]",
";",
"if",
"(",
"!",
"prefix",
")",
"{",
"// 36 to 255 should be \"\"",
"prefix",
"=",
"\"\"",
";",
"}",
"return",
"prefix",
"+",
"util",
... | decode a URI payload bytes @returns a string | [
"decode",
"a",
"URI",
"payload",
"bytes"
] | 77ad9a17be20c89e0a45956870c4e9d732981dee | https://github.com/whitedogg13/react-native-nfc-manager/blob/77ad9a17be20c89e0a45956870c4e9d732981dee/ndef-lib/ndef-uri.js#L9-L15 | train |
whitedogg13/react-native-nfc-manager | ndef-lib/ndef-uri.js | encode | function encode(uri) {
var prefix,
protocolCode,
encoded;
// check each protocol, unless we've found a match
// "urn:" is the one exception where we need to keep checking
// slice so we don't check ""
protocols.slice(1).forEach(function(protocol) {
... | javascript | function encode(uri) {
var prefix,
protocolCode,
encoded;
// check each protocol, unless we've found a match
// "urn:" is the one exception where we need to keep checking
// slice so we don't check ""
protocols.slice(1).forEach(function(protocol) {
... | [
"function",
"encode",
"(",
"uri",
")",
"{",
"var",
"prefix",
",",
"protocolCode",
",",
"encoded",
";",
"// check each protocol, unless we've found a match",
"// \"urn:\" is the one exception where we need to keep checking",
"// slice so we don't check \"\"",
"protocols",
".",
"sl... | shorten a URI with standard prefix @returns an array of bytes | [
"shorten",
"a",
"URI",
"with",
"standard",
"prefix"
] | 77ad9a17be20c89e0a45956870c4e9d732981dee | https://github.com/whitedogg13/react-native-nfc-manager/blob/77ad9a17be20c89e0a45956870c4e9d732981dee/ndef-lib/ndef-uri.js#L19-L44 | train |
whitedogg13/react-native-nfc-manager | ndef-lib/ndef-util.js | bytesToHexString | function bytesToHexString(bytes) {
var dec, hexstring, bytesAsHexString = "";
for (var i = 0; i < bytes.length; i++) {
if (bytes[i] >= 0) {
dec = bytes[i];
} else {
dec = 256 + bytes[i];
}
hexstring = dec.toString(16);
// zero padding
if (hexstring... | javascript | function bytesToHexString(bytes) {
var dec, hexstring, bytesAsHexString = "";
for (var i = 0; i < bytes.length; i++) {
if (bytes[i] >= 0) {
dec = bytes[i];
} else {
dec = 256 + bytes[i];
}
hexstring = dec.toString(16);
// zero padding
if (hexstring... | [
"function",
"bytesToHexString",
"(",
"bytes",
")",
"{",
"var",
"dec",
",",
"hexstring",
",",
"bytesAsHexString",
"=",
"\"\"",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"bytes",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"bytes"... | useful for readable version of Tag UID | [
"useful",
"for",
"readable",
"version",
"of",
"Tag",
"UID"
] | 77ad9a17be20c89e0a45956870c4e9d732981dee | https://github.com/whitedogg13/react-native-nfc-manager/blob/77ad9a17be20c89e0a45956870c4e9d732981dee/ndef-lib/ndef-util.js#L89-L105 | train |
whitedogg13/react-native-nfc-manager | ndef-lib/ndef-util.js | toHex | function toHex(i) {
var hex;
if (i < 0) {
i += 256;
}
hex = i.toString(16);
// zero padding
if (hex.length == 1) {
hex = "0" + hex;
}
return hex;
} | javascript | function toHex(i) {
var hex;
if (i < 0) {
i += 256;
}
hex = i.toString(16);
// zero padding
if (hex.length == 1) {
hex = "0" + hex;
}
return hex;
} | [
"function",
"toHex",
"(",
"i",
")",
"{",
"var",
"hex",
";",
"if",
"(",
"i",
"<",
"0",
")",
"{",
"i",
"+=",
"256",
";",
"}",
"hex",
"=",
"i",
".",
"toString",
"(",
"16",
")",
";",
"// zero padding",
"if",
"(",
"hex",
".",
"length",
"==",
"1",
... | i must be <= 256 | [
"i",
"must",
"be",
"<",
"=",
"256"
] | 77ad9a17be20c89e0a45956870c4e9d732981dee | https://github.com/whitedogg13/react-native-nfc-manager/blob/77ad9a17be20c89e0a45956870c4e9d732981dee/ndef-lib/ndef-util.js#L108-L121 | train |
auth0/auth0.js | src/authentication/index.js | Authentication | function Authentication(auth0, options) {
// If we have two arguments, the first one is a WebAuth instance, so we assign that
// if not, it's an options object and then we should use that as options instead
// this is here because we don't want to break people coming from v8
if (arguments.length === 2) {
th... | javascript | function Authentication(auth0, options) {
// If we have two arguments, the first one is a WebAuth instance, so we assign that
// if not, it's an options object and then we should use that as options instead
// this is here because we don't want to break people coming from v8
if (arguments.length === 2) {
th... | [
"function",
"Authentication",
"(",
"auth0",
",",
"options",
")",
"{",
"// If we have two arguments, the first one is a WebAuth instance, so we assign that",
"// if not, it's an options object and then we should use that as options instead",
"// this is here because we don't want to break people ... | Creates a new Auth0 Authentication API client
@constructor
@param {Object} options
@param {String} options.domain your Auth0 domain
@param {String} options.clientID the Client ID found on your Application settings page
@param {String} [options.redirectUri] url that the Auth0 will redirect after Auth with the Authorizat... | [
"Creates",
"a",
"new",
"Auth0",
"Authentication",
"API",
"client"
] | c9861c406946c22904250a69a0fddaa04c679850 | https://github.com/auth0/auth0.js/blob/c9861c406946c22904250a69a0fddaa04c679850/src/authentication/index.js#L29-L85 | train |
fperucic/treant-js | vendor/perfect-scrollbar/perfect-scrollbar.js | function() {
var applyTouchMove = function(difference_x, difference_y) {
$this.scrollTop($this.scrollTop() - difference_y);
$this.scrollLeft($this.scrollLeft() - difference_x);
// update bar position
updateBarSizeAndPosition();
};
... | javascript | function() {
var applyTouchMove = function(difference_x, difference_y) {
$this.scrollTop($this.scrollTop() - difference_y);
$this.scrollLeft($this.scrollLeft() - difference_x);
// update bar position
updateBarSizeAndPosition();
};
... | [
"function",
"(",
")",
"{",
"var",
"applyTouchMove",
"=",
"function",
"(",
"difference_x",
",",
"difference_y",
")",
"{",
"$this",
".",
"scrollTop",
"(",
"$this",
".",
"scrollTop",
"(",
")",
"-",
"difference_y",
")",
";",
"$this",
".",
"scrollLeft",
"(",
... | bind mobile touch handler | [
"bind",
"mobile",
"touch",
"handler"
] | a5f95627baa265a891858678de47dff180848613 | https://github.com/fperucic/treant-js/blob/a5f95627baa265a891858678de47dff180848613/vendor/perfect-scrollbar/perfect-scrollbar.js#L220-L279 | train | |
fperucic/treant-js | Treant.js | function( obj1, obj2 ) {
var newObj = {};
if ( obj1 ) {
this.inheritAttrs( newObj, this.cloneObj( obj1 ) );
}
if ( obj2 ) {
this.inheritAttrs( newObj, obj2 );
}
return newObj;
} | javascript | function( obj1, obj2 ) {
var newObj = {};
if ( obj1 ) {
this.inheritAttrs( newObj, this.cloneObj( obj1 ) );
}
if ( obj2 ) {
this.inheritAttrs( newObj, obj2 );
}
return newObj;
} | [
"function",
"(",
"obj1",
",",
"obj2",
")",
"{",
"var",
"newObj",
"=",
"{",
"}",
";",
"if",
"(",
"obj1",
")",
"{",
"this",
".",
"inheritAttrs",
"(",
"newObj",
",",
"this",
".",
"cloneObj",
"(",
"obj1",
")",
")",
";",
"}",
"if",
"(",
"obj2",
")",... | Returns a new object by merging the two supplied objects
@param {object} obj1
@param {object} obj2
@returns {object} | [
"Returns",
"a",
"new",
"object",
"by",
"merging",
"the",
"two",
"supplied",
"objects"
] | a5f95627baa265a891858678de47dff180848613 | https://github.com/fperucic/treant-js/blob/a5f95627baa265a891858678de47dff180848613/Treant.js#L58-L67 | train | |
fperucic/treant-js | Treant.js | function() {
if ( $ ) {
Array.prototype.unshift.apply( arguments, [true, {}] );
return $.extend.apply( $, arguments );
}
else {
return UTIL.createMerge.apply( this, arguments );
}
} | javascript | function() {
if ( $ ) {
Array.prototype.unshift.apply( arguments, [true, {}] );
return $.extend.apply( $, arguments );
}
else {
return UTIL.createMerge.apply( this, arguments );
}
} | [
"function",
"(",
")",
"{",
"if",
"(",
"$",
")",
"{",
"Array",
".",
"prototype",
".",
"unshift",
".",
"apply",
"(",
"arguments",
",",
"[",
"true",
",",
"{",
"}",
"]",
")",
";",
"return",
"$",
".",
"extend",
".",
"apply",
"(",
"$",
",",
"argument... | Takes any number of arguments
@returns {*} | [
"Takes",
"any",
"number",
"of",
"arguments"
] | a5f95627baa265a891858678de47dff180848613 | https://github.com/fperucic/treant-js/blob/a5f95627baa265a891858678de47dff180848613/Treant.js#L73-L81 | train | |
fperucic/treant-js | Treant.js | function (jsonConfig, treeId ) {
/**
* @param {object} jsonConfig
* @param {number} treeId
* @returns {Tree}
*/
this.reset = function( jsonConfig, treeId ) {
this.initJsonConfig = jsonConfig;
this.initTreeId = treeId;
t... | javascript | function (jsonConfig, treeId ) {
/**
* @param {object} jsonConfig
* @param {number} treeId
* @returns {Tree}
*/
this.reset = function( jsonConfig, treeId ) {
this.initJsonConfig = jsonConfig;
this.initTreeId = treeId;
t... | [
"function",
"(",
"jsonConfig",
",",
"treeId",
")",
"{",
"/**\r\n * @param {object} jsonConfig\r\n * @param {number} treeId\r\n * @returns {Tree}\r\n */",
"this",
".",
"reset",
"=",
"function",
"(",
"jsonConfig",
",",
"treeId",
")",
"{",
"this",
... | Tree constructor.
@param {object} jsonConfig
@param {number} treeId
@constructor | [
"Tree",
"constructor",
"."
] | a5f95627baa265a891858678de47dff180848613 | https://github.com/fperucic/treant-js/blob/a5f95627baa265a891858678de47dff180848613/Treant.js#L404-L452 | train | |
fperucic/treant-js | Treant.js | function( node, level ) {
node.leftNeighborId = this.lastNodeOnLevel[level];
if ( node.leftNeighborId ) {
node.leftNeighbor().rightNeighborId = node.id;
}
this.lastNodeOnLevel[level] = node.id;
return this;
} | javascript | function( node, level ) {
node.leftNeighborId = this.lastNodeOnLevel[level];
if ( node.leftNeighborId ) {
node.leftNeighbor().rightNeighborId = node.id;
}
this.lastNodeOnLevel[level] = node.id;
return this;
} | [
"function",
"(",
"node",
",",
"level",
")",
"{",
"node",
".",
"leftNeighborId",
"=",
"this",
".",
"lastNodeOnLevel",
"[",
"level",
"]",
";",
"if",
"(",
"node",
".",
"leftNeighborId",
")",
"{",
"node",
".",
"leftNeighbor",
"(",
")",
".",
"rightNeighborId"... | Algorithm works from left to right, so previous processed node will be left neighbour of the next node
@param {TreeNode} node
@param {number} level
@returns {Tree} | [
"Algorithm",
"works",
"from",
"left",
"to",
"right",
"so",
"previous",
"processed",
"node",
"will",
"be",
"left",
"neighbour",
"of",
"the",
"next",
"node"
] | a5f95627baa265a891858678de47dff180848613 | https://github.com/fperucic/treant-js/blob/a5f95627baa265a891858678de47dff180848613/Treant.js#L1049-L1056 | train | |
fperucic/treant-js | Treant.js | function( nodeStructure, id, parentId, tree, stackParentId ) {
this.reset( nodeStructure, id, parentId, tree, stackParentId );
} | javascript | function( nodeStructure, id, parentId, tree, stackParentId ) {
this.reset( nodeStructure, id, parentId, tree, stackParentId );
} | [
"function",
"(",
"nodeStructure",
",",
"id",
",",
"parentId",
",",
"tree",
",",
"stackParentId",
")",
"{",
"this",
".",
"reset",
"(",
"nodeStructure",
",",
"id",
",",
"parentId",
",",
"tree",
",",
"stackParentId",
")",
";",
"}"
] | TreeNode constructor.
@param {object} nodeStructure
@param {number} id
@param {number} parentId
@param {Tree} tree
@param {number} stackParentId
@constructor | [
"TreeNode",
"constructor",
"."
] | a5f95627baa265a891858678de47dff180848613 | https://github.com/fperucic/treant-js/blob/a5f95627baa265a891858678de47dff180848613/Treant.js#L1305-L1307 | train | |
fperucic/treant-js | Treant.js | function() {
var orientation = this.getTreeConfig().rootOrientation;
if ( this.pseudo ) {
// prevents separating the subtrees
return ( -this.getTreeConfig().subTeeSeparation );
}
if ( orientation === 'NORTH' || orientation === 'SO... | javascript | function() {
var orientation = this.getTreeConfig().rootOrientation;
if ( this.pseudo ) {
// prevents separating the subtrees
return ( -this.getTreeConfig().subTeeSeparation );
}
if ( orientation === 'NORTH' || orientation === 'SO... | [
"function",
"(",
")",
"{",
"var",
"orientation",
"=",
"this",
".",
"getTreeConfig",
"(",
")",
".",
"rootOrientation",
";",
"if",
"(",
"this",
".",
"pseudo",
")",
"{",
"// prevents separating the subtrees\r",
"return",
"(",
"-",
"this",
".",
"getTreeConfig",
... | Returns the width of the node
@returns {float} | [
"Returns",
"the",
"width",
"of",
"the",
"node"
] | a5f95627baa265a891858678de47dff180848613 | https://github.com/fperucic/treant-js/blob/a5f95627baa265a891858678de47dff180848613/Treant.js#L1408-L1422 | train | |
fperucic/treant-js | Treant.js | function(startPoint) {
var orient = this.Tree().CONFIG.rootOrientation, point = {};
if ( this.stackParentId ) { // return different end point if node is a stacked child
if ( orient === 'NORTH' || orient === 'SOUTH' ) {
orient = 'WEST';
}... | javascript | function(startPoint) {
var orient = this.Tree().CONFIG.rootOrientation, point = {};
if ( this.stackParentId ) { // return different end point if node is a stacked child
if ( orient === 'NORTH' || orient === 'SOUTH' ) {
orient = 'WEST';
}... | [
"function",
"(",
"startPoint",
")",
"{",
"var",
"orient",
"=",
"this",
".",
"Tree",
"(",
")",
".",
"CONFIG",
".",
"rootOrientation",
",",
"point",
"=",
"{",
"}",
";",
"if",
"(",
"this",
".",
"stackParentId",
")",
"{",
"// return different end point if node... | returns start or the end point of the connector line, origin is upper-left | [
"returns",
"start",
"or",
"the",
"end",
"point",
"of",
"the",
"connector",
"line",
"origin",
"is",
"upper",
"-",
"left"
] | a5f95627baa265a891858678de47dff180848613 | https://github.com/fperucic/treant-js/blob/a5f95627baa265a891858678de47dff180848613/Treant.js#L1548-L1578 | train | |
fperucic/treant-js | Treant.js | function( jsonConfig, callback, jQuery ) {
if ( jsonConfig instanceof Array ) {
jsonConfig = JSONconfig.make( jsonConfig );
}
// optional
if ( jQuery ) {
$ = jQuery;
}
this.tree = TreeStore.createTree( jsonConfig );
this.tree.p... | javascript | function( jsonConfig, callback, jQuery ) {
if ( jsonConfig instanceof Array ) {
jsonConfig = JSONconfig.make( jsonConfig );
}
// optional
if ( jQuery ) {
$ = jQuery;
}
this.tree = TreeStore.createTree( jsonConfig );
this.tree.p... | [
"function",
"(",
"jsonConfig",
",",
"callback",
",",
"jQuery",
")",
"{",
"if",
"(",
"jsonConfig",
"instanceof",
"Array",
")",
"{",
"jsonConfig",
"=",
"JSONconfig",
".",
"make",
"(",
"jsonConfig",
")",
";",
"}",
"// optional\r",
"if",
"(",
"jQuery",
")",
... | Chart constructor. | [
"Chart",
"constructor",
"."
] | a5f95627baa265a891858678de47dff180848613 | https://github.com/fperucic/treant-js/blob/a5f95627baa265a891858678de47dff180848613/Treant.js#L2150-L2162 | train | |
auth0/lock | support/playground/assets/remember.js | uniq | function uniq(el, arr){
arr = arr && arr.join ? arr : [];
if (!el) return arr.join(' > ');
if (9 == el.nodeType) return arr.join(' > ');
if (1 != el.nodeType) return arr.join(' > ');
arr.unshift(selector(el));
if (el.id) return arr.join(' > ');
return uniq(el.parentNode, arr);
} | javascript | function uniq(el, arr){
arr = arr && arr.join ? arr : [];
if (!el) return arr.join(' > ');
if (9 == el.nodeType) return arr.join(' > ');
if (1 != el.nodeType) return arr.join(' > ');
arr.unshift(selector(el));
if (el.id) return arr.join(' > ');
return uniq(el.parentNode, arr);
} | [
"function",
"uniq",
"(",
"el",
",",
"arr",
")",
"{",
"arr",
"=",
"arr",
"&&",
"arr",
".",
"join",
"?",
"arr",
":",
"[",
"]",
";",
"if",
"(",
"!",
"el",
")",
"return",
"arr",
".",
"join",
"(",
"' > '",
")",
";",
"if",
"(",
"9",
"==",
"el",
... | Generate unique selector of `el`.
@param {Element} el
@return {String}
@api public | [
"Generate",
"unique",
"selector",
"of",
"el",
"."
] | 5fac76442f7257cd86cc1c973a773a1c5527f59c | https://github.com/auth0/lock/blob/5fac76442f7257cd86cc1c973a773a1c5527f59c/support/playground/assets/remember.js#L643-L651 | train |
auth0/lock | support/playground/assets/remember.js | selector | function selector(el){
var classname = trim(el.className.baseVal ? el.className.baseVal : el.className);
var i = el.parentNode && 9 == el.parentNode.nodeType ? -1 : index(el);
return el.tagName.toLowerCase()
+ (el.id ? '#' + el.id : '')
+ (classname ? classname.replace(/^| +/g, '.') : '')
+ (~i ? ':n... | javascript | function selector(el){
var classname = trim(el.className.baseVal ? el.className.baseVal : el.className);
var i = el.parentNode && 9 == el.parentNode.nodeType ? -1 : index(el);
return el.tagName.toLowerCase()
+ (el.id ? '#' + el.id : '')
+ (classname ? classname.replace(/^| +/g, '.') : '')
+ (~i ? ':n... | [
"function",
"selector",
"(",
"el",
")",
"{",
"var",
"classname",
"=",
"trim",
"(",
"el",
".",
"className",
".",
"baseVal",
"?",
"el",
".",
"className",
".",
"baseVal",
":",
"el",
".",
"className",
")",
";",
"var",
"i",
"=",
"el",
".",
"parentNode",
... | Generate a selector of the given `el`.
@param {Element} el
@return {String}
@api private | [
"Generate",
"a",
"selector",
"of",
"the",
"given",
"el",
"."
] | 5fac76442f7257cd86cc1c973a773a1c5527f59c | https://github.com/auth0/lock/blob/5fac76442f7257cd86cc1c973a773a1c5527f59c/support/playground/assets/remember.js#L661-L669 | train |
yeoman/yo | lib/routes/clear-config.js | _clearGeneratorConfig | function _clearGeneratorConfig(app, generator) {
if (generator === '*') {
globalConfig.removeAll();
} else {
globalConfig.remove(generator);
}
console.log('Global config has been successfully cleared');
app.navigate('home');
} | javascript | function _clearGeneratorConfig(app, generator) {
if (generator === '*') {
globalConfig.removeAll();
} else {
globalConfig.remove(generator);
}
console.log('Global config has been successfully cleared');
app.navigate('home');
} | [
"function",
"_clearGeneratorConfig",
"(",
"app",
",",
"generator",
")",
"{",
"if",
"(",
"generator",
"===",
"'*'",
")",
"{",
"globalConfig",
".",
"removeAll",
"(",
")",
";",
"}",
"else",
"{",
"globalConfig",
".",
"remove",
"(",
"generator",
")",
";",
"}"... | Clear the given generator from the global config file
@param {Object} app
@param {String} generator Name of the generator to be clear. Use '*' to clear all generators. | [
"Clear",
"the",
"given",
"generator",
"from",
"the",
"global",
"config",
"file"
] | 932ef07104b81de32fa3f0f6c9c2df61f4f0d9e6 | https://github.com/yeoman/yo/blob/932ef07104b81de32fa3f0f6c9c2df61f4f0d9e6/lib/routes/clear-config.js#L74-L83 | train |
probablyup/markdown-to-jsx | index.js | parserFor | function parserFor(rules) {
// Sorts rules in order of increasing order, then
// ascending rule name in case of ties.
let ruleList = Object.keys(rules);
/* istanbul ignore next */
if (process.env.NODE_ENV !== 'production') {
ruleList.forEach(function(type) {
let order = rules[type].order;
if ... | javascript | function parserFor(rules) {
// Sorts rules in order of increasing order, then
// ascending rule name in case of ties.
let ruleList = Object.keys(rules);
/* istanbul ignore next */
if (process.env.NODE_ENV !== 'production') {
ruleList.forEach(function(type) {
let order = rules[type].order;
if ... | [
"function",
"parserFor",
"(",
"rules",
")",
"{",
"// Sorts rules in order of increasing order, then",
"// ascending rule name in case of ties.",
"let",
"ruleList",
"=",
"Object",
".",
"keys",
"(",
"rules",
")",
";",
"/* istanbul ignore next */",
"if",
"(",
"process",
".",... | Creates a parser for a given set of rules, with the precedence
specified as a list of rules.
@rules: an object containing
rule type -> {match, order, parse} objects
(lower order is higher precedence)
(Note: `order` is added to defaultRules after creation so that
the `order` of defaultRules in the source matches the `o... | [
"Creates",
"a",
"parser",
"for",
"a",
"given",
"set",
"of",
"rules",
"with",
"the",
"precedence",
"specified",
"as",
"a",
"list",
"of",
"rules",
"."
] | 9570018bac22c759899be839089cc33d3d739af0 | https://github.com/probablyup/markdown-to-jsx/blob/9570018bac22c759899be839089cc33d3d739af0/index.js#L417-L497 | train |
probablyup/markdown-to-jsx | index.js | inlineRegex | function inlineRegex(regex) {
return function match(source, state) {
if (state.inline) {
return regex.exec(source);
} else {
return null;
}
};
} | javascript | function inlineRegex(regex) {
return function match(source, state) {
if (state.inline) {
return regex.exec(source);
} else {
return null;
}
};
} | [
"function",
"inlineRegex",
"(",
"regex",
")",
"{",
"return",
"function",
"match",
"(",
"source",
",",
"state",
")",
"{",
"if",
"(",
"state",
".",
"inline",
")",
"{",
"return",
"regex",
".",
"exec",
"(",
"source",
")",
";",
"}",
"else",
"{",
"return",... | Creates a match function for an inline scoped or simple element from a regex | [
"Creates",
"a",
"match",
"function",
"for",
"an",
"inline",
"scoped",
"or",
"simple",
"element",
"from",
"a",
"regex"
] | 9570018bac22c759899be839089cc33d3d739af0 | https://github.com/probablyup/markdown-to-jsx/blob/9570018bac22c759899be839089cc33d3d739af0/index.js#L500-L508 | train |
probablyup/markdown-to-jsx | index.js | parseSimpleInline | function parseSimpleInline(parse, content, state) {
const isCurrentlyInline = state.inline || false;
const isCurrentlySimple = state.simple || false;
state.inline = false;
state.simple = true;
const result = parse(content, state);
state.inline = isCurrentlyInline;
state.simple = isCurrentlySimple;
retur... | javascript | function parseSimpleInline(parse, content, state) {
const isCurrentlyInline = state.inline || false;
const isCurrentlySimple = state.simple || false;
state.inline = false;
state.simple = true;
const result = parse(content, state);
state.inline = isCurrentlyInline;
state.simple = isCurrentlySimple;
retur... | [
"function",
"parseSimpleInline",
"(",
"parse",
",",
"content",
",",
"state",
")",
"{",
"const",
"isCurrentlyInline",
"=",
"state",
".",
"inline",
"||",
"false",
";",
"const",
"isCurrentlySimple",
"=",
"state",
".",
"simple",
"||",
"false",
";",
"state",
".",... | Anything inline that isn't a link. | [
"Anything",
"inline",
"that",
"isn",
"t",
"a",
"link",
"."
] | 9570018bac22c759899be839089cc33d3d739af0 | https://github.com/probablyup/markdown-to-jsx/blob/9570018bac22c759899be839089cc33d3d739af0/index.js#L626-L635 | train |
HttpErrorPages/HttpErrorPages | lib/express.js | function(){
res.type('.html');
res.send(_render(tpl, css, {
code: httpStatusCode,
title: pageData.title,
message: pageData.message,
footer: opt.footer
}))
} | javascript | function(){
res.type('.html');
res.send(_render(tpl, css, {
code: httpStatusCode,
title: pageData.title,
message: pageData.message,
footer: opt.footer
}))
} | [
"function",
"(",
")",
"{",
"res",
".",
"type",
"(",
"'.html'",
")",
";",
"res",
".",
"send",
"(",
"_render",
"(",
"tpl",
",",
"css",
",",
"{",
"code",
":",
"httpStatusCode",
",",
"title",
":",
"pageData",
".",
"title",
",",
"message",
":",
"pageDat... | standard http-error-pages | [
"standard",
"http",
"-",
"error",
"-",
"pages"
] | 055edf7671174432c039b74faaf2e6d3b660d1b1 | https://github.com/HttpErrorPages/HttpErrorPages/blob/055edf7671174432c039b74faaf2e6d3b660d1b1/lib/express.js#L45-L53 | train | |
HttpErrorPages/HttpErrorPages | lib/page-renderer.js | renderTemplate | function renderTemplate(template, css, data={}){
// assign css
data.inlinecss = css;
// render template - use custom escape function to handle linebreaks!
return _ejs.render(template, data, {
escape: function(text){
if (!text){
return '';
}
... | javascript | function renderTemplate(template, css, data={}){
// assign css
data.inlinecss = css;
// render template - use custom escape function to handle linebreaks!
return _ejs.render(template, data, {
escape: function(text){
if (!text){
return '';
}
... | [
"function",
"renderTemplate",
"(",
"template",
",",
"css",
",",
"data",
"=",
"{",
"}",
")",
"{",
"// assign css",
"data",
".",
"inlinecss",
"=",
"css",
";",
"// render template - use custom escape function to handle linebreaks!",
"return",
"_ejs",
".",
"render",
"("... | render template using given data | [
"render",
"template",
"using",
"given",
"data"
] | 055edf7671174432c039b74faaf2e6d3b660d1b1 | https://github.com/HttpErrorPages/HttpErrorPages/blob/055edf7671174432c039b74faaf2e6d3b660d1b1/lib/page-renderer.js#L4-L25 | train |
HttpErrorPages/HttpErrorPages | lib/json-reader.js | readJSONFile | async function readJSONFile(filename){
// load file
let raw = await _fs.readFile(filename, 'utf8');
// strip single line js comments
raw = raw.replace(/^\s*\/\/.*$/gm, '');
// parse text
return JSON.parse(raw);
} | javascript | async function readJSONFile(filename){
// load file
let raw = await _fs.readFile(filename, 'utf8');
// strip single line js comments
raw = raw.replace(/^\s*\/\/.*$/gm, '');
// parse text
return JSON.parse(raw);
} | [
"async",
"function",
"readJSONFile",
"(",
"filename",
")",
"{",
"// load file",
"let",
"raw",
"=",
"await",
"_fs",
".",
"readFile",
"(",
"filename",
",",
"'utf8'",
")",
";",
"// strip single line js comments",
"raw",
"=",
"raw",
".",
"replace",
"(",
"/",
"^\... | parse json file and allow single line comments | [
"parse",
"json",
"file",
"and",
"allow",
"single",
"line",
"comments"
] | 055edf7671174432c039b74faaf2e6d3b660d1b1 | https://github.com/HttpErrorPages/HttpErrorPages/blob/055edf7671174432c039b74faaf2e6d3b660d1b1/lib/json-reader.js#L4-L13 | train |
meodai/color-names | scripts/build.js | log | function log(key, value, message, errorLevel = 1) {
const error = {};
// looks for the original item that caused the error
error.entries = colorsSrc.entires.filter((entry) => {
return entry[key] === value;
});
error.message = message;
error.errorLevel = errorLevel;
errors.push(error);
} | javascript | function log(key, value, message, errorLevel = 1) {
const error = {};
// looks for the original item that caused the error
error.entries = colorsSrc.entires.filter((entry) => {
return entry[key] === value;
});
error.message = message;
error.errorLevel = errorLevel;
errors.push(error);
} | [
"function",
"log",
"(",
"key",
",",
"value",
",",
"message",
",",
"errorLevel",
"=",
"1",
")",
"{",
"const",
"error",
"=",
"{",
"}",
";",
"// looks for the original item that caused the error",
"error",
".",
"entries",
"=",
"colorsSrc",
".",
"entires",
".",
... | logs errors and warning
@param {string} key key to look for in input
@param {string} value value to look for
@param {string} message error message
@param {Number} errorLevel if any error is set to 1, the program will exit | [
"logs",
"errors",
"and",
"warning"
] | 03c708fd8cea7189bf9c41d51d701c0571bcec7f | https://github.com/meodai/color-names/blob/03c708fd8cea7189bf9c41d51d701c0571bcec7f/scripts/build.js#L213-L224 | train |
kentcdodds/cross-env | src/command.js | commandConvert | function commandConvert(command, env, normalize = false) {
if (!isWindows()) {
return command
}
const envUnixRegex = /\$(\w+)|\${(\w+)}/g // $my_var or ${my_var}
const convertedCmd = command.replace(envUnixRegex, (match, $1, $2) => {
const varName = $1 || $2
// In Windows, non-existent variables are... | javascript | function commandConvert(command, env, normalize = false) {
if (!isWindows()) {
return command
}
const envUnixRegex = /\$(\w+)|\${(\w+)}/g // $my_var or ${my_var}
const convertedCmd = command.replace(envUnixRegex, (match, $1, $2) => {
const varName = $1 || $2
// In Windows, non-existent variables are... | [
"function",
"commandConvert",
"(",
"command",
",",
"env",
",",
"normalize",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"isWindows",
"(",
")",
")",
"{",
"return",
"command",
"}",
"const",
"envUnixRegex",
"=",
"/",
"\\$(\\w+)|\\${(\\w+)}",
"/",
"g",
"// $my_var... | Converts an environment variable usage to be appropriate for the current OS
@param {String} command Command to convert
@param {Object} env Map of the current environment variable names and their values
@param {boolean} normalize If the command should be normalized using `path`
after converting
@returns {String} Convert... | [
"Converts",
"an",
"environment",
"variable",
"usage",
"to",
"be",
"appropriate",
"for",
"the",
"current",
"OS"
] | 2b36bb3c303e00d37371f93e08990bf9612ca492 | https://github.com/kentcdodds/cross-env/blob/2b36bb3c303e00d37371f93e08990bf9612ca492/src/command.js#L14-L32 | train |
tus/tus-js-client | bin/phantom-jasmine.js | checkJasmineStatus | function checkJasmineStatus() {
// Only inject the source once.
if (jasmineFound) {
return;
}
var found = page.evaluate(function () {
return "jasmine" in window && jasmine.getEnv;
});
if (!found) {
return;
}
jasmineFound = true;
injectReporter();
} | javascript | function checkJasmineStatus() {
// Only inject the source once.
if (jasmineFound) {
return;
}
var found = page.evaluate(function () {
return "jasmine" in window && jasmine.getEnv;
});
if (!found) {
return;
}
jasmineFound = true;
injectReporter();
} | [
"function",
"checkJasmineStatus",
"(",
")",
"{",
"// Only inject the source once.",
"if",
"(",
"jasmineFound",
")",
"{",
"return",
";",
"}",
"var",
"found",
"=",
"page",
".",
"evaluate",
"(",
"function",
"(",
")",
"{",
"return",
"\"jasmine\"",
"in",
"window",
... | Tests whether the global jasmine object is available yet and if so, inject the source for the ConsoleReporter. | [
"Tests",
"whether",
"the",
"global",
"jasmine",
"object",
"is",
"available",
"yet",
"and",
"if",
"so",
"inject",
"the",
"source",
"for",
"the",
"ConsoleReporter",
"."
] | 13cdc861391a343f303c15e9eb0d24f6df87978f | https://github.com/tus/tus-js-client/blob/13cdc861391a343f303c15e9eb0d24f6df87978f/bin/phantom-jasmine.js#L40-L57 | train |
Subsets and Splits
SQL Console for semeru/code-text-javascript
Retrieves 20,000 non-null code samples labeled as JavaScript, providing a basic overview of the dataset.