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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
xiongwilee/Gracejs | app/blog/static/js/common/reveal/markdown.js | getForwardedAttributes | function getForwardedAttributes( section ) {
var attributes = section.attributes;
var result = [];
for( var i = 0, len = attributes.length; i < len; i++ ) {
var name = attributes[i].name,
value = attributes[i].value;
// disregard attributes that are used for markdown loading/parsing
if( /data\-(ma... | javascript | function getForwardedAttributes( section ) {
var attributes = section.attributes;
var result = [];
for( var i = 0, len = attributes.length; i < len; i++ ) {
var name = attributes[i].name,
value = attributes[i].value;
// disregard attributes that are used for markdown loading/parsing
if( /data\-(ma... | [
"function",
"getForwardedAttributes",
"(",
"section",
")",
"{",
"var",
"attributes",
"=",
"section",
".",
"attributes",
";",
"var",
"result",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"len",
"=",
"attributes",
".",
"length",
";",
"i",
... | Given a markdown slide section element, this will
return all arguments that aren't related to markdown
parsing. Used to forward any other user-defined arguments
to the output markdown slide. | [
"Given",
"a",
"markdown",
"slide",
"section",
"element",
"this",
"will",
"return",
"all",
"arguments",
"that",
"aren",
"t",
"related",
"to",
"markdown",
"parsing",
".",
"Used",
"to",
"forward",
"any",
"other",
"user",
"-",
"defined",
"arguments",
"to",
"the"... | a4ca954d28ddcd1c39a0b3eefe16e79a390fb507 | https://github.com/xiongwilee/Gracejs/blob/a4ca954d28ddcd1c39a0b3eefe16e79a390fb507/app/blog/static/js/common/reveal/markdown.js#L74-L96 | train |
xiongwilee/Gracejs | app/blog/static/js/common/reveal/markdown.js | getSlidifyOptions | function getSlidifyOptions( options ) {
options = options || {};
options.separator = options.separator || DEFAULT_SLIDE_SEPARATOR;
options.notesSeparator = options.notesSeparator || DEFAULT_NOTES_SEPARATOR;
options.attributes = options.attributes || '';
return options;
} | javascript | function getSlidifyOptions( options ) {
options = options || {};
options.separator = options.separator || DEFAULT_SLIDE_SEPARATOR;
options.notesSeparator = options.notesSeparator || DEFAULT_NOTES_SEPARATOR;
options.attributes = options.attributes || '';
return options;
} | [
"function",
"getSlidifyOptions",
"(",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"options",
".",
"separator",
"=",
"options",
".",
"separator",
"||",
"DEFAULT_SLIDE_SEPARATOR",
";",
"options",
".",
"notesSeparator",
"=",
"options",
".... | Inspects the given options and fills out default
values for what's not defined. | [
"Inspects",
"the",
"given",
"options",
"and",
"fills",
"out",
"default",
"values",
"for",
"what",
"s",
"not",
"defined",
"."
] | a4ca954d28ddcd1c39a0b3eefe16e79a390fb507 | https://github.com/xiongwilee/Gracejs/blob/a4ca954d28ddcd1c39a0b3eefe16e79a390fb507/app/blog/static/js/common/reveal/markdown.js#L102-L111 | train |
xiongwilee/Gracejs | app/blog/static/js/common/reveal/markdown.js | slidify | function slidify( markdown, options ) {
options = getSlidifyOptions( options );
var separatorRegex = new RegExp( options.separator + ( options.verticalSeparator ? '|' + options.verticalSeparator : '' ), 'mg' ),
horizontalSeparatorRegex = new RegExp( options.separator );
var matches,
lastIndex = 0,
isH... | javascript | function slidify( markdown, options ) {
options = getSlidifyOptions( options );
var separatorRegex = new RegExp( options.separator + ( options.verticalSeparator ? '|' + options.verticalSeparator : '' ), 'mg' ),
horizontalSeparatorRegex = new RegExp( options.separator );
var matches,
lastIndex = 0,
isH... | [
"function",
"slidify",
"(",
"markdown",
",",
"options",
")",
"{",
"options",
"=",
"getSlidifyOptions",
"(",
"options",
")",
";",
"var",
"separatorRegex",
"=",
"new",
"RegExp",
"(",
"options",
".",
"separator",
"+",
"(",
"options",
".",
"verticalSeparator",
"... | Parses a data string into multiple slides based
on the passed in separator arguments. | [
"Parses",
"a",
"data",
"string",
"into",
"multiple",
"slides",
"based",
"on",
"the",
"passed",
"in",
"separator",
"arguments",
"."
] | a4ca954d28ddcd1c39a0b3eefe16e79a390fb507 | https://github.com/xiongwilee/Gracejs/blob/a4ca954d28ddcd1c39a0b3eefe16e79a390fb507/app/blog/static/js/common/reveal/markdown.js#L138-L204 | train |
xiongwilee/Gracejs | app/blog/static/js/common/reveal/markdown.js | addAttributeInElement | function addAttributeInElement( node, elementTarget, separator ) {
var mardownClassesInElementsRegex = new RegExp( separator, 'mg' );
var mardownClassRegex = new RegExp( "([^\"= ]+?)=\"([^\"=]+?)\"", 'mg' );
var nodeValue = node.nodeValue;
if( matches = mardownClassesInElementsRegex.exec( nodeValue ) ) {
v... | javascript | function addAttributeInElement( node, elementTarget, separator ) {
var mardownClassesInElementsRegex = new RegExp( separator, 'mg' );
var mardownClassRegex = new RegExp( "([^\"= ]+?)=\"([^\"=]+?)\"", 'mg' );
var nodeValue = node.nodeValue;
if( matches = mardownClassesInElementsRegex.exec( nodeValue ) ) {
v... | [
"function",
"addAttributeInElement",
"(",
"node",
",",
"elementTarget",
",",
"separator",
")",
"{",
"var",
"mardownClassesInElementsRegex",
"=",
"new",
"RegExp",
"(",
"separator",
",",
"'mg'",
")",
";",
"var",
"mardownClassRegex",
"=",
"new",
"RegExp",
"(",
"\"(... | Check if a node value has the attributes pattern.
If yes, extract it and add that value as one or several attributes
the the terget element.
You need Cache Killer on Chrome to see the effect on any FOM transformation
directly on refresh (F5)
http://stackoverflow.com/questions/5690269/disabling-chrome-cache-for-website... | [
"Check",
"if",
"a",
"node",
"value",
"has",
"the",
"attributes",
"pattern",
".",
"If",
"yes",
"extract",
"it",
"and",
"add",
"that",
"value",
"as",
"one",
"or",
"several",
"attributes",
"the",
"the",
"terget",
"element",
"."
] | a4ca954d28ddcd1c39a0b3eefe16e79a390fb507 | https://github.com/xiongwilee/Gracejs/blob/a4ca954d28ddcd1c39a0b3eefe16e79a390fb507/app/blog/static/js/common/reveal/markdown.js#L293-L309 | train |
xiongwilee/Gracejs | app/blog/static/js/common/reveal/markdown.js | addAttributes | function addAttributes( section, element, previousElement, separatorElementAttributes, separatorSectionAttributes ) {
if ( element != null && element.childNodes != undefined && element.childNodes.length > 0 ) {
previousParentElement = element;
for( var i = 0; i < element.childNodes.length; i++ ) {
childEle... | javascript | function addAttributes( section, element, previousElement, separatorElementAttributes, separatorSectionAttributes ) {
if ( element != null && element.childNodes != undefined && element.childNodes.length > 0 ) {
previousParentElement = element;
for( var i = 0; i < element.childNodes.length; i++ ) {
childEle... | [
"function",
"addAttributes",
"(",
"section",
",",
"element",
",",
"previousElement",
",",
"separatorElementAttributes",
",",
"separatorSectionAttributes",
")",
"{",
"if",
"(",
"element",
"!=",
"null",
"&&",
"element",
".",
"childNodes",
"!=",
"undefined",
"&&",
"e... | Add attributes to the parent element of a text node,
or the element of an attribute node. | [
"Add",
"attributes",
"to",
"the",
"parent",
"element",
"of",
"a",
"text",
"node",
"or",
"the",
"element",
"of",
"an",
"attribute",
"node",
"."
] | a4ca954d28ddcd1c39a0b3eefe16e79a390fb507 | https://github.com/xiongwilee/Gracejs/blob/a4ca954d28ddcd1c39a0b3eefe16e79a390fb507/app/blog/static/js/common/reveal/markdown.js#L315-L348 | train |
xiongwilee/Gracejs | app/blog/static/js/common/reveal/markdown.js | convertSlides | function convertSlides() {
var sections = document.querySelectorAll( '[data-markdown]');
for( var i = 0, len = sections.length; i < len; i++ ) {
var section = sections[i];
// Only parse the same slide once
if( !section.getAttribute( 'data-markdown-parsed' ) ) {
section.setAttribute( 'data-markdown... | javascript | function convertSlides() {
var sections = document.querySelectorAll( '[data-markdown]');
for( var i = 0, len = sections.length; i < len; i++ ) {
var section = sections[i];
// Only parse the same slide once
if( !section.getAttribute( 'data-markdown-parsed' ) ) {
section.setAttribute( 'data-markdown... | [
"function",
"convertSlides",
"(",
")",
"{",
"var",
"sections",
"=",
"document",
".",
"querySelectorAll",
"(",
"'[data-markdown]'",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"len",
"=",
"sections",
".",
"length",
";",
"i",
"<",
"len",
";",
"i",
... | Converts any current data-markdown slides in the
DOM to HTML. | [
"Converts",
"any",
"current",
"data",
"-",
"markdown",
"slides",
"in",
"the",
"DOM",
"to",
"HTML",
"."
] | a4ca954d28ddcd1c39a0b3eefe16e79a390fb507 | https://github.com/xiongwilee/Gracejs/blob/a4ca954d28ddcd1c39a0b3eefe16e79a390fb507/app/blog/static/js/common/reveal/markdown.js#L354-L388 | train |
Shopify/node-themekit | lib/run-executable.js | runExecutable | function runExecutable(args, cwd, logLevel) {
const logger = require('./logger')(logLevel);
return new Promise((resolve, reject) => {
logger.silly('Theme Kit command starting');
let errors = '';
const pathToExecutable = path.join(config.destination, config.binName);
fs.statSync(pathToExecutable);
... | javascript | function runExecutable(args, cwd, logLevel) {
const logger = require('./logger')(logLevel);
return new Promise((resolve, reject) => {
logger.silly('Theme Kit command starting');
let errors = '';
const pathToExecutable = path.join(config.destination, config.binName);
fs.statSync(pathToExecutable);
... | [
"function",
"runExecutable",
"(",
"args",
",",
"cwd",
",",
"logLevel",
")",
"{",
"const",
"logger",
"=",
"require",
"(",
"'./logger'",
")",
"(",
"logLevel",
")",
";",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"logg... | Spawns a child process to run the Theme Kit executable with given parameters
@param {string[]} args array to pass to the executable
@param {string} cwd directory to run command on
@param {string} logLevel level of logging required | [
"Spawns",
"a",
"child",
"process",
"to",
"run",
"the",
"Theme",
"Kit",
"executable",
"with",
"given",
"parameters"
] | 8f71a778b301dffda673181c651f58b368b25293 | https://github.com/Shopify/node-themekit/blob/8f71a778b301dffda673181c651f58b368b25293/lib/run-executable.js#L13-L43 | train |
Shopify/node-themekit | lib/utils.js | cleanFile | function cleanFile(pathToFile) {
try {
fs.unlinkSync(pathToFile);
} catch (err) {
switch (err.code) {
case 'ENOENT':
return;
default:
throw new Error(err);
}
}
} | javascript | function cleanFile(pathToFile) {
try {
fs.unlinkSync(pathToFile);
} catch (err) {
switch (err.code) {
case 'ENOENT':
return;
default:
throw new Error(err);
}
}
} | [
"function",
"cleanFile",
"(",
"pathToFile",
")",
"{",
"try",
"{",
"fs",
".",
"unlinkSync",
"(",
"pathToFile",
")",
";",
"}",
"catch",
"(",
"err",
")",
"{",
"switch",
"(",
"err",
".",
"code",
")",
"{",
"case",
"'ENOENT'",
":",
"return",
";",
"default"... | Deletes a file from the filesystem if it exists.
Does nothing if it doesn't do anything.
@param {string} pathToFile path to file to delete | [
"Deletes",
"a",
"file",
"from",
"the",
"filesystem",
"if",
"it",
"exists",
".",
"Does",
"nothing",
"if",
"it",
"doesn",
"t",
"do",
"anything",
"."
] | 8f71a778b301dffda673181c651f58b368b25293 | https://github.com/Shopify/node-themekit/blob/8f71a778b301dffda673181c651f58b368b25293/lib/utils.js#L8-L19 | train |
splunk/splunk-sdk-javascript | contrib/dox/doc_builder.js | function () {
var module = "Global";
for(var i = 0; i < doc.tags.length; i++) {
var tag = doc.tags[i];
if (tag.type === "method") {
module = tag.content;
}
else if (tag.type === "function") {
module = tag.content;
... | javascript | function () {
var module = "Global";
for(var i = 0; i < doc.tags.length; i++) {
var tag = doc.tags[i];
if (tag.type === "method") {
module = tag.content;
}
else if (tag.type === "function") {
module = tag.content;
... | [
"function",
"(",
")",
"{",
"var",
"module",
"=",
"\"Global\"",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"doc",
".",
"tags",
".",
"length",
";",
"i",
"++",
")",
"{",
"var",
"tag",
"=",
"doc",
".",
"tags",
"[",
"i",
"]",
";",
"if... | Find the parent module and note the name | [
"Find",
"the",
"parent",
"module",
"and",
"note",
"the",
"name"
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/contrib/dox/doc_builder.js#L67-L80 | train | |
splunk/splunk-sdk-javascript | lib/http.js | function() {
// We perform the bindings so that every function works
// properly when it is passed as a callback.
this.get = utils.bind(this, this.get);
this.del = utils.bind(this, this.del);
this.post = utils.bind(... | javascript | function() {
// We perform the bindings so that every function works
// properly when it is passed as a callback.
this.get = utils.bind(this, this.get);
this.del = utils.bind(this, this.del);
this.post = utils.bind(... | [
"function",
"(",
")",
"{",
"// We perform the bindings so that every function works",
"// properly when it is passed as a callback.",
"this",
".",
"get",
"=",
"utils",
".",
"bind",
"(",
"this",
",",
"this",
".",
"get",
")",
";",
"this",
".",
"del",
"=",
"utils",
"... | Constructor for `splunkjs.Http`.
@constructor
@return {splunkjs.Http} A new `splunkjs.Http` instance.
@method splunkjs.Http | [
"Constructor",
"for",
"splunkjs",
".",
"Http",
"."
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/lib/http.js#L72-L87 | train | |
splunk/splunk-sdk-javascript | lib/http.js | function() {
var cookieString = "";
utils.forEach(this._cookieStore, function (cookieValue, cookieKey) {
cookieString += cookieKey;
cookieString += '=';
cookieString += cookieValue;
cookieString += '; ';
});
... | javascript | function() {
var cookieString = "";
utils.forEach(this._cookieStore, function (cookieValue, cookieKey) {
cookieString += cookieKey;
cookieString += '=';
cookieString += cookieValue;
cookieString += '; ';
});
... | [
"function",
"(",
")",
"{",
"var",
"cookieString",
"=",
"\"\"",
";",
"utils",
".",
"forEach",
"(",
"this",
".",
"_cookieStore",
",",
"function",
"(",
"cookieValue",
",",
"cookieKey",
")",
"{",
"cookieString",
"+=",
"cookieKey",
";",
"cookieString",
"+=",
"'... | Returns all cookies formatted as a string to be put into the Cookie Header. | [
"Returns",
"all",
"cookies",
"formatted",
"as",
"a",
"string",
"to",
"be",
"put",
"into",
"the",
"Cookie",
"Header",
"."
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/lib/http.js#L97-L109 | train | |
splunk/splunk-sdk-javascript | lib/http.js | function(url, headers, params, timeout, callback) {
var message = {
method: "GET",
headers: headers,
timeout: timeout,
query: params
};
return this.request(url, message, callback);
} | javascript | function(url, headers, params, timeout, callback) {
var message = {
method: "GET",
headers: headers,
timeout: timeout,
query: params
};
return this.request(url, message, callback);
} | [
"function",
"(",
"url",
",",
"headers",
",",
"params",
",",
"timeout",
",",
"callback",
")",
"{",
"var",
"message",
"=",
"{",
"method",
":",
"\"GET\"",
",",
"headers",
":",
"headers",
",",
"timeout",
":",
"timeout",
",",
"query",
":",
"params",
"}",
... | Performs a GET request.
@param {String} url The URL of the GET request.
@param {Object} headers An object of headers for this request.
@param {Object} params Parameters for this request.
@param {Number} timeout A timeout period.
@param {Function} callback The function to call when the request is complete: `(err, respo... | [
"Performs",
"a",
"GET",
"request",
"."
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/lib/http.js#L142-L151 | train | |
splunk/splunk-sdk-javascript | lib/http.js | function(url, message, callback) {
var that = this;
var wrappedCallback = function(response) {
callback = callback || function() {};
// Handle cookies if 'set-cookie' header is in the response
var cookieHeaders = response.response.headers['set-co... | javascript | function(url, message, callback) {
var that = this;
var wrappedCallback = function(response) {
callback = callback || function() {};
// Handle cookies if 'set-cookie' header is in the response
var cookieHeaders = response.response.headers['set-co... | [
"function",
"(",
"url",
",",
"message",
",",
"callback",
")",
"{",
"var",
"that",
"=",
"this",
";",
"var",
"wrappedCallback",
"=",
"function",
"(",
"response",
")",
"{",
"callback",
"=",
"callback",
"||",
"function",
"(",
")",
"{",
"}",
";",
"// Handle... | Performs a request.
This function sets up how to handle a response from a request, but
delegates calling the request to the `makeRequest` subclass.
@param {String} url The encoded URL of the request.
@param {Object} message An object with values for method, headers, timeout, and encoded body.
@param {Function} callba... | [
"Performs",
"a",
"request",
"."
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/lib/http.js#L211-L262 | train | |
splunk/splunk-sdk-javascript | lib/http.js | function(error, response, data) {
var complete_response, json = {};
var contentType = null;
if (response && response.headers) {
contentType = utils.trim(response.headers["content-type"] || response.headers["Content-Type"] || response.headers["Content-type"] || respon... | javascript | function(error, response, data) {
var complete_response, json = {};
var contentType = null;
if (response && response.headers) {
contentType = utils.trim(response.headers["content-type"] || response.headers["Content-Type"] || response.headers["Content-type"] || respon... | [
"function",
"(",
"error",
",",
"response",
",",
"data",
")",
"{",
"var",
"complete_response",
",",
"json",
"=",
"{",
"}",
";",
"var",
"contentType",
"=",
"null",
";",
"if",
"(",
"response",
"&&",
"response",
".",
"headers",
")",
"{",
"contentType",
"="... | Generates a unified response with the given parameters.
@param {Object} error An error object, if one exists for the request.
@param {Object} response The response object.
@param {Object} data The response data.
@return {Object} A unified response object.
@method splunkjs.Http | [
"Generates",
"a",
"unified",
"response",
"with",
"the",
"given",
"parameters",
"."
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/lib/http.js#L300-L333 | train | |
splunk/splunk-sdk-javascript | examples/node/helloworld/search_oneshot.js | function(results, done) {
// Find the index of the fields we want
var rawIndex = results.fields.indexOf("_raw");
var sourcetypeIndex = results.fields.indexOf("sourcetype");
var userIndex = results.fields.indexOf("user");
//... | javascript | function(results, done) {
// Find the index of the fields we want
var rawIndex = results.fields.indexOf("_raw");
var sourcetypeIndex = results.fields.indexOf("sourcetype");
var userIndex = results.fields.indexOf("user");
//... | [
"function",
"(",
"results",
",",
"done",
")",
"{",
"// Find the index of the fields we want",
"var",
"rawIndex",
"=",
"results",
".",
"fields",
".",
"indexOf",
"(",
"\"_raw\"",
")",
";",
"var",
"sourcetypeIndex",
"=",
"results",
".",
"fields",
".",
"indexOf",
... | The job is done, and the results are returned inline | [
"The",
"job",
"is",
"done",
"and",
"the",
"results",
"are",
"returned",
"inline"
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/examples/node/helloworld/search_oneshot.js#L58-L74 | train | |
splunk/splunk-sdk-javascript | examples/node/helloworld/search_realtime.js | function(job, done) {
var MAX_COUNT = 5;
var count = 0;
Async.whilst(
// Loop for N times
function() { return MAX_COUNT > count; },
// Every second, ask for preview results
fu... | javascript | function(job, done) {
var MAX_COUNT = 5;
var count = 0;
Async.whilst(
// Loop for N times
function() { return MAX_COUNT > count; },
// Every second, ask for preview results
fu... | [
"function",
"(",
"job",
",",
"done",
")",
"{",
"var",
"MAX_COUNT",
"=",
"5",
";",
"var",
"count",
"=",
"0",
";",
"Async",
".",
"whilst",
"(",
"// Loop for N times",
"function",
"(",
")",
"{",
"return",
"MAX_COUNT",
">",
"count",
";",
"}",
",",
"// Ev... | The search is never going to be done, so we simply poll it every second to get more results | [
"The",
"search",
"is",
"never",
"going",
"to",
"be",
"done",
"so",
"we",
"simply",
"poll",
"it",
"every",
"second",
"to",
"get",
"more",
"results"
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/examples/node/helloworld/search_realtime.js#L61-L109 | train | |
splunk/splunk-sdk-javascript | client/splunk.ui.timeline.js | function(script)
{
// create local undefined vars so that script cannot access private vars
var _namespaces = undefined;
var _imported = undefined;
var _loading = undefined;
var _classPaths = undefined;
var _classInfo = undefined;
var _classDependencyList = undefined;
var _mixinCount = undefined;
var... | javascript | function(script)
{
// create local undefined vars so that script cannot access private vars
var _namespaces = undefined;
var _imported = undefined;
var _loading = undefined;
var _classPaths = undefined;
var _classInfo = undefined;
var _classDependencyList = undefined;
var _mixinCount = undefined;
var... | [
"function",
"(",
"script",
")",
"{",
"// create local undefined vars so that script cannot access private vars",
"var",
"_namespaces",
"=",
"undefined",
";",
"var",
"_imported",
"=",
"undefined",
";",
"var",
"_loading",
"=",
"undefined",
";",
"var",
"_classPaths",
"=",
... | Private Functions
Function for evaluating dynamically loaded scripts. | [
"Private",
"Functions",
"Function",
"for",
"evaluating",
"dynamically",
"loaded",
"scripts",
"."
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.ui.timeline.js#L509-L528 | train | |
splunk/splunk-sdk-javascript | lib/ui/charting/i18n.js | ungettext | function ungettext(msgid1, msgid2, n) {
if (_i18n_locale.locale_name == 'en_DEBUG') return __debug_trans_str(msgid1);
var id = ''+_i18n_plural(n)+'-'+msgid1;
var entry = _i18n_catalog[id];
return entry == undefined ? (n==1 ? msgid1 : msgid2) : entry;
} | javascript | function ungettext(msgid1, msgid2, n) {
if (_i18n_locale.locale_name == 'en_DEBUG') return __debug_trans_str(msgid1);
var id = ''+_i18n_plural(n)+'-'+msgid1;
var entry = _i18n_catalog[id];
return entry == undefined ? (n==1 ? msgid1 : msgid2) : entry;
} | [
"function",
"ungettext",
"(",
"msgid1",
",",
"msgid2",
",",
"n",
")",
"{",
"if",
"(",
"_i18n_locale",
".",
"locale_name",
"==",
"'en_DEBUG'",
")",
"return",
"__debug_trans_str",
"(",
"msgid1",
")",
";",
"var",
"id",
"=",
"''",
"+",
"_i18n_plural",
"(",
"... | Translate a string containing a number
Eg. ungettext('Delete %(files)d file?', 'Delete %(files)d files?', files)
Use in conjuction with sprintf():
sprintf( ungettext('Delete %(files)d file?', 'Delete %(files)d files?', files), { files: 14 } ) | [
"Translate",
"a",
"string",
"containing",
"a",
"number"
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/lib/ui/charting/i18n.js#L46-L51 | train |
splunk/splunk-sdk-javascript | lib/ui/charting/i18n.js | Time | function Time(hour, minute, second, microsecond) {
if (_i18n_locale.locale_name == 'en_DEBUG') {
this.hour = 11;
this.minute = 22;
this.second = 33;
this.microsecond = 123000;
} else {
this.hour = hour;
this.minute = minute;
... | javascript | function Time(hour, minute, second, microsecond) {
if (_i18n_locale.locale_name == 'en_DEBUG') {
this.hour = 11;
this.minute = 22;
this.second = 33;
this.microsecond = 123000;
} else {
this.hour = hour;
this.minute = minute;
... | [
"function",
"Time",
"(",
"hour",
",",
"minute",
",",
"second",
",",
"microsecond",
")",
"{",
"if",
"(",
"_i18n_locale",
".",
"locale_name",
"==",
"'en_DEBUG'",
")",
"{",
"this",
".",
"hour",
"=",
"11",
";",
"this",
".",
"minute",
"=",
"22",
";",
"thi... | Class to hold time information in lieu of datetime.time | [
"Class",
"to",
"hold",
"time",
"information",
"in",
"lieu",
"of",
"datetime",
".",
"time"
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/lib/ui/charting/i18n.js#L294-L306 | train |
splunk/splunk-sdk-javascript | lib/ui/charting/i18n.js | DateTime | function DateTime(date) {
if (date instanceof DateTime)
return date;
if (_i18n_locale.locale_name == 'en_DEBUG')
date = new Date(3333, 10, 22, 11, 22, 33, 123);
if (date instanceof Date) {
this.date = date;
this.hour = date.getHours();
... | javascript | function DateTime(date) {
if (date instanceof DateTime)
return date;
if (_i18n_locale.locale_name == 'en_DEBUG')
date = new Date(3333, 10, 22, 11, 22, 33, 123);
if (date instanceof Date) {
this.date = date;
this.hour = date.getHours();
... | [
"function",
"DateTime",
"(",
"date",
")",
"{",
"if",
"(",
"date",
"instanceof",
"DateTime",
")",
"return",
"date",
";",
"if",
"(",
"_i18n_locale",
".",
"locale_name",
"==",
"'en_DEBUG'",
")",
"date",
"=",
"new",
"Date",
"(",
"3333",
",",
"10",
",",
"22... | Wrapper object for JS Date objects | [
"Wrapper",
"object",
"for",
"JS",
"Date",
"objects"
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/lib/ui/charting/i18n.js#L311-L330 | train |
splunk/splunk-sdk-javascript | examples/node/helloworld/firedalerts_async.js | function(firedAlertGroups, done) {
// Get the list of all fired alert groups, including the all group (represented by "-").
var groups = firedAlertGroups.list();
console.log("Fired alert groups:");
Async.seriesEach(
groups,
... | javascript | function(firedAlertGroups, done) {
// Get the list of all fired alert groups, including the all group (represented by "-").
var groups = firedAlertGroups.list();
console.log("Fired alert groups:");
Async.seriesEach(
groups,
... | [
"function",
"(",
"firedAlertGroups",
",",
"done",
")",
"{",
"// Get the list of all fired alert groups, including the all group (represented by \"-\").",
"var",
"groups",
"=",
"firedAlertGroups",
".",
"list",
"(",
")",
";",
"console",
".",
"log",
"(",
"\"Fired alert groups:... | Print them out. | [
"Print",
"them",
"out",
"."
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/examples/node/helloworld/firedalerts_async.js#L57-L89 | train | |
splunk/splunk-sdk-javascript | contrib/commander.js | camelcase | function camelcase(flag) {
return flag.split('-').reduce(function(str, word){
return str + word[0].toUpperCase() + word.slice(1);
});
} | javascript | function camelcase(flag) {
return flag.split('-').reduce(function(str, word){
return str + word[0].toUpperCase() + word.slice(1);
});
} | [
"function",
"camelcase",
"(",
"flag",
")",
"{",
"return",
"flag",
".",
"split",
"(",
"'-'",
")",
".",
"reduce",
"(",
"function",
"(",
"str",
",",
"word",
")",
"{",
"return",
"str",
"+",
"word",
"[",
"0",
"]",
".",
"toUpperCase",
"(",
")",
"+",
"w... | Camel-case the given `flag`
@param {String} flag
@return {String}
@api private | [
"Camel",
"-",
"case",
"the",
"given",
"flag"
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/contrib/commander.js#L1054-L1058 | train |
splunk/splunk-sdk-javascript | contrib/commander.js | pad | function pad(str, width) {
var len = Math.max(0, width - str.length);
return str + Array(len + 1).join(' ');
} | javascript | function pad(str, width) {
var len = Math.max(0, width - str.length);
return str + Array(len + 1).join(' ');
} | [
"function",
"pad",
"(",
"str",
",",
"width",
")",
"{",
"var",
"len",
"=",
"Math",
".",
"max",
"(",
"0",
",",
"width",
"-",
"str",
".",
"length",
")",
";",
"return",
"str",
"+",
"Array",
"(",
"len",
"+",
"1",
")",
".",
"join",
"(",
"' '",
")",... | Pad `str` to `width`.
@param {String} str
@param {Number} width
@return {String}
@api private | [
"Pad",
"str",
"to",
"width",
"."
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/contrib/commander.js#L1081-L1084 | train |
splunk/splunk-sdk-javascript | examples/node/jobs.js | function(sids, options, callback) {
_check_sids('cancel', sids);
// For each of the supplied sids, cancel the job.
this._foreach(sids, function(job, idx, done) {
job.cancel(function (err) {
if (err) {
done(err);
... | javascript | function(sids, options, callback) {
_check_sids('cancel', sids);
// For each of the supplied sids, cancel the job.
this._foreach(sids, function(job, idx, done) {
job.cancel(function (err) {
if (err) {
done(err);
... | [
"function",
"(",
"sids",
",",
"options",
",",
"callback",
")",
"{",
"_check_sids",
"(",
"'cancel'",
",",
"sids",
")",
";",
"// For each of the supplied sids, cancel the job.",
"this",
".",
"_foreach",
"(",
"sids",
",",
"function",
"(",
"job",
",",
"idx",
",",
... | Cancel the specified search jobs | [
"Cancel",
"the",
"specified",
"search",
"jobs"
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/examples/node/jobs.js#L145-L160 | train | |
splunk/splunk-sdk-javascript | examples/node/jobs.js | function(args, options, callback) {
// Get the query and parameters, and remove the extraneous
// search parameter
var query = options.search;
var params = options;
delete params.search;
// Create the job
this.service.jobs().create(que... | javascript | function(args, options, callback) {
// Get the query and parameters, and remove the extraneous
// search parameter
var query = options.search;
var params = options;
delete params.search;
// Create the job
this.service.jobs().create(que... | [
"function",
"(",
"args",
",",
"options",
",",
"callback",
")",
"{",
"// Get the query and parameters, and remove the extraneous",
"// search parameter",
"var",
"query",
"=",
"options",
".",
"search",
";",
"var",
"params",
"=",
"options",
";",
"delete",
"params",
"."... | Create a search job | [
"Create",
"a",
"search",
"job"
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/examples/node/jobs.js#L191-L208 | train | |
splunk/splunk-sdk-javascript | examples/node/jobs.js | function(sids, options, callback) {
sids = sids || [];
if (sids.length === 0) {
// If no job SIDs are provided, we list all jobs.
var jobs = this.service.jobs();
jobs.fetch(function(err, jobs) {
if (err) {
... | javascript | function(sids, options, callback) {
sids = sids || [];
if (sids.length === 0) {
// If no job SIDs are provided, we list all jobs.
var jobs = this.service.jobs();
jobs.fetch(function(err, jobs) {
if (err) {
... | [
"function",
"(",
"sids",
",",
"options",
",",
"callback",
")",
"{",
"sids",
"=",
"sids",
"||",
"[",
"]",
";",
"if",
"(",
"sids",
".",
"length",
"===",
"0",
")",
"{",
"// If no job SIDs are provided, we list all jobs.",
"var",
"jobs",
"=",
"this",
".",
"s... | List all current search jobs if no jobs specified, otherwise list the properties of the specified jobs. | [
"List",
"all",
"current",
"search",
"jobs",
"if",
"no",
"jobs",
"specified",
"otherwise",
"list",
"the",
"properties",
"of",
"the",
"specified",
"jobs",
"."
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/examples/node/jobs.js#L212-L257 | train | |
splunk/splunk-sdk-javascript | examples/modularinputs/github_commits/bin/app/github_commits.js | getDisplayDate | function getDisplayDate(date) {
var monthStrings = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
date = new Date(date);
var hours = date.getHours();
if (hours < 10) {
hours = "0" + hours.toString();
}
var mins = date.g... | javascript | function getDisplayDate(date) {
var monthStrings = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
date = new Date(date);
var hours = date.getHours();
if (hours < 10) {
hours = "0" + hours.toString();
}
var mins = date.g... | [
"function",
"getDisplayDate",
"(",
"date",
")",
"{",
"var",
"monthStrings",
"=",
"[",
"\"Jan\"",
",",
"\"Feb\"",
",",
"\"Mar\"",
",",
"\"Apr\"",
",",
"\"May\"",
",",
"\"Jun\"",
",",
"\"Jul\"",
",",
"\"Aug\"",
",",
"\"Sep\"",
",",
"\"Oct\"",
",",
"\"Nov\"",... | Create easy to read date format. | [
"Create",
"easy",
"to",
"read",
"date",
"format",
"."
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/examples/modularinputs/github_commits/bin/app/github_commits.js#L32-L48 | train |
splunk/splunk-sdk-javascript | lib/log.js | function(allMessages) {
allMessages = allMessages || [];
for(var i = 0; i < allMessages.length; i++) {
var message = allMessages[i];
var type = message["type"];
var text = message["text"];
var msg = '[SPLUNKD] ' + text;... | javascript | function(allMessages) {
allMessages = allMessages || [];
for(var i = 0; i < allMessages.length; i++) {
var message = allMessages[i];
var type = message["type"];
var text = message["text"];
var msg = '[SPLUNKD] ' + text;... | [
"function",
"(",
"allMessages",
")",
"{",
"allMessages",
"=",
"allMessages",
"||",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"allMessages",
".",
"length",
";",
"i",
"++",
")",
"{",
"var",
"message",
"=",
"allMessages",
"[",
"i... | Prints all messages that are retrieved from the splunkd server to the
console.
@function splunkjs.Logger | [
"Prints",
"all",
"messages",
"that",
"are",
"retrieved",
"from",
"the",
"splunkd",
"server",
"to",
"the",
"console",
"."
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/lib/log.js#L139-L167 | train | |
splunk/splunk-sdk-javascript | lib/ui/charting/js_charting.js | function(name, properties) {
// first respect the field hide list that came from the parent module
if(properties.fieldHideList && $.inArray(name, properties.fieldHideList) > -1) {
return false;
}
// next process the field visibility lists from the xml
... | javascript | function(name, properties) {
// first respect the field hide list that came from the parent module
if(properties.fieldHideList && $.inArray(name, properties.fieldHideList) > -1) {
return false;
}
// next process the field visibility lists from the xml
... | [
"function",
"(",
"name",
",",
"properties",
")",
"{",
"// first respect the field hide list that came from the parent module",
"if",
"(",
"properties",
".",
"fieldHideList",
"&&",
"$",
".",
"inArray",
"(",
"name",
",",
"properties",
".",
"fieldHideList",
")",
">",
"... | returns false if series should not be added to the chart | [
"returns",
"false",
"if",
"series",
"should",
"not",
"be",
"added",
"to",
"the",
"chart"
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/lib/ui/charting/js_charting.js#L1434-L1452 | train | |
splunk/splunk-sdk-javascript | lib/ui/charting/js_charting.js | function($super, key, value, properties) {
var keysToIgnore = {
'chart.nullValueMode': true
};
if(key in keysToIgnore) {
return;
}
$super(key, value, properties);
} | javascript | function($super, key, value, properties) {
var keysToIgnore = {
'chart.nullValueMode': true
};
if(key in keysToIgnore) {
return;
}
$super(key, value, properties);
} | [
"function",
"(",
"$super",
",",
"key",
",",
"value",
",",
"properties",
")",
"{",
"var",
"keysToIgnore",
"=",
"{",
"'chart.nullValueMode'",
":",
"true",
"}",
";",
"if",
"(",
"key",
"in",
"keysToIgnore",
")",
"{",
"return",
";",
"}",
"$super",
"(",
"key... | override point-based charts need to defensively ignore null-value mode, since 'connect' will lead to unexpected results | [
"override",
"point",
"-",
"based",
"charts",
"need",
"to",
"defensively",
"ignore",
"null",
"-",
"value",
"mode",
"since",
"connect",
"will",
"lead",
"to",
"unexpected",
"results"
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/lib/ui/charting/js_charting.js#L1769-L1778 | train | |
splunk/splunk-sdk-javascript | lib/ui/charting/js_charting.js | function(point, series) {
if(!point || !point.graphic) {
return;
}
point.graphic.attr({'fill': this.fadedElementColor, 'stroke-width': 1, 'stroke': this.fadedElementBorderColor});
} | javascript | function(point, series) {
if(!point || !point.graphic) {
return;
}
point.graphic.attr({'fill': this.fadedElementColor, 'stroke-width': 1, 'stroke': this.fadedElementBorderColor});
} | [
"function",
"(",
"point",
",",
"series",
")",
"{",
"if",
"(",
"!",
"point",
"||",
"!",
"point",
".",
"graphic",
")",
"{",
"return",
";",
"}",
"point",
".",
"graphic",
".",
"attr",
"(",
"{",
"'fill'",
":",
"this",
".",
"fadedElementColor",
",",
"'st... | doing full overrides here to avoid a double-repaint, even though there is some duplicate code override | [
"doing",
"full",
"overrides",
"here",
"to",
"avoid",
"a",
"double",
"-",
"repaint",
"even",
"though",
"there",
"is",
"some",
"duplicate",
"code",
"override"
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/lib/ui/charting/js_charting.js#L1915-L1920 | train | |
splunk/splunk-sdk-javascript | lib/ui/charting/js_charting.js | function(properties, data) {
var axisProperties = this.parseUtils.getXAxisProperties(properties),
orientation = (this.axesAreInverted) ? 'vertical' : 'horizontal',
colorScheme = this.getAxisColorScheme();
// add some extra info to the axisProperties as needed
... | javascript | function(properties, data) {
var axisProperties = this.parseUtils.getXAxisProperties(properties),
orientation = (this.axesAreInverted) ? 'vertical' : 'horizontal',
colorScheme = this.getAxisColorScheme();
// add some extra info to the axisProperties as needed
... | [
"function",
"(",
"properties",
",",
"data",
")",
"{",
"var",
"axisProperties",
"=",
"this",
".",
"parseUtils",
".",
"getXAxisProperties",
"(",
"properties",
")",
",",
"orientation",
"=",
"(",
"this",
".",
"axesAreInverted",
")",
"?",
"'vertical'",
":",
"'hor... | override force the x axis to be numeric | [
"override",
"force",
"the",
"x",
"axis",
"to",
"be",
"numeric"
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/lib/ui/charting/js_charting.js#L2345-L2364 | train | |
splunk/splunk-sdk-javascript | lib/ui/charting/js_charting.js | function($super) {
if(!this.hasSVG) {
$super();
return;
}
var i, loopSplit, loopKeyName, loopKeyElem, loopValElem,
$tooltip = $('.highcharts-tooltip', $(this.renderTo)),
tooltipElements = (this.hasSVG) ? $('tspan', $tool... | javascript | function($super) {
if(!this.hasSVG) {
$super();
return;
}
var i, loopSplit, loopKeyName, loopKeyElem, loopValElem,
$tooltip = $('.highcharts-tooltip', $(this.renderTo)),
tooltipElements = (this.hasSVG) ? $('tspan', $tool... | [
"function",
"(",
"$super",
")",
"{",
"if",
"(",
"!",
"this",
".",
"hasSVG",
")",
"{",
"$super",
"(",
")",
";",
"return",
";",
"}",
"var",
"i",
",",
"loopSplit",
",",
"loopKeyName",
",",
"loopKeyElem",
",",
"loopValElem",
",",
"$tooltip",
"=",
"$",
... | we have to override here because the tooltip structure is different | [
"we",
"have",
"to",
"override",
"here",
"because",
"the",
"tooltip",
"structure",
"is",
"different"
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/lib/ui/charting/js_charting.js#L2581-L2605 | train | |
splunk/splunk-sdk-javascript | lib/ui/charting/js_charting.js | function(properties, data) {
var useTimeNames = (this.processedData.xAxisType === 'time'),
resolveLabel = this.getLabel.bind(this);
this.formatTooltip(properties, data);
$.extend(true, this.hcConfig, {
plotOptions: {
pie: {
... | javascript | function(properties, data) {
var useTimeNames = (this.processedData.xAxisType === 'time'),
resolveLabel = this.getLabel.bind(this);
this.formatTooltip(properties, data);
$.extend(true, this.hcConfig, {
plotOptions: {
pie: {
... | [
"function",
"(",
"properties",
",",
"data",
")",
"{",
"var",
"useTimeNames",
"=",
"(",
"this",
".",
"processedData",
".",
"xAxisType",
"===",
"'time'",
")",
",",
"resolveLabel",
"=",
"this",
".",
"getLabel",
".",
"bind",
"(",
"this",
")",
";",
"this",
... | override not calling super class method, pie charts don't have axes or legend | [
"override",
"not",
"calling",
"super",
"class",
"method",
"pie",
"charts",
"don",
"t",
"have",
"axes",
"or",
"legend"
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/lib/ui/charting/js_charting.js#L2798-L2813 | train | |
splunk/splunk-sdk-javascript | lib/ui/charting/js_charting.js | function(list, map, legendSize) {
var hexColor;
this.colorList = [];
this.hcConfig.colors = [];
for(i = 0; i < list.length; i++) {
hexColor = this.colorPalette.getColor(list[i], map[list[i]], legendSize);
this.colorList.push(hexColor);
... | javascript | function(list, map, legendSize) {
var hexColor;
this.colorList = [];
this.hcConfig.colors = [];
for(i = 0; i < list.length; i++) {
hexColor = this.colorPalette.getColor(list[i], map[list[i]], legendSize);
this.colorList.push(hexColor);
... | [
"function",
"(",
"list",
",",
"map",
",",
"legendSize",
")",
"{",
"var",
"hexColor",
";",
"this",
".",
"colorList",
"=",
"[",
"]",
";",
"this",
".",
"hcConfig",
".",
"colors",
"=",
"[",
"]",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"list"... | override the inner charts will handle adding opacity to their color schemes | [
"override",
"the",
"inner",
"charts",
"will",
"handle",
"adding",
"opacity",
"to",
"their",
"color",
"schemes"
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/lib/ui/charting/js_charting.js#L3364-L3373 | train | |
splunk/splunk-sdk-javascript | lib/ui/charting/js_charting.js | function(ticks) {
var key,
tickArray = [];
for(key in ticks) {
if(ticks.hasOwnProperty(key)) {
tickArray.push(ticks[key]);
}
}
tickArray.sort(function(t1, t2) {
return (t1.pos - t2.pos);
... | javascript | function(ticks) {
var key,
tickArray = [];
for(key in ticks) {
if(ticks.hasOwnProperty(key)) {
tickArray.push(ticks[key]);
}
}
tickArray.sort(function(t1, t2) {
return (t1.pos - t2.pos);
... | [
"function",
"(",
"ticks",
")",
"{",
"var",
"key",
",",
"tickArray",
"=",
"[",
"]",
";",
"for",
"(",
"key",
"in",
"ticks",
")",
"{",
"if",
"(",
"ticks",
".",
"hasOwnProperty",
"(",
"key",
")",
")",
"{",
"tickArray",
".",
"push",
"(",
"ticks",
"[",... | returns the ticks in an array in ascending order by 'pos' | [
"returns",
"the",
"ticks",
"in",
"an",
"array",
"in",
"ascending",
"order",
"by",
"pos"
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/lib/ui/charting/js_charting.js#L3982-L3995 | train | |
splunk/splunk-sdk-javascript | lib/ui/charting/js_charting.js | function(options, extremes) {
// if there are no extremes (i.e. no meaningful data was extracted), go with 0 to 100
if(!extremes.min && !extremes.max) {
options.min = 0;
options.max = 100;
return;
}
// if the min or max is s... | javascript | function(options, extremes) {
// if there are no extremes (i.e. no meaningful data was extracted), go with 0 to 100
if(!extremes.min && !extremes.max) {
options.min = 0;
options.max = 100;
return;
}
// if the min or max is s... | [
"function",
"(",
"options",
",",
"extremes",
")",
"{",
"// if there are no extremes (i.e. no meaningful data was extracted), go with 0 to 100",
"if",
"(",
"!",
"extremes",
".",
"min",
"&&",
"!",
"extremes",
".",
"max",
")",
"{",
"options",
".",
"min",
"=",
"0",
";... | clean up various issues that can arise from the axis extremes | [
"clean",
"up",
"various",
"issues",
"that",
"can",
"arise",
"from",
"the",
"axis",
"extremes"
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/lib/ui/charting/js_charting.js#L4292-L4317 | train | |
splunk/splunk-sdk-javascript | lib/ui/charting/js_charting.js | function(startVal, endVal, drawFn, finishCallback) {
var animationRange = endVal - startVal,
duration = 500,
animationProperties = {
duration: duration,
step: function(now, fx) {
drawFn(startVal + now);
... | javascript | function(startVal, endVal, drawFn, finishCallback) {
var animationRange = endVal - startVal,
duration = 500,
animationProperties = {
duration: duration,
step: function(now, fx) {
drawFn(startVal + now);
... | [
"function",
"(",
"startVal",
",",
"endVal",
",",
"drawFn",
",",
"finishCallback",
")",
"{",
"var",
"animationRange",
"=",
"endVal",
"-",
"startVal",
",",
"duration",
"=",
"500",
",",
"animationProperties",
"=",
"{",
"duration",
":",
"duration",
",",
"step",
... | we can't use the jQuery animation library explicitly to perform complex SVG animations, but we can take advantage of their implementation using a meaningless css property and a custom step function | [
"we",
"can",
"t",
"use",
"the",
"jQuery",
"animation",
"library",
"explicitly",
"to",
"perform",
"complex",
"SVG",
"animations",
"but",
"we",
"can",
"take",
"advantage",
"of",
"their",
"implementation",
"using",
"a",
"meaningless",
"css",
"property",
"and",
"a... | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/lib/ui/charting/js_charting.js#L5436-L5458 | train | |
splunk/splunk-sdk-javascript | lib/ui/charting/js_charting.js | function($super, oldValue, newValue) {
var oldPrecision = this.mathUtils.getDecimalPrecision(oldValue, 3),
newPrecision = this.mathUtils.getDecimalPrecision(newValue, 3);
this.valueAnimationPrecision = Math.max(oldPrecision, newPrecision);
$super(oldValue, newValue);... | javascript | function($super, oldValue, newValue) {
var oldPrecision = this.mathUtils.getDecimalPrecision(oldValue, 3),
newPrecision = this.mathUtils.getDecimalPrecision(newValue, 3);
this.valueAnimationPrecision = Math.max(oldPrecision, newPrecision);
$super(oldValue, newValue);... | [
"function",
"(",
"$super",
",",
"oldValue",
",",
"newValue",
")",
"{",
"var",
"oldPrecision",
"=",
"this",
".",
"mathUtils",
".",
"getDecimalPrecision",
"(",
"oldValue",
",",
"3",
")",
",",
"newPrecision",
"=",
"this",
".",
"mathUtils",
".",
"getDecimalPreci... | override use the decimal precision of the old and new values to set things up for a smooth animation | [
"override",
"use",
"the",
"decimal",
"precision",
"of",
"the",
"old",
"and",
"new",
"values",
"to",
"set",
"things",
"up",
"for",
"a",
"smooth",
"animation"
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/lib/ui/charting/js_charting.js#L6023-L6029 | train | |
splunk/splunk-sdk-javascript | lib/ui/charting/js_charting.js | function(fillColor) {
var fillColorHex = this.colorUtils.hexFromColor(fillColor),
luminanceThreshold = 128,
darkColor = 'black',
lightColor = 'white',
fillLuminance = this.colorUtils.getLuminance(fillColorHex);
return (fillLuminanc... | javascript | function(fillColor) {
var fillColorHex = this.colorUtils.hexFromColor(fillColor),
luminanceThreshold = 128,
darkColor = 'black',
lightColor = 'white',
fillLuminance = this.colorUtils.getLuminance(fillColorHex);
return (fillLuminanc... | [
"function",
"(",
"fillColor",
")",
"{",
"var",
"fillColorHex",
"=",
"this",
".",
"colorUtils",
".",
"hexFromColor",
"(",
"fillColor",
")",
",",
"luminanceThreshold",
"=",
"128",
",",
"darkColor",
"=",
"'black'",
",",
"lightColor",
"=",
"'white'",
",",
"fillL... | use the value to determine the fill color, then use that color's luminance determine if a light or dark font color should be used | [
"use",
"the",
"value",
"to",
"determine",
"the",
"fill",
"color",
"then",
"use",
"that",
"color",
"s",
"luminance",
"determine",
"if",
"a",
"light",
"or",
"dark",
"font",
"color",
"should",
"be",
"used"
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/lib/ui/charting/js_charting.js#L6060-L6068 | train | |
splunk/splunk-sdk-javascript | lib/ui/charting/js_charting.js | function(num) {
var result = Math.log(num) / Math.LN10;
return (Math.round(result * 10000) / 10000);
} | javascript | function(num) {
var result = Math.log(num) / Math.LN10;
return (Math.round(result * 10000) / 10000);
} | [
"function",
"(",
"num",
")",
"{",
"var",
"result",
"=",
"Math",
".",
"log",
"(",
"num",
")",
"/",
"Math",
".",
"LN10",
";",
"return",
"(",
"Math",
".",
"round",
"(",
"result",
"*",
"10000",
")",
"/",
"10000",
")",
";",
"}"
] | shortcut for base-ten log, also rounds to four decimal points of precision to make pretty numbers | [
"shortcut",
"for",
"base",
"-",
"ten",
"log",
"also",
"rounds",
"to",
"four",
"decimal",
"points",
"of",
"precision",
"to",
"make",
"pretty",
"numbers"
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/lib/ui/charting/js_charting.js#L7272-L7275 | train | |
splunk/splunk-sdk-javascript | lib/ui/charting/js_charting.js | function(num) {
if(typeof num !== "number") {
return NaN;
}
var isNegative = (num < 0),
result;
if(isNegative) {
num = -num;
}
if(num < 10) {
num += (10 - num) / 10;
}
... | javascript | function(num) {
if(typeof num !== "number") {
return NaN;
}
var isNegative = (num < 0),
result;
if(isNegative) {
num = -num;
}
if(num < 10) {
num += (10 - num) / 10;
}
... | [
"function",
"(",
"num",
")",
"{",
"if",
"(",
"typeof",
"num",
"!==",
"\"number\"",
")",
"{",
"return",
"NaN",
";",
"}",
"var",
"isNegative",
"=",
"(",
"num",
"<",
"0",
")",
",",
"result",
";",
"if",
"(",
"isNegative",
")",
"{",
"num",
"=",
"-",
... | transforms numbers to a normalized log scale that can handle negative numbers rounds to four decimal points of precision | [
"transforms",
"numbers",
"to",
"a",
"normalized",
"log",
"scale",
"that",
"can",
"handle",
"negative",
"numbers",
"rounds",
"to",
"four",
"decimal",
"points",
"of",
"precision"
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/lib/ui/charting/js_charting.js#L7279-L7294 | train | |
splunk/splunk-sdk-javascript | lib/ui/charting/js_charting.js | function(num) {
if(typeof num !== "number") {
return NaN;
}
var isNegative = (num < 0),
result;
if(isNegative) {
num = -num;
}
result = Math.pow(10, num);
if(result < 10) {
... | javascript | function(num) {
if(typeof num !== "number") {
return NaN;
}
var isNegative = (num < 0),
result;
if(isNegative) {
num = -num;
}
result = Math.pow(10, num);
if(result < 10) {
... | [
"function",
"(",
"num",
")",
"{",
"if",
"(",
"typeof",
"num",
"!==",
"\"number\"",
")",
"{",
"return",
"NaN",
";",
"}",
"var",
"isNegative",
"=",
"(",
"num",
"<",
"0",
")",
",",
"result",
";",
"if",
"(",
"isNegative",
")",
"{",
"num",
"=",
"-",
... | reverses the transformation made by absLogBaseTen above rounds to three decimal points of precision | [
"reverses",
"the",
"transformation",
"made",
"by",
"absLogBaseTen",
"above",
"rounds",
"to",
"three",
"decimal",
"points",
"of",
"precision"
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/lib/ui/charting/js_charting.js#L7298-L7314 | train | |
splunk/splunk-sdk-javascript | lib/ui/charting/js_charting.js | function(num) {
if(typeof num !== "number") {
return NaN;
}
var isNegative = num < 0;
num = (isNegative) ? -num : num;
var log = this.logBaseTen(num),
result = Math.pow(10, Math.floor(log));
return (isNegative) ? -r... | javascript | function(num) {
if(typeof num !== "number") {
return NaN;
}
var isNegative = num < 0;
num = (isNegative) ? -num : num;
var log = this.logBaseTen(num),
result = Math.pow(10, Math.floor(log));
return (isNegative) ? -r... | [
"function",
"(",
"num",
")",
"{",
"if",
"(",
"typeof",
"num",
"!==",
"\"number\"",
")",
"{",
"return",
"NaN",
";",
"}",
"var",
"isNegative",
"=",
"num",
"<",
"0",
";",
"num",
"=",
"(",
"isNegative",
")",
"?",
"-",
"num",
":",
"num",
";",
"var",
... | calculates the power of ten that is closest to but not greater than the number negative numbers are treated as their absolute value and the sign of the result is flipped before returning | [
"calculates",
"the",
"power",
"of",
"ten",
"that",
"is",
"closest",
"to",
"but",
"not",
"greater",
"than",
"the",
"number",
"negative",
"numbers",
"are",
"treated",
"as",
"their",
"absolute",
"value",
"and",
"the",
"sign",
"of",
"the",
"result",
"is",
"fli... | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/lib/ui/charting/js_charting.js#L7318-L7328 | train | |
splunk/splunk-sdk-javascript | lib/ui/charting/js_charting.js | function(num, max) {
max = max || Infinity;
var precision = 0;
while(precision < max && num.toFixed(precision) !== num.toString()) {
precision += 1;
}
return precision;
} | javascript | function(num, max) {
max = max || Infinity;
var precision = 0;
while(precision < max && num.toFixed(precision) !== num.toString()) {
precision += 1;
}
return precision;
} | [
"function",
"(",
"num",
",",
"max",
")",
"{",
"max",
"=",
"max",
"||",
"Infinity",
";",
"var",
"precision",
"=",
"0",
";",
"while",
"(",
"precision",
"<",
"max",
"&&",
"num",
".",
"toFixed",
"(",
"precision",
")",
"!==",
"num",
".",
"toString",
"("... | returns the number of digits of precision after the decimal point optionally accepts a maximum number, after which point it will stop looking and return the max | [
"returns",
"the",
"number",
"of",
"digits",
"of",
"precision",
"after",
"the",
"decimal",
"point",
"optionally",
"accepts",
"a",
"maximum",
"number",
"after",
"which",
"point",
"it",
"will",
"stop",
"looking",
"and",
"return",
"the",
"max"
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/lib/ui/charting/js_charting.js#L7346-L7355 | train | |
splunk/splunk-sdk-javascript | lib/ui/charting/js_charting.js | function(isoString, pointSpan) {
var i18n = Splunk.JSCharting.i18nUtils,
bdTime = this.extractBdTime(isoString),
dateObject;
if(bdTime.isInvalid) {
return null;
}
dateObject = this.bdTimeToDateObject(bdTime);
i... | javascript | function(isoString, pointSpan) {
var i18n = Splunk.JSCharting.i18nUtils,
bdTime = this.extractBdTime(isoString),
dateObject;
if(bdTime.isInvalid) {
return null;
}
dateObject = this.bdTimeToDateObject(bdTime);
i... | [
"function",
"(",
"isoString",
",",
"pointSpan",
")",
"{",
"var",
"i18n",
"=",
"Splunk",
".",
"JSCharting",
".",
"i18nUtils",
",",
"bdTime",
"=",
"this",
".",
"extractBdTime",
"(",
"isoString",
")",
",",
"dateObject",
";",
"if",
"(",
"bdTime",
".",
"isInv... | returns null if string cannot be parsed | [
"returns",
"null",
"if",
"string",
"cannot",
"be",
"parsed"
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/lib/ui/charting/js_charting.js#L7886-L7903 | train | |
splunk/splunk-sdk-javascript | lib/ui/charting/js_charting.js | function(hexNum, alpha) {
if(typeof hexNum !== "number") {
hexNum = parseInt(hexNum, 16);
}
if(isNaN(hexNum) || hexNum < 0x000000 || hexNum > 0xffffff) {
return undefined;
}
var r = (hexNum & 0xff0000) >> 16,
g =... | javascript | function(hexNum, alpha) {
if(typeof hexNum !== "number") {
hexNum = parseInt(hexNum, 16);
}
if(isNaN(hexNum) || hexNum < 0x000000 || hexNum > 0xffffff) {
return undefined;
}
var r = (hexNum & 0xff0000) >> 16,
g =... | [
"function",
"(",
"hexNum",
",",
"alpha",
")",
"{",
"if",
"(",
"typeof",
"hexNum",
"!==",
"\"number\"",
")",
"{",
"hexNum",
"=",
"parseInt",
"(",
"hexNum",
",",
"16",
")",
";",
"}",
"if",
"(",
"isNaN",
"(",
"hexNum",
")",
"||",
"hexNum",
"<",
"0x000... | converts a hex number to its css-friendly counterpart, with optional alpha transparency field returns undefined if the input is cannot be parsed to a valid number or if the number is out of range | [
"converts",
"a",
"hex",
"number",
"to",
"its",
"css",
"-",
"friendly",
"counterpart",
"with",
"optional",
"alpha",
"transparency",
"field",
"returns",
"undefined",
"if",
"the",
"input",
"is",
"cannot",
"be",
"parsed",
"to",
"a",
"valid",
"number",
"or",
"if"... | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/lib/ui/charting/js_charting.js#L8009-L8021 | train | |
splunk/splunk-sdk-javascript | lib/ui/charting/js_charting.js | function(color) {
var normalizedColor = Splunk.util.normalizeColor(color);
return (normalizedColor) ? parseInt(normalizedColor.replace("#", "0x"), 16) : 0;
} | javascript | function(color) {
var normalizedColor = Splunk.util.normalizeColor(color);
return (normalizedColor) ? parseInt(normalizedColor.replace("#", "0x"), 16) : 0;
} | [
"function",
"(",
"color",
")",
"{",
"var",
"normalizedColor",
"=",
"Splunk",
".",
"util",
".",
"normalizeColor",
"(",
"color",
")",
";",
"return",
"(",
"normalizedColor",
")",
"?",
"parseInt",
"(",
"normalizedColor",
".",
"replace",
"(",
"\"#\"",
",",
"\"0... | coverts a color string in either hex or rgb format into its corresponding hex number returns zero if the color string can't be parsed as either format | [
"coverts",
"a",
"color",
"string",
"in",
"either",
"hex",
"or",
"rgb",
"format",
"into",
"its",
"corresponding",
"hex",
"number",
"returns",
"zero",
"if",
"the",
"color",
"string",
"can",
"t",
"be",
"parsed",
"as",
"either",
"format"
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/lib/ui/charting/js_charting.js#L8025-L8029 | train | |
splunk/splunk-sdk-javascript | lib/ui/charting/js_charting.js | function(rgbaStr) {
// lazy create the regex
if(!this.rgbaRegex) {
this.rgbaRegex = /^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,[\s\d.]+\)\s*$/;
}
var colorComponents = this.rgbaRegex.exec(rgbaStr);
if(!colorComponents) {
... | javascript | function(rgbaStr) {
// lazy create the regex
if(!this.rgbaRegex) {
this.rgbaRegex = /^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,[\s\d.]+\)\s*$/;
}
var colorComponents = this.rgbaRegex.exec(rgbaStr);
if(!colorComponents) {
... | [
"function",
"(",
"rgbaStr",
")",
"{",
"// lazy create the regex",
"if",
"(",
"!",
"this",
".",
"rgbaRegex",
")",
"{",
"this",
".",
"rgbaRegex",
"=",
"/",
"^rgba\\(\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*,[\\s\\d.]+\\)\\s*$",
"/",
";",
"}",
"var",
"colo... | given a color string in rgba format, returns the equivalent color in rgb format if the color string is not in valid rgba format, returns the color string un-modified | [
"given",
"a",
"color",
"string",
"in",
"rgba",
"format",
"returns",
"the",
"equivalent",
"color",
"in",
"rgb",
"format",
"if",
"the",
"color",
"string",
"is",
"not",
"in",
"valid",
"rgba",
"format",
"returns",
"the",
"color",
"string",
"un",
"-",
"modified... | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/lib/ui/charting/js_charting.js#L8039-L8049 | train | |
splunk/splunk-sdk-javascript | lib/ui/charting/js_charting.js | function(properties) {
var key, newKey,
remapped = {},
axisProps = this.filterPropsByRegex(properties, /(axisX|primaryAxis|axisLabelsX|axisTitleX|gridLinesX)/);
for(key in axisProps) {
if(axisProps.hasOwnProperty(key)) {
if(!thi... | javascript | function(properties) {
var key, newKey,
remapped = {},
axisProps = this.filterPropsByRegex(properties, /(axisX|primaryAxis|axisLabelsX|axisTitleX|gridLinesX)/);
for(key in axisProps) {
if(axisProps.hasOwnProperty(key)) {
if(!thi... | [
"function",
"(",
"properties",
")",
"{",
"var",
"key",
",",
"newKey",
",",
"remapped",
"=",
"{",
"}",
",",
"axisProps",
"=",
"this",
".",
"filterPropsByRegex",
"(",
"properties",
",",
"/",
"(axisX|primaryAxis|axisLabelsX|axisTitleX|gridLinesX)",
"/",
")",
";",
... | returns a map of properties that apply either to the x-axis or to x-axis labels all axis-related keys are renamed to 'axis' and all axis-label-related keys are renamed to 'axisLabels' | [
"returns",
"a",
"map",
"of",
"properties",
"that",
"apply",
"either",
"to",
"the",
"x",
"-",
"axis",
"or",
"to",
"x",
"-",
"axis",
"labels",
"all",
"axis",
"-",
"related",
"keys",
"are",
"renamed",
"to",
"axis",
"and",
"all",
"axis",
"-",
"label",
"-... | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/lib/ui/charting/js_charting.js#L8077-L8093 | train | |
splunk/splunk-sdk-javascript | lib/ui/charting/js_charting.js | function(key, properties) {
if(!(/primaryAxis/.test(key))) {
return false;
}
if(/primaryAxisTitle/.test(key)) {
return properties[key.replace(/primaryAxisTitle/, "axisTitleX")];
}
return properties[key.replace(/primaryAxis/, "ax... | javascript | function(key, properties) {
if(!(/primaryAxis/.test(key))) {
return false;
}
if(/primaryAxisTitle/.test(key)) {
return properties[key.replace(/primaryAxisTitle/, "axisTitleX")];
}
return properties[key.replace(/primaryAxis/, "ax... | [
"function",
"(",
"key",
",",
"properties",
")",
"{",
"if",
"(",
"!",
"(",
"/",
"primaryAxis",
"/",
".",
"test",
"(",
"key",
")",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"/",
"primaryAxisTitle",
"/",
".",
"test",
"(",
"key",
")",
... | checks if the given x-axis key is deprecated, and if so returns true if that key's non-deprecated counterpart is set in the properties map, otherwise returns false | [
"checks",
"if",
"the",
"given",
"x",
"-",
"axis",
"key",
"is",
"deprecated",
"and",
"if",
"so",
"returns",
"true",
"if",
"that",
"key",
"s",
"non",
"-",
"deprecated",
"counterpart",
"is",
"set",
"in",
"the",
"properties",
"map",
"otherwise",
"returns",
"... | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/lib/ui/charting/js_charting.js#L8097-L8105 | train | |
splunk/splunk-sdk-javascript | lib/ui/charting/js_charting.js | function(properties) {
var key, newKey,
remapped = {},
axisProps = this.filterPropsByRegex(properties, /(axisY|secondaryAxis|axisLabelsY|axisTitleY|gridLinesY)/);
for(key in axisProps) {
if(axisProps.hasOwnProperty(key)) {
if(!t... | javascript | function(properties) {
var key, newKey,
remapped = {},
axisProps = this.filterPropsByRegex(properties, /(axisY|secondaryAxis|axisLabelsY|axisTitleY|gridLinesY)/);
for(key in axisProps) {
if(axisProps.hasOwnProperty(key)) {
if(!t... | [
"function",
"(",
"properties",
")",
"{",
"var",
"key",
",",
"newKey",
",",
"remapped",
"=",
"{",
"}",
",",
"axisProps",
"=",
"this",
".",
"filterPropsByRegex",
"(",
"properties",
",",
"/",
"(axisY|secondaryAxis|axisLabelsY|axisTitleY|gridLinesY)",
"/",
")",
";",... | returns a map of properties that apply either to the y-axis or to y-axis labels all axis-related keys are renamed to 'axis' and all axis-label-related keys are renamed to 'axisLabels' | [
"returns",
"a",
"map",
"of",
"properties",
"that",
"apply",
"either",
"to",
"the",
"y",
"-",
"axis",
"or",
"to",
"y",
"-",
"axis",
"labels",
"all",
"axis",
"-",
"related",
"keys",
"are",
"renamed",
"to",
"axis",
"and",
"all",
"axis",
"-",
"label",
"-... | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/lib/ui/charting/js_charting.js#L8109-L8125 | train | |
splunk/splunk-sdk-javascript | lib/ui/charting/js_charting.js | function(key, properties) {
if(!(/secondaryAxis/.test(key))) {
return false;
}
if(/secondaryAxisTitle/.test(key)) {
return properties[key.replace(/secondaryAxisTitle/, "axisTitleY")];
}
return properties[key.replace(/secondaryAx... | javascript | function(key, properties) {
if(!(/secondaryAxis/.test(key))) {
return false;
}
if(/secondaryAxisTitle/.test(key)) {
return properties[key.replace(/secondaryAxisTitle/, "axisTitleY")];
}
return properties[key.replace(/secondaryAx... | [
"function",
"(",
"key",
",",
"properties",
")",
"{",
"if",
"(",
"!",
"(",
"/",
"secondaryAxis",
"/",
".",
"test",
"(",
"key",
")",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"/",
"secondaryAxisTitle",
"/",
".",
"test",
"(",
"key",
")"... | checks if the given y-axis key is deprecated, and if so returns true if that key's non-deprecated counterpart is set in the properties map, otherwise returns false | [
"checks",
"if",
"the",
"given",
"y",
"-",
"axis",
"key",
"is",
"deprecated",
"and",
"if",
"so",
"returns",
"true",
"if",
"that",
"key",
"s",
"non",
"-",
"deprecated",
"counterpart",
"is",
"set",
"in",
"the",
"properties",
"map",
"otherwise",
"returns",
"... | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/lib/ui/charting/js_charting.js#L8129-L8137 | train | |
splunk/splunk-sdk-javascript | lib/ui/charting/js_charting.js | function(props, regex) {
if(!(regex instanceof RegExp)) {
return props;
}
var key,
filtered = {};
for(key in props) {
if(props.hasOwnProperty(key) && regex.test(key)) {
filtered[key] = props[key];
... | javascript | function(props, regex) {
if(!(regex instanceof RegExp)) {
return props;
}
var key,
filtered = {};
for(key in props) {
if(props.hasOwnProperty(key) && regex.test(key)) {
filtered[key] = props[key];
... | [
"function",
"(",
"props",
",",
"regex",
")",
"{",
"if",
"(",
"!",
"(",
"regex",
"instanceof",
"RegExp",
")",
")",
"{",
"return",
"props",
";",
"}",
"var",
"key",
",",
"filtered",
"=",
"{",
"}",
";",
"for",
"(",
"key",
"in",
"props",
")",
"{",
"... | uses the given regex to filter out any properties whose key doesn't match will return an empty object if the props input is not a map | [
"uses",
"the",
"given",
"regex",
"to",
"filter",
"out",
"any",
"properties",
"whose",
"key",
"doesn",
"t",
"match",
"will",
"return",
"an",
"empty",
"object",
"if",
"the",
"props",
"input",
"is",
"not",
"a",
"map"
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/lib/ui/charting/js_charting.js#L8141-L8154 | train | |
splunk/splunk-sdk-javascript | lib/ui/charting/js_charting.js | function(array1, array2) {
// make sure these are actually arrays
if(!(array1 instanceof Array) || !(array2 instanceof Array)) {
return false;
}
if(array1 === array2) {
// true if they are the same object
return true;
... | javascript | function(array1, array2) {
// make sure these are actually arrays
if(!(array1 instanceof Array) || !(array2 instanceof Array)) {
return false;
}
if(array1 === array2) {
// true if they are the same object
return true;
... | [
"function",
"(",
"array1",
",",
"array2",
")",
"{",
"// make sure these are actually arrays",
"if",
"(",
"!",
"(",
"array1",
"instanceof",
"Array",
")",
"||",
"!",
"(",
"array2",
"instanceof",
"Array",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",... | a simple utility method for comparing arrays, assumes one-dimensional arrays of primitives, performs strict comparisons | [
"a",
"simple",
"utility",
"method",
"for",
"comparing",
"arrays",
"assumes",
"one",
"-",
"dimensional",
"arrays",
"of",
"primitives",
"performs",
"strict",
"comparisons"
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/lib/ui/charting/js_charting.js#L8201-L8221 | train | |
splunk/splunk-sdk-javascript | lib/ui/charting/js_charting.js | function(date, format) {
var i, replacements,
locale = locale_name();
if(format && locale_uses_day_before_month()) {
replacements = this.DAY_FIRST_FORMATS;
for(i = 0; i < replacements.length; i++) {
format = format.replace(repla... | javascript | function(date, format) {
var i, replacements,
locale = locale_name();
if(format && locale_uses_day_before_month()) {
replacements = this.DAY_FIRST_FORMATS;
for(i = 0; i < replacements.length; i++) {
format = format.replace(repla... | [
"function",
"(",
"date",
",",
"format",
")",
"{",
"var",
"i",
",",
"replacements",
",",
"locale",
"=",
"locale_name",
"(",
")",
";",
"if",
"(",
"format",
"&&",
"locale_uses_day_before_month",
"(",
")",
")",
"{",
"replacements",
"=",
"this",
".",
"DAY_FIR... | a special-case hack to handle some i18n bugs, see SPL-42469 | [
"a",
"special",
"-",
"case",
"hack",
"to",
"handle",
"some",
"i18n",
"bugs",
"see",
"SPL",
"-",
"42469"
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/lib/ui/charting/js_charting.js#L8261-L8278 | train | |
splunk/splunk-sdk-javascript | client/splunk.ui.charting.js | function(args) {
args = this.trim(args, '&\?#');
var parts = args.split('&');
var output = {};
var key;
var value;
var equalsSegments;
var lim = parts.length;
for (var i=0,l=lim; i<l; i++) {
equalsSegments ... | javascript | function(args) {
args = this.trim(args, '&\?#');
var parts = args.split('&');
var output = {};
var key;
var value;
var equalsSegments;
var lim = parts.length;
for (var i=0,l=lim; i<l; i++) {
equalsSegments ... | [
"function",
"(",
"args",
")",
"{",
"args",
"=",
"this",
".",
"trim",
"(",
"args",
",",
"'&\\?#'",
")",
";",
"var",
"parts",
"=",
"args",
".",
"split",
"(",
"'&'",
")",
";",
"var",
"output",
"=",
"{",
"}",
";",
"var",
"key",
";",
"var",
"value",... | Converts a flat querystring into an object literal | [
"Converts",
"a",
"flat",
"querystring",
"into",
"an",
"object",
"literal"
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.ui.charting.js#L10790-L10807 | train | |
splunk/splunk-sdk-javascript | client/splunk.ui.charting.js | function(){
var hashPos = window.location.href.indexOf('#');
if (hashPos == -1) {
return "";
}
var qPos = window.location.href.indexOf('?', hashPos);
if (qPos != -1)
return window.location.href.substr(qPos);
return window.location.href.substr(h... | javascript | function(){
var hashPos = window.location.href.indexOf('#');
if (hashPos == -1) {
return "";
}
var qPos = window.location.href.indexOf('?', hashPos);
if (qPos != -1)
return window.location.href.substr(qPos);
return window.location.href.substr(h... | [
"function",
"(",
")",
"{",
"var",
"hashPos",
"=",
"window",
".",
"location",
".",
"href",
".",
"indexOf",
"(",
"'#'",
")",
";",
"if",
"(",
"hashPos",
"==",
"-",
"1",
")",
"{",
"return",
"\"\"",
";",
"}",
"var",
"qPos",
"=",
"window",
".",
"locati... | Extracts the fragment identifier value. | [
"Extracts",
"the",
"fragment",
"identifier",
"value",
"."
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.ui.charting.js#L10812-L10825 | train | |
splunk/splunk-sdk-javascript | client/splunk.ui.charting.js | function(serverOffsetThen, d) {
if (!Splunk.util.isInt(serverOffsetThen)) {
return 0;
}
// what JS thinks the timezone offset is at the time given by d. This WILL INCLUDE DST
var clientOffsetThen = d.getTimezoneOffset() * 60;
// what splunkd to... | javascript | function(serverOffsetThen, d) {
if (!Splunk.util.isInt(serverOffsetThen)) {
return 0;
}
// what JS thinks the timezone offset is at the time given by d. This WILL INCLUDE DST
var clientOffsetThen = d.getTimezoneOffset() * 60;
// what splunkd to... | [
"function",
"(",
"serverOffsetThen",
",",
"d",
")",
"{",
"if",
"(",
"!",
"Splunk",
".",
"util",
".",
"isInt",
"(",
"serverOffsetThen",
")",
")",
"{",
"return",
"0",
";",
"}",
"// what JS thinks the timezone offset is at the time given by d. This WILL INCLUDE DST",
"... | Given a timezone offset in minutes, and a JS Date object,
returns the delta in milliseconds, of the two timezones.
Note that this will include the offset contributions from DST for both. | [
"Given",
"a",
"timezone",
"offset",
"in",
"minutes",
"and",
"a",
"JS",
"Date",
"object",
"returns",
"the",
"delta",
"in",
"milliseconds",
"of",
"the",
"two",
"timezones",
".",
"Note",
"that",
"this",
"will",
"include",
"the",
"offset",
"contributions",
"from... | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.ui.charting.js#L10894-L10904 | train | |
splunk/splunk-sdk-javascript | client/splunk.ui.charting.js | function() {
var output = '', seg, len;
for (var i=0,l=arguments.length; i<l; i++) {
seg = arguments[i].toString();
len = seg.length;
if (len > 1 && seg.charAt(len-1) == '/') {
seg = seg.substring(0, len-1);
}
... | javascript | function() {
var output = '', seg, len;
for (var i=0,l=arguments.length; i<l; i++) {
seg = arguments[i].toString();
len = seg.length;
if (len > 1 && seg.charAt(len-1) == '/') {
seg = seg.substring(0, len-1);
}
... | [
"function",
"(",
")",
"{",
"var",
"output",
"=",
"''",
",",
"seg",
",",
"len",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"l",
"=",
"arguments",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"{",
"seg",
"=",
"arguments",
"[",
"i"... | Returns a proper path that is relative to the current appserver location.
This is critical to ensure that we are proxy compatible. This method
takes 1 or more arguments, which will all be stiched together in sequence.
Ex: make_url('search/job'); // "/splunk/search/job"
Ex: make_url('/search/job'); // "/splunk/search/j... | [
"Returns",
"a",
"proper",
"path",
"that",
"is",
"relative",
"to",
"the",
"current",
"appserver",
"location",
".",
"This",
"is",
"critical",
"to",
"ensure",
"that",
"we",
"are",
"proxy",
"compatible",
".",
"This",
"method",
"takes",
"1",
"or",
"more",
"argu... | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.ui.charting.js#L10975-L11011 | train | |
splunk/splunk-sdk-javascript | client/splunk.ui.charting.js | function(url, options) {
url = this.make_url(url);
if (options) url = url + '?' + this.propToQueryString(options);
return url;
} | javascript | function(url, options) {
url = this.make_url(url);
if (options) url = url + '?' + this.propToQueryString(options);
return url;
} | [
"function",
"(",
"url",
",",
"options",
")",
"{",
"url",
"=",
"this",
".",
"make_url",
"(",
"url",
")",
";",
"if",
"(",
"options",
")",
"url",
"=",
"url",
"+",
"'?'",
"+",
"this",
".",
"propToQueryString",
"(",
"options",
")",
";",
"return",
"url",... | Given a path and a dictionary of options, builds a qualified query string.
@param uri {String} required; path to endpoint. eg. "search/jobs"
@param options {Object} key / value par of query params eg. {'foo': 'bar'} | [
"Given",
"a",
"path",
"and",
"a",
"dictionary",
"of",
"options",
"builds",
"a",
"qualified",
"query",
"string",
"."
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.ui.charting.js#L11019-L11023 | train | |
splunk/splunk-sdk-javascript | client/splunk.ui.charting.js | function(uri, options, windowObj, focus) {
uri = this.make_full_url(uri, options);
if (!windowObj) windowObj = window;
windowObj.document.location = uri;
if (focus && windowObj.focus) windowObj.focus();
return;
} | javascript | function(uri, options, windowObj, focus) {
uri = this.make_full_url(uri, options);
if (!windowObj) windowObj = window;
windowObj.document.location = uri;
if (focus && windowObj.focus) windowObj.focus();
return;
} | [
"function",
"(",
"uri",
",",
"options",
",",
"windowObj",
",",
"focus",
")",
"{",
"uri",
"=",
"this",
".",
"make_full_url",
"(",
"uri",
",",
"options",
")",
";",
"if",
"(",
"!",
"windowObj",
")",
"windowObj",
"=",
"window",
";",
"windowObj",
".",
"do... | Redirects user to a new page.
@param uri {String} required
@param options {Object} containing parameters like:
sid => attaches optional sid in valid format
s => attaches optional saved search name
q => attaches optional search string in valid format
Example:
util.redirect_to('app/core/search', {
'sid' : 1234,
'foo' :... | [
"Redirects",
"user",
"to",
"a",
"new",
"page",
"."
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.ui.charting.js#L11044-L11050 | train | |
splunk/splunk-sdk-javascript | client/splunk.ui.charting.js | function(path) {
if (path === undefined) {
path = document.location.pathname;
}
var locale = this.getConfigValue('LOCALE').toString();
// if there is no way to figure out the locale, just return pathname
if (!this.getConfigValue('LOCALE') || p... | javascript | function(path) {
if (path === undefined) {
path = document.location.pathname;
}
var locale = this.getConfigValue('LOCALE').toString();
// if there is no way to figure out the locale, just return pathname
if (!this.getConfigValue('LOCALE') || p... | [
"function",
"(",
"path",
")",
"{",
"if",
"(",
"path",
"===",
"undefined",
")",
"{",
"path",
"=",
"document",
".",
"location",
".",
"pathname",
";",
"}",
"var",
"locale",
"=",
"this",
".",
"getConfigValue",
"(",
"'LOCALE'",
")",
".",
"toString",
"(",
... | Return the path without the localization segment. | [
"Return",
"the",
"path",
"without",
"the",
"localization",
"segment",
"."
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.ui.charting.js#L11109-L11121 | train | |
splunk/splunk-sdk-javascript | client/splunk.ui.charting.js | function(){
var pageYOffset = 0;
if(window.pageYOffset){
pageYOffset = window.pageYOffset;
}else if(document.documentElement && document.documentElement.scrollTop){
pageYOffset = document.documentElement.scrollTop;
}
return page... | javascript | function(){
var pageYOffset = 0;
if(window.pageYOffset){
pageYOffset = window.pageYOffset;
}else if(document.documentElement && document.documentElement.scrollTop){
pageYOffset = document.documentElement.scrollTop;
}
return page... | [
"function",
"(",
")",
"{",
"var",
"pageYOffset",
"=",
"0",
";",
"if",
"(",
"window",
".",
"pageYOffset",
")",
"{",
"pageYOffset",
"=",
"window",
".",
"pageYOffset",
";",
"}",
"else",
"if",
"(",
"document",
".",
"documentElement",
"&&",
"document",
".",
... | Retrieve the amount of content that has been hidden by scrolling down.
@type Number
@return 0-n value. | [
"Retrieve",
"the",
"amount",
"of",
"content",
"that",
"has",
"been",
"hidden",
"by",
"scrolling",
"down",
"."
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.ui.charting.js#L11149-L11157 | train | |
splunk/splunk-sdk-javascript | client/splunk.ui.charting.js | function(){
return {
width:(!isNaN(window.innerWidth))?window.innerWidth:document.documentElement.clientWidth||0,
height:(!isNaN(window.innerHeight))?window.innerHeight:document.documentElement.clientHeight||0
};
} | javascript | function(){
return {
width:(!isNaN(window.innerWidth))?window.innerWidth:document.documentElement.clientWidth||0,
height:(!isNaN(window.innerHeight))?window.innerHeight:document.documentElement.clientHeight||0
};
} | [
"function",
"(",
")",
"{",
"return",
"{",
"width",
":",
"(",
"!",
"isNaN",
"(",
"window",
".",
"innerWidth",
")",
")",
"?",
"window",
".",
"innerWidth",
":",
"document",
".",
"documentElement",
".",
"clientWidth",
"||",
"0",
",",
"height",
":",
"(",
... | Retrieve the inner dimensions of the window. This does not work in jQuery.
@type Object
@return An object literal having width and height attributes. | [
"Retrieve",
"the",
"inner",
"dimensions",
"of",
"the",
"window",
".",
"This",
"does",
"not",
"work",
"in",
"jQuery",
"."
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.ui.charting.js#L11165-L11170 | train | |
splunk/splunk-sdk-javascript | client/splunk.ui.charting.js | function(el, styleProperty){
if(el.currentStyle){
return el.currentStyle[styleProperty];
}else if(window.getComputedStyle){
var cssProperty = styleProperty.replace(/([A-Z])/g, "-$1").toLowerCase();
var computedStyle = window.getComputedStyle(el, ""... | javascript | function(el, styleProperty){
if(el.currentStyle){
return el.currentStyle[styleProperty];
}else if(window.getComputedStyle){
var cssProperty = styleProperty.replace(/([A-Z])/g, "-$1").toLowerCase();
var computedStyle = window.getComputedStyle(el, ""... | [
"function",
"(",
"el",
",",
"styleProperty",
")",
"{",
"if",
"(",
"el",
".",
"currentStyle",
")",
"{",
"return",
"el",
".",
"currentStyle",
"[",
"styleProperty",
"]",
";",
"}",
"else",
"if",
"(",
"window",
".",
"getComputedStyle",
")",
"{",
"var",
"css... | Retrieve the computed style from a specified element.
@param el
@param styleProperty
@return The computed style value.
@type String | [
"Retrieve",
"the",
"computed",
"style",
"from",
"a",
"specified",
"element",
"."
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.ui.charting.js#L11180-L11190 | train | |
splunk/splunk-sdk-javascript | client/splunk.ui.charting.js | function(p, s){
s = s || window.location.search;
if(!s){
return null;
}
if(!(s.indexOf(p+'=')+1)){
return null;
}
return s.split(p+'=')[1].split('&')[0];
} | javascript | function(p, s){
s = s || window.location.search;
if(!s){
return null;
}
if(!(s.indexOf(p+'=')+1)){
return null;
}
return s.split(p+'=')[1].split('&')[0];
} | [
"function",
"(",
"p",
",",
"s",
")",
"{",
"s",
"=",
"s",
"||",
"window",
".",
"location",
".",
"search",
";",
"if",
"(",
"!",
"s",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"!",
"(",
"s",
".",
"indexOf",
"(",
"p",
"+",
"'='",
")",
... | Retrieve a GET parameter from the window.location. Type casting is not performed.
@param {String} p The param value to retrieve.
@param {String} s Optional string to search through instead of window.location.search
@return {String || null} The string value or null if it does not exist. | [
"Retrieve",
"a",
"GET",
"parameter",
"from",
"the",
"window",
".",
"location",
".",
"Type",
"casting",
"is",
"not",
"performed",
"."
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.ui.charting.js#L11198-L11207 | train | |
splunk/splunk-sdk-javascript | client/splunk.ui.charting.js | function(rgb){
var parts = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
var hex = (parts[1]<<16|parts[2]<<8|parts[3]).toString(16);
return "#"+Array(6-hex.length).concat([hex]).toString().replace(/,/g, 0);
} | javascript | function(rgb){
var parts = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
var hex = (parts[1]<<16|parts[2]<<8|parts[3]).toString(16);
return "#"+Array(6-hex.length).concat([hex]).toString().replace(/,/g, 0);
} | [
"function",
"(",
"rgb",
")",
"{",
"var",
"parts",
"=",
"rgb",
".",
"match",
"(",
"/",
"^rgb\\((\\d+),\\s*(\\d+),\\s*(\\d+)\\)$",
"/",
")",
";",
"var",
"hex",
"=",
"(",
"parts",
"[",
"1",
"]",
"<<",
"16",
"|",
"parts",
"[",
"2",
"]",
"<<",
"8",
"|",... | Take an RGB value and convert to HEX equivalent.
@param {String} rgb A RGB value following rgb(XXX, XXX, XXX) convention.
@type String
@return A HEX equivalent for a given RGB value with a leading '#' character. | [
"Take",
"an",
"RGB",
"value",
"and",
"convert",
"to",
"HEX",
"equivalent",
"."
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.ui.charting.js#L11216-L11220 | train | |
splunk/splunk-sdk-javascript | client/splunk.ui.charting.js | function(target, innerHTML) {
/*@cc_on //innerHTML is faster for IE
target.innerHTML = innerHTML;
return target;
@*/
var targetClone = target.cloneNode(false);
targetClone.innerHTML = innerHTML;
target.parentNode.replaceChild(ta... | javascript | function(target, innerHTML) {
/*@cc_on //innerHTML is faster for IE
target.innerHTML = innerHTML;
return target;
@*/
var targetClone = target.cloneNode(false);
targetClone.innerHTML = innerHTML;
target.parentNode.replaceChild(ta... | [
"function",
"(",
"target",
",",
"innerHTML",
")",
"{",
"/*@cc_on //innerHTML is faster for IE\n target.innerHTML = innerHTML;\n return target;\n @*/",
"var",
"targetClone",
"=",
"target",
".",
"cloneNode",
"(",
"false",
")",
";",
"targetCl... | innerHTML substitute when it is not fast enough.
@param {HTMLObject} target The target DOM element to replace innerHTML content with.
@param {String} innerHTML The innerHTML string to add.
@return {HTMLObject} The reference to the target DOM element as it may have been cloned and removed. | [
"innerHTML",
"substitute",
"when",
"it",
"is",
"not",
"fast",
"enough",
"."
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.ui.charting.js#L11251-L11260 | train | |
splunk/splunk-sdk-javascript | client/splunk.ui.charting.js | function(q, isUserEntered) {
var workingQ = '' + q;
workingQ = workingQ.replace(this.reLTrim, '').replace(this.reRNormalize, ' ');
if (workingQ.substring(0, 1) == '|') {
return q;
}
// this is specific to the case where searchstring = 'search ... | javascript | function(q, isUserEntered) {
var workingQ = '' + q;
workingQ = workingQ.replace(this.reLTrim, '').replace(this.reRNormalize, ' ');
if (workingQ.substring(0, 1) == '|') {
return q;
}
// this is specific to the case where searchstring = 'search ... | [
"function",
"(",
"q",
",",
"isUserEntered",
")",
"{",
"var",
"workingQ",
"=",
"''",
"+",
"q",
";",
"workingQ",
"=",
"workingQ",
".",
"replace",
"(",
"this",
".",
"reLTrim",
",",
"''",
")",
".",
"replace",
"(",
"this",
".",
"reRNormalize",
",",
"' '",... | Returns a fully qualified search string by prepending the 'search'
command of unqualified searches. This method deems strings as unqualified
if it does not start with a | or 'search '
@param {boolean} isUserEntered Indicates if 'q' is expected to be unqualified | [
"Returns",
"a",
"fully",
"qualified",
"search",
"string",
"by",
"prepending",
"the",
"search",
"command",
"of",
"unqualified",
"searches",
".",
"This",
"method",
"deems",
"strings",
"as",
"unqualified",
"if",
"it",
"does",
"not",
"start",
"with",
"a",
"|",
"... | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.ui.charting.js#L11313-L11328 | train | |
splunk/splunk-sdk-javascript | client/splunk.ui.charting.js | function(q) {
var workingQ = '' + q;
workingQ = workingQ.replace(this.reLTrimCommand, '');
if (workingQ.substring(0, 7) == 'search ') {
return workingQ.substring(7).replace(this.reLTrimCommand, '');
}
return q;
} | javascript | function(q) {
var workingQ = '' + q;
workingQ = workingQ.replace(this.reLTrimCommand, '');
if (workingQ.substring(0, 7) == 'search ') {
return workingQ.substring(7).replace(this.reLTrimCommand, '');
}
return q;
} | [
"function",
"(",
"q",
")",
"{",
"var",
"workingQ",
"=",
"''",
"+",
"q",
";",
"workingQ",
"=",
"workingQ",
".",
"replace",
"(",
"this",
".",
"reLTrimCommand",
",",
"''",
")",
";",
"if",
"(",
"workingQ",
".",
"substring",
"(",
"0",
",",
"7",
")",
"... | Returns an unqualified search string by removing any leading 'search '
command. This method does a simple search at the beginning of the
search. | [
"Returns",
"an",
"unqualified",
"search",
"string",
"by",
"removing",
"any",
"leading",
"search",
"command",
".",
"This",
"method",
"does",
"a",
"simple",
"search",
"at",
"the",
"beginning",
"of",
"the",
"search",
"."
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.ui.charting.js#L11335-L11342 | train | |
splunk/splunk-sdk-javascript | client/splunk.ui.charting.js | function(strList) {
if (typeof(strList) != 'string' || !strList) return [];
var items = [];
var field_name_buffer = [];
var inquote = false;
var str = $.trim(strList);
for (var i=0,j=str.length; i<j; i++) {
if (str.charAt(i) == '\\'... | javascript | function(strList) {
if (typeof(strList) != 'string' || !strList) return [];
var items = [];
var field_name_buffer = [];
var inquote = false;
var str = $.trim(strList);
for (var i=0,j=str.length; i<j; i++) {
if (str.charAt(i) == '\\'... | [
"function",
"(",
"strList",
")",
"{",
"if",
"(",
"typeof",
"(",
"strList",
")",
"!=",
"'string'",
"||",
"!",
"strList",
")",
"return",
"[",
"]",
";",
"var",
"items",
"=",
"[",
"]",
";",
"var",
"field_name_buffer",
"=",
"[",
"]",
";",
"var",
"inquot... | Deserializes a string into a field list. | [
"Deserializes",
"a",
"string",
"into",
"a",
"field",
"list",
"."
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.ui.charting.js#L11347-L11389 | train | |
splunk/splunk-sdk-javascript | client/splunk.ui.charting.js | function(obj1, obj2){
if(obj1 instanceof Array && obj2 instanceof Array){
if(obj1.length!==obj2.length){
return false;
}else{
for(var i=0; i<obj1.length; i++){
if(!this.... | javascript | function(obj1, obj2){
if(obj1 instanceof Array && obj2 instanceof Array){
if(obj1.length!==obj2.length){
return false;
}else{
for(var i=0; i<obj1.length; i++){
if(!this.... | [
"function",
"(",
"obj1",
",",
"obj2",
")",
"{",
"if",
"(",
"obj1",
"instanceof",
"Array",
"&&",
"obj2",
"instanceof",
"Array",
")",
"{",
"if",
"(",
"obj1",
".",
"length",
"!==",
"obj2",
".",
"length",
")",
"{",
"return",
"false",
";",
"}",
"else",
... | Compare the likeness of two objects. Please use with discretion. | [
"Compare",
"the",
"likeness",
"of",
"two",
"objects",
".",
"Please",
"use",
"with",
"discretion",
"."
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.ui.charting.js#L11429-L11467 | train | |
splunk/splunk-sdk-javascript | client/splunk.ui.charting.js | function(){
var self = this,
startTime = null,
stopTime = null,
times = [];
var isSet = function(prop){
return (prop==null)?false:true;
};
var isStarted = function(){
return isSet(startTime);
... | javascript | function(){
var self = this,
startTime = null,
stopTime = null,
times = [];
var isSet = function(prop){
return (prop==null)?false:true;
};
var isStarted = function(){
return isSet(startTime);
... | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
",",
"startTime",
"=",
"null",
",",
"stopTime",
"=",
"null",
",",
"times",
"=",
"[",
"]",
";",
"var",
"isSet",
"=",
"function",
"(",
"prop",
")",
"{",
"return",
"(",
"prop",
"==",
"null",
")"... | Stop watch class. | [
"Stop",
"watch",
"class",
"."
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.ui.charting.js#L11471-L11530 | train | |
splunk/splunk-sdk-javascript | client/splunk.ui.charting.js | function(string, maxLength) {
if (!string) return string;
if (maxLength < 1) return string;
if (string.length <= maxLength) return string;
if (maxLength == 1) return string.substring(0,1) + '...';
var midpoint = Math.ceil(string.length / 2);
var t... | javascript | function(string, maxLength) {
if (!string) return string;
if (maxLength < 1) return string;
if (string.length <= maxLength) return string;
if (maxLength == 1) return string.substring(0,1) + '...';
var midpoint = Math.ceil(string.length / 2);
var t... | [
"function",
"(",
"string",
",",
"maxLength",
")",
"{",
"if",
"(",
"!",
"string",
")",
"return",
"string",
";",
"if",
"(",
"maxLength",
"<",
"1",
")",
"return",
"string",
";",
"if",
"(",
"string",
".",
"length",
"<=",
"maxLength",
")",
"return",
"stri... | Returns a string trimmed to maxLength by removing characters from the
middle of the string and replacing with ellipses.
Ex: Splunk.util.smartTrim('1234567890', 5) ==> '12...890' | [
"Returns",
"a",
"string",
"trimmed",
"to",
"maxLength",
"by",
"removing",
"characters",
"from",
"the",
"middle",
"of",
"the",
"string",
"and",
"replacing",
"with",
"ellipses",
"."
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.ui.charting.js#L11543-L11554 | train | |
splunk/splunk-sdk-javascript | client/splunk.ui.charting.js | function(fragment, reg, value) {
if (typeof fragment == 'string') {
if (fragment.match(reg)) {
fragment = fragment.replace(reg, value);
}
return fragment;
}
else if (typeof fragment == "function") {
r... | javascript | function(fragment, reg, value) {
if (typeof fragment == 'string') {
if (fragment.match(reg)) {
fragment = fragment.replace(reg, value);
}
return fragment;
}
else if (typeof fragment == "function") {
r... | [
"function",
"(",
"fragment",
",",
"reg",
",",
"value",
")",
"{",
"if",
"(",
"typeof",
"fragment",
"==",
"'string'",
")",
"{",
"if",
"(",
"fragment",
".",
"match",
"(",
"reg",
")",
")",
"{",
"fragment",
"=",
"fragment",
".",
"replace",
"(",
"reg",
"... | walked through the entirety of fragment to all levels of nesting
and will replace all matches of the given single regex with the given
single value.
replacement will occur in both keys and values. | [
"walked",
"through",
"the",
"entirety",
"of",
"fragment",
"to",
"all",
"levels",
"of",
"nesting",
"and",
"will",
"replace",
"all",
"matches",
"of",
"the",
"given",
"single",
"regex",
"with",
"the",
"given",
"single",
"value",
".",
"replacement",
"will",
"occ... | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.ui.charting.js#L11611-L11645 | train | |
splunk/splunk-sdk-javascript | client/splunk.ui.charting.js | extend | function extend(a, b) {
var n;
if (!a) {
a = {};
}
for (n in b) {
a[n] = b[n];
}
return a;
} | javascript | function extend(a, b) {
var n;
if (!a) {
a = {};
}
for (n in b) {
a[n] = b[n];
}
return a;
} | [
"function",
"extend",
"(",
"a",
",",
"b",
")",
"{",
"var",
"n",
";",
"if",
"(",
"!",
"a",
")",
"{",
"a",
"=",
"{",
"}",
";",
"}",
"for",
"(",
"n",
"in",
"b",
")",
"{",
"a",
"[",
"n",
"]",
"=",
"b",
"[",
"n",
"]",
";",
"}",
"return",
... | Extend an object with the members of another
@param {Object} a The object to be extended
@param {Object} b The object to add to the first one | [
"Extend",
"an",
"object",
"with",
"the",
"members",
"of",
"another"
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.ui.charting.js#L12123-L12132 | train |
splunk/splunk-sdk-javascript | client/splunk.ui.charting.js | erase | function erase(arr, item) {
var i = arr.length;
while (i--) {
if (arr[i] === item) {
arr.splice(i, 1);
break;
}
}
//return arr;
} | javascript | function erase(arr, item) {
var i = arr.length;
while (i--) {
if (arr[i] === item) {
arr.splice(i, 1);
break;
}
}
//return arr;
} | [
"function",
"erase",
"(",
"arr",
",",
"item",
")",
"{",
"var",
"i",
"=",
"arr",
".",
"length",
";",
"while",
"(",
"i",
"--",
")",
"{",
"if",
"(",
"arr",
"[",
"i",
"]",
"===",
"item",
")",
"{",
"arr",
".",
"splice",
"(",
"i",
",",
"1",
")",
... | Remove last occurence of an item from an array
@param {Array} arr
@param {Mixed} item | [
"Remove",
"last",
"occurence",
"of",
"an",
"item",
"from",
"an",
"array"
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.ui.charting.js#L12186-L12195 | train |
splunk/splunk-sdk-javascript | client/splunk.ui.charting.js | attr | function attr(elem, prop, value) {
var key,
setAttribute = 'setAttribute',
ret;
// if the prop is a string
if (isString(prop)) {
// set the value
if (defined(value)) {
elem[setAttribute](prop, value);
// get the value
} else if (elem && elem.getAttribute) { // elem not defined when pri... | javascript | function attr(elem, prop, value) {
var key,
setAttribute = 'setAttribute',
ret;
// if the prop is a string
if (isString(prop)) {
// set the value
if (defined(value)) {
elem[setAttribute](prop, value);
// get the value
} else if (elem && elem.getAttribute) { // elem not defined when pri... | [
"function",
"attr",
"(",
"elem",
",",
"prop",
",",
"value",
")",
"{",
"var",
"key",
",",
"setAttribute",
"=",
"'setAttribute'",
",",
"ret",
";",
"// if the prop is a string\r",
"if",
"(",
"isString",
"(",
"prop",
")",
")",
"{",
"// set the value\r",
"if",
... | Set or get an attribute or an object of attributes. Can't use jQuery attr because
it attempts to set expando properties on the SVG element, which is not allowed.
@param {Object} elem The DOM element to receive the attribute(s)
@param {String|Object} prop The property or an abject of key-value pairs
@param {String} val... | [
"Set",
"or",
"get",
"an",
"attribute",
"or",
"an",
"object",
"of",
"attributes",
".",
"Can",
"t",
"use",
"jQuery",
"attr",
"because",
"it",
"attempts",
"to",
"set",
"expando",
"properties",
"on",
"the",
"SVG",
"element",
"which",
"is",
"not",
"allowed",
... | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.ui.charting.js#L12213-L12237 | train |
splunk/splunk-sdk-javascript | client/splunk.ui.charting.js | css | function css(el, styles) {
if (isIE) {
if (styles && styles.opacity !== UNDEFINED) {
styles.filter = 'alpha(opacity=' + (styles.opacity * 100) + ')';
}
}
extend(el.style, styles);
} | javascript | function css(el, styles) {
if (isIE) {
if (styles && styles.opacity !== UNDEFINED) {
styles.filter = 'alpha(opacity=' + (styles.opacity * 100) + ')';
}
}
extend(el.style, styles);
} | [
"function",
"css",
"(",
"el",
",",
"styles",
")",
"{",
"if",
"(",
"isIE",
")",
"{",
"if",
"(",
"styles",
"&&",
"styles",
".",
"opacity",
"!==",
"UNDEFINED",
")",
"{",
"styles",
".",
"filter",
"=",
"'alpha(opacity='",
"+",
"(",
"styles",
".",
"opacity... | Set CSS on a given element
@param {Object} el
@param {Object} styles Style object with camel case property names | [
"Set",
"CSS",
"on",
"a",
"given",
"element"
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.ui.charting.js#L12268-L12275 | train |
splunk/splunk-sdk-javascript | client/splunk.ui.charting.js | createElement | function createElement(tag, attribs, styles, parent, nopad) {
var el = doc.createElement(tag);
if (attribs) {
extend(el, attribs);
}
if (nopad) {
css(el, {padding: 0, border: NONE, margin: 0});
}
if (styles) {
css(el, styles);
}
if (parent) {
parent.appendChild(el);
}
return el;
} | javascript | function createElement(tag, attribs, styles, parent, nopad) {
var el = doc.createElement(tag);
if (attribs) {
extend(el, attribs);
}
if (nopad) {
css(el, {padding: 0, border: NONE, margin: 0});
}
if (styles) {
css(el, styles);
}
if (parent) {
parent.appendChild(el);
}
return el;
} | [
"function",
"createElement",
"(",
"tag",
",",
"attribs",
",",
"styles",
",",
"parent",
",",
"nopad",
")",
"{",
"var",
"el",
"=",
"doc",
".",
"createElement",
"(",
"tag",
")",
";",
"if",
"(",
"attribs",
")",
"{",
"extend",
"(",
"el",
",",
"attribs",
... | Utility function to create element with attributes and styles
@param {Object} tag
@param {Object} attribs
@param {Object} styles
@param {Object} parent
@param {Object} nopad | [
"Utility",
"function",
"to",
"create",
"element",
"with",
"attributes",
"and",
"styles"
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.ui.charting.js#L12285-L12300 | train |
splunk/splunk-sdk-javascript | client/splunk.ui.charting.js | getPosition | function getPosition(el) {
var p = { left: el.offsetLeft, top: el.offsetTop };
el = el.offsetParent;
while (el) {
p.left += el.offsetLeft;
p.top += el.offsetTop;
if (el !== doc.body && el !== doc.documentElement) {
p.left -= el.scrollLeft;
p.top -= el.scrollTop;
}
el = el.offsetParent;
}
... | javascript | function getPosition(el) {
var p = { left: el.offsetLeft, top: el.offsetTop };
el = el.offsetParent;
while (el) {
p.left += el.offsetLeft;
p.top += el.offsetTop;
if (el !== doc.body && el !== doc.documentElement) {
p.left -= el.scrollLeft;
p.top -= el.scrollTop;
}
el = el.offsetParent;
}
... | [
"function",
"getPosition",
"(",
"el",
")",
"{",
"var",
"p",
"=",
"{",
"left",
":",
"el",
".",
"offsetLeft",
",",
"top",
":",
"el",
".",
"offsetTop",
"}",
";",
"el",
"=",
"el",
".",
"offsetParent",
";",
"while",
"(",
"el",
")",
"{",
"p",
".",
"l... | Loop up the node tree and add offsetWidth and offsetHeight to get the
total page offset for a given element. Used by Opera and iOS on hover and
all browsers on point click.
@param {Object} el | [
"Loop",
"up",
"the",
"node",
"tree",
"and",
"add",
"offsetWidth",
"and",
"offsetHeight",
"to",
"get",
"the",
"total",
"page",
"offset",
"for",
"a",
"given",
"element",
".",
"Used",
"by",
"Opera",
"and",
"iOS",
"on",
"hover",
"and",
"all",
"browsers",
"on... | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.ui.charting.js#L12423-L12436 | train |
splunk/splunk-sdk-javascript | client/splunk.ui.charting.js | placeBox | function placeBox(boxWidth, boxHeight, outerLeft, outerTop, outerWidth, outerHeight, point) {
// keep the box within the chart area
var pointX = point.x,
pointY = point.y,
x = pointX - boxWidth + outerLeft - 25,
y = pointY - boxHeight + outerTop + 10,
alignedRight;
// it is too far to the left, adju... | javascript | function placeBox(boxWidth, boxHeight, outerLeft, outerTop, outerWidth, outerHeight, point) {
// keep the box within the chart area
var pointX = point.x,
pointY = point.y,
x = pointX - boxWidth + outerLeft - 25,
y = pointY - boxHeight + outerTop + 10,
alignedRight;
// it is too far to the left, adju... | [
"function",
"placeBox",
"(",
"boxWidth",
",",
"boxHeight",
",",
"outerLeft",
",",
"outerTop",
",",
"outerWidth",
",",
"outerHeight",
",",
"point",
")",
"{",
"// keep the box within the chart area\r",
"var",
"pointX",
"=",
"point",
".",
"x",
",",
"pointY",
"=",
... | Utility method extracted from Tooltip code that places a tooltip in a chart without spilling over
and not covering the point it self. | [
"Utility",
"method",
"extracted",
"from",
"Tooltip",
"code",
"that",
"places",
"a",
"tooltip",
"in",
"a",
"chart",
"without",
"spilling",
"over",
"and",
"not",
"covering",
"the",
"point",
"it",
"self",
"."
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.ui.charting.js#L12470-L12521 | train |
splunk/splunk-sdk-javascript | client/splunk.ui.charting.js | stableSort | function stableSort(arr, sortFunction) {
var length = arr.length,
i;
// Add index to each item
for (i = 0; i < length; i++) {
arr[i].ss_i = i; // stable sort index
}
arr.sort(function (a, b) {
var sortValue = sortFunction(a, b);
return sortValue === 0 ? a.ss_i - b.ss_i : sortValue;
});
/... | javascript | function stableSort(arr, sortFunction) {
var length = arr.length,
i;
// Add index to each item
for (i = 0; i < length; i++) {
arr[i].ss_i = i; // stable sort index
}
arr.sort(function (a, b) {
var sortValue = sortFunction(a, b);
return sortValue === 0 ? a.ss_i - b.ss_i : sortValue;
});
/... | [
"function",
"stableSort",
"(",
"arr",
",",
"sortFunction",
")",
"{",
"var",
"length",
"=",
"arr",
".",
"length",
",",
"i",
";",
"// Add index to each item\r",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"arr",
"[",
... | Utility method that sorts an object array and keeping the order of equal items.
ECMA script standard does not specify the behaviour when items are equal. | [
"Utility",
"method",
"that",
"sorts",
"an",
"object",
"array",
"and",
"keeping",
"the",
"order",
"of",
"equal",
"items",
".",
"ECMA",
"script",
"standard",
"does",
"not",
"specify",
"the",
"behaviour",
"when",
"items",
"are",
"equal",
"."
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.ui.charting.js#L12527-L12545 | train |
splunk/splunk-sdk-javascript | client/splunk.ui.charting.js | function (start, end, pos, complete) {
var ret = [],
i = start.length,
startVal;
if (pos === 1) { // land on the final path without adjustment points appended in the ends
ret = complete;
} else if (i === end.length && pos < 1) {
while (i--) {
startVal = parseFloat(start[i]);
ret[i... | javascript | function (start, end, pos, complete) {
var ret = [],
i = start.length,
startVal;
if (pos === 1) { // land on the final path without adjustment points appended in the ends
ret = complete;
} else if (i === end.length && pos < 1) {
while (i--) {
startVal = parseFloat(start[i]);
ret[i... | [
"function",
"(",
"start",
",",
"end",
",",
"pos",
",",
"complete",
")",
"{",
"var",
"ret",
"=",
"[",
"]",
",",
"i",
"=",
"start",
".",
"length",
",",
"startVal",
";",
"if",
"(",
"pos",
"===",
"1",
")",
"{",
"// land on the final path without adjustment... | Interpolate each value of the path and return the array | [
"Interpolate",
"each",
"value",
"of",
"the",
"path",
"and",
"return",
"the",
"array"
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.ui.charting.js#L12637-L12658 | train | |
splunk/splunk-sdk-javascript | client/splunk.ui.charting.js | function () {
var element = this.element,
childNodes = element.childNodes,
i = childNodes.length;
while (i--) {
element.removeChild(childNodes[i]);
}
} | javascript | function () {
var element = this.element,
childNodes = element.childNodes,
i = childNodes.length;
while (i--) {
element.removeChild(childNodes[i]);
}
} | [
"function",
"(",
")",
"{",
"var",
"element",
"=",
"this",
".",
"element",
",",
"childNodes",
"=",
"element",
".",
"childNodes",
",",
"i",
"=",
"childNodes",
".",
"length",
";",
"while",
"(",
"i",
"--",
")",
"{",
"element",
".",
"removeChild",
"(",
"c... | Empty a group element | [
"Empty",
"a",
"group",
"element"
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.ui.charting.js#L14257-L14265 | train | |
splunk/splunk-sdk-javascript | client/splunk.ui.charting.js | function (points, width) {
// points format: [M, 0, 0, L, 100, 0]
// normalize to a crisp line
if (points[1] === points[4]) {
points[1] = points[4] = mathRound(points[1]) + (width % 2 / 2);
}
if (points[2] === points[5]) {
points[2] = points[5] = mathRound(points[2]) + (width % 2 / 2);
}
re... | javascript | function (points, width) {
// points format: [M, 0, 0, L, 100, 0]
// normalize to a crisp line
if (points[1] === points[4]) {
points[1] = points[4] = mathRound(points[1]) + (width % 2 / 2);
}
if (points[2] === points[5]) {
points[2] = points[5] = mathRound(points[2]) + (width % 2 / 2);
}
re... | [
"function",
"(",
"points",
",",
"width",
")",
"{",
"// points format: [M, 0, 0, L, 100, 0]\r",
"// normalize to a crisp line\r",
"if",
"(",
"points",
"[",
"1",
"]",
"===",
"points",
"[",
"4",
"]",
")",
"{",
"points",
"[",
"1",
"]",
"=",
"points",
"[",
"4",
... | Make a straight line crisper by not spilling out to neighbour pixels
@param {Array} points
@param {Number} width | [
"Make",
"a",
"straight",
"line",
"crisper",
"by",
"not",
"spilling",
"out",
"to",
"neighbour",
"pixels"
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.ui.charting.js#L14572-L14582 | train | |
splunk/splunk-sdk-javascript | client/splunk.ui.charting.js | function (x, y, r, innerR, start, end) {
// arcs are defined as symbols for the ability to set
// attributes in attr and animate
if (isObject(x)) {
y = x.y;
r = x.r;
innerR = x.innerR;
start = x.start;
end = x.end;
x = x.x;
}
return this.symbol('arc', x || 0, y || 0, r || 0, {... | javascript | function (x, y, r, innerR, start, end) {
// arcs are defined as symbols for the ability to set
// attributes in attr and animate
if (isObject(x)) {
y = x.y;
r = x.r;
innerR = x.innerR;
start = x.start;
end = x.end;
x = x.x;
}
return this.symbol('arc', x || 0, y || 0, r || 0, {... | [
"function",
"(",
"x",
",",
"y",
",",
"r",
",",
"innerR",
",",
"start",
",",
"end",
")",
"{",
"// arcs are defined as symbols for the ability to set\r",
"// attributes in attr and animate\r",
"if",
"(",
"isObject",
"(",
"x",
")",
")",
"{",
"y",
"=",
"x",
".",
... | Draw and return an arc
@param {Number} x X position
@param {Number} y Y position
@param {Number} r Radius
@param {Number} innerR Inner radius like used in donut charts
@param {Number} start Starting angle
@param {Number} end Ending angle | [
"Draw",
"and",
"return",
"an",
"arc"
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.ui.charting.js#L14623-L14641 | train | |
splunk/splunk-sdk-javascript | client/splunk.ui.charting.js | function (name) {
var elem = this.createElement('g');
return defined(name) ? elem.attr({ 'class': PREFIX + name }) : elem;
} | javascript | function (name) {
var elem = this.createElement('g');
return defined(name) ? elem.attr({ 'class': PREFIX + name }) : elem;
} | [
"function",
"(",
"name",
")",
"{",
"var",
"elem",
"=",
"this",
".",
"createElement",
"(",
"'g'",
")",
";",
"return",
"defined",
"(",
"name",
")",
"?",
"elem",
".",
"attr",
"(",
"{",
"'class'",
":",
"PREFIX",
"+",
"name",
"}",
")",
":",
"elem",
";... | Create a group
@param {String} name The group will be given a class name of 'highcharts-{name}'.
This can be used for styling and scripting. | [
"Create",
"a",
"group"
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.ui.charting.js#L14700-L14703 | train | |
splunk/splunk-sdk-javascript | client/splunk.ui.charting.js | function (x, y, width, height) {
var wrapper,
id = PREFIX + idCounter++,
clipPath = this.createElement('clipPath').attr({
id: id
}).add(this.defs);
wrapper = this.rect(x, y, width, height, 0).add(clipPath);
wrapper.id = id;
wrapper.clipPath = clipPath;
return wrapper;
} | javascript | function (x, y, width, height) {
var wrapper,
id = PREFIX + idCounter++,
clipPath = this.createElement('clipPath').attr({
id: id
}).add(this.defs);
wrapper = this.rect(x, y, width, height, 0).add(clipPath);
wrapper.id = id;
wrapper.clipPath = clipPath;
return wrapper;
} | [
"function",
"(",
"x",
",",
"y",
",",
"width",
",",
"height",
")",
"{",
"var",
"wrapper",
",",
"id",
"=",
"PREFIX",
"+",
"idCounter",
"++",
",",
"clipPath",
"=",
"this",
".",
"createElement",
"(",
"'clipPath'",
")",
".",
"attr",
"(",
"{",
"id",
":",... | Define a clipping rectangle
@param {String} id
@param {Number} x
@param {Number} y
@param {Number} width
@param {Number} height | [
"Define",
"a",
"clipping",
"rectangle"
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.ui.charting.js#L14922-L14935 | train | |
splunk/splunk-sdk-javascript | client/splunk.ui.charting.js | function (color, elem, prop) {
var colorObject,
regexRgba = /^rgba/;
if (color && color.linearGradient) {
var renderer = this,
strLinearGradient = 'linearGradient',
linearGradient = color[strLinearGradient],
id = PREFIX + idCounter++,
gradientObject,
stopColor,
stopOpacity;
... | javascript | function (color, elem, prop) {
var colorObject,
regexRgba = /^rgba/;
if (color && color.linearGradient) {
var renderer = this,
strLinearGradient = 'linearGradient',
linearGradient = color[strLinearGradient],
id = PREFIX + idCounter++,
gradientObject,
stopColor,
stopOpacity;
... | [
"function",
"(",
"color",
",",
"elem",
",",
"prop",
")",
"{",
"var",
"colorObject",
",",
"regexRgba",
"=",
"/",
"^rgba",
"/",
";",
"if",
"(",
"color",
"&&",
"color",
".",
"linearGradient",
")",
"{",
"var",
"renderer",
"=",
"this",
",",
"strLinearGradie... | Take a color and return it if it's a string, make it a gradient if it's a
gradient configuration object
@param {Object} color The color or config object | [
"Take",
"a",
"color",
"and",
"return",
"it",
"if",
"it",
"s",
"a",
"string",
"make",
"it",
"a",
"gradient",
"if",
"it",
"s",
"a",
"gradient",
"configuration",
"object"
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.ui.charting.js#L14944-L15006 | train | |
splunk/splunk-sdk-javascript | client/splunk.ui.charting.js | function (renderer, nodeName) {
var markup = ['<', nodeName, ' filled="f" stroked="f"'],
style = ['position: ', ABSOLUTE, ';'];
// divs and shapes need size
if (nodeName === 'shape' || nodeName === DIV) {
style.push('left:0;top:0;width:10px;height:10px;');
}
if (docMode8) {
style.push('vis... | javascript | function (renderer, nodeName) {
var markup = ['<', nodeName, ' filled="f" stroked="f"'],
style = ['position: ', ABSOLUTE, ';'];
// divs and shapes need size
if (nodeName === 'shape' || nodeName === DIV) {
style.push('left:0;top:0;width:10px;height:10px;');
}
if (docMode8) {
style.push('vis... | [
"function",
"(",
"renderer",
",",
"nodeName",
")",
"{",
"var",
"markup",
"=",
"[",
"'<'",
",",
"nodeName",
",",
"' filled=\"f\" stroked=\"f\"'",
"]",
",",
"style",
"=",
"[",
"'position: '",
",",
"ABSOLUTE",
",",
"';'",
"]",
";",
"// divs and shapes need size\r... | Initialize a new VML element wrapper. It builds the markup as a string
to minimize DOM traffic.
@param {Object} renderer
@param {Object} nodeName | [
"Initialize",
"a",
"new",
"VML",
"element",
"wrapper",
".",
"It",
"builds",
"the",
"markup",
"as",
"a",
"string",
"to",
"minimize",
"DOM",
"traffic",
"."
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.ui.charting.js#L15070-L15093 | train | |
splunk/splunk-sdk-javascript | client/splunk.ui.charting.js | function () {
var wrapper = this;
if (wrapper.destroyClip) {
wrapper.destroyClip();
}
return SVGElement.prototype.destroy.apply(wrapper);
} | javascript | function () {
var wrapper = this;
if (wrapper.destroyClip) {
wrapper.destroyClip();
}
return SVGElement.prototype.destroy.apply(wrapper);
} | [
"function",
"(",
")",
"{",
"var",
"wrapper",
"=",
"this",
";",
"if",
"(",
"wrapper",
".",
"destroyClip",
")",
"{",
"wrapper",
".",
"destroyClip",
"(",
")",
";",
"}",
"return",
"SVGElement",
".",
"prototype",
".",
"destroy",
".",
"apply",
"(",
"wrapper"... | Extend element.destroy by removing it from the clip members array | [
"Extend",
"element",
".",
"destroy",
"by",
"removing",
"it",
"from",
"the",
"clip",
"members",
"array"
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.ui.charting.js#L15401-L15409 | train | |
splunk/splunk-sdk-javascript | client/splunk.ui.charting.js | function (eventType, handler) {
// simplest possible event model for internal use
this.element['on' + eventType] = function () {
var evt = win.event;
evt.target = evt.srcElement;
handler(evt);
};
return this;
} | javascript | function (eventType, handler) {
// simplest possible event model for internal use
this.element['on' + eventType] = function () {
var evt = win.event;
evt.target = evt.srcElement;
handler(evt);
};
return this;
} | [
"function",
"(",
"eventType",
",",
"handler",
")",
"{",
"// simplest possible event model for internal use\r",
"this",
".",
"element",
"[",
"'on'",
"+",
"eventType",
"]",
"=",
"function",
"(",
")",
"{",
"var",
"evt",
"=",
"win",
".",
"event",
";",
"evt",
"."... | Add an event listener. VML override for normalizing event parameters.
@param {String} eventType
@param {Function} handler | [
"Add",
"an",
"event",
"listener",
".",
"VML",
"override",
"for",
"normalizing",
"event",
"parameters",
"."
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.ui.charting.js#L15459-L15467 | train | |
splunk/splunk-sdk-javascript | client/splunk.ui.charting.js | function (str, x, y) {
var defaultChartStyle = defaultOptions.chart.style;
return this.createElement('span')
.attr({
text: str,
x: mathRound(x),
y: mathRound(y)
})
.css({
whiteSpace: 'nowrap',
fontFamily: defaultChartStyle.fontFamily,
fontSize: defaultChartStyle.fontS... | javascript | function (str, x, y) {
var defaultChartStyle = defaultOptions.chart.style;
return this.createElement('span')
.attr({
text: str,
x: mathRound(x),
y: mathRound(y)
})
.css({
whiteSpace: 'nowrap',
fontFamily: defaultChartStyle.fontFamily,
fontSize: defaultChartStyle.fontS... | [
"function",
"(",
"str",
",",
"x",
",",
"y",
")",
"{",
"var",
"defaultChartStyle",
"=",
"defaultOptions",
".",
"chart",
".",
"style",
";",
"return",
"this",
".",
"createElement",
"(",
"'span'",
")",
".",
"attr",
"(",
"{",
"text",
":",
"str",
",",
"x",... | Create rotated and aligned text
@param {String} str
@param {Number} x
@param {Number} y | [
"Create",
"rotated",
"and",
"aligned",
"text"
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.ui.charting.js#L15858-L15873 | train | |
splunk/splunk-sdk-javascript | client/splunk.ui.charting.js | function () {
var value = this.value,
ret;
if (dateTimeLabelFormat) { // datetime axis
ret = dateFormat(dateTimeLabelFormat, value);
} else if (tickInterval % 1000000 === 0) { // use M abbreviation
ret = (value / 1000000) + 'M';
} else if (tickInterval % 1000 === 0) { ... | javascript | function () {
var value = this.value,
ret;
if (dateTimeLabelFormat) { // datetime axis
ret = dateFormat(dateTimeLabelFormat, value);
} else if (tickInterval % 1000000 === 0) { // use M abbreviation
ret = (value / 1000000) + 'M';
} else if (tickInterval % 1000 === 0) { ... | [
"function",
"(",
")",
"{",
"var",
"value",
"=",
"this",
".",
"value",
",",
"ret",
";",
"if",
"(",
"dateTimeLabelFormat",
")",
"{",
"// datetime axis\r",
"ret",
"=",
"dateFormat",
"(",
"dateTimeLabelFormat",
",",
"value",
")",
";",
"}",
"else",
"if",
"(",... | can be overwritten by dynamic format | [
"can",
"be",
"overwritten",
"by",
"dynamic",
"format"
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.ui.charting.js#L16283-L16303 | train | |
splunk/splunk-sdk-javascript | client/splunk.ui.charting.js | Tick | function Tick(pos, minor) {
var tick = this;
tick.pos = pos;
tick.minor = minor;
tick.isNew = true;
if (!minor) {
tick.addLabel();
}
} | javascript | function Tick(pos, minor) {
var tick = this;
tick.pos = pos;
tick.minor = minor;
tick.isNew = true;
if (!minor) {
tick.addLabel();
}
} | [
"function",
"Tick",
"(",
"pos",
",",
"minor",
")",
"{",
"var",
"tick",
"=",
"this",
";",
"tick",
".",
"pos",
"=",
"pos",
";",
"tick",
".",
"minor",
"=",
"minor",
";",
"tick",
".",
"isNew",
"=",
"true",
";",
"if",
"(",
"!",
"minor",
")",
"{",
... | The Tick class | [
"The",
"Tick",
"class"
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.ui.charting.js#L16320-L16329 | train |
splunk/splunk-sdk-javascript | client/splunk.ui.charting.js | StackItem | function StackItem(options, isNegative, x, stackOption) {
var stackItem = this;
// Tells if the stack is negative
stackItem.isNegative = isNegative;
// Save the options to be able to style the label
stackItem.options = options;
// Save the x value to be able to position the label later
... | javascript | function StackItem(options, isNegative, x, stackOption) {
var stackItem = this;
// Tells if the stack is negative
stackItem.isNegative = isNegative;
// Save the options to be able to style the label
stackItem.options = options;
// Save the x value to be able to position the label later
... | [
"function",
"StackItem",
"(",
"options",
",",
"isNegative",
",",
"x",
",",
"stackOption",
")",
"{",
"var",
"stackItem",
"=",
"this",
";",
"// Tells if the stack is negative\r",
"stackItem",
".",
"isNegative",
"=",
"isNegative",
";",
"// Save the options to be able to ... | The class for stack items | [
"The",
"class",
"for",
"stack",
"items"
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.ui.charting.js#L16725-L16751 | train |
splunk/splunk-sdk-javascript | client/splunk.ui.charting.js | correctFloat | function correctFloat(num) {
var invMag, ret = num;
magnitude = pick(magnitude, math.pow(10, mathFloor(math.log(tickInterval) / math.LN10)));
if (magnitude < 1) {
invMag = mathRound(1 / magnitude) * 10;
ret = mathRound(num * invMag) / invMag;
}
return ret;
} | javascript | function correctFloat(num) {
var invMag, ret = num;
magnitude = pick(magnitude, math.pow(10, mathFloor(math.log(tickInterval) / math.LN10)));
if (magnitude < 1) {
invMag = mathRound(1 / magnitude) * 10;
ret = mathRound(num * invMag) / invMag;
}
return ret;
} | [
"function",
"correctFloat",
"(",
"num",
")",
"{",
"var",
"invMag",
",",
"ret",
"=",
"num",
";",
"magnitude",
"=",
"pick",
"(",
"magnitude",
",",
"math",
".",
"pow",
"(",
"10",
",",
"mathFloor",
"(",
"math",
".",
"log",
"(",
"tickInterval",
")",
"/",
... | Fix JS round off float errors
@param {Number} num | [
"Fix",
"JS",
"round",
"off",
"float",
"errors"
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.ui.charting.js#L17252-L17261 | train |
splunk/splunk-sdk-javascript | client/splunk.ui.charting.js | setCategories | function setCategories(newCategories, doRedraw) {
// set the categories
axis.categories = userOptions.categories = categories = newCategories;
// force reindexing tooltips
each(associatedSeries, function (series) {
series.translate();
series.setTooltipPoints(true);
});
//... | javascript | function setCategories(newCategories, doRedraw) {
// set the categories
axis.categories = userOptions.categories = categories = newCategories;
// force reindexing tooltips
each(associatedSeries, function (series) {
series.translate();
series.setTooltipPoints(true);
});
//... | [
"function",
"setCategories",
"(",
"newCategories",
",",
"doRedraw",
")",
"{",
"// set the categories\r",
"axis",
".",
"categories",
"=",
"userOptions",
".",
"categories",
"=",
"categories",
"=",
"newCategories",
";",
"// force reindexing tooltips\r",
"each",
"(",
"ass... | Set new axis categories and optionally redraw
@param {Array} newCategories
@param {Boolean} doRedraw | [
"Set",
"new",
"axis",
"categories",
"and",
"optionally",
"redraw"
] | 9aec5443860926654c2ab8ee3bf198a407c53b07 | https://github.com/splunk/splunk-sdk-javascript/blob/9aec5443860926654c2ab8ee3bf198a407c53b07/client/splunk.ui.charting.js#L17942-L17959 | 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.