id
int32 0
58k
| 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
sequence | docstring
stringlengths 4
11.8k
| docstring_tokens
sequence | sha
stringlengths 40
40
| url
stringlengths 86
226
|
---|---|---|---|---|---|---|---|---|---|---|---|
100 | ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | function(html) {
var range = rangy.createRange(this.doc),
node = this.doc.createElement('DIV'),
fragment = this.doc.createDocumentFragment(),
lastChild;
node.innerHTML = html;
lastChild = node.lastChild;
while (node.firstChild) {
fragment.appendChild(node.firstChild);
}
this.insertNode(fragment);
if (lastChild) {
this.setAfter(lastChild);
}
} | javascript | function(html) {
var range = rangy.createRange(this.doc),
node = this.doc.createElement('DIV'),
fragment = this.doc.createDocumentFragment(),
lastChild;
node.innerHTML = html;
lastChild = node.lastChild;
while (node.firstChild) {
fragment.appendChild(node.firstChild);
}
this.insertNode(fragment);
if (lastChild) {
this.setAfter(lastChild);
}
} | [
"function",
"(",
"html",
")",
"{",
"var",
"range",
"=",
"rangy",
".",
"createRange",
"(",
"this",
".",
"doc",
")",
",",
"node",
"=",
"this",
".",
"doc",
".",
"createElement",
"(",
"'DIV'",
")",
",",
"fragment",
"=",
"this",
".",
"doc",
".",
"createDocumentFragment",
"(",
")",
",",
"lastChild",
";",
"node",
".",
"innerHTML",
"=",
"html",
";",
"lastChild",
"=",
"node",
".",
"lastChild",
";",
"while",
"(",
"node",
".",
"firstChild",
")",
"{",
"fragment",
".",
"appendChild",
"(",
"node",
".",
"firstChild",
")",
";",
"}",
"this",
".",
"insertNode",
"(",
"fragment",
")",
";",
"if",
"(",
"lastChild",
")",
"{",
"this",
".",
"setAfter",
"(",
"lastChild",
")",
";",
"}",
"}"
] | Insert html at the caret position and move the cursor after the inserted html
@param {String} html HTML string to insert
@example
selection.insertHTML("<p>foobar</p>"); | [
"Insert",
"html",
"at",
"the",
"caret",
"position",
"and",
"move",
"the",
"cursor",
"after",
"the",
"inserted",
"html"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L9161-L9178 |
|
101 | ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | function(nodeOptions) {
var ranges = this.getOwnRanges(),
node, nodes = [];
if (ranges.length == 0) {
return nodes;
}
for (var i = ranges.length; i--;) {
node = this.doc.createElement(nodeOptions.nodeName);
nodes.push(node);
if (nodeOptions.className) {
node.className = nodeOptions.className;
}
if (nodeOptions.cssStyle) {
node.setAttribute('style', nodeOptions.cssStyle);
}
try {
// This only works when the range boundaries are not overlapping other elements
ranges[i].surroundContents(node);
this.selectNode(node);
} catch(e) {
// fallback
node.appendChild(ranges[i].extractContents());
ranges[i].insertNode(node);
}
}
return nodes;
} | javascript | function(nodeOptions) {
var ranges = this.getOwnRanges(),
node, nodes = [];
if (ranges.length == 0) {
return nodes;
}
for (var i = ranges.length; i--;) {
node = this.doc.createElement(nodeOptions.nodeName);
nodes.push(node);
if (nodeOptions.className) {
node.className = nodeOptions.className;
}
if (nodeOptions.cssStyle) {
node.setAttribute('style', nodeOptions.cssStyle);
}
try {
// This only works when the range boundaries are not overlapping other elements
ranges[i].surroundContents(node);
this.selectNode(node);
} catch(e) {
// fallback
node.appendChild(ranges[i].extractContents());
ranges[i].insertNode(node);
}
}
return nodes;
} | [
"function",
"(",
"nodeOptions",
")",
"{",
"var",
"ranges",
"=",
"this",
".",
"getOwnRanges",
"(",
")",
",",
"node",
",",
"nodes",
"=",
"[",
"]",
";",
"if",
"(",
"ranges",
".",
"length",
"==",
"0",
")",
"{",
"return",
"nodes",
";",
"}",
"for",
"(",
"var",
"i",
"=",
"ranges",
".",
"length",
";",
"i",
"--",
";",
")",
"{",
"node",
"=",
"this",
".",
"doc",
".",
"createElement",
"(",
"nodeOptions",
".",
"nodeName",
")",
";",
"nodes",
".",
"push",
"(",
"node",
")",
";",
"if",
"(",
"nodeOptions",
".",
"className",
")",
"{",
"node",
".",
"className",
"=",
"nodeOptions",
".",
"className",
";",
"}",
"if",
"(",
"nodeOptions",
".",
"cssStyle",
")",
"{",
"node",
".",
"setAttribute",
"(",
"'style'",
",",
"nodeOptions",
".",
"cssStyle",
")",
";",
"}",
"try",
"{",
"// This only works when the range boundaries are not overlapping other elements",
"ranges",
"[",
"i",
"]",
".",
"surroundContents",
"(",
"node",
")",
";",
"this",
".",
"selectNode",
"(",
"node",
")",
";",
"}",
"catch",
"(",
"e",
")",
"{",
"// fallback",
"node",
".",
"appendChild",
"(",
"ranges",
"[",
"i",
"]",
".",
"extractContents",
"(",
")",
")",
";",
"ranges",
"[",
"i",
"]",
".",
"insertNode",
"(",
"node",
")",
";",
"}",
"}",
"return",
"nodes",
";",
"}"
] | Wraps current selection with the given node
@param {Object} node The node to surround the selected elements with | [
"Wraps",
"current",
"selection",
"with",
"the",
"given",
"node"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L9199-L9226 |
|
102 | ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | function() {
var ranges = [],
r = this.getRange(),
tmpRanges;
if (r) { ranges.push(r); }
if (this.unselectableClass && this.contain && r) {
var uneditables = this.getOwnUneditables(),
tmpRange;
if (uneditables.length > 0) {
for (var i = 0, imax = uneditables.length; i < imax; i++) {
tmpRanges = [];
for (var j = 0, jmax = ranges.length; j < jmax; j++) {
if (ranges[j]) {
switch (ranges[j].compareNode(uneditables[i])) {
case 2:
// all selection inside uneditable. remove
break;
case 3:
//section begins before and ends after uneditable. spilt
tmpRange = ranges[j].cloneRange();
tmpRange.setEndBefore(uneditables[i]);
tmpRanges.push(tmpRange);
tmpRange = ranges[j].cloneRange();
tmpRange.setStartAfter(uneditables[i]);
tmpRanges.push(tmpRange);
break;
default:
// in all other cases uneditable does not touch selection. dont modify
tmpRanges.push(ranges[j]);
}
}
ranges = tmpRanges;
}
}
}
}
return ranges;
} | javascript | function() {
var ranges = [],
r = this.getRange(),
tmpRanges;
if (r) { ranges.push(r); }
if (this.unselectableClass && this.contain && r) {
var uneditables = this.getOwnUneditables(),
tmpRange;
if (uneditables.length > 0) {
for (var i = 0, imax = uneditables.length; i < imax; i++) {
tmpRanges = [];
for (var j = 0, jmax = ranges.length; j < jmax; j++) {
if (ranges[j]) {
switch (ranges[j].compareNode(uneditables[i])) {
case 2:
// all selection inside uneditable. remove
break;
case 3:
//section begins before and ends after uneditable. spilt
tmpRange = ranges[j].cloneRange();
tmpRange.setEndBefore(uneditables[i]);
tmpRanges.push(tmpRange);
tmpRange = ranges[j].cloneRange();
tmpRange.setStartAfter(uneditables[i]);
tmpRanges.push(tmpRange);
break;
default:
// in all other cases uneditable does not touch selection. dont modify
tmpRanges.push(ranges[j]);
}
}
ranges = tmpRanges;
}
}
}
}
return ranges;
} | [
"function",
"(",
")",
"{",
"var",
"ranges",
"=",
"[",
"]",
",",
"r",
"=",
"this",
".",
"getRange",
"(",
")",
",",
"tmpRanges",
";",
"if",
"(",
"r",
")",
"{",
"ranges",
".",
"push",
"(",
"r",
")",
";",
"}",
"if",
"(",
"this",
".",
"unselectableClass",
"&&",
"this",
".",
"contain",
"&&",
"r",
")",
"{",
"var",
"uneditables",
"=",
"this",
".",
"getOwnUneditables",
"(",
")",
",",
"tmpRange",
";",
"if",
"(",
"uneditables",
".",
"length",
">",
"0",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"imax",
"=",
"uneditables",
".",
"length",
";",
"i",
"<",
"imax",
";",
"i",
"++",
")",
"{",
"tmpRanges",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"j",
"=",
"0",
",",
"jmax",
"=",
"ranges",
".",
"length",
";",
"j",
"<",
"jmax",
";",
"j",
"++",
")",
"{",
"if",
"(",
"ranges",
"[",
"j",
"]",
")",
"{",
"switch",
"(",
"ranges",
"[",
"j",
"]",
".",
"compareNode",
"(",
"uneditables",
"[",
"i",
"]",
")",
")",
"{",
"case",
"2",
":",
"// all selection inside uneditable. remove",
"break",
";",
"case",
"3",
":",
"//section begins before and ends after uneditable. spilt",
"tmpRange",
"=",
"ranges",
"[",
"j",
"]",
".",
"cloneRange",
"(",
")",
";",
"tmpRange",
".",
"setEndBefore",
"(",
"uneditables",
"[",
"i",
"]",
")",
";",
"tmpRanges",
".",
"push",
"(",
"tmpRange",
")",
";",
"tmpRange",
"=",
"ranges",
"[",
"j",
"]",
".",
"cloneRange",
"(",
")",
";",
"tmpRange",
".",
"setStartAfter",
"(",
"uneditables",
"[",
"i",
"]",
")",
";",
"tmpRanges",
".",
"push",
"(",
"tmpRange",
")",
";",
"break",
";",
"default",
":",
"// in all other cases uneditable does not touch selection. dont modify",
"tmpRanges",
".",
"push",
"(",
"ranges",
"[",
"j",
"]",
")",
";",
"}",
"}",
"ranges",
"=",
"tmpRanges",
";",
"}",
"}",
"}",
"}",
"return",
"ranges",
";",
"}"
] | Returns an array of ranges that belong only to this editable Needed as uneditable block in contenteditabel can split range into pieces If manipulating content reverse loop is usually needed as manipulation can shift subsequent ranges | [
"Returns",
"an",
"array",
"of",
"ranges",
"that",
"belong",
"only",
"to",
"this",
"editable",
"Needed",
"as",
"uneditable",
"block",
"in",
"contenteditabel",
"can",
"split",
"range",
"into",
"pieces",
"If",
"manipulating",
"content",
"reverse",
"loop",
"is",
"usually",
"needed",
"as",
"manipulation",
"can",
"shift",
"subsequent",
"ranges"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L9434-L9474 |
|
103 | ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | function(node) {
var cssStyleMatch;
while (node) {
cssStyleMatch = this.cssStyle ? hasStyleAttr(node, this.similarStyleRegExp) : false;
if (node.nodeType == wysihtml5.ELEMENT_NODE && node.getAttribute("contenteditable") != "false" && rangy.dom.arrayContains(this.tagNames, node.tagName.toLowerCase()) && cssStyleMatch) {
return node;
}
node = node.parentNode;
}
return false;
} | javascript | function(node) {
var cssStyleMatch;
while (node) {
cssStyleMatch = this.cssStyle ? hasStyleAttr(node, this.similarStyleRegExp) : false;
if (node.nodeType == wysihtml5.ELEMENT_NODE && node.getAttribute("contenteditable") != "false" && rangy.dom.arrayContains(this.tagNames, node.tagName.toLowerCase()) && cssStyleMatch) {
return node;
}
node = node.parentNode;
}
return false;
} | [
"function",
"(",
"node",
")",
"{",
"var",
"cssStyleMatch",
";",
"while",
"(",
"node",
")",
"{",
"cssStyleMatch",
"=",
"this",
".",
"cssStyle",
"?",
"hasStyleAttr",
"(",
"node",
",",
"this",
".",
"similarStyleRegExp",
")",
":",
"false",
";",
"if",
"(",
"node",
".",
"nodeType",
"==",
"wysihtml5",
".",
"ELEMENT_NODE",
"&&",
"node",
".",
"getAttribute",
"(",
"\"contenteditable\"",
")",
"!=",
"\"false\"",
"&&",
"rangy",
".",
"dom",
".",
"arrayContains",
"(",
"this",
".",
"tagNames",
",",
"node",
".",
"tagName",
".",
"toLowerCase",
"(",
")",
")",
"&&",
"cssStyleMatch",
")",
"{",
"return",
"node",
";",
"}",
"node",
"=",
"node",
".",
"parentNode",
";",
"}",
"return",
"false",
";",
"}"
] | returns parents of node with given style attribute | [
"returns",
"parents",
"of",
"node",
"with",
"given",
"style",
"attribute"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L9823-L9834 |
|
104 | ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | function(command, value) {
var obj = wysihtml5.commands[command],
args = wysihtml5.lang.array(arguments).get(),
method = obj && obj.exec,
result = null;
this.editor.fire("beforecommand:composer");
if (method) {
args.unshift(this.composer);
result = method.apply(obj, args);
} else {
try {
// try/catch for buggy firefox
result = this.doc.execCommand(command, false, value);
} catch(e) {}
}
this.editor.fire("aftercommand:composer");
return result;
} | javascript | function(command, value) {
var obj = wysihtml5.commands[command],
args = wysihtml5.lang.array(arguments).get(),
method = obj && obj.exec,
result = null;
this.editor.fire("beforecommand:composer");
if (method) {
args.unshift(this.composer);
result = method.apply(obj, args);
} else {
try {
// try/catch for buggy firefox
result = this.doc.execCommand(command, false, value);
} catch(e) {}
}
this.editor.fire("aftercommand:composer");
return result;
} | [
"function",
"(",
"command",
",",
"value",
")",
"{",
"var",
"obj",
"=",
"wysihtml5",
".",
"commands",
"[",
"command",
"]",
",",
"args",
"=",
"wysihtml5",
".",
"lang",
".",
"array",
"(",
"arguments",
")",
".",
"get",
"(",
")",
",",
"method",
"=",
"obj",
"&&",
"obj",
".",
"exec",
",",
"result",
"=",
"null",
";",
"this",
".",
"editor",
".",
"fire",
"(",
"\"beforecommand:composer\"",
")",
";",
"if",
"(",
"method",
")",
"{",
"args",
".",
"unshift",
"(",
"this",
".",
"composer",
")",
";",
"result",
"=",
"method",
".",
"apply",
"(",
"obj",
",",
"args",
")",
";",
"}",
"else",
"{",
"try",
"{",
"// try/catch for buggy firefox",
"result",
"=",
"this",
".",
"doc",
".",
"execCommand",
"(",
"command",
",",
"false",
",",
"value",
")",
";",
"}",
"catch",
"(",
"e",
")",
"{",
"}",
"}",
"this",
".",
"editor",
".",
"fire",
"(",
"\"aftercommand:composer\"",
")",
";",
"return",
"result",
";",
"}"
] | Check whether the browser supports the given command
@param {String} command The command string which to execute (eg. "bold", "italic", "insertUnorderedList")
@param {String} [value] The command value parameter, needed for some commands ("createLink", "insertImage", ...), optional for commands that don't require one ("bold", "underline", ...)
@example
commands.exec("insertImage", "http://a1.twimg.com/profile_images/113868655/schrei_twitter_reasonably_small.jpg"); | [
"Check",
"whether",
"the",
"browser",
"supports",
"the",
"given",
"command"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L10224-L10244 |
|
105 | ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | function(command, commandValue) {
var obj = wysihtml5.commands[command],
args = wysihtml5.lang.array(arguments).get(),
method = obj && obj.state;
if (method) {
args.unshift(this.composer);
return method.apply(obj, args);
} else {
try {
// try/catch for buggy firefox
return this.doc.queryCommandState(command);
} catch(e) {
return false;
}
}
} | javascript | function(command, commandValue) {
var obj = wysihtml5.commands[command],
args = wysihtml5.lang.array(arguments).get(),
method = obj && obj.state;
if (method) {
args.unshift(this.composer);
return method.apply(obj, args);
} else {
try {
// try/catch for buggy firefox
return this.doc.queryCommandState(command);
} catch(e) {
return false;
}
}
} | [
"function",
"(",
"command",
",",
"commandValue",
")",
"{",
"var",
"obj",
"=",
"wysihtml5",
".",
"commands",
"[",
"command",
"]",
",",
"args",
"=",
"wysihtml5",
".",
"lang",
".",
"array",
"(",
"arguments",
")",
".",
"get",
"(",
")",
",",
"method",
"=",
"obj",
"&&",
"obj",
".",
"state",
";",
"if",
"(",
"method",
")",
"{",
"args",
".",
"unshift",
"(",
"this",
".",
"composer",
")",
";",
"return",
"method",
".",
"apply",
"(",
"obj",
",",
"args",
")",
";",
"}",
"else",
"{",
"try",
"{",
"// try/catch for buggy firefox",
"return",
"this",
".",
"doc",
".",
"queryCommandState",
"(",
"command",
")",
";",
"}",
"catch",
"(",
"e",
")",
"{",
"return",
"false",
";",
"}",
"}",
"}"
] | Check whether the current command is active
If the caret is within a bold text, then calling this with command "bold" should return true
@param {String} command The command string which to check (eg. "bold", "italic", "insertUnorderedList")
@param {String} [commandValue] The command value parameter (eg. for "insertImage" the image src)
@return {Boolean} Whether the command is active
@example
var isCurrentSelectionBold = commands.state("bold"); | [
"Check",
"whether",
"the",
"current",
"command",
"is",
"active",
"If",
"the",
"caret",
"is",
"within",
"a",
"bold",
"text",
"then",
"calling",
"this",
"with",
"command",
"bold",
"should",
"return",
"true"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L10256-L10271 |
|
106 | ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | _changeLinks | function _changeLinks(composer, anchors, attributes) {
var oldAttrs;
for (var a = anchors.length; a--;) {
// Remove all old attributes
oldAttrs = anchors[a].attributes;
for (var oa = oldAttrs.length; oa--;) {
anchors[a].removeAttribute(oldAttrs.item(oa).name);
}
// Set new attributes
for (var j in attributes) {
if (attributes.hasOwnProperty(j)) {
anchors[a].setAttribute(j, attributes[j]);
}
}
}
} | javascript | function _changeLinks(composer, anchors, attributes) {
var oldAttrs;
for (var a = anchors.length; a--;) {
// Remove all old attributes
oldAttrs = anchors[a].attributes;
for (var oa = oldAttrs.length; oa--;) {
anchors[a].removeAttribute(oldAttrs.item(oa).name);
}
// Set new attributes
for (var j in attributes) {
if (attributes.hasOwnProperty(j)) {
anchors[a].setAttribute(j, attributes[j]);
}
}
}
} | [
"function",
"_changeLinks",
"(",
"composer",
",",
"anchors",
",",
"attributes",
")",
"{",
"var",
"oldAttrs",
";",
"for",
"(",
"var",
"a",
"=",
"anchors",
".",
"length",
";",
"a",
"--",
";",
")",
"{",
"// Remove all old attributes",
"oldAttrs",
"=",
"anchors",
"[",
"a",
"]",
".",
"attributes",
";",
"for",
"(",
"var",
"oa",
"=",
"oldAttrs",
".",
"length",
";",
"oa",
"--",
";",
")",
"{",
"anchors",
"[",
"a",
"]",
".",
"removeAttribute",
"(",
"oldAttrs",
".",
"item",
"(",
"oa",
")",
".",
"name",
")",
";",
"}",
"// Set new attributes",
"for",
"(",
"var",
"j",
"in",
"attributes",
")",
"{",
"if",
"(",
"attributes",
".",
"hasOwnProperty",
"(",
"j",
")",
")",
"{",
"anchors",
"[",
"a",
"]",
".",
"setAttribute",
"(",
"j",
",",
"attributes",
"[",
"j",
"]",
")",
";",
"}",
"}",
"}",
"}"
] | Changes attributes of links | [
"Changes",
"attributes",
"of",
"links"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L10351-L10369 |
107 | ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | _execCommand | function _execCommand(doc, composer, command, nodeName, className) {
var ranges = composer.selection.getOwnRanges();
for (var i = ranges.length; i--;){
composer.selection.getSelection().removeAllRanges();
composer.selection.setSelection(ranges[i]);
if (className) {
var eventListener = dom.observe(doc, "DOMNodeInserted", function(event) {
var target = event.target,
displayStyle;
if (target.nodeType !== wysihtml5.ELEMENT_NODE) {
return;
}
displayStyle = dom.getStyle("display").from(target);
if (displayStyle.substr(0, 6) !== "inline") {
// Make sure that only block elements receive the given class
target.className += " " + className;
}
});
}
doc.execCommand(command, false, nodeName);
if (eventListener) {
eventListener.stop();
}
}
} | javascript | function _execCommand(doc, composer, command, nodeName, className) {
var ranges = composer.selection.getOwnRanges();
for (var i = ranges.length; i--;){
composer.selection.getSelection().removeAllRanges();
composer.selection.setSelection(ranges[i]);
if (className) {
var eventListener = dom.observe(doc, "DOMNodeInserted", function(event) {
var target = event.target,
displayStyle;
if (target.nodeType !== wysihtml5.ELEMENT_NODE) {
return;
}
displayStyle = dom.getStyle("display").from(target);
if (displayStyle.substr(0, 6) !== "inline") {
// Make sure that only block elements receive the given class
target.className += " " + className;
}
});
}
doc.execCommand(command, false, nodeName);
if (eventListener) {
eventListener.stop();
}
}
} | [
"function",
"_execCommand",
"(",
"doc",
",",
"composer",
",",
"command",
",",
"nodeName",
",",
"className",
")",
"{",
"var",
"ranges",
"=",
"composer",
".",
"selection",
".",
"getOwnRanges",
"(",
")",
";",
"for",
"(",
"var",
"i",
"=",
"ranges",
".",
"length",
";",
"i",
"--",
";",
")",
"{",
"composer",
".",
"selection",
".",
"getSelection",
"(",
")",
".",
"removeAllRanges",
"(",
")",
";",
"composer",
".",
"selection",
".",
"setSelection",
"(",
"ranges",
"[",
"i",
"]",
")",
";",
"if",
"(",
"className",
")",
"{",
"var",
"eventListener",
"=",
"dom",
".",
"observe",
"(",
"doc",
",",
"\"DOMNodeInserted\"",
",",
"function",
"(",
"event",
")",
"{",
"var",
"target",
"=",
"event",
".",
"target",
",",
"displayStyle",
";",
"if",
"(",
"target",
".",
"nodeType",
"!==",
"wysihtml5",
".",
"ELEMENT_NODE",
")",
"{",
"return",
";",
"}",
"displayStyle",
"=",
"dom",
".",
"getStyle",
"(",
"\"display\"",
")",
".",
"from",
"(",
"target",
")",
";",
"if",
"(",
"displayStyle",
".",
"substr",
"(",
"0",
",",
"6",
")",
"!==",
"\"inline\"",
")",
"{",
"// Make sure that only block elements receive the given class",
"target",
".",
"className",
"+=",
"\" \"",
"+",
"className",
";",
"}",
"}",
")",
";",
"}",
"doc",
".",
"execCommand",
"(",
"command",
",",
"false",
",",
"nodeName",
")",
";",
"if",
"(",
"eventListener",
")",
"{",
"eventListener",
".",
"stop",
"(",
")",
";",
"}",
"}",
"}"
] | Execute native query command
and if necessary modify the inserted node's className | [
"Execute",
"native",
"query",
"command",
"and",
"if",
"necessary",
"modify",
"the",
"inserted",
"node",
"s",
"className"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L10674-L10699 |
108 | ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | function(composer, command, tagName, className, classRegExp, cssStyle, styleRegExp) {
var that = this;
if (this.state(composer, command, tagName, className, classRegExp, cssStyle, styleRegExp) &&
composer.selection.isCollapsed() &&
!composer.selection.caretIsLastInSelection() &&
!composer.selection.caretIsFirstInSelection()
) {
var state_element = that.state(composer, command, tagName, className, classRegExp)[0];
composer.selection.executeAndRestoreRangy(function() {
var parent = state_element.parentNode;
composer.selection.selectNode(state_element, true);
wysihtml5.commands.formatInline.exec(composer, command, tagName, className, classRegExp, cssStyle, styleRegExp, true, true);
});
} else {
if (this.state(composer, command, tagName, className, classRegExp, cssStyle, styleRegExp) && !composer.selection.isCollapsed()) {
composer.selection.executeAndRestoreRangy(function() {
wysihtml5.commands.formatInline.exec(composer, command, tagName, className, classRegExp, cssStyle, styleRegExp, true, true);
});
} else {
wysihtml5.commands.formatInline.exec(composer, command, tagName, className, classRegExp, cssStyle, styleRegExp);
}
}
} | javascript | function(composer, command, tagName, className, classRegExp, cssStyle, styleRegExp) {
var that = this;
if (this.state(composer, command, tagName, className, classRegExp, cssStyle, styleRegExp) &&
composer.selection.isCollapsed() &&
!composer.selection.caretIsLastInSelection() &&
!composer.selection.caretIsFirstInSelection()
) {
var state_element = that.state(composer, command, tagName, className, classRegExp)[0];
composer.selection.executeAndRestoreRangy(function() {
var parent = state_element.parentNode;
composer.selection.selectNode(state_element, true);
wysihtml5.commands.formatInline.exec(composer, command, tagName, className, classRegExp, cssStyle, styleRegExp, true, true);
});
} else {
if (this.state(composer, command, tagName, className, classRegExp, cssStyle, styleRegExp) && !composer.selection.isCollapsed()) {
composer.selection.executeAndRestoreRangy(function() {
wysihtml5.commands.formatInline.exec(composer, command, tagName, className, classRegExp, cssStyle, styleRegExp, true, true);
});
} else {
wysihtml5.commands.formatInline.exec(composer, command, tagName, className, classRegExp, cssStyle, styleRegExp);
}
}
} | [
"function",
"(",
"composer",
",",
"command",
",",
"tagName",
",",
"className",
",",
"classRegExp",
",",
"cssStyle",
",",
"styleRegExp",
")",
"{",
"var",
"that",
"=",
"this",
";",
"if",
"(",
"this",
".",
"state",
"(",
"composer",
",",
"command",
",",
"tagName",
",",
"className",
",",
"classRegExp",
",",
"cssStyle",
",",
"styleRegExp",
")",
"&&",
"composer",
".",
"selection",
".",
"isCollapsed",
"(",
")",
"&&",
"!",
"composer",
".",
"selection",
".",
"caretIsLastInSelection",
"(",
")",
"&&",
"!",
"composer",
".",
"selection",
".",
"caretIsFirstInSelection",
"(",
")",
")",
"{",
"var",
"state_element",
"=",
"that",
".",
"state",
"(",
"composer",
",",
"command",
",",
"tagName",
",",
"className",
",",
"classRegExp",
")",
"[",
"0",
"]",
";",
"composer",
".",
"selection",
".",
"executeAndRestoreRangy",
"(",
"function",
"(",
")",
"{",
"var",
"parent",
"=",
"state_element",
".",
"parentNode",
";",
"composer",
".",
"selection",
".",
"selectNode",
"(",
"state_element",
",",
"true",
")",
";",
"wysihtml5",
".",
"commands",
".",
"formatInline",
".",
"exec",
"(",
"composer",
",",
"command",
",",
"tagName",
",",
"className",
",",
"classRegExp",
",",
"cssStyle",
",",
"styleRegExp",
",",
"true",
",",
"true",
")",
";",
"}",
")",
";",
"}",
"else",
"{",
"if",
"(",
"this",
".",
"state",
"(",
"composer",
",",
"command",
",",
"tagName",
",",
"className",
",",
"classRegExp",
",",
"cssStyle",
",",
"styleRegExp",
")",
"&&",
"!",
"composer",
".",
"selection",
".",
"isCollapsed",
"(",
")",
")",
"{",
"composer",
".",
"selection",
".",
"executeAndRestoreRangy",
"(",
"function",
"(",
")",
"{",
"wysihtml5",
".",
"commands",
".",
"formatInline",
".",
"exec",
"(",
"composer",
",",
"command",
",",
"tagName",
",",
"className",
",",
"classRegExp",
",",
"cssStyle",
",",
"styleRegExp",
",",
"true",
",",
"true",
")",
";",
"}",
")",
";",
"}",
"else",
"{",
"wysihtml5",
".",
"commands",
".",
"formatInline",
".",
"exec",
"(",
"composer",
",",
"command",
",",
"tagName",
",",
"className",
",",
"classRegExp",
",",
"cssStyle",
",",
"styleRegExp",
")",
";",
"}",
"}",
"}"
] | Executes so that if collapsed caret is in a state and executing that state it should unformat that state It is achieved by selecting the entire state element before executing. This works on built in contenteditable inline format commands | [
"Executes",
"so",
"that",
"if",
"collapsed",
"caret",
"is",
"in",
"a",
"state",
"and",
"executing",
"that",
"state",
"it",
"should",
"unformat",
"that",
"state",
"It",
"is",
"achieved",
"by",
"selecting",
"the",
"entire",
"state",
"element",
"before",
"executing",
".",
"This",
"works",
"on",
"built",
"in",
"contenteditable",
"inline",
"format",
"commands"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L10981-L11004 |
|
109 | ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | function() {
if (this.textarea.element.form) {
var hiddenField = document.createElement("input");
hiddenField.type = "hidden";
hiddenField.name = "_wysihtml5_mode";
hiddenField.value = 1;
dom.insert(hiddenField).after(this.textarea.element);
}
} | javascript | function() {
if (this.textarea.element.form) {
var hiddenField = document.createElement("input");
hiddenField.type = "hidden";
hiddenField.name = "_wysihtml5_mode";
hiddenField.value = 1;
dom.insert(hiddenField).after(this.textarea.element);
}
} | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"textarea",
".",
"element",
".",
"form",
")",
"{",
"var",
"hiddenField",
"=",
"document",
".",
"createElement",
"(",
"\"input\"",
")",
";",
"hiddenField",
".",
"type",
"=",
"\"hidden\"",
";",
"hiddenField",
".",
"name",
"=",
"\"_wysihtml5_mode\"",
";",
"hiddenField",
".",
"value",
"=",
"1",
";",
"dom",
".",
"insert",
"(",
"hiddenField",
")",
".",
"after",
"(",
"this",
".",
"textarea",
".",
"element",
")",
";",
"}",
"}"
] | Creates hidden field which tells the server after submit, that the user used an wysiwyg editor | [
"Creates",
"hidden",
"field",
"which",
"tells",
"the",
"server",
"after",
"submit",
"that",
"the",
"user",
"used",
"an",
"wysiwyg",
"editor"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L12178-L12186 |
|
110 | ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | function(shouldParseHtml) {
this.textarea.setValue(wysihtml5.lang.string(this.composer.getValue(false, false)).trim(), shouldParseHtml);
} | javascript | function(shouldParseHtml) {
this.textarea.setValue(wysihtml5.lang.string(this.composer.getValue(false, false)).trim(), shouldParseHtml);
} | [
"function",
"(",
"shouldParseHtml",
")",
"{",
"this",
".",
"textarea",
".",
"setValue",
"(",
"wysihtml5",
".",
"lang",
".",
"string",
"(",
"this",
".",
"composer",
".",
"getValue",
"(",
"false",
",",
"false",
")",
")",
".",
"trim",
"(",
")",
",",
"shouldParseHtml",
")",
";",
"}"
] | Sync html from composer to textarea
Takes care of placeholders
@param {Boolean} shouldParseHtml Whether the html should be sanitized before inserting it into the textarea | [
"Sync",
"html",
"from",
"composer",
"to",
"textarea",
"Takes",
"care",
"of",
"placeholders"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L13045-L13047 |
|
111 | ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | function(shouldParseHtml) {
var textareaValue = this.textarea.getValue(false, false);
if (textareaValue) {
this.composer.setValue(textareaValue, shouldParseHtml);
} else {
this.composer.clear();
this.editor.fire("set_placeholder");
}
} | javascript | function(shouldParseHtml) {
var textareaValue = this.textarea.getValue(false, false);
if (textareaValue) {
this.composer.setValue(textareaValue, shouldParseHtml);
} else {
this.composer.clear();
this.editor.fire("set_placeholder");
}
} | [
"function",
"(",
"shouldParseHtml",
")",
"{",
"var",
"textareaValue",
"=",
"this",
".",
"textarea",
".",
"getValue",
"(",
"false",
",",
"false",
")",
";",
"if",
"(",
"textareaValue",
")",
"{",
"this",
".",
"composer",
".",
"setValue",
"(",
"textareaValue",
",",
"shouldParseHtml",
")",
";",
"}",
"else",
"{",
"this",
".",
"composer",
".",
"clear",
"(",
")",
";",
"this",
".",
"editor",
".",
"fire",
"(",
"\"set_placeholder\"",
")",
";",
"}",
"}"
] | Sync value of textarea to composer
Takes care of placeholders
@param {Boolean} shouldParseHtml Whether the html should be sanitized before inserting it into the composer | [
"Sync",
"value",
"of",
"textarea",
"to",
"composer",
"Takes",
"care",
"of",
"placeholders"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L13054-L13062 |
|
112 | ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | function() {
var interval,
that = this,
form = this.textarea.element.form,
startInterval = function() {
interval = setInterval(function() { that.fromComposerToTextarea(); }, INTERVAL);
},
stopInterval = function() {
clearInterval(interval);
interval = null;
};
startInterval();
if (form) {
// If the textarea is in a form make sure that after onreset and onsubmit the composer
// has the correct state
wysihtml5.dom.observe(form, "submit", function() {
that.sync(true);
});
wysihtml5.dom.observe(form, "reset", function() {
setTimeout(function() { that.fromTextareaToComposer(); }, 0);
});
}
this.editor.on("change_view", function(view) {
if (view === "composer" && !interval) {
that.fromTextareaToComposer(true);
startInterval();
} else if (view === "textarea") {
that.fromComposerToTextarea(true);
stopInterval();
}
});
this.editor.on("destroy:composer", stopInterval);
} | javascript | function() {
var interval,
that = this,
form = this.textarea.element.form,
startInterval = function() {
interval = setInterval(function() { that.fromComposerToTextarea(); }, INTERVAL);
},
stopInterval = function() {
clearInterval(interval);
interval = null;
};
startInterval();
if (form) {
// If the textarea is in a form make sure that after onreset and onsubmit the composer
// has the correct state
wysihtml5.dom.observe(form, "submit", function() {
that.sync(true);
});
wysihtml5.dom.observe(form, "reset", function() {
setTimeout(function() { that.fromTextareaToComposer(); }, 0);
});
}
this.editor.on("change_view", function(view) {
if (view === "composer" && !interval) {
that.fromTextareaToComposer(true);
startInterval();
} else if (view === "textarea") {
that.fromComposerToTextarea(true);
stopInterval();
}
});
this.editor.on("destroy:composer", stopInterval);
} | [
"function",
"(",
")",
"{",
"var",
"interval",
",",
"that",
"=",
"this",
",",
"form",
"=",
"this",
".",
"textarea",
".",
"element",
".",
"form",
",",
"startInterval",
"=",
"function",
"(",
")",
"{",
"interval",
"=",
"setInterval",
"(",
"function",
"(",
")",
"{",
"that",
".",
"fromComposerToTextarea",
"(",
")",
";",
"}",
",",
"INTERVAL",
")",
";",
"}",
",",
"stopInterval",
"=",
"function",
"(",
")",
"{",
"clearInterval",
"(",
"interval",
")",
";",
"interval",
"=",
"null",
";",
"}",
";",
"startInterval",
"(",
")",
";",
"if",
"(",
"form",
")",
"{",
"// If the textarea is in a form make sure that after onreset and onsubmit the composer",
"// has the correct state",
"wysihtml5",
".",
"dom",
".",
"observe",
"(",
"form",
",",
"\"submit\"",
",",
"function",
"(",
")",
"{",
"that",
".",
"sync",
"(",
"true",
")",
";",
"}",
")",
";",
"wysihtml5",
".",
"dom",
".",
"observe",
"(",
"form",
",",
"\"reset\"",
",",
"function",
"(",
")",
"{",
"setTimeout",
"(",
"function",
"(",
")",
"{",
"that",
".",
"fromTextareaToComposer",
"(",
")",
";",
"}",
",",
"0",
")",
";",
"}",
")",
";",
"}",
"this",
".",
"editor",
".",
"on",
"(",
"\"change_view\"",
",",
"function",
"(",
"view",
")",
"{",
"if",
"(",
"view",
"===",
"\"composer\"",
"&&",
"!",
"interval",
")",
"{",
"that",
".",
"fromTextareaToComposer",
"(",
"true",
")",
";",
"startInterval",
"(",
")",
";",
"}",
"else",
"if",
"(",
"view",
"===",
"\"textarea\"",
")",
"{",
"that",
".",
"fromComposerToTextarea",
"(",
"true",
")",
";",
"stopInterval",
"(",
")",
";",
"}",
"}",
")",
";",
"this",
".",
"editor",
".",
"on",
"(",
"\"destroy:composer\"",
",",
"stopInterval",
")",
";",
"}"
] | Initializes interval-based syncing
also makes sure that on-submit the composer's content is synced with the textarea
immediately when the form gets submitted | [
"Initializes",
"interval",
"-",
"based",
"syncing",
"also",
"makes",
"sure",
"that",
"on",
"-",
"submit",
"the",
"composer",
"s",
"content",
"is",
"synced",
"with",
"the",
"textarea",
"immediately",
"when",
"the",
"form",
"gets",
"submitted"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L13081-L13117 |
|
113 | ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | function() {
var that = this,
oldHtml,
cleanHtml;
if (wysihtml5.browser.supportsModenPaste()) {
this.on("paste:composer", function(event) {
event.preventDefault();
oldHtml = wysihtml5.dom.getPastedHtml(event);
if (oldHtml) {
that._cleanAndPaste(oldHtml);
}
});
} else {
this.on("beforepaste:composer", function(event) {
event.preventDefault();
wysihtml5.dom.getPastedHtmlWithDiv(that.composer, function(pastedHTML) {
if (pastedHTML) {
that._cleanAndPaste(pastedHTML);
}
});
});
}
} | javascript | function() {
var that = this,
oldHtml,
cleanHtml;
if (wysihtml5.browser.supportsModenPaste()) {
this.on("paste:composer", function(event) {
event.preventDefault();
oldHtml = wysihtml5.dom.getPastedHtml(event);
if (oldHtml) {
that._cleanAndPaste(oldHtml);
}
});
} else {
this.on("beforepaste:composer", function(event) {
event.preventDefault();
wysihtml5.dom.getPastedHtmlWithDiv(that.composer, function(pastedHTML) {
if (pastedHTML) {
that._cleanAndPaste(pastedHTML);
}
});
});
}
} | [
"function",
"(",
")",
"{",
"var",
"that",
"=",
"this",
",",
"oldHtml",
",",
"cleanHtml",
";",
"if",
"(",
"wysihtml5",
".",
"browser",
".",
"supportsModenPaste",
"(",
")",
")",
"{",
"this",
".",
"on",
"(",
"\"paste:composer\"",
",",
"function",
"(",
"event",
")",
"{",
"event",
".",
"preventDefault",
"(",
")",
";",
"oldHtml",
"=",
"wysihtml5",
".",
"dom",
".",
"getPastedHtml",
"(",
"event",
")",
";",
"if",
"(",
"oldHtml",
")",
"{",
"that",
".",
"_cleanAndPaste",
"(",
"oldHtml",
")",
";",
"}",
"}",
")",
";",
"}",
"else",
"{",
"this",
".",
"on",
"(",
"\"beforepaste:composer\"",
",",
"function",
"(",
"event",
")",
"{",
"event",
".",
"preventDefault",
"(",
")",
";",
"wysihtml5",
".",
"dom",
".",
"getPastedHtmlWithDiv",
"(",
"that",
".",
"composer",
",",
"function",
"(",
"pastedHTML",
")",
"{",
"if",
"(",
"pastedHTML",
")",
"{",
"that",
".",
"_cleanAndPaste",
"(",
"pastedHTML",
")",
";",
"}",
"}",
")",
";",
"}",
")",
";",
"}",
"}"
] | Prepare html parser logic
- Observes for paste and drop | [
"Prepare",
"html",
"parser",
"logic",
"-",
"Observes",
"for",
"paste",
"and",
"drop"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L13395-L13420 |
|
114 | ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | function() {
var data = this.elementToChange || {},
fields = this.container.querySelectorAll(SELECTOR_FIELDS),
length = fields.length,
i = 0;
for (; i<length; i++) {
data[fields[i].getAttribute(ATTRIBUTE_FIELDS)] = fields[i].value;
}
return data;
} | javascript | function() {
var data = this.elementToChange || {},
fields = this.container.querySelectorAll(SELECTOR_FIELDS),
length = fields.length,
i = 0;
for (; i<length; i++) {
data[fields[i].getAttribute(ATTRIBUTE_FIELDS)] = fields[i].value;
}
return data;
} | [
"function",
"(",
")",
"{",
"var",
"data",
"=",
"this",
".",
"elementToChange",
"||",
"{",
"}",
",",
"fields",
"=",
"this",
".",
"container",
".",
"querySelectorAll",
"(",
"SELECTOR_FIELDS",
")",
",",
"length",
"=",
"fields",
".",
"length",
",",
"i",
"=",
"0",
";",
"for",
"(",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"data",
"[",
"fields",
"[",
"i",
"]",
".",
"getAttribute",
"(",
"ATTRIBUTE_FIELDS",
")",
"]",
"=",
"fields",
"[",
"i",
"]",
".",
"value",
";",
"}",
"return",
"data",
";",
"}"
] | Grabs all fields in the dialog and puts them in key=>value style in an object which
then gets returned | [
"Grabs",
"all",
"fields",
"in",
"the",
"dialog",
"and",
"puts",
"them",
"in",
"key",
"=",
">",
"value",
"style",
"in",
"an",
"object",
"which",
"then",
"gets",
"returned"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L13537-L13547 |
|
115 | ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | function() {
clearInterval(this.interval);
this.elementToChange = null;
dom.removeClass(this.link, CLASS_NAME_OPENED);
this.container.style.display = "none";
this.fire("hide");
} | javascript | function() {
clearInterval(this.interval);
this.elementToChange = null;
dom.removeClass(this.link, CLASS_NAME_OPENED);
this.container.style.display = "none";
this.fire("hide");
} | [
"function",
"(",
")",
"{",
"clearInterval",
"(",
"this",
".",
"interval",
")",
";",
"this",
".",
"elementToChange",
"=",
"null",
";",
"dom",
".",
"removeClass",
"(",
"this",
".",
"link",
",",
"CLASS_NAME_OPENED",
")",
";",
"this",
".",
"container",
".",
"style",
".",
"display",
"=",
"\"none\"",
";",
"this",
".",
"fire",
"(",
"\"hide\"",
")",
";",
"}"
] | Hide the dialog element | [
"Hide",
"the",
"dialog",
"element"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L13624-L13630 |
|
116 | ColorlibHQ/AdminLTE | plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js | function() {
var editor = this;
$.map(this.toolbar.commandMapping, function(value) {
return [value];
}).filter(function(commandObj) {
return commandObj.dialog;
}).map(function(commandObj) {
return commandObj.dialog;
}).forEach(function(dialog) {
dialog.on('show', function() {
$(this.container).modal('show');
});
dialog.on('hide', function() {
$(this.container).modal('hide');
setTimeout(editor.composer.focus, 0);
});
$(dialog.container).on('shown.bs.modal', function () {
$(this).find('input, select, textarea').first().focus();
});
});
this.on('change_view', function() {
$(this.toolbar.container.children).find('a.btn').not('[data-wysihtml5-action="change_view"]').toggleClass('disabled');
});
} | javascript | function() {
var editor = this;
$.map(this.toolbar.commandMapping, function(value) {
return [value];
}).filter(function(commandObj) {
return commandObj.dialog;
}).map(function(commandObj) {
return commandObj.dialog;
}).forEach(function(dialog) {
dialog.on('show', function() {
$(this.container).modal('show');
});
dialog.on('hide', function() {
$(this.container).modal('hide');
setTimeout(editor.composer.focus, 0);
});
$(dialog.container).on('shown.bs.modal', function () {
$(this).find('input, select, textarea').first().focus();
});
});
this.on('change_view', function() {
$(this.toolbar.container.children).find('a.btn').not('[data-wysihtml5-action="change_view"]').toggleClass('disabled');
});
} | [
"function",
"(",
")",
"{",
"var",
"editor",
"=",
"this",
";",
"$",
".",
"map",
"(",
"this",
".",
"toolbar",
".",
"commandMapping",
",",
"function",
"(",
"value",
")",
"{",
"return",
"[",
"value",
"]",
";",
"}",
")",
".",
"filter",
"(",
"function",
"(",
"commandObj",
")",
"{",
"return",
"commandObj",
".",
"dialog",
";",
"}",
")",
".",
"map",
"(",
"function",
"(",
"commandObj",
")",
"{",
"return",
"commandObj",
".",
"dialog",
";",
"}",
")",
".",
"forEach",
"(",
"function",
"(",
"dialog",
")",
"{",
"dialog",
".",
"on",
"(",
"'show'",
",",
"function",
"(",
")",
"{",
"$",
"(",
"this",
".",
"container",
")",
".",
"modal",
"(",
"'show'",
")",
";",
"}",
")",
";",
"dialog",
".",
"on",
"(",
"'hide'",
",",
"function",
"(",
")",
"{",
"$",
"(",
"this",
".",
"container",
")",
".",
"modal",
"(",
"'hide'",
")",
";",
"setTimeout",
"(",
"editor",
".",
"composer",
".",
"focus",
",",
"0",
")",
";",
"}",
")",
";",
"$",
"(",
"dialog",
".",
"container",
")",
".",
"on",
"(",
"'shown.bs.modal'",
",",
"function",
"(",
")",
"{",
"$",
"(",
"this",
")",
".",
"find",
"(",
"'input, select, textarea'",
")",
".",
"first",
"(",
")",
".",
"focus",
"(",
")",
";",
"}",
")",
";",
"}",
")",
";",
"this",
".",
"on",
"(",
"'change_view'",
",",
"function",
"(",
")",
"{",
"$",
"(",
"this",
".",
"toolbar",
".",
"container",
".",
"children",
")",
".",
"find",
"(",
"'a.btn'",
")",
".",
"not",
"(",
"'[data-wysihtml5-action=\"change_view\"]'",
")",
".",
"toggleClass",
"(",
"'disabled'",
")",
";",
"}",
")",
";",
"}"
] | sync wysihtml5 events for dialogs with bootstrap events | [
"sync",
"wysihtml5",
"events",
"for",
"dialogs",
"with",
"bootstrap",
"events"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.js#L14691-L14714 |
|
117 | ColorlibHQ/AdminLTE | dist/js/demo.js | store | function store(name, val) {
if (typeof (Storage) !== 'undefined') {
localStorage.setItem(name, val)
} else {
window.alert('Please use a modern browser to properly view this template!')
}
} | javascript | function store(name, val) {
if (typeof (Storage) !== 'undefined') {
localStorage.setItem(name, val)
} else {
window.alert('Please use a modern browser to properly view this template!')
}
} | [
"function",
"store",
"(",
"name",
",",
"val",
")",
"{",
"if",
"(",
"typeof",
"(",
"Storage",
")",
"!==",
"'undefined'",
")",
"{",
"localStorage",
".",
"setItem",
"(",
"name",
",",
"val",
")",
"}",
"else",
"{",
"window",
".",
"alert",
"(",
"'Please use a modern browser to properly view this template!'",
")",
"}",
"}"
] | Store a new settings in the browser
@param String name Name of the setting
@param String val Value of the setting
@returns void | [
"Store",
"a",
"new",
"settings",
"in",
"the",
"browser"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/dist/js/demo.js#L67-L73 |
118 | ColorlibHQ/AdminLTE | bower_components/bootstrap-colorpicker/dist/js/bootstrap-colorpicker.js | function(
val, predefinedColors, fallbackColor, fallbackFormat, hexNumberSignPrefix) {
this.fallbackValue = fallbackColor ?
(
(typeof fallbackColor === 'string') ?
this.parse(fallbackColor) :
fallbackColor
) :
null;
this.fallbackFormat = fallbackFormat ? fallbackFormat : 'rgba';
this.hexNumberSignPrefix = hexNumberSignPrefix === true;
this.value = this.fallbackValue;
this.origFormat = null; // original string format
this.predefinedColors = predefinedColors ? predefinedColors : {};
// We don't want to share aliases across instances so we extend new object
this.colors = $.extend({}, Color.webColors, this.predefinedColors);
if (val) {
if (typeof val.h !== 'undefined') {
this.value = val;
} else {
this.setColor(String(val));
}
}
if (!this.value) {
// Initial value is always black if no arguments are passed or val is empty
this.value = {
h: 0,
s: 0,
b: 0,
a: 1
};
}
} | javascript | function(
val, predefinedColors, fallbackColor, fallbackFormat, hexNumberSignPrefix) {
this.fallbackValue = fallbackColor ?
(
(typeof fallbackColor === 'string') ?
this.parse(fallbackColor) :
fallbackColor
) :
null;
this.fallbackFormat = fallbackFormat ? fallbackFormat : 'rgba';
this.hexNumberSignPrefix = hexNumberSignPrefix === true;
this.value = this.fallbackValue;
this.origFormat = null; // original string format
this.predefinedColors = predefinedColors ? predefinedColors : {};
// We don't want to share aliases across instances so we extend new object
this.colors = $.extend({}, Color.webColors, this.predefinedColors);
if (val) {
if (typeof val.h !== 'undefined') {
this.value = val;
} else {
this.setColor(String(val));
}
}
if (!this.value) {
// Initial value is always black if no arguments are passed or val is empty
this.value = {
h: 0,
s: 0,
b: 0,
a: 1
};
}
} | [
"function",
"(",
"val",
",",
"predefinedColors",
",",
"fallbackColor",
",",
"fallbackFormat",
",",
"hexNumberSignPrefix",
")",
"{",
"this",
".",
"fallbackValue",
"=",
"fallbackColor",
"?",
"(",
"(",
"typeof",
"fallbackColor",
"===",
"'string'",
")",
"?",
"this",
".",
"parse",
"(",
"fallbackColor",
")",
":",
"fallbackColor",
")",
":",
"null",
";",
"this",
".",
"fallbackFormat",
"=",
"fallbackFormat",
"?",
"fallbackFormat",
":",
"'rgba'",
";",
"this",
".",
"hexNumberSignPrefix",
"=",
"hexNumberSignPrefix",
"===",
"true",
";",
"this",
".",
"value",
"=",
"this",
".",
"fallbackValue",
";",
"this",
".",
"origFormat",
"=",
"null",
";",
"// original string format",
"this",
".",
"predefinedColors",
"=",
"predefinedColors",
"?",
"predefinedColors",
":",
"{",
"}",
";",
"// We don't want to share aliases across instances so we extend new object",
"this",
".",
"colors",
"=",
"$",
".",
"extend",
"(",
"{",
"}",
",",
"Color",
".",
"webColors",
",",
"this",
".",
"predefinedColors",
")",
";",
"if",
"(",
"val",
")",
"{",
"if",
"(",
"typeof",
"val",
".",
"h",
"!==",
"'undefined'",
")",
"{",
"this",
".",
"value",
"=",
"val",
";",
"}",
"else",
"{",
"this",
".",
"setColor",
"(",
"String",
"(",
"val",
")",
")",
";",
"}",
"}",
"if",
"(",
"!",
"this",
".",
"value",
")",
"{",
"// Initial value is always black if no arguments are passed or val is empty",
"this",
".",
"value",
"=",
"{",
"h",
":",
"0",
",",
"s",
":",
"0",
",",
"b",
":",
"0",
",",
"a",
":",
"1",
"}",
";",
"}",
"}"
] | Color manipulation helper class
@param {Object|String} [val]
@param {Object} [predefinedColors]
@param {String|null} [fallbackColor]
@param {String|null} [fallbackFormat]
@param {Boolean} [hexNumberSignPrefix]
@constructor | [
"Color",
"manipulation",
"helper",
"class"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/bootstrap-colorpicker/dist/js/bootstrap-colorpicker.js#L37-L77 |
|
119 | ColorlibHQ/AdminLTE | bower_components/bootstrap-colorpicker/dist/js/bootstrap-colorpicker.js | function(val) {
return new Color(
val ? val : null,
this.options.colorSelectors,
this.options.fallbackColor ? this.options.fallbackColor : this.color,
this.options.fallbackFormat,
this.options.hexNumberSignPrefix
);
} | javascript | function(val) {
return new Color(
val ? val : null,
this.options.colorSelectors,
this.options.fallbackColor ? this.options.fallbackColor : this.color,
this.options.fallbackFormat,
this.options.hexNumberSignPrefix
);
} | [
"function",
"(",
"val",
")",
"{",
"return",
"new",
"Color",
"(",
"val",
"?",
"val",
":",
"null",
",",
"this",
".",
"options",
".",
"colorSelectors",
",",
"this",
".",
"options",
".",
"fallbackColor",
"?",
"this",
".",
"options",
".",
"fallbackColor",
":",
"this",
".",
"color",
",",
"this",
".",
"options",
".",
"fallbackFormat",
",",
"this",
".",
"options",
".",
"hexNumberSignPrefix",
")",
";",
"}"
] | Creates a new color using the instance options
@protected
@param {String} val
@returns {Color} | [
"Creates",
"a",
"new",
"color",
"using",
"the",
"instance",
"options"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/bootstrap-colorpicker/dist/js/bootstrap-colorpicker.js#L1081-L1089 |
|
120 | ColorlibHQ/AdminLTE | bower_components/jquery-sparkline/src/base.js | function (el, x, y) {
var currentRegion = this.currentRegion,
highlightEnabled = !this.options.get('disableHighlight'),
newRegion;
if (x > this.canvasWidth || y > this.canvasHeight || x < 0 || y < 0) {
return null;
}
newRegion = this.getRegion(el, x, y);
if (currentRegion !== newRegion) {
if (currentRegion !== undefined && highlightEnabled) {
this.removeHighlight();
}
this.currentRegion = newRegion;
if (newRegion !== undefined && highlightEnabled) {
this.renderHighlight();
}
return true;
}
return false;
} | javascript | function (el, x, y) {
var currentRegion = this.currentRegion,
highlightEnabled = !this.options.get('disableHighlight'),
newRegion;
if (x > this.canvasWidth || y > this.canvasHeight || x < 0 || y < 0) {
return null;
}
newRegion = this.getRegion(el, x, y);
if (currentRegion !== newRegion) {
if (currentRegion !== undefined && highlightEnabled) {
this.removeHighlight();
}
this.currentRegion = newRegion;
if (newRegion !== undefined && highlightEnabled) {
this.renderHighlight();
}
return true;
}
return false;
} | [
"function",
"(",
"el",
",",
"x",
",",
"y",
")",
"{",
"var",
"currentRegion",
"=",
"this",
".",
"currentRegion",
",",
"highlightEnabled",
"=",
"!",
"this",
".",
"options",
".",
"get",
"(",
"'disableHighlight'",
")",
",",
"newRegion",
";",
"if",
"(",
"x",
">",
"this",
".",
"canvasWidth",
"||",
"y",
">",
"this",
".",
"canvasHeight",
"||",
"x",
"<",
"0",
"||",
"y",
"<",
"0",
")",
"{",
"return",
"null",
";",
"}",
"newRegion",
"=",
"this",
".",
"getRegion",
"(",
"el",
",",
"x",
",",
"y",
")",
";",
"if",
"(",
"currentRegion",
"!==",
"newRegion",
")",
"{",
"if",
"(",
"currentRegion",
"!==",
"undefined",
"&&",
"highlightEnabled",
")",
"{",
"this",
".",
"removeHighlight",
"(",
")",
";",
"}",
"this",
".",
"currentRegion",
"=",
"newRegion",
";",
"if",
"(",
"newRegion",
"!==",
"undefined",
"&&",
"highlightEnabled",
")",
"{",
"this",
".",
"renderHighlight",
"(",
")",
";",
"}",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] | Highlight an item based on the moused-over x,y co-ordinate | [
"Highlight",
"an",
"item",
"based",
"on",
"the",
"moused",
"-",
"over",
"x",
"y",
"co",
"-",
"ordinate"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/jquery-sparkline/src/base.js#L224-L243 |
|
121 | ColorlibHQ/AdminLTE | bower_components/jvectormap/lib/world-map.js | function(){
this.width = this.container.width();
this.height = this.container.height();
this.resize();
this.canvas.setSize(this.width, this.height);
this.applyTransform();
} | javascript | function(){
this.width = this.container.width();
this.height = this.container.height();
this.resize();
this.canvas.setSize(this.width, this.height);
this.applyTransform();
} | [
"function",
"(",
")",
"{",
"this",
".",
"width",
"=",
"this",
".",
"container",
".",
"width",
"(",
")",
";",
"this",
".",
"height",
"=",
"this",
".",
"container",
".",
"height",
"(",
")",
";",
"this",
".",
"resize",
"(",
")",
";",
"this",
".",
"canvas",
".",
"setSize",
"(",
"this",
".",
"width",
",",
"this",
".",
"height",
")",
";",
"this",
".",
"applyTransform",
"(",
")",
";",
"}"
] | Synchronize the size of the map with the size of the container. Suitable in situations where the size of the container is changed programmatically or container is shown after it became visible. | [
"Synchronize",
"the",
"size",
"of",
"the",
"map",
"with",
"the",
"size",
"of",
"the",
"container",
".",
"Suitable",
"in",
"situations",
"where",
"the",
"size",
"of",
"the",
"container",
"is",
"changed",
"programmatically",
"or",
"container",
"is",
"shown",
"after",
"it",
"became",
"visible",
"."
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/jvectormap/lib/world-map.js#L190-L196 |
|
122 | ColorlibHQ/AdminLTE | bower_components/jvectormap/lib/world-map.js | function() {
var key,
i;
for (key in this.series) {
for (i = 0; i < this.series[key].length; i++) {
this.series[key][i].clear();
}
}
this.scale = this.baseScale;
this.transX = this.baseTransX;
this.transY = this.baseTransY;
this.applyTransform();
} | javascript | function() {
var key,
i;
for (key in this.series) {
for (i = 0; i < this.series[key].length; i++) {
this.series[key][i].clear();
}
}
this.scale = this.baseScale;
this.transX = this.baseTransX;
this.transY = this.baseTransY;
this.applyTransform();
} | [
"function",
"(",
")",
"{",
"var",
"key",
",",
"i",
";",
"for",
"(",
"key",
"in",
"this",
".",
"series",
")",
"{",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"series",
"[",
"key",
"]",
".",
"length",
";",
"i",
"++",
")",
"{",
"this",
".",
"series",
"[",
"key",
"]",
"[",
"i",
"]",
".",
"clear",
"(",
")",
";",
"}",
"}",
"this",
".",
"scale",
"=",
"this",
".",
"baseScale",
";",
"this",
".",
"transX",
"=",
"this",
".",
"baseTransX",
";",
"this",
".",
"transY",
"=",
"this",
".",
"baseTransY",
";",
"this",
".",
"applyTransform",
"(",
")",
";",
"}"
] | Reset all the series and show the map with the initial zoom. | [
"Reset",
"all",
"the",
"series",
"and",
"show",
"the",
"map",
"with",
"the",
"initial",
"zoom",
"."
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/jvectormap/lib/world-map.js#L201-L214 |
|
123 | ColorlibHQ/AdminLTE | bower_components/jvectormap/lib/world-map.js | function(key, marker, seriesData){
var markers = {},
data = [],
values,
i,
seriesData = seriesData || [];
markers[key] = marker;
for (i = 0; i < seriesData.length; i++) {
values = {};
values[key] = seriesData[i];
data.push(values);
}
this.addMarkers(markers, data);
} | javascript | function(key, marker, seriesData){
var markers = {},
data = [],
values,
i,
seriesData = seriesData || [];
markers[key] = marker;
for (i = 0; i < seriesData.length; i++) {
values = {};
values[key] = seriesData[i];
data.push(values);
}
this.addMarkers(markers, data);
} | [
"function",
"(",
"key",
",",
"marker",
",",
"seriesData",
")",
"{",
"var",
"markers",
"=",
"{",
"}",
",",
"data",
"=",
"[",
"]",
",",
"values",
",",
"i",
",",
"seriesData",
"=",
"seriesData",
"||",
"[",
"]",
";",
"markers",
"[",
"key",
"]",
"=",
"marker",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"seriesData",
".",
"length",
";",
"i",
"++",
")",
"{",
"values",
"=",
"{",
"}",
";",
"values",
"[",
"key",
"]",
"=",
"seriesData",
"[",
"i",
"]",
";",
"data",
".",
"push",
"(",
"values",
")",
";",
"}",
"this",
".",
"addMarkers",
"(",
"markers",
",",
"data",
")",
";",
"}"
] | Add one marker to the map.
@param {String} key Marker unique code.
@param {Object} marker Marker configuration parameters.
@param {Array} seriesData Values to add to the data series. | [
"Add",
"one",
"marker",
"to",
"the",
"map",
"."
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/jvectormap/lib/world-map.js#L755-L770 |
|
124 | ColorlibHQ/AdminLTE | bower_components/jvectormap/lib/world-map.js | function(markers, seriesData){
var i;
seriesData = seriesData || [];
this.createMarkers(markers);
for (i = 0; i < seriesData.length; i++) {
this.series.markers[i].setValues(seriesData[i] || {});
};
} | javascript | function(markers, seriesData){
var i;
seriesData = seriesData || [];
this.createMarkers(markers);
for (i = 0; i < seriesData.length; i++) {
this.series.markers[i].setValues(seriesData[i] || {});
};
} | [
"function",
"(",
"markers",
",",
"seriesData",
")",
"{",
"var",
"i",
";",
"seriesData",
"=",
"seriesData",
"||",
"[",
"]",
";",
"this",
".",
"createMarkers",
"(",
"markers",
")",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"seriesData",
".",
"length",
";",
"i",
"++",
")",
"{",
"this",
".",
"series",
".",
"markers",
"[",
"i",
"]",
".",
"setValues",
"(",
"seriesData",
"[",
"i",
"]",
"||",
"{",
"}",
")",
";",
"}",
";",
"}"
] | Add set of marker to the map.
@param {Object|Array} markers Markers to add to the map. In case of array is provided, codes of markers will be set as string representations of array indexes.
@param {Array} seriesData Values to add to the data series. | [
"Add",
"set",
"of",
"marker",
"to",
"the",
"map",
"."
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/jvectormap/lib/world-map.js#L777-L786 |
|
125 | ColorlibHQ/AdminLTE | bower_components/jvectormap/lib/world-map.js | function(markers){
var i;
for (i = 0; i < markers.length; i++) {
this.markers[ markers[i] ].element.remove();
delete this.markers[ markers[i] ];
};
} | javascript | function(markers){
var i;
for (i = 0; i < markers.length; i++) {
this.markers[ markers[i] ].element.remove();
delete this.markers[ markers[i] ];
};
} | [
"function",
"(",
"markers",
")",
"{",
"var",
"i",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"markers",
".",
"length",
";",
"i",
"++",
")",
"{",
"this",
".",
"markers",
"[",
"markers",
"[",
"i",
"]",
"]",
".",
"element",
".",
"remove",
"(",
")",
";",
"delete",
"this",
".",
"markers",
"[",
"markers",
"[",
"i",
"]",
"]",
";",
"}",
";",
"}"
] | Remove some markers from the map.
@param {Array} markers Array of marker codes to be removed. | [
"Remove",
"some",
"markers",
"from",
"the",
"map",
"."
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/jvectormap/lib/world-map.js#L792-L799 |
|
126 | ColorlibHQ/AdminLTE | bower_components/jvectormap/lib/world-map.js | function(lat, lng) {
var point,
proj = jvm.WorldMap.maps[this.params.map].projection,
centralMeridian = proj.centralMeridian,
width = this.width - this.baseTransX * 2 * this.baseScale,
height = this.height - this.baseTransY * 2 * this.baseScale,
inset,
bbox,
scaleFactor = this.scale / this.baseScale;
if (lng < (-180 + centralMeridian)) {
lng += 360;
}
point = jvm.Proj[proj.type](lat, lng, centralMeridian);
inset = this.getInsetForPoint(point.x, point.y);
if (inset) {
bbox = inset.bbox;
point.x = (point.x - bbox[0].x) / (bbox[1].x - bbox[0].x) * inset.width * this.scale;
point.y = (point.y - bbox[0].y) / (bbox[1].y - bbox[0].y) * inset.height * this.scale;
return {
x: point.x + this.transX*this.scale + inset.left*this.scale,
y: point.y + this.transY*this.scale + inset.top*this.scale
};
} else {
return false;
}
} | javascript | function(lat, lng) {
var point,
proj = jvm.WorldMap.maps[this.params.map].projection,
centralMeridian = proj.centralMeridian,
width = this.width - this.baseTransX * 2 * this.baseScale,
height = this.height - this.baseTransY * 2 * this.baseScale,
inset,
bbox,
scaleFactor = this.scale / this.baseScale;
if (lng < (-180 + centralMeridian)) {
lng += 360;
}
point = jvm.Proj[proj.type](lat, lng, centralMeridian);
inset = this.getInsetForPoint(point.x, point.y);
if (inset) {
bbox = inset.bbox;
point.x = (point.x - bbox[0].x) / (bbox[1].x - bbox[0].x) * inset.width * this.scale;
point.y = (point.y - bbox[0].y) / (bbox[1].y - bbox[0].y) * inset.height * this.scale;
return {
x: point.x + this.transX*this.scale + inset.left*this.scale,
y: point.y + this.transY*this.scale + inset.top*this.scale
};
} else {
return false;
}
} | [
"function",
"(",
"lat",
",",
"lng",
")",
"{",
"var",
"point",
",",
"proj",
"=",
"jvm",
".",
"WorldMap",
".",
"maps",
"[",
"this",
".",
"params",
".",
"map",
"]",
".",
"projection",
",",
"centralMeridian",
"=",
"proj",
".",
"centralMeridian",
",",
"width",
"=",
"this",
".",
"width",
"-",
"this",
".",
"baseTransX",
"*",
"2",
"*",
"this",
".",
"baseScale",
",",
"height",
"=",
"this",
".",
"height",
"-",
"this",
".",
"baseTransY",
"*",
"2",
"*",
"this",
".",
"baseScale",
",",
"inset",
",",
"bbox",
",",
"scaleFactor",
"=",
"this",
".",
"scale",
"/",
"this",
".",
"baseScale",
";",
"if",
"(",
"lng",
"<",
"(",
"-",
"180",
"+",
"centralMeridian",
")",
")",
"{",
"lng",
"+=",
"360",
";",
"}",
"point",
"=",
"jvm",
".",
"Proj",
"[",
"proj",
".",
"type",
"]",
"(",
"lat",
",",
"lng",
",",
"centralMeridian",
")",
";",
"inset",
"=",
"this",
".",
"getInsetForPoint",
"(",
"point",
".",
"x",
",",
"point",
".",
"y",
")",
";",
"if",
"(",
"inset",
")",
"{",
"bbox",
"=",
"inset",
".",
"bbox",
";",
"point",
".",
"x",
"=",
"(",
"point",
".",
"x",
"-",
"bbox",
"[",
"0",
"]",
".",
"x",
")",
"/",
"(",
"bbox",
"[",
"1",
"]",
".",
"x",
"-",
"bbox",
"[",
"0",
"]",
".",
"x",
")",
"*",
"inset",
".",
"width",
"*",
"this",
".",
"scale",
";",
"point",
".",
"y",
"=",
"(",
"point",
".",
"y",
"-",
"bbox",
"[",
"0",
"]",
".",
"y",
")",
"/",
"(",
"bbox",
"[",
"1",
"]",
".",
"y",
"-",
"bbox",
"[",
"0",
"]",
".",
"y",
")",
"*",
"inset",
".",
"height",
"*",
"this",
".",
"scale",
";",
"return",
"{",
"x",
":",
"point",
".",
"x",
"+",
"this",
".",
"transX",
"*",
"this",
".",
"scale",
"+",
"inset",
".",
"left",
"*",
"this",
".",
"scale",
",",
"y",
":",
"point",
".",
"y",
"+",
"this",
".",
"transY",
"*",
"this",
".",
"scale",
"+",
"inset",
".",
"top",
"*",
"this",
".",
"scale",
"}",
";",
"}",
"else",
"{",
"return",
"false",
";",
"}",
"}"
] | Converts coordinates expressed as latitude and longitude to the coordinates in pixels on the map.
@param {Number} lat Latitide of point in degrees.
@param {Number} lng Longitude of point in degrees. | [
"Converts",
"coordinates",
"expressed",
"as",
"latitude",
"and",
"longitude",
"to",
"the",
"coordinates",
"in",
"pixels",
"on",
"the",
"map",
"."
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/jvectormap/lib/world-map.js#L819-L849 |
|
127 | ColorlibHQ/AdminLTE | bower_components/jvectormap/lib/world-map.js | function(x, y) {
var proj = jvm.WorldMap.maps[this.params.map].projection,
centralMeridian = proj.centralMeridian,
insets = jvm.WorldMap.maps[this.params.map].insets,
i,
inset,
bbox,
nx,
ny;
for (i = 0; i < insets.length; i++) {
inset = insets[i];
bbox = inset.bbox;
nx = x - (this.transX*this.scale + inset.left*this.scale);
ny = y - (this.transY*this.scale + inset.top*this.scale);
nx = (nx / (inset.width * this.scale)) * (bbox[1].x - bbox[0].x) + bbox[0].x;
ny = (ny / (inset.height * this.scale)) * (bbox[1].y - bbox[0].y) + bbox[0].y;
if (nx > bbox[0].x && nx < bbox[1].x && ny > bbox[0].y && ny < bbox[1].y) {
return jvm.Proj[proj.type + '_inv'](nx, -ny, centralMeridian);
}
}
return false;
} | javascript | function(x, y) {
var proj = jvm.WorldMap.maps[this.params.map].projection,
centralMeridian = proj.centralMeridian,
insets = jvm.WorldMap.maps[this.params.map].insets,
i,
inset,
bbox,
nx,
ny;
for (i = 0; i < insets.length; i++) {
inset = insets[i];
bbox = inset.bbox;
nx = x - (this.transX*this.scale + inset.left*this.scale);
ny = y - (this.transY*this.scale + inset.top*this.scale);
nx = (nx / (inset.width * this.scale)) * (bbox[1].x - bbox[0].x) + bbox[0].x;
ny = (ny / (inset.height * this.scale)) * (bbox[1].y - bbox[0].y) + bbox[0].y;
if (nx > bbox[0].x && nx < bbox[1].x && ny > bbox[0].y && ny < bbox[1].y) {
return jvm.Proj[proj.type + '_inv'](nx, -ny, centralMeridian);
}
}
return false;
} | [
"function",
"(",
"x",
",",
"y",
")",
"{",
"var",
"proj",
"=",
"jvm",
".",
"WorldMap",
".",
"maps",
"[",
"this",
".",
"params",
".",
"map",
"]",
".",
"projection",
",",
"centralMeridian",
"=",
"proj",
".",
"centralMeridian",
",",
"insets",
"=",
"jvm",
".",
"WorldMap",
".",
"maps",
"[",
"this",
".",
"params",
".",
"map",
"]",
".",
"insets",
",",
"i",
",",
"inset",
",",
"bbox",
",",
"nx",
",",
"ny",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"insets",
".",
"length",
";",
"i",
"++",
")",
"{",
"inset",
"=",
"insets",
"[",
"i",
"]",
";",
"bbox",
"=",
"inset",
".",
"bbox",
";",
"nx",
"=",
"x",
"-",
"(",
"this",
".",
"transX",
"*",
"this",
".",
"scale",
"+",
"inset",
".",
"left",
"*",
"this",
".",
"scale",
")",
";",
"ny",
"=",
"y",
"-",
"(",
"this",
".",
"transY",
"*",
"this",
".",
"scale",
"+",
"inset",
".",
"top",
"*",
"this",
".",
"scale",
")",
";",
"nx",
"=",
"(",
"nx",
"/",
"(",
"inset",
".",
"width",
"*",
"this",
".",
"scale",
")",
")",
"*",
"(",
"bbox",
"[",
"1",
"]",
".",
"x",
"-",
"bbox",
"[",
"0",
"]",
".",
"x",
")",
"+",
"bbox",
"[",
"0",
"]",
".",
"x",
";",
"ny",
"=",
"(",
"ny",
"/",
"(",
"inset",
".",
"height",
"*",
"this",
".",
"scale",
")",
")",
"*",
"(",
"bbox",
"[",
"1",
"]",
".",
"y",
"-",
"bbox",
"[",
"0",
"]",
".",
"y",
")",
"+",
"bbox",
"[",
"0",
"]",
".",
"y",
";",
"if",
"(",
"nx",
">",
"bbox",
"[",
"0",
"]",
".",
"x",
"&&",
"nx",
"<",
"bbox",
"[",
"1",
"]",
".",
"x",
"&&",
"ny",
">",
"bbox",
"[",
"0",
"]",
".",
"y",
"&&",
"ny",
"<",
"bbox",
"[",
"1",
"]",
".",
"y",
")",
"{",
"return",
"jvm",
".",
"Proj",
"[",
"proj",
".",
"type",
"+",
"'_inv'",
"]",
"(",
"nx",
",",
"-",
"ny",
",",
"centralMeridian",
")",
";",
"}",
"}",
"return",
"false",
";",
"}"
] | Converts cartesian coordinates into coordinates expressed as latitude and longitude.
@param {Number} x X-axis of point on map in pixels.
@param {Number} y Y-axis of point on map in pixels. | [
"Converts",
"cartesian",
"coordinates",
"into",
"coordinates",
"expressed",
"as",
"latitude",
"and",
"longitude",
"."
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/jvectormap/lib/world-map.js#L856-L882 |
|
128 | ColorlibHQ/AdminLTE | plugins/input-mask/jquery.inputmask.date.extensions.js | function (chrs, buffer, pos, strict, opts) {
var isValid = opts.regex.val1.test(chrs);
if (!strict && !isValid) {
if (chrs.charAt(1) == opts.separator || "-./".indexOf(chrs.charAt(1)) != -1) {
isValid = opts.regex.val1.test("0" + chrs.charAt(0));
if (isValid) {
buffer[pos - 1] = "0";
return { "pos": pos, "c": chrs.charAt(0) };
}
}
}
return isValid;
} | javascript | function (chrs, buffer, pos, strict, opts) {
var isValid = opts.regex.val1.test(chrs);
if (!strict && !isValid) {
if (chrs.charAt(1) == opts.separator || "-./".indexOf(chrs.charAt(1)) != -1) {
isValid = opts.regex.val1.test("0" + chrs.charAt(0));
if (isValid) {
buffer[pos - 1] = "0";
return { "pos": pos, "c": chrs.charAt(0) };
}
}
}
return isValid;
} | [
"function",
"(",
"chrs",
",",
"buffer",
",",
"pos",
",",
"strict",
",",
"opts",
")",
"{",
"var",
"isValid",
"=",
"opts",
".",
"regex",
".",
"val1",
".",
"test",
"(",
"chrs",
")",
";",
"if",
"(",
"!",
"strict",
"&&",
"!",
"isValid",
")",
"{",
"if",
"(",
"chrs",
".",
"charAt",
"(",
"1",
")",
"==",
"opts",
".",
"separator",
"||",
"\"-./\"",
".",
"indexOf",
"(",
"chrs",
".",
"charAt",
"(",
"1",
")",
")",
"!=",
"-",
"1",
")",
"{",
"isValid",
"=",
"opts",
".",
"regex",
".",
"val1",
".",
"test",
"(",
"\"0\"",
"+",
"chrs",
".",
"charAt",
"(",
"0",
")",
")",
";",
"if",
"(",
"isValid",
")",
"{",
"buffer",
"[",
"pos",
"-",
"1",
"]",
"=",
"\"0\"",
";",
"return",
"{",
"\"pos\"",
":",
"pos",
",",
"\"c\"",
":",
"chrs",
".",
"charAt",
"(",
"0",
")",
"}",
";",
"}",
"}",
"}",
"return",
"isValid",
";",
"}"
] | val1 ~ day or month | [
"val1",
"~",
"day",
"or",
"month"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/input-mask/jquery.inputmask.date.extensions.js#L86-L98 |
|
129 | ColorlibHQ/AdminLTE | bower_components/ion.rangeSlider/js/ion.rangeSlider.js | function (is_update) {
this.no_diapason = false;
this.coords.p_step = this.convertToPercent(this.options.step, true);
this.target = "base";
this.toggleInput();
this.append();
this.setMinMax();
if (is_update) {
this.force_redraw = true;
this.calc(true);
// callbacks called
this.callOnUpdate();
} else {
this.force_redraw = true;
this.calc(true);
// callbacks called
this.callOnStart();
}
this.updateScene();
} | javascript | function (is_update) {
this.no_diapason = false;
this.coords.p_step = this.convertToPercent(this.options.step, true);
this.target = "base";
this.toggleInput();
this.append();
this.setMinMax();
if (is_update) {
this.force_redraw = true;
this.calc(true);
// callbacks called
this.callOnUpdate();
} else {
this.force_redraw = true;
this.calc(true);
// callbacks called
this.callOnStart();
}
this.updateScene();
} | [
"function",
"(",
"is_update",
")",
"{",
"this",
".",
"no_diapason",
"=",
"false",
";",
"this",
".",
"coords",
".",
"p_step",
"=",
"this",
".",
"convertToPercent",
"(",
"this",
".",
"options",
".",
"step",
",",
"true",
")",
";",
"this",
".",
"target",
"=",
"\"base\"",
";",
"this",
".",
"toggleInput",
"(",
")",
";",
"this",
".",
"append",
"(",
")",
";",
"this",
".",
"setMinMax",
"(",
")",
";",
"if",
"(",
"is_update",
")",
"{",
"this",
".",
"force_redraw",
"=",
"true",
";",
"this",
".",
"calc",
"(",
"true",
")",
";",
"// callbacks called",
"this",
".",
"callOnUpdate",
"(",
")",
";",
"}",
"else",
"{",
"this",
".",
"force_redraw",
"=",
"true",
";",
"this",
".",
"calc",
"(",
"true",
")",
";",
"// callbacks called",
"this",
".",
"callOnStart",
"(",
")",
";",
"}",
"this",
".",
"updateScene",
"(",
")",
";",
"}"
] | Starts or updates the plugin instance
@param [is_update] {boolean} | [
"Starts",
"or",
"updates",
"the",
"plugin",
"instance"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/ion.rangeSlider/js/ion.rangeSlider.js#L477-L502 |
|
130 | ColorlibHQ/AdminLTE | bower_components/ion.rangeSlider/js/ion.rangeSlider.js | function () {
var min = this.options.min,
max = this.options.max,
from = this.options.from,
to = this.options.to;
if (from > min && to === max) {
this.$cache.s_from.addClass("type_last");
} else if (to < max) {
this.$cache.s_to.addClass("type_last");
}
} | javascript | function () {
var min = this.options.min,
max = this.options.max,
from = this.options.from,
to = this.options.to;
if (from > min && to === max) {
this.$cache.s_from.addClass("type_last");
} else if (to < max) {
this.$cache.s_to.addClass("type_last");
}
} | [
"function",
"(",
")",
"{",
"var",
"min",
"=",
"this",
".",
"options",
".",
"min",
",",
"max",
"=",
"this",
".",
"options",
".",
"max",
",",
"from",
"=",
"this",
".",
"options",
".",
"from",
",",
"to",
"=",
"this",
".",
"options",
".",
"to",
";",
"if",
"(",
"from",
">",
"min",
"&&",
"to",
"===",
"max",
")",
"{",
"this",
".",
"$cache",
".",
"s_from",
".",
"addClass",
"(",
"\"type_last\"",
")",
";",
"}",
"else",
"if",
"(",
"to",
"<",
"max",
")",
"{",
"this",
".",
"$cache",
".",
"s_to",
".",
"addClass",
"(",
"\"type_last\"",
")",
";",
"}",
"}"
] | Determine which handler has a priority
works only for double slider type | [
"Determine",
"which",
"handler",
"has",
"a",
"priority",
"works",
"only",
"for",
"double",
"slider",
"type"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/ion.rangeSlider/js/ion.rangeSlider.js#L578-L589 |
|
131 | ColorlibHQ/AdminLTE | bower_components/ion.rangeSlider/js/ion.rangeSlider.js | function (e) {
if (!this.target) {
var x;
var $handle;
if (this.options.type === "single") {
$handle = this.$cache.single;
} else {
$handle = this.$cache.from;
}
x = $handle.offset().left;
x += ($handle.width() / 2) - 1;
this.pointerClick("single", {preventDefault: function () {}, pageX: x});
}
} | javascript | function (e) {
if (!this.target) {
var x;
var $handle;
if (this.options.type === "single") {
$handle = this.$cache.single;
} else {
$handle = this.$cache.from;
}
x = $handle.offset().left;
x += ($handle.width() / 2) - 1;
this.pointerClick("single", {preventDefault: function () {}, pageX: x});
}
} | [
"function",
"(",
"e",
")",
"{",
"if",
"(",
"!",
"this",
".",
"target",
")",
"{",
"var",
"x",
";",
"var",
"$handle",
";",
"if",
"(",
"this",
".",
"options",
".",
"type",
"===",
"\"single\"",
")",
"{",
"$handle",
"=",
"this",
".",
"$cache",
".",
"single",
";",
"}",
"else",
"{",
"$handle",
"=",
"this",
".",
"$cache",
".",
"from",
";",
"}",
"x",
"=",
"$handle",
".",
"offset",
"(",
")",
".",
"left",
";",
"x",
"+=",
"(",
"$handle",
".",
"width",
"(",
")",
"/",
"2",
")",
"-",
"1",
";",
"this",
".",
"pointerClick",
"(",
"\"single\"",
",",
"{",
"preventDefault",
":",
"function",
"(",
")",
"{",
"}",
",",
"pageX",
":",
"x",
"}",
")",
";",
"}",
"}"
] | Focus with tabIndex
@param e {Object} event object | [
"Focus",
"with",
"tabIndex"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/ion.rangeSlider/js/ion.rangeSlider.js#L742-L758 |
|
132 | ColorlibHQ/AdminLTE | bower_components/ion.rangeSlider/js/ion.rangeSlider.js | function (e) {
if (!this.dragging) {
return;
}
var x = e.pageX || e.originalEvent.touches && e.originalEvent.touches[0].pageX;
this.coords.x_pointer = x - this.coords.x_gap;
this.calc();
} | javascript | function (e) {
if (!this.dragging) {
return;
}
var x = e.pageX || e.originalEvent.touches && e.originalEvent.touches[0].pageX;
this.coords.x_pointer = x - this.coords.x_gap;
this.calc();
} | [
"function",
"(",
"e",
")",
"{",
"if",
"(",
"!",
"this",
".",
"dragging",
")",
"{",
"return",
";",
"}",
"var",
"x",
"=",
"e",
".",
"pageX",
"||",
"e",
".",
"originalEvent",
".",
"touches",
"&&",
"e",
".",
"originalEvent",
".",
"touches",
"[",
"0",
"]",
".",
"pageX",
";",
"this",
".",
"coords",
".",
"x_pointer",
"=",
"x",
"-",
"this",
".",
"coords",
".",
"x_gap",
";",
"this",
".",
"calc",
"(",
")",
";",
"}"
] | Mousemove or touchmove
only for handlers
@param e {Object} event object | [
"Mousemove",
"or",
"touchmove",
"only",
"for",
"handlers"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/ion.rangeSlider/js/ion.rangeSlider.js#L766-L775 |
|
133 | ColorlibHQ/AdminLTE | bower_components/ion.rangeSlider/js/ion.rangeSlider.js | function (e) {
if (this.current_plugin !== this.plugin_count) {
return;
}
if (this.is_active) {
this.is_active = false;
} else {
return;
}
this.$cache.cont.find(".state_hover").removeClass("state_hover");
this.force_redraw = true;
if (is_old_ie) {
$("*").prop("unselectable", false);
}
this.updateScene();
this.restoreOriginalMinInterval();
// callbacks call
if ($.contains(this.$cache.cont[0], e.target) || this.dragging) {
this.callOnFinish();
}
this.dragging = false;
} | javascript | function (e) {
if (this.current_plugin !== this.plugin_count) {
return;
}
if (this.is_active) {
this.is_active = false;
} else {
return;
}
this.$cache.cont.find(".state_hover").removeClass("state_hover");
this.force_redraw = true;
if (is_old_ie) {
$("*").prop("unselectable", false);
}
this.updateScene();
this.restoreOriginalMinInterval();
// callbacks call
if ($.contains(this.$cache.cont[0], e.target) || this.dragging) {
this.callOnFinish();
}
this.dragging = false;
} | [
"function",
"(",
"e",
")",
"{",
"if",
"(",
"this",
".",
"current_plugin",
"!==",
"this",
".",
"plugin_count",
")",
"{",
"return",
";",
"}",
"if",
"(",
"this",
".",
"is_active",
")",
"{",
"this",
".",
"is_active",
"=",
"false",
";",
"}",
"else",
"{",
"return",
";",
"}",
"this",
".",
"$cache",
".",
"cont",
".",
"find",
"(",
"\".state_hover\"",
")",
".",
"removeClass",
"(",
"\"state_hover\"",
")",
";",
"this",
".",
"force_redraw",
"=",
"true",
";",
"if",
"(",
"is_old_ie",
")",
"{",
"$",
"(",
"\"*\"",
")",
".",
"prop",
"(",
"\"unselectable\"",
",",
"false",
")",
";",
"}",
"this",
".",
"updateScene",
"(",
")",
";",
"this",
".",
"restoreOriginalMinInterval",
"(",
")",
";",
"// callbacks call",
"if",
"(",
"$",
".",
"contains",
"(",
"this",
".",
"$cache",
".",
"cont",
"[",
"0",
"]",
",",
"e",
".",
"target",
")",
"||",
"this",
".",
"dragging",
")",
"{",
"this",
".",
"callOnFinish",
"(",
")",
";",
"}",
"this",
".",
"dragging",
"=",
"false",
";",
"}"
] | Mouseup or touchend
only for handlers
@param e {Object} event object | [
"Mouseup",
"or",
"touchend",
"only",
"for",
"handlers"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/ion.rangeSlider/js/ion.rangeSlider.js#L783-L811 |
|
134 | ColorlibHQ/AdminLTE | bower_components/ion.rangeSlider/js/ion.rangeSlider.js | function (target, e) {
e.preventDefault();
var x = e.pageX || e.originalEvent.touches && e.originalEvent.touches[0].pageX;
if (e.button === 2) {
return;
}
if (target === "both") {
this.setTempMinInterval();
}
if (!target) {
target = this.target || "from";
}
this.current_plugin = this.plugin_count;
this.target = target;
this.is_active = true;
this.dragging = true;
this.coords.x_gap = this.$cache.rs.offset().left;
this.coords.x_pointer = x - this.coords.x_gap;
this.calcPointerPercent();
this.changeLevel(target);
if (is_old_ie) {
$("*").prop("unselectable", true);
}
this.$cache.line.trigger("focus");
this.updateScene();
} | javascript | function (target, e) {
e.preventDefault();
var x = e.pageX || e.originalEvent.touches && e.originalEvent.touches[0].pageX;
if (e.button === 2) {
return;
}
if (target === "both") {
this.setTempMinInterval();
}
if (!target) {
target = this.target || "from";
}
this.current_plugin = this.plugin_count;
this.target = target;
this.is_active = true;
this.dragging = true;
this.coords.x_gap = this.$cache.rs.offset().left;
this.coords.x_pointer = x - this.coords.x_gap;
this.calcPointerPercent();
this.changeLevel(target);
if (is_old_ie) {
$("*").prop("unselectable", true);
}
this.$cache.line.trigger("focus");
this.updateScene();
} | [
"function",
"(",
"target",
",",
"e",
")",
"{",
"e",
".",
"preventDefault",
"(",
")",
";",
"var",
"x",
"=",
"e",
".",
"pageX",
"||",
"e",
".",
"originalEvent",
".",
"touches",
"&&",
"e",
".",
"originalEvent",
".",
"touches",
"[",
"0",
"]",
".",
"pageX",
";",
"if",
"(",
"e",
".",
"button",
"===",
"2",
")",
"{",
"return",
";",
"}",
"if",
"(",
"target",
"===",
"\"both\"",
")",
"{",
"this",
".",
"setTempMinInterval",
"(",
")",
";",
"}",
"if",
"(",
"!",
"target",
")",
"{",
"target",
"=",
"this",
".",
"target",
"||",
"\"from\"",
";",
"}",
"this",
".",
"current_plugin",
"=",
"this",
".",
"plugin_count",
";",
"this",
".",
"target",
"=",
"target",
";",
"this",
".",
"is_active",
"=",
"true",
";",
"this",
".",
"dragging",
"=",
"true",
";",
"this",
".",
"coords",
".",
"x_gap",
"=",
"this",
".",
"$cache",
".",
"rs",
".",
"offset",
"(",
")",
".",
"left",
";",
"this",
".",
"coords",
".",
"x_pointer",
"=",
"x",
"-",
"this",
".",
"coords",
".",
"x_gap",
";",
"this",
".",
"calcPointerPercent",
"(",
")",
";",
"this",
".",
"changeLevel",
"(",
"target",
")",
";",
"if",
"(",
"is_old_ie",
")",
"{",
"$",
"(",
"\"*\"",
")",
".",
"prop",
"(",
"\"unselectable\"",
",",
"true",
")",
";",
"}",
"this",
".",
"$cache",
".",
"line",
".",
"trigger",
"(",
"\"focus\"",
")",
";",
"this",
".",
"updateScene",
"(",
")",
";",
"}"
] | Mousedown or touchstart
only for handlers
@param target {String|null}
@param e {Object} event object | [
"Mousedown",
"or",
"touchstart",
"only",
"for",
"handlers"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/ion.rangeSlider/js/ion.rangeSlider.js#L820-L854 |
|
135 | ColorlibHQ/AdminLTE | bower_components/ion.rangeSlider/js/ion.rangeSlider.js | function (target, e) {
e.preventDefault();
var x = e.pageX || e.originalEvent.touches && e.originalEvent.touches[0].pageX;
if (e.button === 2) {
return;
}
this.current_plugin = this.plugin_count;
this.target = target;
this.is_click = true;
this.coords.x_gap = this.$cache.rs.offset().left;
this.coords.x_pointer = +(x - this.coords.x_gap).toFixed();
this.force_redraw = true;
this.calc();
this.$cache.line.trigger("focus");
} | javascript | function (target, e) {
e.preventDefault();
var x = e.pageX || e.originalEvent.touches && e.originalEvent.touches[0].pageX;
if (e.button === 2) {
return;
}
this.current_plugin = this.plugin_count;
this.target = target;
this.is_click = true;
this.coords.x_gap = this.$cache.rs.offset().left;
this.coords.x_pointer = +(x - this.coords.x_gap).toFixed();
this.force_redraw = true;
this.calc();
this.$cache.line.trigger("focus");
} | [
"function",
"(",
"target",
",",
"e",
")",
"{",
"e",
".",
"preventDefault",
"(",
")",
";",
"var",
"x",
"=",
"e",
".",
"pageX",
"||",
"e",
".",
"originalEvent",
".",
"touches",
"&&",
"e",
".",
"originalEvent",
".",
"touches",
"[",
"0",
"]",
".",
"pageX",
";",
"if",
"(",
"e",
".",
"button",
"===",
"2",
")",
"{",
"return",
";",
"}",
"this",
".",
"current_plugin",
"=",
"this",
".",
"plugin_count",
";",
"this",
".",
"target",
"=",
"target",
";",
"this",
".",
"is_click",
"=",
"true",
";",
"this",
".",
"coords",
".",
"x_gap",
"=",
"this",
".",
"$cache",
".",
"rs",
".",
"offset",
"(",
")",
".",
"left",
";",
"this",
".",
"coords",
".",
"x_pointer",
"=",
"+",
"(",
"x",
"-",
"this",
".",
"coords",
".",
"x_gap",
")",
".",
"toFixed",
"(",
")",
";",
"this",
".",
"force_redraw",
"=",
"true",
";",
"this",
".",
"calc",
"(",
")",
";",
"this",
".",
"$cache",
".",
"line",
".",
"trigger",
"(",
"\"focus\"",
")",
";",
"}"
] | Mousedown or touchstart
for other slider elements, like diapason line
@param target {String}
@param e {Object} event object | [
"Mousedown",
"or",
"touchstart",
"for",
"other",
"slider",
"elements",
"like",
"diapason",
"line"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/ion.rangeSlider/js/ion.rangeSlider.js#L863-L881 |
|
136 | ColorlibHQ/AdminLTE | bower_components/ion.rangeSlider/js/ion.rangeSlider.js | function (target, e) {
if (this.current_plugin !== this.plugin_count || e.altKey || e.ctrlKey || e.shiftKey || e.metaKey) {
return;
}
switch (e.which) {
case 83: // W
case 65: // A
case 40: // DOWN
case 37: // LEFT
e.preventDefault();
this.moveByKey(false);
break;
case 87: // S
case 68: // D
case 38: // UP
case 39: // RIGHT
e.preventDefault();
this.moveByKey(true);
break;
}
return true;
} | javascript | function (target, e) {
if (this.current_plugin !== this.plugin_count || e.altKey || e.ctrlKey || e.shiftKey || e.metaKey) {
return;
}
switch (e.which) {
case 83: // W
case 65: // A
case 40: // DOWN
case 37: // LEFT
e.preventDefault();
this.moveByKey(false);
break;
case 87: // S
case 68: // D
case 38: // UP
case 39: // RIGHT
e.preventDefault();
this.moveByKey(true);
break;
}
return true;
} | [
"function",
"(",
"target",
",",
"e",
")",
"{",
"if",
"(",
"this",
".",
"current_plugin",
"!==",
"this",
".",
"plugin_count",
"||",
"e",
".",
"altKey",
"||",
"e",
".",
"ctrlKey",
"||",
"e",
".",
"shiftKey",
"||",
"e",
".",
"metaKey",
")",
"{",
"return",
";",
"}",
"switch",
"(",
"e",
".",
"which",
")",
"{",
"case",
"83",
":",
"// W",
"case",
"65",
":",
"// A",
"case",
"40",
":",
"// DOWN",
"case",
"37",
":",
"// LEFT",
"e",
".",
"preventDefault",
"(",
")",
";",
"this",
".",
"moveByKey",
"(",
"false",
")",
";",
"break",
";",
"case",
"87",
":",
"// S",
"case",
"68",
":",
"// D",
"case",
"38",
":",
"// UP",
"case",
"39",
":",
"// RIGHT",
"e",
".",
"preventDefault",
"(",
")",
";",
"this",
".",
"moveByKey",
"(",
"true",
")",
";",
"break",
";",
"}",
"return",
"true",
";",
"}"
] | Keyborard controls for focused slider
@param target {String}
@param e {Object} event object
@returns {boolean|undefined} | [
"Keyborard",
"controls",
"for",
"focused",
"slider"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/ion.rangeSlider/js/ion.rangeSlider.js#L890-L914 |
|
137 | ColorlibHQ/AdminLTE | bower_components/ion.rangeSlider/js/ion.rangeSlider.js | function (right) {
var p = this.coords.p_pointer;
var p_step = (this.options.max - this.options.min) / 100;
p_step = this.options.step / p_step;
if (right) {
p += p_step;
} else {
p -= p_step;
}
this.coords.x_pointer = this.toFixed(this.coords.w_rs / 100 * p);
this.is_key = true;
this.calc();
} | javascript | function (right) {
var p = this.coords.p_pointer;
var p_step = (this.options.max - this.options.min) / 100;
p_step = this.options.step / p_step;
if (right) {
p += p_step;
} else {
p -= p_step;
}
this.coords.x_pointer = this.toFixed(this.coords.w_rs / 100 * p);
this.is_key = true;
this.calc();
} | [
"function",
"(",
"right",
")",
"{",
"var",
"p",
"=",
"this",
".",
"coords",
".",
"p_pointer",
";",
"var",
"p_step",
"=",
"(",
"this",
".",
"options",
".",
"max",
"-",
"this",
".",
"options",
".",
"min",
")",
"/",
"100",
";",
"p_step",
"=",
"this",
".",
"options",
".",
"step",
"/",
"p_step",
";",
"if",
"(",
"right",
")",
"{",
"p",
"+=",
"p_step",
";",
"}",
"else",
"{",
"p",
"-=",
"p_step",
";",
"}",
"this",
".",
"coords",
".",
"x_pointer",
"=",
"this",
".",
"toFixed",
"(",
"this",
".",
"coords",
".",
"w_rs",
"/",
"100",
"*",
"p",
")",
";",
"this",
".",
"is_key",
"=",
"true",
";",
"this",
".",
"calc",
"(",
")",
";",
"}"
] | Move by key
@param right {boolean} direction to move | [
"Move",
"by",
"key"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/ion.rangeSlider/js/ion.rangeSlider.js#L921-L935 |
|
138 | ColorlibHQ/AdminLTE | bower_components/ion.rangeSlider/js/ion.rangeSlider.js | function () {
var interval = this.result.to - this.result.from;
if (this.old_min_interval === null) {
this.old_min_interval = this.options.min_interval;
}
this.options.min_interval = interval;
} | javascript | function () {
var interval = this.result.to - this.result.from;
if (this.old_min_interval === null) {
this.old_min_interval = this.options.min_interval;
}
this.options.min_interval = interval;
} | [
"function",
"(",
")",
"{",
"var",
"interval",
"=",
"this",
".",
"result",
".",
"to",
"-",
"this",
".",
"result",
".",
"from",
";",
"if",
"(",
"this",
".",
"old_min_interval",
"===",
"null",
")",
"{",
"this",
".",
"old_min_interval",
"=",
"this",
".",
"options",
".",
"min_interval",
";",
"}",
"this",
".",
"options",
".",
"min_interval",
"=",
"interval",
";",
"}"
] | Then dragging interval, prevent interval collapsing
using min_interval option | [
"Then",
"dragging",
"interval",
"prevent",
"interval",
"collapsing",
"using",
"min_interval",
"option"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/ion.rangeSlider/js/ion.rangeSlider.js#L974-L982 |
|
139 | ColorlibHQ/AdminLTE | bower_components/ion.rangeSlider/js/ion.rangeSlider.js | function () {
if (!this.coords.w_rs) {
this.coords.p_pointer = 0;
return;
}
if (this.coords.x_pointer < 0 || isNaN(this.coords.x_pointer) ) {
this.coords.x_pointer = 0;
} else if (this.coords.x_pointer > this.coords.w_rs) {
this.coords.x_pointer = this.coords.w_rs;
}
this.coords.p_pointer = this.toFixed(this.coords.x_pointer / this.coords.w_rs * 100);
} | javascript | function () {
if (!this.coords.w_rs) {
this.coords.p_pointer = 0;
return;
}
if (this.coords.x_pointer < 0 || isNaN(this.coords.x_pointer) ) {
this.coords.x_pointer = 0;
} else if (this.coords.x_pointer > this.coords.w_rs) {
this.coords.x_pointer = this.coords.w_rs;
}
this.coords.p_pointer = this.toFixed(this.coords.x_pointer / this.coords.w_rs * 100);
} | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"coords",
".",
"w_rs",
")",
"{",
"this",
".",
"coords",
".",
"p_pointer",
"=",
"0",
";",
"return",
";",
"}",
"if",
"(",
"this",
".",
"coords",
".",
"x_pointer",
"<",
"0",
"||",
"isNaN",
"(",
"this",
".",
"coords",
".",
"x_pointer",
")",
")",
"{",
"this",
".",
"coords",
".",
"x_pointer",
"=",
"0",
";",
"}",
"else",
"if",
"(",
"this",
".",
"coords",
".",
"x_pointer",
">",
"this",
".",
"coords",
".",
"w_rs",
")",
"{",
"this",
".",
"coords",
".",
"x_pointer",
"=",
"this",
".",
"coords",
".",
"w_rs",
";",
"}",
"this",
".",
"coords",
".",
"p_pointer",
"=",
"this",
".",
"toFixed",
"(",
"this",
".",
"coords",
".",
"x_pointer",
"/",
"this",
".",
"coords",
".",
"w_rs",
"*",
"100",
")",
";",
"}"
] | calculates pointer X in percent | [
"calculates",
"pointer",
"X",
"in",
"percent"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/ion.rangeSlider/js/ion.rangeSlider.js#L1204-L1217 |
|
140 | ColorlibHQ/AdminLTE | bower_components/ion.rangeSlider/js/ion.rangeSlider.js | function (real_x) {
if (this.options.type === "single") {
return "single";
} else {
var m_point = this.coords.p_from_real + ((this.coords.p_to_real - this.coords.p_from_real) / 2);
if (real_x >= m_point) {
return this.options.to_fixed ? "from" : "to";
} else {
return this.options.from_fixed ? "to" : "from";
}
}
} | javascript | function (real_x) {
if (this.options.type === "single") {
return "single";
} else {
var m_point = this.coords.p_from_real + ((this.coords.p_to_real - this.coords.p_from_real) / 2);
if (real_x >= m_point) {
return this.options.to_fixed ? "from" : "to";
} else {
return this.options.from_fixed ? "to" : "from";
}
}
} | [
"function",
"(",
"real_x",
")",
"{",
"if",
"(",
"this",
".",
"options",
".",
"type",
"===",
"\"single\"",
")",
"{",
"return",
"\"single\"",
";",
"}",
"else",
"{",
"var",
"m_point",
"=",
"this",
".",
"coords",
".",
"p_from_real",
"+",
"(",
"(",
"this",
".",
"coords",
".",
"p_to_real",
"-",
"this",
".",
"coords",
".",
"p_from_real",
")",
"/",
"2",
")",
";",
"if",
"(",
"real_x",
">=",
"m_point",
")",
"{",
"return",
"this",
".",
"options",
".",
"to_fixed",
"?",
"\"from\"",
":",
"\"to\"",
";",
"}",
"else",
"{",
"return",
"this",
".",
"options",
".",
"from_fixed",
"?",
"\"to\"",
":",
"\"from\"",
";",
"}",
"}",
"}"
] | Find closest handle to pointer click
@param real_x {Number}
@returns {String} | [
"Find",
"closest",
"handle",
"to",
"pointer",
"click"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/ion.rangeSlider/js/ion.rangeSlider.js#L1258-L1269 |
|
141 | ColorlibHQ/AdminLTE | bower_components/ion.rangeSlider/js/ion.rangeSlider.js | function () {
if (!this.coords.w_rs) {
return;
}
this.labels.p_min = this.labels.w_min / this.coords.w_rs * 100;
this.labels.p_max = this.labels.w_max / this.coords.w_rs * 100;
} | javascript | function () {
if (!this.coords.w_rs) {
return;
}
this.labels.p_min = this.labels.w_min / this.coords.w_rs * 100;
this.labels.p_max = this.labels.w_max / this.coords.w_rs * 100;
} | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"coords",
".",
"w_rs",
")",
"{",
"return",
";",
"}",
"this",
".",
"labels",
".",
"p_min",
"=",
"this",
".",
"labels",
".",
"w_min",
"/",
"this",
".",
"coords",
".",
"w_rs",
"*",
"100",
";",
"this",
".",
"labels",
".",
"p_max",
"=",
"this",
".",
"labels",
".",
"w_max",
"/",
"this",
".",
"coords",
".",
"w_rs",
"*",
"100",
";",
"}"
] | Measure Min and Max labels width in percent | [
"Measure",
"Min",
"and",
"Max",
"labels",
"width",
"in",
"percent"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/ion.rangeSlider/js/ion.rangeSlider.js#L1274-L1281 |
|
142 | ColorlibHQ/AdminLTE | bower_components/ion.rangeSlider/js/ion.rangeSlider.js | function () {
if (!this.coords.w_rs || this.options.hide_from_to) {
return;
}
if (this.options.type === "single") {
this.labels.w_single = this.$cache.single.outerWidth(false);
this.labels.p_single_fake = this.labels.w_single / this.coords.w_rs * 100;
this.labels.p_single_left = this.coords.p_single_fake + (this.coords.p_handle / 2) - (this.labels.p_single_fake / 2);
this.labels.p_single_left = this.checkEdges(this.labels.p_single_left, this.labels.p_single_fake);
} else {
this.labels.w_from = this.$cache.from.outerWidth(false);
this.labels.p_from_fake = this.labels.w_from / this.coords.w_rs * 100;
this.labels.p_from_left = this.coords.p_from_fake + (this.coords.p_handle / 2) - (this.labels.p_from_fake / 2);
this.labels.p_from_left = this.toFixed(this.labels.p_from_left);
this.labels.p_from_left = this.checkEdges(this.labels.p_from_left, this.labels.p_from_fake);
this.labels.w_to = this.$cache.to.outerWidth(false);
this.labels.p_to_fake = this.labels.w_to / this.coords.w_rs * 100;
this.labels.p_to_left = this.coords.p_to_fake + (this.coords.p_handle / 2) - (this.labels.p_to_fake / 2);
this.labels.p_to_left = this.toFixed(this.labels.p_to_left);
this.labels.p_to_left = this.checkEdges(this.labels.p_to_left, this.labels.p_to_fake);
this.labels.w_single = this.$cache.single.outerWidth(false);
this.labels.p_single_fake = this.labels.w_single / this.coords.w_rs * 100;
this.labels.p_single_left = ((this.labels.p_from_left + this.labels.p_to_left + this.labels.p_to_fake) / 2) - (this.labels.p_single_fake / 2);
this.labels.p_single_left = this.toFixed(this.labels.p_single_left);
this.labels.p_single_left = this.checkEdges(this.labels.p_single_left, this.labels.p_single_fake);
}
} | javascript | function () {
if (!this.coords.w_rs || this.options.hide_from_to) {
return;
}
if (this.options.type === "single") {
this.labels.w_single = this.$cache.single.outerWidth(false);
this.labels.p_single_fake = this.labels.w_single / this.coords.w_rs * 100;
this.labels.p_single_left = this.coords.p_single_fake + (this.coords.p_handle / 2) - (this.labels.p_single_fake / 2);
this.labels.p_single_left = this.checkEdges(this.labels.p_single_left, this.labels.p_single_fake);
} else {
this.labels.w_from = this.$cache.from.outerWidth(false);
this.labels.p_from_fake = this.labels.w_from / this.coords.w_rs * 100;
this.labels.p_from_left = this.coords.p_from_fake + (this.coords.p_handle / 2) - (this.labels.p_from_fake / 2);
this.labels.p_from_left = this.toFixed(this.labels.p_from_left);
this.labels.p_from_left = this.checkEdges(this.labels.p_from_left, this.labels.p_from_fake);
this.labels.w_to = this.$cache.to.outerWidth(false);
this.labels.p_to_fake = this.labels.w_to / this.coords.w_rs * 100;
this.labels.p_to_left = this.coords.p_to_fake + (this.coords.p_handle / 2) - (this.labels.p_to_fake / 2);
this.labels.p_to_left = this.toFixed(this.labels.p_to_left);
this.labels.p_to_left = this.checkEdges(this.labels.p_to_left, this.labels.p_to_fake);
this.labels.w_single = this.$cache.single.outerWidth(false);
this.labels.p_single_fake = this.labels.w_single / this.coords.w_rs * 100;
this.labels.p_single_left = ((this.labels.p_from_left + this.labels.p_to_left + this.labels.p_to_fake) / 2) - (this.labels.p_single_fake / 2);
this.labels.p_single_left = this.toFixed(this.labels.p_single_left);
this.labels.p_single_left = this.checkEdges(this.labels.p_single_left, this.labels.p_single_fake);
}
} | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"coords",
".",
"w_rs",
"||",
"this",
".",
"options",
".",
"hide_from_to",
")",
"{",
"return",
";",
"}",
"if",
"(",
"this",
".",
"options",
".",
"type",
"===",
"\"single\"",
")",
"{",
"this",
".",
"labels",
".",
"w_single",
"=",
"this",
".",
"$cache",
".",
"single",
".",
"outerWidth",
"(",
"false",
")",
";",
"this",
".",
"labels",
".",
"p_single_fake",
"=",
"this",
".",
"labels",
".",
"w_single",
"/",
"this",
".",
"coords",
".",
"w_rs",
"*",
"100",
";",
"this",
".",
"labels",
".",
"p_single_left",
"=",
"this",
".",
"coords",
".",
"p_single_fake",
"+",
"(",
"this",
".",
"coords",
".",
"p_handle",
"/",
"2",
")",
"-",
"(",
"this",
".",
"labels",
".",
"p_single_fake",
"/",
"2",
")",
";",
"this",
".",
"labels",
".",
"p_single_left",
"=",
"this",
".",
"checkEdges",
"(",
"this",
".",
"labels",
".",
"p_single_left",
",",
"this",
".",
"labels",
".",
"p_single_fake",
")",
";",
"}",
"else",
"{",
"this",
".",
"labels",
".",
"w_from",
"=",
"this",
".",
"$cache",
".",
"from",
".",
"outerWidth",
"(",
"false",
")",
";",
"this",
".",
"labels",
".",
"p_from_fake",
"=",
"this",
".",
"labels",
".",
"w_from",
"/",
"this",
".",
"coords",
".",
"w_rs",
"*",
"100",
";",
"this",
".",
"labels",
".",
"p_from_left",
"=",
"this",
".",
"coords",
".",
"p_from_fake",
"+",
"(",
"this",
".",
"coords",
".",
"p_handle",
"/",
"2",
")",
"-",
"(",
"this",
".",
"labels",
".",
"p_from_fake",
"/",
"2",
")",
";",
"this",
".",
"labels",
".",
"p_from_left",
"=",
"this",
".",
"toFixed",
"(",
"this",
".",
"labels",
".",
"p_from_left",
")",
";",
"this",
".",
"labels",
".",
"p_from_left",
"=",
"this",
".",
"checkEdges",
"(",
"this",
".",
"labels",
".",
"p_from_left",
",",
"this",
".",
"labels",
".",
"p_from_fake",
")",
";",
"this",
".",
"labels",
".",
"w_to",
"=",
"this",
".",
"$cache",
".",
"to",
".",
"outerWidth",
"(",
"false",
")",
";",
"this",
".",
"labels",
".",
"p_to_fake",
"=",
"this",
".",
"labels",
".",
"w_to",
"/",
"this",
".",
"coords",
".",
"w_rs",
"*",
"100",
";",
"this",
".",
"labels",
".",
"p_to_left",
"=",
"this",
".",
"coords",
".",
"p_to_fake",
"+",
"(",
"this",
".",
"coords",
".",
"p_handle",
"/",
"2",
")",
"-",
"(",
"this",
".",
"labels",
".",
"p_to_fake",
"/",
"2",
")",
";",
"this",
".",
"labels",
".",
"p_to_left",
"=",
"this",
".",
"toFixed",
"(",
"this",
".",
"labels",
".",
"p_to_left",
")",
";",
"this",
".",
"labels",
".",
"p_to_left",
"=",
"this",
".",
"checkEdges",
"(",
"this",
".",
"labels",
".",
"p_to_left",
",",
"this",
".",
"labels",
".",
"p_to_fake",
")",
";",
"this",
".",
"labels",
".",
"w_single",
"=",
"this",
".",
"$cache",
".",
"single",
".",
"outerWidth",
"(",
"false",
")",
";",
"this",
".",
"labels",
".",
"p_single_fake",
"=",
"this",
".",
"labels",
".",
"w_single",
"/",
"this",
".",
"coords",
".",
"w_rs",
"*",
"100",
";",
"this",
".",
"labels",
".",
"p_single_left",
"=",
"(",
"(",
"this",
".",
"labels",
".",
"p_from_left",
"+",
"this",
".",
"labels",
".",
"p_to_left",
"+",
"this",
".",
"labels",
".",
"p_to_fake",
")",
"/",
"2",
")",
"-",
"(",
"this",
".",
"labels",
".",
"p_single_fake",
"/",
"2",
")",
";",
"this",
".",
"labels",
".",
"p_single_left",
"=",
"this",
".",
"toFixed",
"(",
"this",
".",
"labels",
".",
"p_single_left",
")",
";",
"this",
".",
"labels",
".",
"p_single_left",
"=",
"this",
".",
"checkEdges",
"(",
"this",
".",
"labels",
".",
"p_single_left",
",",
"this",
".",
"labels",
".",
"p_single_fake",
")",
";",
"}",
"}"
] | Measure labels width and X in percent | [
"Measure",
"labels",
"width",
"and",
"X",
"in",
"percent"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/ion.rangeSlider/js/ion.rangeSlider.js#L1286-L1319 |
|
143 | ColorlibHQ/AdminLTE | bower_components/ion.rangeSlider/js/ion.rangeSlider.js | function () {
if (this.options.type === "single") {
if (this.options.values.length) {
this.$cache.input.prop("value", this.result.from_value);
} else {
this.$cache.input.prop("value", this.result.from);
}
this.$cache.input.data("from", this.result.from);
} else {
if (this.options.values.length) {
this.$cache.input.prop("value", this.result.from_value + this.options.input_values_separator + this.result.to_value);
} else {
this.$cache.input.prop("value", this.result.from + this.options.input_values_separator + this.result.to);
}
this.$cache.input.data("from", this.result.from);
this.$cache.input.data("to", this.result.to);
}
} | javascript | function () {
if (this.options.type === "single") {
if (this.options.values.length) {
this.$cache.input.prop("value", this.result.from_value);
} else {
this.$cache.input.prop("value", this.result.from);
}
this.$cache.input.data("from", this.result.from);
} else {
if (this.options.values.length) {
this.$cache.input.prop("value", this.result.from_value + this.options.input_values_separator + this.result.to_value);
} else {
this.$cache.input.prop("value", this.result.from + this.options.input_values_separator + this.result.to);
}
this.$cache.input.data("from", this.result.from);
this.$cache.input.data("to", this.result.to);
}
} | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"options",
".",
"type",
"===",
"\"single\"",
")",
"{",
"if",
"(",
"this",
".",
"options",
".",
"values",
".",
"length",
")",
"{",
"this",
".",
"$cache",
".",
"input",
".",
"prop",
"(",
"\"value\"",
",",
"this",
".",
"result",
".",
"from_value",
")",
";",
"}",
"else",
"{",
"this",
".",
"$cache",
".",
"input",
".",
"prop",
"(",
"\"value\"",
",",
"this",
".",
"result",
".",
"from",
")",
";",
"}",
"this",
".",
"$cache",
".",
"input",
".",
"data",
"(",
"\"from\"",
",",
"this",
".",
"result",
".",
"from",
")",
";",
"}",
"else",
"{",
"if",
"(",
"this",
".",
"options",
".",
"values",
".",
"length",
")",
"{",
"this",
".",
"$cache",
".",
"input",
".",
"prop",
"(",
"\"value\"",
",",
"this",
".",
"result",
".",
"from_value",
"+",
"this",
".",
"options",
".",
"input_values_separator",
"+",
"this",
".",
"result",
".",
"to_value",
")",
";",
"}",
"else",
"{",
"this",
".",
"$cache",
".",
"input",
".",
"prop",
"(",
"\"value\"",
",",
"this",
".",
"result",
".",
"from",
"+",
"this",
".",
"options",
".",
"input_values_separator",
"+",
"this",
".",
"result",
".",
"to",
")",
";",
"}",
"this",
".",
"$cache",
".",
"input",
".",
"data",
"(",
"\"from\"",
",",
"this",
".",
"result",
".",
"from",
")",
";",
"this",
".",
"$cache",
".",
"input",
".",
"data",
"(",
"\"to\"",
",",
"this",
".",
"result",
".",
"to",
")",
";",
"}",
"}"
] | Write values to input element | [
"Write",
"values",
"to",
"input",
"element"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/ion.rangeSlider/js/ion.rangeSlider.js#L1649-L1666 |
|
144 | ColorlibHQ/AdminLTE | bower_components/ion.rangeSlider/js/ion.rangeSlider.js | function (value, no_min) {
var diapason = this.options.max - this.options.min,
one_percent = diapason / 100,
val, percent;
if (!diapason) {
this.no_diapason = true;
return 0;
}
if (no_min) {
val = value;
} else {
val = value - this.options.min;
}
percent = val / one_percent;
return this.toFixed(percent);
} | javascript | function (value, no_min) {
var diapason = this.options.max - this.options.min,
one_percent = diapason / 100,
val, percent;
if (!diapason) {
this.no_diapason = true;
return 0;
}
if (no_min) {
val = value;
} else {
val = value - this.options.min;
}
percent = val / one_percent;
return this.toFixed(percent);
} | [
"function",
"(",
"value",
",",
"no_min",
")",
"{",
"var",
"diapason",
"=",
"this",
".",
"options",
".",
"max",
"-",
"this",
".",
"options",
".",
"min",
",",
"one_percent",
"=",
"diapason",
"/",
"100",
",",
"val",
",",
"percent",
";",
"if",
"(",
"!",
"diapason",
")",
"{",
"this",
".",
"no_diapason",
"=",
"true",
";",
"return",
"0",
";",
"}",
"if",
"(",
"no_min",
")",
"{",
"val",
"=",
"value",
";",
"}",
"else",
"{",
"val",
"=",
"value",
"-",
"this",
".",
"options",
".",
"min",
";",
"}",
"percent",
"=",
"val",
"/",
"one_percent",
";",
"return",
"this",
".",
"toFixed",
"(",
"percent",
")",
";",
"}"
] | Convert real value to percent
@param value {Number} X in real
@param no_min {boolean=} don't use min value
@returns {Number} X in percent | [
"Convert",
"real",
"value",
"to",
"percent"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/ion.rangeSlider/js/ion.rangeSlider.js#L1743-L1762 |
|
145 | ColorlibHQ/AdminLTE | bower_components/ion.rangeSlider/js/ion.rangeSlider.js | function (percent) {
var min = this.options.min,
max = this.options.max,
min_decimals = min.toString().split(".")[1],
max_decimals = max.toString().split(".")[1],
min_length, max_length,
avg_decimals = 0,
abs = 0;
if (percent === 0) {
return this.options.min;
}
if (percent === 100) {
return this.options.max;
}
if (min_decimals) {
min_length = min_decimals.length;
avg_decimals = min_length;
}
if (max_decimals) {
max_length = max_decimals.length;
avg_decimals = max_length;
}
if (min_length && max_length) {
avg_decimals = (min_length >= max_length) ? min_length : max_length;
}
if (min < 0) {
abs = Math.abs(min);
min = +(min + abs).toFixed(avg_decimals);
max = +(max + abs).toFixed(avg_decimals);
}
var number = ((max - min) / 100 * percent) + min,
string = this.options.step.toString().split(".")[1],
result;
if (string) {
number = +number.toFixed(string.length);
} else {
number = number / this.options.step;
number = number * this.options.step;
number = +number.toFixed(0);
}
if (abs) {
number -= abs;
}
if (string) {
result = +number.toFixed(string.length);
} else {
result = this.toFixed(number);
}
if (result < this.options.min) {
result = this.options.min;
} else if (result > this.options.max) {
result = this.options.max;
}
return result;
} | javascript | function (percent) {
var min = this.options.min,
max = this.options.max,
min_decimals = min.toString().split(".")[1],
max_decimals = max.toString().split(".")[1],
min_length, max_length,
avg_decimals = 0,
abs = 0;
if (percent === 0) {
return this.options.min;
}
if (percent === 100) {
return this.options.max;
}
if (min_decimals) {
min_length = min_decimals.length;
avg_decimals = min_length;
}
if (max_decimals) {
max_length = max_decimals.length;
avg_decimals = max_length;
}
if (min_length && max_length) {
avg_decimals = (min_length >= max_length) ? min_length : max_length;
}
if (min < 0) {
abs = Math.abs(min);
min = +(min + abs).toFixed(avg_decimals);
max = +(max + abs).toFixed(avg_decimals);
}
var number = ((max - min) / 100 * percent) + min,
string = this.options.step.toString().split(".")[1],
result;
if (string) {
number = +number.toFixed(string.length);
} else {
number = number / this.options.step;
number = number * this.options.step;
number = +number.toFixed(0);
}
if (abs) {
number -= abs;
}
if (string) {
result = +number.toFixed(string.length);
} else {
result = this.toFixed(number);
}
if (result < this.options.min) {
result = this.options.min;
} else if (result > this.options.max) {
result = this.options.max;
}
return result;
} | [
"function",
"(",
"percent",
")",
"{",
"var",
"min",
"=",
"this",
".",
"options",
".",
"min",
",",
"max",
"=",
"this",
".",
"options",
".",
"max",
",",
"min_decimals",
"=",
"min",
".",
"toString",
"(",
")",
".",
"split",
"(",
"\".\"",
")",
"[",
"1",
"]",
",",
"max_decimals",
"=",
"max",
".",
"toString",
"(",
")",
".",
"split",
"(",
"\".\"",
")",
"[",
"1",
"]",
",",
"min_length",
",",
"max_length",
",",
"avg_decimals",
"=",
"0",
",",
"abs",
"=",
"0",
";",
"if",
"(",
"percent",
"===",
"0",
")",
"{",
"return",
"this",
".",
"options",
".",
"min",
";",
"}",
"if",
"(",
"percent",
"===",
"100",
")",
"{",
"return",
"this",
".",
"options",
".",
"max",
";",
"}",
"if",
"(",
"min_decimals",
")",
"{",
"min_length",
"=",
"min_decimals",
".",
"length",
";",
"avg_decimals",
"=",
"min_length",
";",
"}",
"if",
"(",
"max_decimals",
")",
"{",
"max_length",
"=",
"max_decimals",
".",
"length",
";",
"avg_decimals",
"=",
"max_length",
";",
"}",
"if",
"(",
"min_length",
"&&",
"max_length",
")",
"{",
"avg_decimals",
"=",
"(",
"min_length",
">=",
"max_length",
")",
"?",
"min_length",
":",
"max_length",
";",
"}",
"if",
"(",
"min",
"<",
"0",
")",
"{",
"abs",
"=",
"Math",
".",
"abs",
"(",
"min",
")",
";",
"min",
"=",
"+",
"(",
"min",
"+",
"abs",
")",
".",
"toFixed",
"(",
"avg_decimals",
")",
";",
"max",
"=",
"+",
"(",
"max",
"+",
"abs",
")",
".",
"toFixed",
"(",
"avg_decimals",
")",
";",
"}",
"var",
"number",
"=",
"(",
"(",
"max",
"-",
"min",
")",
"/",
"100",
"*",
"percent",
")",
"+",
"min",
",",
"string",
"=",
"this",
".",
"options",
".",
"step",
".",
"toString",
"(",
")",
".",
"split",
"(",
"\".\"",
")",
"[",
"1",
"]",
",",
"result",
";",
"if",
"(",
"string",
")",
"{",
"number",
"=",
"+",
"number",
".",
"toFixed",
"(",
"string",
".",
"length",
")",
";",
"}",
"else",
"{",
"number",
"=",
"number",
"/",
"this",
".",
"options",
".",
"step",
";",
"number",
"=",
"number",
"*",
"this",
".",
"options",
".",
"step",
";",
"number",
"=",
"+",
"number",
".",
"toFixed",
"(",
"0",
")",
";",
"}",
"if",
"(",
"abs",
")",
"{",
"number",
"-=",
"abs",
";",
"}",
"if",
"(",
"string",
")",
"{",
"result",
"=",
"+",
"number",
".",
"toFixed",
"(",
"string",
".",
"length",
")",
";",
"}",
"else",
"{",
"result",
"=",
"this",
".",
"toFixed",
"(",
"number",
")",
";",
"}",
"if",
"(",
"result",
"<",
"this",
".",
"options",
".",
"min",
")",
"{",
"result",
"=",
"this",
".",
"options",
".",
"min",
";",
"}",
"else",
"if",
"(",
"result",
">",
"this",
".",
"options",
".",
"max",
")",
"{",
"result",
"=",
"this",
".",
"options",
".",
"max",
";",
"}",
"return",
"result",
";",
"}"
] | Convert percent to real values
@param percent {Number} X in percent
@returns {Number} X in real | [
"Convert",
"percent",
"to",
"real",
"values"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/ion.rangeSlider/js/ion.rangeSlider.js#L1770-L1835 |
|
146 | ColorlibHQ/AdminLTE | bower_components/ion.rangeSlider/js/ion.rangeSlider.js | function (percent) {
var rounded = Math.round(percent / this.coords.p_step) * this.coords.p_step;
if (rounded > 100) {
rounded = 100;
}
if (percent === 100) {
rounded = 100;
}
return this.toFixed(rounded);
} | javascript | function (percent) {
var rounded = Math.round(percent / this.coords.p_step) * this.coords.p_step;
if (rounded > 100) {
rounded = 100;
}
if (percent === 100) {
rounded = 100;
}
return this.toFixed(rounded);
} | [
"function",
"(",
"percent",
")",
"{",
"var",
"rounded",
"=",
"Math",
".",
"round",
"(",
"percent",
"/",
"this",
".",
"coords",
".",
"p_step",
")",
"*",
"this",
".",
"coords",
".",
"p_step",
";",
"if",
"(",
"rounded",
">",
"100",
")",
"{",
"rounded",
"=",
"100",
";",
"}",
"if",
"(",
"percent",
"===",
"100",
")",
"{",
"rounded",
"=",
"100",
";",
"}",
"return",
"this",
".",
"toFixed",
"(",
"rounded",
")",
";",
"}"
] | Round percent value with step
@param percent {Number}
@returns percent {Number} rounded | [
"Round",
"percent",
"value",
"with",
"step"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/ion.rangeSlider/js/ion.rangeSlider.js#L1843-L1854 |
|
147 | ColorlibHQ/AdminLTE | plugins/timepicker/bootstrap-timepicker.js | function (segment, step) {
if (segment % step === 0) {
return segment;
}
if (Math.round((segment % step) / step)) {
return (segment + (step - segment % step)) % 60;
} else {
return segment - segment % step;
}
} | javascript | function (segment, step) {
if (segment % step === 0) {
return segment;
}
if (Math.round((segment % step) / step)) {
return (segment + (step - segment % step)) % 60;
} else {
return segment - segment % step;
}
} | [
"function",
"(",
"segment",
",",
"step",
")",
"{",
"if",
"(",
"segment",
"%",
"step",
"===",
"0",
")",
"{",
"return",
"segment",
";",
"}",
"if",
"(",
"Math",
".",
"round",
"(",
"(",
"segment",
"%",
"step",
")",
"/",
"step",
")",
")",
"{",
"return",
"(",
"segment",
"+",
"(",
"step",
"-",
"segment",
"%",
"step",
")",
")",
"%",
"60",
";",
"}",
"else",
"{",
"return",
"segment",
"-",
"segment",
"%",
"step",
";",
"}",
"}"
] | Given a segment value like 43, will round and snap the segment
to the nearest "step", like 45 if step is 15. Segment will
"overflow" to 0 if it's larger than 59 or would otherwise
round up to 60. | [
"Given",
"a",
"segment",
"value",
"like",
"43",
"will",
"round",
"and",
"snap",
"the",
"segment",
"to",
"the",
"nearest",
"step",
"like",
"45",
"if",
"step",
"is",
"15",
".",
"Segment",
"will",
"overflow",
"to",
"0",
"if",
"it",
"s",
"larger",
"than",
"59",
"or",
"would",
"otherwise",
"round",
"up",
"to",
"60",
"."
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/timepicker/bootstrap-timepicker.js#L647-L656 |
|
148 | ColorlibHQ/AdminLTE | plugins/timepicker/bootstrap-timepicker.js | function() {
if (this.isInline) {
return;
}
var widgetWidth = this.$widget.outerWidth(), widgetHeight = this.$widget.outerHeight(), visualPadding = 10, windowWidth =
$(window).width(), windowHeight = $(window).height(), scrollTop = $(window).scrollTop();
var zIndex = parseInt(this.$element.parents().filter(function() { return $(this).css('z-index') !== 'auto'; }).first().css('z-index'), 10) + 10;
var offset = this.component ? this.component.parent().offset() : this.$element.offset();
var height = this.component ? this.component.outerHeight(true) : this.$element.outerHeight(false);
var width = this.component ? this.component.outerWidth(true) : this.$element.outerWidth(false);
var left = offset.left, top = offset.top;
this.$widget.removeClass('timepicker-orient-top timepicker-orient-bottom timepicker-orient-right timepicker-orient-left');
if (this.orientation.x !== 'auto') {
this.$widget.addClass('timepicker-orient-' + this.orientation.x);
if (this.orientation.x === 'right') {
left -= widgetWidth - width;
}
} else{
// auto x orientation is best-placement: if it crosses a window edge, fudge it sideways
// Default to left
this.$widget.addClass('timepicker-orient-left');
if (offset.left < 0) {
left -= offset.left - visualPadding;
} else if (offset.left + widgetWidth > windowWidth) {
left = windowWidth - widgetWidth - visualPadding;
}
}
// auto y orientation is best-situation: top or bottom, no fudging, decision based on which shows more of the widget
var yorient = this.orientation.y, topOverflow, bottomOverflow;
if (yorient === 'auto') {
topOverflow = -scrollTop + offset.top - widgetHeight;
bottomOverflow = scrollTop + windowHeight - (offset.top + height + widgetHeight);
if (Math.max(topOverflow, bottomOverflow) === bottomOverflow) {
yorient = 'top';
} else {
yorient = 'bottom';
}
}
this.$widget.addClass('timepicker-orient-' + yorient);
if (yorient === 'top'){
top += height;
} else{
top -= widgetHeight + parseInt(this.$widget.css('padding-top'), 10);
}
this.$widget.css({
top : top,
left : left,
zIndex : zIndex
});
} | javascript | function() {
if (this.isInline) {
return;
}
var widgetWidth = this.$widget.outerWidth(), widgetHeight = this.$widget.outerHeight(), visualPadding = 10, windowWidth =
$(window).width(), windowHeight = $(window).height(), scrollTop = $(window).scrollTop();
var zIndex = parseInt(this.$element.parents().filter(function() { return $(this).css('z-index') !== 'auto'; }).first().css('z-index'), 10) + 10;
var offset = this.component ? this.component.parent().offset() : this.$element.offset();
var height = this.component ? this.component.outerHeight(true) : this.$element.outerHeight(false);
var width = this.component ? this.component.outerWidth(true) : this.$element.outerWidth(false);
var left = offset.left, top = offset.top;
this.$widget.removeClass('timepicker-orient-top timepicker-orient-bottom timepicker-orient-right timepicker-orient-left');
if (this.orientation.x !== 'auto') {
this.$widget.addClass('timepicker-orient-' + this.orientation.x);
if (this.orientation.x === 'right') {
left -= widgetWidth - width;
}
} else{
// auto x orientation is best-placement: if it crosses a window edge, fudge it sideways
// Default to left
this.$widget.addClass('timepicker-orient-left');
if (offset.left < 0) {
left -= offset.left - visualPadding;
} else if (offset.left + widgetWidth > windowWidth) {
left = windowWidth - widgetWidth - visualPadding;
}
}
// auto y orientation is best-situation: top or bottom, no fudging, decision based on which shows more of the widget
var yorient = this.orientation.y, topOverflow, bottomOverflow;
if (yorient === 'auto') {
topOverflow = -scrollTop + offset.top - widgetHeight;
bottomOverflow = scrollTop + windowHeight - (offset.top + height + widgetHeight);
if (Math.max(topOverflow, bottomOverflow) === bottomOverflow) {
yorient = 'top';
} else {
yorient = 'bottom';
}
}
this.$widget.addClass('timepicker-orient-' + yorient);
if (yorient === 'top'){
top += height;
} else{
top -= widgetHeight + parseInt(this.$widget.css('padding-top'), 10);
}
this.$widget.css({
top : top,
left : left,
zIndex : zIndex
});
} | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"isInline",
")",
"{",
"return",
";",
"}",
"var",
"widgetWidth",
"=",
"this",
".",
"$widget",
".",
"outerWidth",
"(",
")",
",",
"widgetHeight",
"=",
"this",
".",
"$widget",
".",
"outerHeight",
"(",
")",
",",
"visualPadding",
"=",
"10",
",",
"windowWidth",
"=",
"$",
"(",
"window",
")",
".",
"width",
"(",
")",
",",
"windowHeight",
"=",
"$",
"(",
"window",
")",
".",
"height",
"(",
")",
",",
"scrollTop",
"=",
"$",
"(",
"window",
")",
".",
"scrollTop",
"(",
")",
";",
"var",
"zIndex",
"=",
"parseInt",
"(",
"this",
".",
"$element",
".",
"parents",
"(",
")",
".",
"filter",
"(",
"function",
"(",
")",
"{",
"return",
"$",
"(",
"this",
")",
".",
"css",
"(",
"'z-index'",
")",
"!==",
"'auto'",
";",
"}",
")",
".",
"first",
"(",
")",
".",
"css",
"(",
"'z-index'",
")",
",",
"10",
")",
"+",
"10",
";",
"var",
"offset",
"=",
"this",
".",
"component",
"?",
"this",
".",
"component",
".",
"parent",
"(",
")",
".",
"offset",
"(",
")",
":",
"this",
".",
"$element",
".",
"offset",
"(",
")",
";",
"var",
"height",
"=",
"this",
".",
"component",
"?",
"this",
".",
"component",
".",
"outerHeight",
"(",
"true",
")",
":",
"this",
".",
"$element",
".",
"outerHeight",
"(",
"false",
")",
";",
"var",
"width",
"=",
"this",
".",
"component",
"?",
"this",
".",
"component",
".",
"outerWidth",
"(",
"true",
")",
":",
"this",
".",
"$element",
".",
"outerWidth",
"(",
"false",
")",
";",
"var",
"left",
"=",
"offset",
".",
"left",
",",
"top",
"=",
"offset",
".",
"top",
";",
"this",
".",
"$widget",
".",
"removeClass",
"(",
"'timepicker-orient-top timepicker-orient-bottom timepicker-orient-right timepicker-orient-left'",
")",
";",
"if",
"(",
"this",
".",
"orientation",
".",
"x",
"!==",
"'auto'",
")",
"{",
"this",
".",
"$widget",
".",
"addClass",
"(",
"'timepicker-orient-'",
"+",
"this",
".",
"orientation",
".",
"x",
")",
";",
"if",
"(",
"this",
".",
"orientation",
".",
"x",
"===",
"'right'",
")",
"{",
"left",
"-=",
"widgetWidth",
"-",
"width",
";",
"}",
"}",
"else",
"{",
"// auto x orientation is best-placement: if it crosses a window edge, fudge it sideways",
"// Default to left",
"this",
".",
"$widget",
".",
"addClass",
"(",
"'timepicker-orient-left'",
")",
";",
"if",
"(",
"offset",
".",
"left",
"<",
"0",
")",
"{",
"left",
"-=",
"offset",
".",
"left",
"-",
"visualPadding",
";",
"}",
"else",
"if",
"(",
"offset",
".",
"left",
"+",
"widgetWidth",
">",
"windowWidth",
")",
"{",
"left",
"=",
"windowWidth",
"-",
"widgetWidth",
"-",
"visualPadding",
";",
"}",
"}",
"// auto y orientation is best-situation: top or bottom, no fudging, decision based on which shows more of the widget",
"var",
"yorient",
"=",
"this",
".",
"orientation",
".",
"y",
",",
"topOverflow",
",",
"bottomOverflow",
";",
"if",
"(",
"yorient",
"===",
"'auto'",
")",
"{",
"topOverflow",
"=",
"-",
"scrollTop",
"+",
"offset",
".",
"top",
"-",
"widgetHeight",
";",
"bottomOverflow",
"=",
"scrollTop",
"+",
"windowHeight",
"-",
"(",
"offset",
".",
"top",
"+",
"height",
"+",
"widgetHeight",
")",
";",
"if",
"(",
"Math",
".",
"max",
"(",
"topOverflow",
",",
"bottomOverflow",
")",
"===",
"bottomOverflow",
")",
"{",
"yorient",
"=",
"'top'",
";",
"}",
"else",
"{",
"yorient",
"=",
"'bottom'",
";",
"}",
"}",
"this",
".",
"$widget",
".",
"addClass",
"(",
"'timepicker-orient-'",
"+",
"yorient",
")",
";",
"if",
"(",
"yorient",
"===",
"'top'",
")",
"{",
"top",
"+=",
"height",
";",
"}",
"else",
"{",
"top",
"-=",
"widgetHeight",
"+",
"parseInt",
"(",
"this",
".",
"$widget",
".",
"css",
"(",
"'padding-top'",
")",
",",
"10",
")",
";",
"}",
"this",
".",
"$widget",
".",
"css",
"(",
"{",
"top",
":",
"top",
",",
"left",
":",
"left",
",",
"zIndex",
":",
"zIndex",
"}",
")",
";",
"}"
] | This method was adapted from bootstrap-datepicker. | [
"This",
"method",
"was",
"adapted",
"from",
"bootstrap",
"-",
"datepicker",
"."
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/plugins/timepicker/bootstrap-timepicker.js#L659-L712 |
|
149 | ColorlibHQ/AdminLTE | bower_components/chart.js/Chart.js | function(element,dimension)
{
if (element['offset'+dimension])
{
return element['offset'+dimension];
}
else
{
return document.defaultView.getComputedStyle(element).getPropertyValue(dimension);
}
} | javascript | function(element,dimension)
{
if (element['offset'+dimension])
{
return element['offset'+dimension];
}
else
{
return document.defaultView.getComputedStyle(element).getPropertyValue(dimension);
}
} | [
"function",
"(",
"element",
",",
"dimension",
")",
"{",
"if",
"(",
"element",
"[",
"'offset'",
"+",
"dimension",
"]",
")",
"{",
"return",
"element",
"[",
"'offset'",
"+",
"dimension",
"]",
";",
"}",
"else",
"{",
"return",
"document",
".",
"defaultView",
".",
"getComputedStyle",
"(",
"element",
")",
".",
"getPropertyValue",
"(",
"dimension",
")",
";",
"}",
"}"
] | Variables global to the chart | [
"Variables",
"global",
"to",
"the",
"chart"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/chart.js/Chart.js#L28-L38 |
|
150 | ColorlibHQ/AdminLTE | bower_components/chart.js/Chart.js | function(){
// First we need the width of the yLabels, assuming the xLabels aren't rotated
// To do that we need the base line at the top and base of the chart, assuming there is no x label rotation
this.startPoint = (this.display) ? this.fontSize : 0;
this.endPoint = (this.display) ? this.height - (this.fontSize * 1.5) - 5 : this.height; // -5 to pad labels
// Apply padding settings to the start and end point.
this.startPoint += this.padding;
this.endPoint -= this.padding;
// Cache the starting height, so can determine if we need to recalculate the scale yAxis
var cachedHeight = this.endPoint - this.startPoint,
cachedYLabelWidth;
// Build the current yLabels so we have an idea of what size they'll be to start
/*
* This sets what is returned from calculateScaleRange as static properties of this class:
*
this.steps;
this.stepValue;
this.min;
this.max;
*
*/
this.calculateYRange(cachedHeight);
// With these properties set we can now build the array of yLabels
// and also the width of the largest yLabel
this.buildYLabels();
this.calculateXLabelRotation();
while((cachedHeight > this.endPoint - this.startPoint)){
cachedHeight = this.endPoint - this.startPoint;
cachedYLabelWidth = this.yLabelWidth;
this.calculateYRange(cachedHeight);
this.buildYLabels();
// Only go through the xLabel loop again if the yLabel width has changed
if (cachedYLabelWidth < this.yLabelWidth){
this.calculateXLabelRotation();
}
}
} | javascript | function(){
// First we need the width of the yLabels, assuming the xLabels aren't rotated
// To do that we need the base line at the top and base of the chart, assuming there is no x label rotation
this.startPoint = (this.display) ? this.fontSize : 0;
this.endPoint = (this.display) ? this.height - (this.fontSize * 1.5) - 5 : this.height; // -5 to pad labels
// Apply padding settings to the start and end point.
this.startPoint += this.padding;
this.endPoint -= this.padding;
// Cache the starting height, so can determine if we need to recalculate the scale yAxis
var cachedHeight = this.endPoint - this.startPoint,
cachedYLabelWidth;
// Build the current yLabels so we have an idea of what size they'll be to start
/*
* This sets what is returned from calculateScaleRange as static properties of this class:
*
this.steps;
this.stepValue;
this.min;
this.max;
*
*/
this.calculateYRange(cachedHeight);
// With these properties set we can now build the array of yLabels
// and also the width of the largest yLabel
this.buildYLabels();
this.calculateXLabelRotation();
while((cachedHeight > this.endPoint - this.startPoint)){
cachedHeight = this.endPoint - this.startPoint;
cachedYLabelWidth = this.yLabelWidth;
this.calculateYRange(cachedHeight);
this.buildYLabels();
// Only go through the xLabel loop again if the yLabel width has changed
if (cachedYLabelWidth < this.yLabelWidth){
this.calculateXLabelRotation();
}
}
} | [
"function",
"(",
")",
"{",
"// First we need the width of the yLabels, assuming the xLabels aren't rotated",
"// To do that we need the base line at the top and base of the chart, assuming there is no x label rotation",
"this",
".",
"startPoint",
"=",
"(",
"this",
".",
"display",
")",
"?",
"this",
".",
"fontSize",
":",
"0",
";",
"this",
".",
"endPoint",
"=",
"(",
"this",
".",
"display",
")",
"?",
"this",
".",
"height",
"-",
"(",
"this",
".",
"fontSize",
"*",
"1.5",
")",
"-",
"5",
":",
"this",
".",
"height",
";",
"// -5 to pad labels",
"// Apply padding settings to the start and end point.",
"this",
".",
"startPoint",
"+=",
"this",
".",
"padding",
";",
"this",
".",
"endPoint",
"-=",
"this",
".",
"padding",
";",
"// Cache the starting height, so can determine if we need to recalculate the scale yAxis",
"var",
"cachedHeight",
"=",
"this",
".",
"endPoint",
"-",
"this",
".",
"startPoint",
",",
"cachedYLabelWidth",
";",
"// Build the current yLabels so we have an idea of what size they'll be to start",
"/*\n\t\t\t *\tThis sets what is returned from calculateScaleRange as static properties of this class:\n\t\t\t *\n\t\t\t\tthis.steps;\n\t\t\t\tthis.stepValue;\n\t\t\t\tthis.min;\n\t\t\t\tthis.max;\n\t\t\t *\n\t\t\t */",
"this",
".",
"calculateYRange",
"(",
"cachedHeight",
")",
";",
"// With these properties set we can now build the array of yLabels",
"// and also the width of the largest yLabel",
"this",
".",
"buildYLabels",
"(",
")",
";",
"this",
".",
"calculateXLabelRotation",
"(",
")",
";",
"while",
"(",
"(",
"cachedHeight",
">",
"this",
".",
"endPoint",
"-",
"this",
".",
"startPoint",
")",
")",
"{",
"cachedHeight",
"=",
"this",
".",
"endPoint",
"-",
"this",
".",
"startPoint",
";",
"cachedYLabelWidth",
"=",
"this",
".",
"yLabelWidth",
";",
"this",
".",
"calculateYRange",
"(",
"cachedHeight",
")",
";",
"this",
".",
"buildYLabels",
"(",
")",
";",
"// Only go through the xLabel loop again if the yLabel width has changed",
"if",
"(",
"cachedYLabelWidth",
"<",
"this",
".",
"yLabelWidth",
")",
"{",
"this",
".",
"calculateXLabelRotation",
"(",
")",
";",
"}",
"}",
"}"
] | Fitting loop to rotate x Labels and figure out what fits there, and also calculate how many Y steps to use | [
"Fitting",
"loop",
"to",
"rotate",
"x",
"Labels",
"and",
"figure",
"out",
"what",
"fits",
"there",
"and",
"also",
"calculate",
"how",
"many",
"Y",
"steps",
"to",
"use"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/chart.js/Chart.js#L1482-L1528 |
|
151 | ColorlibHQ/AdminLTE | bower_components/jquery-sparkline/src/vcanvas-base.js | function (width, height, canvas) {
// XXX This should probably be a configurable option
var match;
match = this._pxregex.exec(height);
if (match) {
this.pixelHeight = match[1];
} else {
this.pixelHeight = $(canvas).height();
}
match = this._pxregex.exec(width);
if (match) {
this.pixelWidth = match[1];
} else {
this.pixelWidth = $(canvas).width();
}
} | javascript | function (width, height, canvas) {
// XXX This should probably be a configurable option
var match;
match = this._pxregex.exec(height);
if (match) {
this.pixelHeight = match[1];
} else {
this.pixelHeight = $(canvas).height();
}
match = this._pxregex.exec(width);
if (match) {
this.pixelWidth = match[1];
} else {
this.pixelWidth = $(canvas).width();
}
} | [
"function",
"(",
"width",
",",
"height",
",",
"canvas",
")",
"{",
"// XXX This should probably be a configurable option",
"var",
"match",
";",
"match",
"=",
"this",
".",
"_pxregex",
".",
"exec",
"(",
"height",
")",
";",
"if",
"(",
"match",
")",
"{",
"this",
".",
"pixelHeight",
"=",
"match",
"[",
"1",
"]",
";",
"}",
"else",
"{",
"this",
".",
"pixelHeight",
"=",
"$",
"(",
"canvas",
")",
".",
"height",
"(",
")",
";",
"}",
"match",
"=",
"this",
".",
"_pxregex",
".",
"exec",
"(",
"width",
")",
";",
"if",
"(",
"match",
")",
"{",
"this",
".",
"pixelWidth",
"=",
"match",
"[",
"1",
"]",
";",
"}",
"else",
"{",
"this",
".",
"pixelWidth",
"=",
"$",
"(",
"canvas",
")",
".",
"width",
"(",
")",
";",
"}",
"}"
] | Calculate the pixel dimensions of the canvas | [
"Calculate",
"the",
"pixel",
"dimensions",
"of",
"the",
"canvas"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/jquery-sparkline/src/vcanvas-base.js#L79-L94 |
|
152 | ColorlibHQ/AdminLTE | bower_components/jquery-sparkline/src/vcanvas-base.js | function (shapetype, shapeargs) {
var id = shapeCount++;
shapeargs.unshift(id);
return new VShape(this, id, shapetype, shapeargs);
} | javascript | function (shapetype, shapeargs) {
var id = shapeCount++;
shapeargs.unshift(id);
return new VShape(this, id, shapetype, shapeargs);
} | [
"function",
"(",
"shapetype",
",",
"shapeargs",
")",
"{",
"var",
"id",
"=",
"shapeCount",
"++",
";",
"shapeargs",
".",
"unshift",
"(",
"id",
")",
";",
"return",
"new",
"VShape",
"(",
"this",
",",
"id",
",",
"shapetype",
",",
"shapeargs",
")",
";",
"}"
] | Generate a shape object and id for later rendering | [
"Generate",
"a",
"shape",
"object",
"and",
"id",
"for",
"later",
"rendering"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/jquery-sparkline/src/vcanvas-base.js#L99-L103 |
|
153 | ColorlibHQ/AdminLTE | bower_components/moment/src/lib/duration/humanize.js | substituteTimeAgo | function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) {
return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture);
} | javascript | function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) {
return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture);
} | [
"function",
"substituteTimeAgo",
"(",
"string",
",",
"number",
",",
"withoutSuffix",
",",
"isFuture",
",",
"locale",
")",
"{",
"return",
"locale",
".",
"relativeTime",
"(",
"number",
"||",
"1",
",",
"!",
"!",
"withoutSuffix",
",",
"string",
",",
"isFuture",
")",
";",
"}"
] | helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize | [
"helper",
"function",
"for",
"moment",
".",
"fn",
".",
"from",
"moment",
".",
"fn",
".",
"fromNow",
"and",
"moment",
".",
"duration",
".",
"fn",
".",
"humanize"
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/moment/src/lib/duration/humanize.js#L14-L16 |
154 | ColorlibHQ/AdminLTE | bower_components/jquery/src/css.js | finalPropName | function finalPropName( name ) {
var ret = jQuery.cssProps[ name ];
if ( !ret ) {
ret = jQuery.cssProps[ name ] = vendorPropName( name ) || name;
}
return ret;
} | javascript | function finalPropName( name ) {
var ret = jQuery.cssProps[ name ];
if ( !ret ) {
ret = jQuery.cssProps[ name ] = vendorPropName( name ) || name;
}
return ret;
} | [
"function",
"finalPropName",
"(",
"name",
")",
"{",
"var",
"ret",
"=",
"jQuery",
".",
"cssProps",
"[",
"name",
"]",
";",
"if",
"(",
"!",
"ret",
")",
"{",
"ret",
"=",
"jQuery",
".",
"cssProps",
"[",
"name",
"]",
"=",
"vendorPropName",
"(",
"name",
")",
"||",
"name",
";",
"}",
"return",
"ret",
";",
"}"
] | Return a property mapped along what jQuery.cssProps suggests or to a vendor prefixed property. | [
"Return",
"a",
"property",
"mapped",
"along",
"what",
"jQuery",
".",
"cssProps",
"suggests",
"or",
"to",
"a",
"vendor",
"prefixed",
"property",
"."
] | 19113c3cbc19a7afe0cfd3158d647064d2d30661 | https://github.com/ColorlibHQ/AdminLTE/blob/19113c3cbc19a7afe0cfd3158d647064d2d30661/bower_components/jquery/src/css.js#L63-L69 |
155 | NervJS/taro | packages/taro-h5/src/api/interactive/index.js | init | function init (doc) {
if (status === 'ready') return
const taroStyle = doc.createElement('style')
taroStyle.textContent = '@font-face{font-weight:normal;font-style:normal;font-family:"taro";src:url("data:application/x-font-ttf;charset=utf-8;base64, AAEAAAALAIAAAwAwR1NVQrD+s+0AAAE4AAAAQk9TLzJWs0t/AAABfAAAAFZjbWFwqVgGvgAAAeAAAAGGZ2x5Zph7qG0AAANwAAAAdGhlYWQRFoGhAAAA4AAAADZoaGVhCCsD7AAAALwAAAAkaG10eAg0AAAAAAHUAAAADGxvY2EADAA6AAADaAAAAAhtYXhwAQ4AJAAAARgAAAAgbmFtZYrphEEAAAPkAAACVXBvc3S3shtSAAAGPAAAADUAAQAAA+gAAABaA+gAAAAAA+gAAQAAAAAAAAAAAAAAAAAAAAMAAQAAAAEAAADih+FfDzz1AAsD6AAAAADXB57LAAAAANcHnssAAP/sA+gDOgAAAAgAAgAAAAAAAAABAAAAAwAYAAEAAAAAAAIAAAAKAAoAAAD/AAAAAAAAAAEAAAAKAB4ALAABREZMVAAIAAQAAAAAAAAAAQAAAAFsaWdhAAgAAAABAAAAAQAEAAQAAAABAAgAAQAGAAAAAQAAAAAAAQK8AZAABQAIAnoCvAAAAIwCegK8AAAB4AAxAQIAAAIABQMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUGZFZABAAHjqCAPoAAAAWgPoABQAAAABAAAAAAAAA+gAAABkAAAD6AAAAAAABQAAAAMAAAAsAAAABAAAAV4AAQAAAAAAWAADAAEAAAAsAAMACgAAAV4ABAAsAAAABgAEAAEAAgB46gj//wAAAHjqCP//AAAAAAABAAYABgAAAAEAAgAAAQYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAKAAAAAAAAAACAAAAeAAAAHgAAAABAADqCAAA6ggAAAACAAAAAAAAAAwAOgABAAD/7AAyABQAAgAANzMVFB4UKAAAAAABAAAAAAO7AzoAFwAAEy4BPwE+AR8BFjY3ATYWFycWFAcBBiInPQoGBwUHGgzLDCELAh0LHwsNCgr9uQoeCgGzCyEOCw0HCZMJAQoBvgkCCg0LHQv9sQsKAAAAAAAAEgDeAAEAAAAAAAAAHQAAAAEAAAAAAAEABAAdAAEAAAAAAAIABwAhAAEAAAAAAAMABAAoAAEAAAAAAAQABAAsAAEAAAAAAAUACwAwAAEAAAAAAAYABAA7AAEAAAAAAAoAKwA/AAEAAAAAAAsAEwBqAAMAAQQJAAAAOgB9AAMAAQQJAAEACAC3AAMAAQQJAAIADgC/AAMAAQQJAAMACADNAAMAAQQJAAQACADVAAMAAQQJAAUAFgDdAAMAAQQJAAYACADzAAMAAQQJAAoAVgD7AAMAAQQJAAsAJgFRCiAgQ3JlYXRlZCBieSBmb250LWNhcnJpZXIKICB3ZXVpUmVndWxhcndldWl3ZXVpVmVyc2lvbiAxLjB3ZXVpR2VuZXJhdGVkIGJ5IHN2ZzJ0dGYgZnJvbSBGb250ZWxsbyBwcm9qZWN0Lmh0dHA6Ly9mb250ZWxsby5jb20ACgAgACAAQwByAGUAYQB0AGUAZAAgAGIAeQAgAGYAbwBuAHQALQBjAGEAcgByAGkAZQByAAoAIAAgAHcAZQB1AGkAUgBlAGcAdQBsAGEAcgB3AGUAdQBpAHcAZQB1AGkAVgBlAHIAcwBpAG8AbgAgADEALgAwAHcAZQB1AGkARwBlAG4AZQByAGEAdABlAGQAIABiAHkAIABzAHYAZwAyAHQAdABmACAAZgByAG8AbQAgAEYAbwBuAHQAZQBsAGwAbwAgAHAAcgBvAGoAZQBjAHQALgBoAHQAdABwADoALwAvAGYAbwBuAHQAZQBsAGwAbwAuAGMAbwBtAAAAAAIAAAAAAAAACgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwECAQMBBAABeAd1bmlFQTA4AAAAAAA=") format("truetype");}@-webkit-keyframes taroLoading{0%{-webkit-transform:rotate3d(0, 0, 1, 0deg);}100%{-webkit-transform:rotate3d(0, 0, 1, 360deg);transform:rotate3d(0, 0, 1, 360deg);}}@keyframes taroLoading{0%{-webkit-transform:rotate3d(0, 0, 1, 0deg);}100%{-webkit-transform:rotate3d(0, 0, 1, 360deg);transform:rotate3d(0, 0, 1, 360deg);}}.taro-modal__foot:after {content: "";position: absolute;left: 0;top: 0;right: 0;height: 1px;border-top: 1px solid #D5D5D6;color: #D5D5D6;-webkit-transform-origin: 0 0;transform-origin: 0 0;-webkit-transform: scaleY(0.5);transform: scaleY(0.5);} .taro-model__btn:active {background-color: #EEEEEE}.taro-model__btn:not(:first-child):after {content: "";position: absolute;left: 0;top: 0;width: 1px;bottom: 0;border-left: 1px solid #D5D5D6;color: #D5D5D6;-webkit-transform-origin: 0 0;transform-origin: 0 0;-webkit-transform: scaleX(0.5);transform: scaleX(0.5);}.taro-actionsheet__cell:not(:first-child):after {content: "";position: absolute;left: 0;top: 0;right: 0;height: 1px;border-top: 1px solid #e5e5e5;color: #e5e5e5;-webkit-transform-origin: 0 0;transform-origin: 0 0;-webkit-transform: scaleY(0.5);transform: scaleY(0.5);}'
doc.querySelector('head').appendChild(taroStyle)
status = 'ready'
} | javascript | function init (doc) {
if (status === 'ready') return
const taroStyle = doc.createElement('style')
taroStyle.textContent = '@font-face{font-weight:normal;font-style:normal;font-family:"taro";src:url("data:application/x-font-ttf;charset=utf-8;base64, AAEAAAALAIAAAwAwR1NVQrD+s+0AAAE4AAAAQk9TLzJWs0t/AAABfAAAAFZjbWFwqVgGvgAAAeAAAAGGZ2x5Zph7qG0AAANwAAAAdGhlYWQRFoGhAAAA4AAAADZoaGVhCCsD7AAAALwAAAAkaG10eAg0AAAAAAHUAAAADGxvY2EADAA6AAADaAAAAAhtYXhwAQ4AJAAAARgAAAAgbmFtZYrphEEAAAPkAAACVXBvc3S3shtSAAAGPAAAADUAAQAAA+gAAABaA+gAAAAAA+gAAQAAAAAAAAAAAAAAAAAAAAMAAQAAAAEAAADih+FfDzz1AAsD6AAAAADXB57LAAAAANcHnssAAP/sA+gDOgAAAAgAAgAAAAAAAAABAAAAAwAYAAEAAAAAAAIAAAAKAAoAAAD/AAAAAAAAAAEAAAAKAB4ALAABREZMVAAIAAQAAAAAAAAAAQAAAAFsaWdhAAgAAAABAAAAAQAEAAQAAAABAAgAAQAGAAAAAQAAAAAAAQK8AZAABQAIAnoCvAAAAIwCegK8AAAB4AAxAQIAAAIABQMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUGZFZABAAHjqCAPoAAAAWgPoABQAAAABAAAAAAAAA+gAAABkAAAD6AAAAAAABQAAAAMAAAAsAAAABAAAAV4AAQAAAAAAWAADAAEAAAAsAAMACgAAAV4ABAAsAAAABgAEAAEAAgB46gj//wAAAHjqCP//AAAAAAABAAYABgAAAAEAAgAAAQYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAKAAAAAAAAAACAAAAeAAAAHgAAAABAADqCAAA6ggAAAACAAAAAAAAAAwAOgABAAD/7AAyABQAAgAANzMVFB4UKAAAAAABAAAAAAO7AzoAFwAAEy4BPwE+AR8BFjY3ATYWFycWFAcBBiInPQoGBwUHGgzLDCELAh0LHwsNCgr9uQoeCgGzCyEOCw0HCZMJAQoBvgkCCg0LHQv9sQsKAAAAAAAAEgDeAAEAAAAAAAAAHQAAAAEAAAAAAAEABAAdAAEAAAAAAAIABwAhAAEAAAAAAAMABAAoAAEAAAAAAAQABAAsAAEAAAAAAAUACwAwAAEAAAAAAAYABAA7AAEAAAAAAAoAKwA/AAEAAAAAAAsAEwBqAAMAAQQJAAAAOgB9AAMAAQQJAAEACAC3AAMAAQQJAAIADgC/AAMAAQQJAAMACADNAAMAAQQJAAQACADVAAMAAQQJAAUAFgDdAAMAAQQJAAYACADzAAMAAQQJAAoAVgD7AAMAAQQJAAsAJgFRCiAgQ3JlYXRlZCBieSBmb250LWNhcnJpZXIKICB3ZXVpUmVndWxhcndldWl3ZXVpVmVyc2lvbiAxLjB3ZXVpR2VuZXJhdGVkIGJ5IHN2ZzJ0dGYgZnJvbSBGb250ZWxsbyBwcm9qZWN0Lmh0dHA6Ly9mb250ZWxsby5jb20ACgAgACAAQwByAGUAYQB0AGUAZAAgAGIAeQAgAGYAbwBuAHQALQBjAGEAcgByAGkAZQByAAoAIAAgAHcAZQB1AGkAUgBlAGcAdQBsAGEAcgB3AGUAdQBpAHcAZQB1AGkAVgBlAHIAcwBpAG8AbgAgADEALgAwAHcAZQB1AGkARwBlAG4AZQByAGEAdABlAGQAIABiAHkAIABzAHYAZwAyAHQAdABmACAAZgByAG8AbQAgAEYAbwBuAHQAZQBsAGwAbwAgAHAAcgBvAGoAZQBjAHQALgBoAHQAdABwADoALwAvAGYAbwBuAHQAZQBsAGwAbwAuAGMAbwBtAAAAAAIAAAAAAAAACgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwECAQMBBAABeAd1bmlFQTA4AAAAAAA=") format("truetype");}@-webkit-keyframes taroLoading{0%{-webkit-transform:rotate3d(0, 0, 1, 0deg);}100%{-webkit-transform:rotate3d(0, 0, 1, 360deg);transform:rotate3d(0, 0, 1, 360deg);}}@keyframes taroLoading{0%{-webkit-transform:rotate3d(0, 0, 1, 0deg);}100%{-webkit-transform:rotate3d(0, 0, 1, 360deg);transform:rotate3d(0, 0, 1, 360deg);}}.taro-modal__foot:after {content: "";position: absolute;left: 0;top: 0;right: 0;height: 1px;border-top: 1px solid #D5D5D6;color: #D5D5D6;-webkit-transform-origin: 0 0;transform-origin: 0 0;-webkit-transform: scaleY(0.5);transform: scaleY(0.5);} .taro-model__btn:active {background-color: #EEEEEE}.taro-model__btn:not(:first-child):after {content: "";position: absolute;left: 0;top: 0;width: 1px;bottom: 0;border-left: 1px solid #D5D5D6;color: #D5D5D6;-webkit-transform-origin: 0 0;transform-origin: 0 0;-webkit-transform: scaleX(0.5);transform: scaleX(0.5);}.taro-actionsheet__cell:not(:first-child):after {content: "";position: absolute;left: 0;top: 0;right: 0;height: 1px;border-top: 1px solid #e5e5e5;color: #e5e5e5;-webkit-transform-origin: 0 0;transform-origin: 0 0;-webkit-transform: scaleY(0.5);transform: scaleY(0.5);}'
doc.querySelector('head').appendChild(taroStyle)
status = 'ready'
} | [
"function",
"init",
"(",
"doc",
")",
"{",
"if",
"(",
"status",
"===",
"'ready'",
")",
"return",
"const",
"taroStyle",
"=",
"doc",
".",
"createElement",
"(",
"'style'",
")",
"taroStyle",
".",
"textContent",
"=",
"'@font-face{font-weight:normal;font-style:normal;font-family:\"taro\";src:url(\"data:application/x-font-ttf;charset=utf-8;base64, AAEAAAALAIAAAwAwR1NVQrD+s+0AAAE4AAAAQk9TLzJWs0t/AAABfAAAAFZjbWFwqVgGvgAAAeAAAAGGZ2x5Zph7qG0AAANwAAAAdGhlYWQRFoGhAAAA4AAAADZoaGVhCCsD7AAAALwAAAAkaG10eAg0AAAAAAHUAAAADGxvY2EADAA6AAADaAAAAAhtYXhwAQ4AJAAAARgAAAAgbmFtZYrphEEAAAPkAAACVXBvc3S3shtSAAAGPAAAADUAAQAAA+gAAABaA+gAAAAAA+gAAQAAAAAAAAAAAAAAAAAAAAMAAQAAAAEAAADih+FfDzz1AAsD6AAAAADXB57LAAAAANcHnssAAP/sA+gDOgAAAAgAAgAAAAAAAAABAAAAAwAYAAEAAAAAAAIAAAAKAAoAAAD/AAAAAAAAAAEAAAAKAB4ALAABREZMVAAIAAQAAAAAAAAAAQAAAAFsaWdhAAgAAAABAAAAAQAEAAQAAAABAAgAAQAGAAAAAQAAAAAAAQK8AZAABQAIAnoCvAAAAIwCegK8AAAB4AAxAQIAAAIABQMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUGZFZABAAHjqCAPoAAAAWgPoABQAAAABAAAAAAAAA+gAAABkAAAD6AAAAAAABQAAAAMAAAAsAAAABAAAAV4AAQAAAAAAWAADAAEAAAAsAAMACgAAAV4ABAAsAAAABgAEAAEAAgB46gj//wAAAHjqCP//AAAAAAABAAYABgAAAAEAAgAAAQYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAKAAAAAAAAAACAAAAeAAAAHgAAAABAADqCAAA6ggAAAACAAAAAAAAAAwAOgABAAD/7AAyABQAAgAANzMVFB4UKAAAAAABAAAAAAO7AzoAFwAAEy4BPwE+AR8BFjY3ATYWFycWFAcBBiInPQoGBwUHGgzLDCELAh0LHwsNCgr9uQoeCgGzCyEOCw0HCZMJAQoBvgkCCg0LHQv9sQsKAAAAAAAAEgDeAAEAAAAAAAAAHQAAAAEAAAAAAAEABAAdAAEAAAAAAAIABwAhAAEAAAAAAAMABAAoAAEAAAAAAAQABAAsAAEAAAAAAAUACwAwAAEAAAAAAAYABAA7AAEAAAAAAAoAKwA/AAEAAAAAAAsAEwBqAAMAAQQJAAAAOgB9AAMAAQQJAAEACAC3AAMAAQQJAAIADgC/AAMAAQQJAAMACADNAAMAAQQJAAQACADVAAMAAQQJAAUAFgDdAAMAAQQJAAYACADzAAMAAQQJAAoAVgD7AAMAAQQJAAsAJgFRCiAgQ3JlYXRlZCBieSBmb250LWNhcnJpZXIKICB3ZXVpUmVndWxhcndldWl3ZXVpVmVyc2lvbiAxLjB3ZXVpR2VuZXJhdGVkIGJ5IHN2ZzJ0dGYgZnJvbSBGb250ZWxsbyBwcm9qZWN0Lmh0dHA6Ly9mb250ZWxsby5jb20ACgAgACAAQwByAGUAYQB0AGUAZAAgAGIAeQAgAGYAbwBuAHQALQBjAGEAcgByAGkAZQByAAoAIAAgAHcAZQB1AGkAUgBlAGcAdQBsAGEAcgB3AGUAdQBpAHcAZQB1AGkAVgBlAHIAcwBpAG8AbgAgADEALgAwAHcAZQB1AGkARwBlAG4AZQByAGEAdABlAGQAIABiAHkAIABzAHYAZwAyAHQAdABmACAAZgByAG8AbQAgAEYAbwBuAHQAZQBsAGwAbwAgAHAAcgBvAGoAZQBjAHQALgBoAHQAdABwADoALwAvAGYAbwBuAHQAZQBsAGwAbwAuAGMAbwBtAAAAAAIAAAAAAAAACgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwECAQMBBAABeAd1bmlFQTA4AAAAAAA=\") format(\"truetype\");}@-webkit-keyframes taroLoading{0%{-webkit-transform:rotate3d(0, 0, 1, 0deg);}100%{-webkit-transform:rotate3d(0, 0, 1, 360deg);transform:rotate3d(0, 0, 1, 360deg);}}@keyframes taroLoading{0%{-webkit-transform:rotate3d(0, 0, 1, 0deg);}100%{-webkit-transform:rotate3d(0, 0, 1, 360deg);transform:rotate3d(0, 0, 1, 360deg);}}.taro-modal__foot:after {content: \"\";position: absolute;left: 0;top: 0;right: 0;height: 1px;border-top: 1px solid #D5D5D6;color: #D5D5D6;-webkit-transform-origin: 0 0;transform-origin: 0 0;-webkit-transform: scaleY(0.5);transform: scaleY(0.5);} .taro-model__btn:active {background-color: #EEEEEE}.taro-model__btn:not(:first-child):after {content: \"\";position: absolute;left: 0;top: 0;width: 1px;bottom: 0;border-left: 1px solid #D5D5D6;color: #D5D5D6;-webkit-transform-origin: 0 0;transform-origin: 0 0;-webkit-transform: scaleX(0.5);transform: scaleX(0.5);}.taro-actionsheet__cell:not(:first-child):after {content: \"\";position: absolute;left: 0;top: 0;right: 0;height: 1px;border-top: 1px solid #e5e5e5;color: #e5e5e5;-webkit-transform-origin: 0 0;transform-origin: 0 0;-webkit-transform: scaleY(0.5);transform: scaleY(0.5);}'",
"doc",
".",
"querySelector",
"(",
"'head'",
")",
".",
"appendChild",
"(",
"taroStyle",
")",
"status",
"=",
"'ready'",
"}"
] | inject necessary style | [
"inject",
"necessary",
"style"
] | 274e76d731d7f158141287e31cbd51f092d472c5 | https://github.com/NervJS/taro/blob/274e76d731d7f158141287e31cbd51f092d472c5/packages/taro-h5/src/api/interactive/index.js#L10-L18 |
156 | NervJS/taro | packages/taro/src/internal/_common.js | listCacheDelete | function listCacheDelete(key) {
var data = this.__data__,
index = assocIndexOf(data, key)
if (index < 0) {
return false
}
var lastIndex = data.length - 1
if (index == lastIndex) {
data.pop()
} else {
splice.call(data, index, 1)
}
return true
} | javascript | function listCacheDelete(key) {
var data = this.__data__,
index = assocIndexOf(data, key)
if (index < 0) {
return false
}
var lastIndex = data.length - 1
if (index == lastIndex) {
data.pop()
} else {
splice.call(data, index, 1)
}
return true
} | [
"function",
"listCacheDelete",
"(",
"key",
")",
"{",
"var",
"data",
"=",
"this",
".",
"__data__",
",",
"index",
"=",
"assocIndexOf",
"(",
"data",
",",
"key",
")",
"if",
"(",
"index",
"<",
"0",
")",
"{",
"return",
"false",
"}",
"var",
"lastIndex",
"=",
"data",
".",
"length",
"-",
"1",
"if",
"(",
"index",
"==",
"lastIndex",
")",
"{",
"data",
".",
"pop",
"(",
")",
"}",
"else",
"{",
"splice",
".",
"call",
"(",
"data",
",",
"index",
",",
"1",
")",
"}",
"return",
"true",
"}"
] | Removes `key` and its value from the list cache.
@private
@name delete
@memberOf ListCache
@param {string} key The key of the value to remove.
@returns {boolean} Returns `true` if the entry was removed, else `false`. | [
"Removes",
"key",
"and",
"its",
"value",
"from",
"the",
"list",
"cache",
"."
] | 274e76d731d7f158141287e31cbd51f092d472c5 | https://github.com/NervJS/taro/blob/274e76d731d7f158141287e31cbd51f092d472c5/packages/taro/src/internal/_common.js#L273-L287 |
157 | mui-org/material-ui | scripts/sizeSnapshot/create.js | getWebpackSizes | async function getWebpackSizes() {
await fse.mkdirp(path.join(__dirname, 'build'));
const configPath = path.join(__dirname, 'webpack.config.js');
const statsPath = path.join(__dirname, 'build', 'stats.json');
await exec(`webpack --config ${configPath} --json > ${statsPath}`);
const stats = await fse.readJSON(statsPath);
const assets = new Map(stats.assets.map(asset => [asset.name, asset]));
return Object.entries(stats.assetsByChunkName).map(([chunkName, assetName]) => {
const parsedSize = assets.get(assetName).size;
const gzipSize = assets.get(`${assetName}.gz`).size;
return [chunkName, { parsed: parsedSize, gzip: gzipSize }];
});
} | javascript | async function getWebpackSizes() {
await fse.mkdirp(path.join(__dirname, 'build'));
const configPath = path.join(__dirname, 'webpack.config.js');
const statsPath = path.join(__dirname, 'build', 'stats.json');
await exec(`webpack --config ${configPath} --json > ${statsPath}`);
const stats = await fse.readJSON(statsPath);
const assets = new Map(stats.assets.map(asset => [asset.name, asset]));
return Object.entries(stats.assetsByChunkName).map(([chunkName, assetName]) => {
const parsedSize = assets.get(assetName).size;
const gzipSize = assets.get(`${assetName}.gz`).size;
return [chunkName, { parsed: parsedSize, gzip: gzipSize }];
});
} | [
"async",
"function",
"getWebpackSizes",
"(",
")",
"{",
"await",
"fse",
".",
"mkdirp",
"(",
"path",
".",
"join",
"(",
"__dirname",
",",
"'build'",
")",
")",
";",
"const",
"configPath",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"'webpack.config.js'",
")",
";",
"const",
"statsPath",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"'build'",
",",
"'stats.json'",
")",
";",
"await",
"exec",
"(",
"`",
"${",
"configPath",
"}",
"${",
"statsPath",
"}",
"`",
")",
";",
"const",
"stats",
"=",
"await",
"fse",
".",
"readJSON",
"(",
"statsPath",
")",
";",
"const",
"assets",
"=",
"new",
"Map",
"(",
"stats",
".",
"assets",
".",
"map",
"(",
"asset",
"=>",
"[",
"asset",
".",
"name",
",",
"asset",
"]",
")",
")",
";",
"return",
"Object",
".",
"entries",
"(",
"stats",
".",
"assetsByChunkName",
")",
".",
"map",
"(",
"(",
"[",
"chunkName",
",",
"assetName",
"]",
")",
"=>",
"{",
"const",
"parsedSize",
"=",
"assets",
".",
"get",
"(",
"assetName",
")",
".",
"size",
";",
"const",
"gzipSize",
"=",
"assets",
".",
"get",
"(",
"`",
"${",
"assetName",
"}",
"`",
")",
".",
"size",
";",
"return",
"[",
"chunkName",
",",
"{",
"parsed",
":",
"parsedSize",
",",
"gzip",
":",
"gzipSize",
"}",
"]",
";",
"}",
")",
";",
"}"
] | creates size snapshot for every bundle that built with webpack | [
"creates",
"size",
"snapshot",
"for",
"every",
"bundle",
"that",
"built",
"with",
"webpack"
] | 1555e52367835946382fbf2a8f681de71318915d | https://github.com/mui-org/material-ui/blob/1555e52367835946382fbf2a8f681de71318915d/scripts/sizeSnapshot/create.js#L34-L49 |
158 | mui-org/material-ui | packages/material-ui/src/Hidden/Hidden.js | Hidden | function Hidden(props) {
const { implementation, ...other } = props;
if (implementation === 'js') {
return <HiddenJs {...other} />;
}
return <HiddenCss {...other} />;
} | javascript | function Hidden(props) {
const { implementation, ...other } = props;
if (implementation === 'js') {
return <HiddenJs {...other} />;
}
return <HiddenCss {...other} />;
} | [
"function",
"Hidden",
"(",
"props",
")",
"{",
"const",
"{",
"implementation",
",",
"...",
"other",
"}",
"=",
"props",
";",
"if",
"(",
"implementation",
"===",
"'js'",
")",
"{",
"return",
"<",
"HiddenJs",
"{",
"...",
"other",
"}",
"/",
">",
";",
"}",
"return",
"<",
"HiddenCss",
"{",
"...",
"other",
"}",
"/",
">",
";",
"}"
] | Responsively hides children based on the selected implementation. | [
"Responsively",
"hides",
"children",
"based",
"on",
"the",
"selected",
"implementation",
"."
] | 1555e52367835946382fbf2a8f681de71318915d | https://github.com/mui-org/material-ui/blob/1555e52367835946382fbf2a8f681de71318915d/packages/material-ui/src/Hidden/Hidden.js#L9-L17 |
159 | mui-org/material-ui | packages/material-ui-codemod/src/v1.0.0/svg-icon-imports.js | transformSVGIconImports | function transformSVGIconImports(j, root) {
const pathMatchRegex = /^material-ui\/svg-icons\/.+\/(.+)$/;
root
.find(j.Literal)
.filter(path => pathMatchRegex.test(path.node.value))
.forEach(path => {
const [, iconName] = path.node.value.match(pathMatchRegex);
// update to new path
path.node.value = `@material-ui/icons/${pascalize(iconName)}`;
});
} | javascript | function transformSVGIconImports(j, root) {
const pathMatchRegex = /^material-ui\/svg-icons\/.+\/(.+)$/;
root
.find(j.Literal)
.filter(path => pathMatchRegex.test(path.node.value))
.forEach(path => {
const [, iconName] = path.node.value.match(pathMatchRegex);
// update to new path
path.node.value = `@material-ui/icons/${pascalize(iconName)}`;
});
} | [
"function",
"transformSVGIconImports",
"(",
"j",
",",
"root",
")",
"{",
"const",
"pathMatchRegex",
"=",
"/",
"^material-ui\\/svg-icons\\/.+\\/(.+)$",
"/",
";",
"root",
".",
"find",
"(",
"j",
".",
"Literal",
")",
".",
"filter",
"(",
"path",
"=>",
"pathMatchRegex",
".",
"test",
"(",
"path",
".",
"node",
".",
"value",
")",
")",
".",
"forEach",
"(",
"path",
"=>",
"{",
"const",
"[",
",",
"iconName",
"]",
"=",
"path",
".",
"node",
".",
"value",
".",
"match",
"(",
"pathMatchRegex",
")",
";",
"// update to new path",
"path",
".",
"node",
".",
"value",
"=",
"`",
"${",
"pascalize",
"(",
"iconName",
")",
"}",
"`",
";",
"}",
")",
";",
"}"
] | Update all `svg-icons` import references to use `@material-ui/icons` package.
Find and replace string literal AST nodes to ensure all svg-icon paths get updated, regardless
of being in an import declaration, or a require() call, etc.
https://github.com/mui-org/material-ui/tree/master/packages/@material-ui/icons
@param {jscodeshift_api_object} j
@param {jscodeshift_ast_object} root | [
"Update",
"all",
"svg",
"-",
"icons",
"import",
"references",
"to",
"use"
] | 1555e52367835946382fbf2a8f681de71318915d | https://github.com/mui-org/material-ui/blob/1555e52367835946382fbf2a8f681de71318915d/packages/material-ui-codemod/src/v1.0.0/svg-icon-imports.js#L29-L40 |
160 | mui-org/material-ui | packages/material-ui-icons/scripts/create-typings.js | run | async function run() {
console.log(`\u{1f52c} Searching for modules inside "${chalk.dim(SRC_DIR)}".`);
const files = glob.sync('!(index)*.js', { cwd: SRC_DIR });
const typings = files.map(file => createIconTyping(file));
await Promise.all([...typings, createIndexTyping(files)]);
console.log(`\u{1F5C4} Written typings to ${chalk.dim(TARGET_DIR)}.`);
} | javascript | async function run() {
console.log(`\u{1f52c} Searching for modules inside "${chalk.dim(SRC_DIR)}".`);
const files = glob.sync('!(index)*.js', { cwd: SRC_DIR });
const typings = files.map(file => createIconTyping(file));
await Promise.all([...typings, createIndexTyping(files)]);
console.log(`\u{1F5C4} Written typings to ${chalk.dim(TARGET_DIR)}.`);
} | [
"async",
"function",
"run",
"(",
")",
"{",
"console",
".",
"log",
"(",
"`",
"\\u{1f52c}",
"${",
"chalk",
".",
"dim",
"(",
"SRC_DIR",
")",
"}",
"`",
")",
";",
"const",
"files",
"=",
"glob",
".",
"sync",
"(",
"'!(index)*.js'",
",",
"{",
"cwd",
":",
"SRC_DIR",
"}",
")",
";",
"const",
"typings",
"=",
"files",
".",
"map",
"(",
"file",
"=>",
"createIconTyping",
"(",
"file",
")",
")",
";",
"await",
"Promise",
".",
"all",
"(",
"[",
"...",
"typings",
",",
"createIndexTyping",
"(",
"files",
")",
"]",
")",
";",
"console",
".",
"log",
"(",
"`",
"\\u{1F5C4}",
"${",
"chalk",
".",
"dim",
"(",
"TARGET_DIR",
")",
"}",
"`",
")",
";",
"}"
] | Generate TypeScript. | [
"Generate",
"TypeScript",
"."
] | 1555e52367835946382fbf2a8f681de71318915d | https://github.com/mui-org/material-ui/blob/1555e52367835946382fbf2a8f681de71318915d/packages/material-ui-icons/scripts/create-typings.js#L33-L39 |
161 | mui-org/material-ui | docs/src/pages/getting-started/page-layout-examples/dashboard/Orders.js | createData | function createData(id, date, name, shipTo, paymentMethod, amount) {
return { id, date, name, shipTo, paymentMethod, amount };
} | javascript | function createData(id, date, name, shipTo, paymentMethod, amount) {
return { id, date, name, shipTo, paymentMethod, amount };
} | [
"function",
"createData",
"(",
"id",
",",
"date",
",",
"name",
",",
"shipTo",
",",
"paymentMethod",
",",
"amount",
")",
"{",
"return",
"{",
"id",
",",
"date",
",",
"name",
",",
"shipTo",
",",
"paymentMethod",
",",
"amount",
"}",
";",
"}"
] | Generate Order Data | [
"Generate",
"Order",
"Data"
] | 1555e52367835946382fbf2a8f681de71318915d | https://github.com/mui-org/material-ui/blob/1555e52367835946382fbf2a8f681de71318915d/docs/src/pages/getting-started/page-layout-examples/dashboard/Orders.js#L14-L16 |
162 | mui-org/material-ui | dangerfile.js | git | function git(args) {
return new Promise((resolve, reject) => {
exec(`git ${args}`, (err, stdout) => {
if (err) {
reject(err);
} else {
resolve(stdout.trim());
}
});
});
} | javascript | function git(args) {
return new Promise((resolve, reject) => {
exec(`git ${args}`, (err, stdout) => {
if (err) {
reject(err);
} else {
resolve(stdout.trim());
}
});
});
} | [
"function",
"git",
"(",
"args",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"exec",
"(",
"`",
"${",
"args",
"}",
"`",
",",
"(",
"err",
",",
"stdout",
")",
"=>",
"{",
"if",
"(",
"err",
")",
"{",
"reject",
"(",
"err",
")",
";",
"}",
"else",
"{",
"resolve",
"(",
"stdout",
".",
"trim",
"(",
")",
")",
";",
"}",
"}",
")",
";",
"}",
")",
";",
"}"
] | executes a git subcommand
@param {any} args | [
"executes",
"a",
"git",
"subcommand"
] | 1555e52367835946382fbf2a8f681de71318915d | https://github.com/mui-org/material-ui/blob/1555e52367835946382fbf2a8f681de71318915d/dangerfile.js#L15-L25 |
163 | mui-org/material-ui | dangerfile.js | addPercent | function addPercent(change, goodEmoji = '', badEmooji = ':small_red_triangle:') {
const formatted = (change * 100).toFixed(2);
if (/^-|^0(?:\.0+)$/.test(formatted)) {
return `${formatted}% ${goodEmoji}`;
}
return `+${formatted}% ${badEmooji}`;
} | javascript | function addPercent(change, goodEmoji = '', badEmooji = ':small_red_triangle:') {
const formatted = (change * 100).toFixed(2);
if (/^-|^0(?:\.0+)$/.test(formatted)) {
return `${formatted}% ${goodEmoji}`;
}
return `+${formatted}% ${badEmooji}`;
} | [
"function",
"addPercent",
"(",
"change",
",",
"goodEmoji",
"=",
"''",
",",
"badEmooji",
"=",
"':small_red_triangle:'",
")",
"{",
"const",
"formatted",
"=",
"(",
"change",
"*",
"100",
")",
".",
"toFixed",
"(",
"2",
")",
";",
"if",
"(",
"/",
"^-|^0(?:\\.0+)$",
"/",
".",
"test",
"(",
"formatted",
")",
")",
"{",
"return",
"`",
"${",
"formatted",
"}",
"${",
"goodEmoji",
"}",
"`",
";",
"}",
"return",
"`",
"${",
"formatted",
"}",
"${",
"badEmooji",
"}",
"`",
";",
"}"
] | Generates a user-readable string from a percentage change
@param {number} change
@param {string} goodEmoji emoji on reduction
@param {string} badEmooji emoji on increase | [
"Generates",
"a",
"user",
"-",
"readable",
"string",
"from",
"a",
"percentage",
"change"
] | 1555e52367835946382fbf2a8f681de71318915d | https://github.com/mui-org/material-ui/blob/1555e52367835946382fbf2a8f681de71318915d/dangerfile.js#L71-L77 |
164 | mui-org/material-ui | dangerfile.js | generateMDTable | function generateMDTable(headers, body) {
const headerRow = headers.map(header => header.label);
const alignmentRow = headers.map(header => {
if (header.align === 'right') {
return ' ---:';
}
if (header.align === 'center') {
return ':---:';
}
return ' --- ';
});
return [headerRow, alignmentRow, ...body].map(row => row.join(' | ')).join('\n');
} | javascript | function generateMDTable(headers, body) {
const headerRow = headers.map(header => header.label);
const alignmentRow = headers.map(header => {
if (header.align === 'right') {
return ' ---:';
}
if (header.align === 'center') {
return ':---:';
}
return ' --- ';
});
return [headerRow, alignmentRow, ...body].map(row => row.join(' | ')).join('\n');
} | [
"function",
"generateMDTable",
"(",
"headers",
",",
"body",
")",
"{",
"const",
"headerRow",
"=",
"headers",
".",
"map",
"(",
"header",
"=>",
"header",
".",
"label",
")",
";",
"const",
"alignmentRow",
"=",
"headers",
".",
"map",
"(",
"header",
"=>",
"{",
"if",
"(",
"header",
".",
"align",
"===",
"'right'",
")",
"{",
"return",
"' ---:'",
";",
"}",
"if",
"(",
"header",
".",
"align",
"===",
"'center'",
")",
"{",
"return",
"':---:'",
";",
"}",
"return",
"' --- '",
";",
"}",
")",
";",
"return",
"[",
"headerRow",
",",
"alignmentRow",
",",
"...",
"body",
"]",
".",
"map",
"(",
"row",
"=>",
"row",
".",
"join",
"(",
"' | '",
")",
")",
".",
"join",
"(",
"'\\n'",
")",
";",
"}"
] | Generates a Markdown table
@param {{ label: string, align: 'left' | 'center' | 'right'}[]} headers
@param {string[][]} body
@returns {string} | [
"Generates",
"a",
"Markdown",
"table"
] | 1555e52367835946382fbf2a8f681de71318915d | https://github.com/mui-org/material-ui/blob/1555e52367835946382fbf2a8f681de71318915d/dangerfile.js#L85-L98 |
165 | mui-org/material-ui | docs/src/modules/utils/find.js | findComponents | function findComponents(directory, components = []) {
const items = fs.readdirSync(directory);
items.forEach(item => {
const itemPath = path.resolve(directory, item);
if (fs.statSync(itemPath).isDirectory()) {
findComponents(itemPath, components);
return;
}
if (!componentRegex.test(item)) {
return;
}
components.push({
filename: itemPath,
});
});
return components;
} | javascript | function findComponents(directory, components = []) {
const items = fs.readdirSync(directory);
items.forEach(item => {
const itemPath = path.resolve(directory, item);
if (fs.statSync(itemPath).isDirectory()) {
findComponents(itemPath, components);
return;
}
if (!componentRegex.test(item)) {
return;
}
components.push({
filename: itemPath,
});
});
return components;
} | [
"function",
"findComponents",
"(",
"directory",
",",
"components",
"=",
"[",
"]",
")",
"{",
"const",
"items",
"=",
"fs",
".",
"readdirSync",
"(",
"directory",
")",
";",
"items",
".",
"forEach",
"(",
"item",
"=>",
"{",
"const",
"itemPath",
"=",
"path",
".",
"resolve",
"(",
"directory",
",",
"item",
")",
";",
"if",
"(",
"fs",
".",
"statSync",
"(",
"itemPath",
")",
".",
"isDirectory",
"(",
")",
")",
"{",
"findComponents",
"(",
"itemPath",
",",
"components",
")",
";",
"return",
";",
"}",
"if",
"(",
"!",
"componentRegex",
".",
"test",
"(",
"item",
")",
")",
"{",
"return",
";",
"}",
"components",
".",
"push",
"(",
"{",
"filename",
":",
"itemPath",
",",
"}",
")",
";",
"}",
")",
";",
"return",
"components",
";",
"}"
] | Returns the component source in a flat array. | [
"Returns",
"the",
"component",
"source",
"in",
"a",
"flat",
"array",
"."
] | 1555e52367835946382fbf2a8f681de71318915d | https://github.com/mui-org/material-ui/blob/1555e52367835946382fbf2a8f681de71318915d/docs/src/modules/utils/find.js#L54-L75 |
166 | mui-org/material-ui | docs/src/modules/utils/find.js | findPages | function findPages(
options = {},
directory = path.resolve(__dirname, '../../../../pages'),
pages = [],
) {
fs.readdirSync(directory).forEach(item => {
const itemPath = path.resolve(directory, item);
const pathname = itemPath
.replace(new RegExp(`\\${path.sep}`, 'g'), '/')
.replace(/^.*\/pages/, '')
.replace('.js', '')
.replace(/^\/index$/, '/') // Replace `index` by `/`.
.replace(/\/index$/, '');
if (pathname.indexOf('.eslintrc') !== -1) {
return;
}
if (
options.front &&
pathname.indexOf('/components') === -1 &&
pathname.indexOf('/api') === -1
) {
return;
}
if (fs.statSync(itemPath).isDirectory()) {
const children = [];
pages.push({
pathname,
children,
});
findPages(options, itemPath, children);
return;
}
if (!jsRegex.test(item) || blackList.includes(pathname)) {
return;
}
pages.push({
pathname,
});
});
// sort by pathnames without '-' so that e.g. card comes before card-action
pages.sort((a, b) => {
const pathnameA = a.pathname.replace(/-/g, '');
const pathnameB = b.pathname.replace(/-/g, '');
if (pathnameA < pathnameB) return -1;
if (pathnameA > pathnameB) return 1;
return 0;
});
return pages;
} | javascript | function findPages(
options = {},
directory = path.resolve(__dirname, '../../../../pages'),
pages = [],
) {
fs.readdirSync(directory).forEach(item => {
const itemPath = path.resolve(directory, item);
const pathname = itemPath
.replace(new RegExp(`\\${path.sep}`, 'g'), '/')
.replace(/^.*\/pages/, '')
.replace('.js', '')
.replace(/^\/index$/, '/') // Replace `index` by `/`.
.replace(/\/index$/, '');
if (pathname.indexOf('.eslintrc') !== -1) {
return;
}
if (
options.front &&
pathname.indexOf('/components') === -1 &&
pathname.indexOf('/api') === -1
) {
return;
}
if (fs.statSync(itemPath).isDirectory()) {
const children = [];
pages.push({
pathname,
children,
});
findPages(options, itemPath, children);
return;
}
if (!jsRegex.test(item) || blackList.includes(pathname)) {
return;
}
pages.push({
pathname,
});
});
// sort by pathnames without '-' so that e.g. card comes before card-action
pages.sort((a, b) => {
const pathnameA = a.pathname.replace(/-/g, '');
const pathnameB = b.pathname.replace(/-/g, '');
if (pathnameA < pathnameB) return -1;
if (pathnameA > pathnameB) return 1;
return 0;
});
return pages;
} | [
"function",
"findPages",
"(",
"options",
"=",
"{",
"}",
",",
"directory",
"=",
"path",
".",
"resolve",
"(",
"__dirname",
",",
"'../../../../pages'",
")",
",",
"pages",
"=",
"[",
"]",
",",
")",
"{",
"fs",
".",
"readdirSync",
"(",
"directory",
")",
".",
"forEach",
"(",
"item",
"=>",
"{",
"const",
"itemPath",
"=",
"path",
".",
"resolve",
"(",
"directory",
",",
"item",
")",
";",
"const",
"pathname",
"=",
"itemPath",
".",
"replace",
"(",
"new",
"RegExp",
"(",
"`",
"\\\\",
"${",
"path",
".",
"sep",
"}",
"`",
",",
"'g'",
")",
",",
"'/'",
")",
".",
"replace",
"(",
"/",
"^.*\\/pages",
"/",
",",
"''",
")",
".",
"replace",
"(",
"'.js'",
",",
"''",
")",
".",
"replace",
"(",
"/",
"^\\/index$",
"/",
",",
"'/'",
")",
"// Replace `index` by `/`.",
".",
"replace",
"(",
"/",
"\\/index$",
"/",
",",
"''",
")",
";",
"if",
"(",
"pathname",
".",
"indexOf",
"(",
"'.eslintrc'",
")",
"!==",
"-",
"1",
")",
"{",
"return",
";",
"}",
"if",
"(",
"options",
".",
"front",
"&&",
"pathname",
".",
"indexOf",
"(",
"'/components'",
")",
"===",
"-",
"1",
"&&",
"pathname",
".",
"indexOf",
"(",
"'/api'",
")",
"===",
"-",
"1",
")",
"{",
"return",
";",
"}",
"if",
"(",
"fs",
".",
"statSync",
"(",
"itemPath",
")",
".",
"isDirectory",
"(",
")",
")",
"{",
"const",
"children",
"=",
"[",
"]",
";",
"pages",
".",
"push",
"(",
"{",
"pathname",
",",
"children",
",",
"}",
")",
";",
"findPages",
"(",
"options",
",",
"itemPath",
",",
"children",
")",
";",
"return",
";",
"}",
"if",
"(",
"!",
"jsRegex",
".",
"test",
"(",
"item",
")",
"||",
"blackList",
".",
"includes",
"(",
"pathname",
")",
")",
"{",
"return",
";",
"}",
"pages",
".",
"push",
"(",
"{",
"pathname",
",",
"}",
")",
";",
"}",
")",
";",
"// sort by pathnames without '-' so that e.g. card comes before card-action",
"pages",
".",
"sort",
"(",
"(",
"a",
",",
"b",
")",
"=>",
"{",
"const",
"pathnameA",
"=",
"a",
".",
"pathname",
".",
"replace",
"(",
"/",
"-",
"/",
"g",
",",
"''",
")",
";",
"const",
"pathnameB",
"=",
"b",
".",
"pathname",
".",
"replace",
"(",
"/",
"-",
"/",
"g",
",",
"''",
")",
";",
"if",
"(",
"pathnameA",
"<",
"pathnameB",
")",
"return",
"-",
"1",
";",
"if",
"(",
"pathnameA",
">",
"pathnameB",
")",
"return",
"1",
";",
"return",
"0",
";",
"}",
")",
";",
"return",
"pages",
";",
"}"
] | Returns the Next.js pages available in a nested format. The output is in the next.js format. Each pathname is a route you can navigate to. | [
"Returns",
"the",
"Next",
".",
"js",
"pages",
"available",
"in",
"a",
"nested",
"format",
".",
"The",
"output",
"is",
"in",
"the",
"next",
".",
"js",
"format",
".",
"Each",
"pathname",
"is",
"a",
"route",
"you",
"can",
"navigate",
"to",
"."
] | 1555e52367835946382fbf2a8f681de71318915d | https://github.com/mui-org/material-ui/blob/1555e52367835946382fbf2a8f681de71318915d/docs/src/modules/utils/find.js#L83-L138 |
167 | mui-org/material-ui | docs/src/pages/components/slider/CustomValueReducerSlider.js | valueReducer | function valueReducer(rawValue, props, event) {
const { disabled, max, min, step } = props;
function roundToStep(number) {
return Math.round(number / step) * step;
}
if (!disabled && step) {
if (rawValue > min && rawValue < max) {
if (rawValue === max - step) {
// If moving the Slider using arrow keys and value is formerly an maximum edge value
return roundToStep(rawValue + step / 2);
}
if (rawValue === min + step) {
// Same for minimum edge value
return roundToStep(rawValue - step / 2);
}
return roundToStep(rawValue);
}
return rawValue;
}
return defaultValueReducer(rawValue, props, event);
} | javascript | function valueReducer(rawValue, props, event) {
const { disabled, max, min, step } = props;
function roundToStep(number) {
return Math.round(number / step) * step;
}
if (!disabled && step) {
if (rawValue > min && rawValue < max) {
if (rawValue === max - step) {
// If moving the Slider using arrow keys and value is formerly an maximum edge value
return roundToStep(rawValue + step / 2);
}
if (rawValue === min + step) {
// Same for minimum edge value
return roundToStep(rawValue - step / 2);
}
return roundToStep(rawValue);
}
return rawValue;
}
return defaultValueReducer(rawValue, props, event);
} | [
"function",
"valueReducer",
"(",
"rawValue",
",",
"props",
",",
"event",
")",
"{",
"const",
"{",
"disabled",
",",
"max",
",",
"min",
",",
"step",
"}",
"=",
"props",
";",
"function",
"roundToStep",
"(",
"number",
")",
"{",
"return",
"Math",
".",
"round",
"(",
"number",
"/",
"step",
")",
"*",
"step",
";",
"}",
"if",
"(",
"!",
"disabled",
"&&",
"step",
")",
"{",
"if",
"(",
"rawValue",
">",
"min",
"&&",
"rawValue",
"<",
"max",
")",
"{",
"if",
"(",
"rawValue",
"===",
"max",
"-",
"step",
")",
"{",
"// If moving the Slider using arrow keys and value is formerly an maximum edge value",
"return",
"roundToStep",
"(",
"rawValue",
"+",
"step",
"/",
"2",
")",
";",
"}",
"if",
"(",
"rawValue",
"===",
"min",
"+",
"step",
")",
"{",
"// Same for minimum edge value",
"return",
"roundToStep",
"(",
"rawValue",
"-",
"step",
"/",
"2",
")",
";",
"}",
"return",
"roundToStep",
"(",
"rawValue",
")",
";",
"}",
"return",
"rawValue",
";",
"}",
"return",
"defaultValueReducer",
"(",
"rawValue",
",",
"props",
",",
"event",
")",
";",
"}"
] | a value reducer that will snap to multiple of 10 but also to the edge value
Useful here because the max=104 is not a multiple of 10 | [
"a",
"value",
"reducer",
"that",
"will",
"snap",
"to",
"multiple",
"of",
"10",
"but",
"also",
"to",
"the",
"edge",
"value",
"Useful",
"here",
"because",
"the",
"max",
"=",
"104",
"is",
"not",
"a",
"multiple",
"of",
"10"
] | 1555e52367835946382fbf2a8f681de71318915d | https://github.com/mui-org/material-ui/blob/1555e52367835946382fbf2a8f681de71318915d/docs/src/pages/components/slider/CustomValueReducerSlider.js#L16-L39 |
168 | mui-org/material-ui | packages/material-ui-styles/src/jssPreset/jssPreset.js | jssPreset | function jssPreset() {
return {
plugins: [
functions(),
global(),
nested(),
camelCase(),
defaultUnit(),
// Disable the vendor prefixer server-side, it does nothing.
// This way, we can get a performance boost.
// In the documentation, we are using `autoprefixer` to solve this problem.
typeof window === 'undefined' ? null : vendorPrefixer(),
propsSort(),
],
};
} | javascript | function jssPreset() {
return {
plugins: [
functions(),
global(),
nested(),
camelCase(),
defaultUnit(),
// Disable the vendor prefixer server-side, it does nothing.
// This way, we can get a performance boost.
// In the documentation, we are using `autoprefixer` to solve this problem.
typeof window === 'undefined' ? null : vendorPrefixer(),
propsSort(),
],
};
} | [
"function",
"jssPreset",
"(",
")",
"{",
"return",
"{",
"plugins",
":",
"[",
"functions",
"(",
")",
",",
"global",
"(",
")",
",",
"nested",
"(",
")",
",",
"camelCase",
"(",
")",
",",
"defaultUnit",
"(",
")",
",",
"// Disable the vendor prefixer server-side, it does nothing.",
"// This way, we can get a performance boost.",
"// In the documentation, we are using `autoprefixer` to solve this problem.",
"typeof",
"window",
"===",
"'undefined'",
"?",
"null",
":",
"vendorPrefixer",
"(",
")",
",",
"propsSort",
"(",
")",
",",
"]",
",",
"}",
";",
"}"
] | Subset of jss-preset-default with only the plugins the Material-UI components are using. | [
"Subset",
"of",
"jss",
"-",
"preset",
"-",
"default",
"with",
"only",
"the",
"plugins",
"the",
"Material",
"-",
"UI",
"components",
"are",
"using",
"."
] | 1555e52367835946382fbf2a8f681de71318915d | https://github.com/mui-org/material-ui/blob/1555e52367835946382fbf2a8f681de71318915d/packages/material-ui-styles/src/jssPreset/jssPreset.js#L10-L25 |
169 | mui-org/material-ui | packages/material-ui/src/ClickAwayListener/ClickAwayListener.js | ClickAwayListener | function ClickAwayListener(props) {
const { children, mouseEvent = 'onMouseUp', touchEvent = 'onTouchEnd', onClickAway } = props;
const mountedRef = useMountedRef();
const movedRef = React.useRef(false);
const nodeRef = React.useRef(null);
// can be removed once we drop support for non ref forwarding class components
const handleOwnRef = React.useCallback(instance => {
// #StrictMode ready
nodeRef.current = ReactDOM.findDOMNode(instance);
}, []);
const handleRef = useForkRef(children.ref, handleOwnRef);
const handleClickAway = React.useCallback(
event => {
// Ignore events that have been `event.preventDefault()` marked.
if (event.defaultPrevented) {
return;
}
// IE 11 support, which trigger the handleClickAway even after the unbind
if (!mountedRef.current) {
return;
}
// Do not act if user performed touchmove
if (movedRef.current) {
movedRef.current = false;
return;
}
const { current: node } = nodeRef;
// The child might render null.
if (!node) {
return;
}
const doc = ownerDocument(node);
if (
doc.documentElement &&
doc.documentElement.contains(event.target) &&
!node.contains(event.target)
) {
onClickAway(event);
}
},
[mountedRef, onClickAway],
);
const handleTouchMove = React.useCallback(() => {
movedRef.current = true;
}, []);
const listenerProps = {};
if (mouseEvent !== false) {
listenerProps[mouseEvent] = handleClickAway;
}
if (touchEvent !== false) {
listenerProps[touchEvent] = handleClickAway;
listenerProps.onTouchMove = handleTouchMove;
}
return (
<React.Fragment>
{React.cloneElement(children, { ref: handleRef })}
<EventListener target="document" {...listenerProps} />
</React.Fragment>
);
} | javascript | function ClickAwayListener(props) {
const { children, mouseEvent = 'onMouseUp', touchEvent = 'onTouchEnd', onClickAway } = props;
const mountedRef = useMountedRef();
const movedRef = React.useRef(false);
const nodeRef = React.useRef(null);
// can be removed once we drop support for non ref forwarding class components
const handleOwnRef = React.useCallback(instance => {
// #StrictMode ready
nodeRef.current = ReactDOM.findDOMNode(instance);
}, []);
const handleRef = useForkRef(children.ref, handleOwnRef);
const handleClickAway = React.useCallback(
event => {
// Ignore events that have been `event.preventDefault()` marked.
if (event.defaultPrevented) {
return;
}
// IE 11 support, which trigger the handleClickAway even after the unbind
if (!mountedRef.current) {
return;
}
// Do not act if user performed touchmove
if (movedRef.current) {
movedRef.current = false;
return;
}
const { current: node } = nodeRef;
// The child might render null.
if (!node) {
return;
}
const doc = ownerDocument(node);
if (
doc.documentElement &&
doc.documentElement.contains(event.target) &&
!node.contains(event.target)
) {
onClickAway(event);
}
},
[mountedRef, onClickAway],
);
const handleTouchMove = React.useCallback(() => {
movedRef.current = true;
}, []);
const listenerProps = {};
if (mouseEvent !== false) {
listenerProps[mouseEvent] = handleClickAway;
}
if (touchEvent !== false) {
listenerProps[touchEvent] = handleClickAway;
listenerProps.onTouchMove = handleTouchMove;
}
return (
<React.Fragment>
{React.cloneElement(children, { ref: handleRef })}
<EventListener target="document" {...listenerProps} />
</React.Fragment>
);
} | [
"function",
"ClickAwayListener",
"(",
"props",
")",
"{",
"const",
"{",
"children",
",",
"mouseEvent",
"=",
"'onMouseUp'",
",",
"touchEvent",
"=",
"'onTouchEnd'",
",",
"onClickAway",
"}",
"=",
"props",
";",
"const",
"mountedRef",
"=",
"useMountedRef",
"(",
")",
";",
"const",
"movedRef",
"=",
"React",
".",
"useRef",
"(",
"false",
")",
";",
"const",
"nodeRef",
"=",
"React",
".",
"useRef",
"(",
"null",
")",
";",
"// can be removed once we drop support for non ref forwarding class components",
"const",
"handleOwnRef",
"=",
"React",
".",
"useCallback",
"(",
"instance",
"=>",
"{",
"// #StrictMode ready",
"nodeRef",
".",
"current",
"=",
"ReactDOM",
".",
"findDOMNode",
"(",
"instance",
")",
";",
"}",
",",
"[",
"]",
")",
";",
"const",
"handleRef",
"=",
"useForkRef",
"(",
"children",
".",
"ref",
",",
"handleOwnRef",
")",
";",
"const",
"handleClickAway",
"=",
"React",
".",
"useCallback",
"(",
"event",
"=>",
"{",
"// Ignore events that have been `event.preventDefault()` marked.",
"if",
"(",
"event",
".",
"defaultPrevented",
")",
"{",
"return",
";",
"}",
"// IE 11 support, which trigger the handleClickAway even after the unbind",
"if",
"(",
"!",
"mountedRef",
".",
"current",
")",
"{",
"return",
";",
"}",
"// Do not act if user performed touchmove",
"if",
"(",
"movedRef",
".",
"current",
")",
"{",
"movedRef",
".",
"current",
"=",
"false",
";",
"return",
";",
"}",
"const",
"{",
"current",
":",
"node",
"}",
"=",
"nodeRef",
";",
"// The child might render null.",
"if",
"(",
"!",
"node",
")",
"{",
"return",
";",
"}",
"const",
"doc",
"=",
"ownerDocument",
"(",
"node",
")",
";",
"if",
"(",
"doc",
".",
"documentElement",
"&&",
"doc",
".",
"documentElement",
".",
"contains",
"(",
"event",
".",
"target",
")",
"&&",
"!",
"node",
".",
"contains",
"(",
"event",
".",
"target",
")",
")",
"{",
"onClickAway",
"(",
"event",
")",
";",
"}",
"}",
",",
"[",
"mountedRef",
",",
"onClickAway",
"]",
",",
")",
";",
"const",
"handleTouchMove",
"=",
"React",
".",
"useCallback",
"(",
"(",
")",
"=>",
"{",
"movedRef",
".",
"current",
"=",
"true",
";",
"}",
",",
"[",
"]",
")",
";",
"const",
"listenerProps",
"=",
"{",
"}",
";",
"if",
"(",
"mouseEvent",
"!==",
"false",
")",
"{",
"listenerProps",
"[",
"mouseEvent",
"]",
"=",
"handleClickAway",
";",
"}",
"if",
"(",
"touchEvent",
"!==",
"false",
")",
"{",
"listenerProps",
"[",
"touchEvent",
"]",
"=",
"handleClickAway",
";",
"listenerProps",
".",
"onTouchMove",
"=",
"handleTouchMove",
";",
"}",
"return",
"(",
"<",
"React",
".",
"Fragment",
">",
"\n ",
"{",
"React",
".",
"cloneElement",
"(",
"children",
",",
"{",
"ref",
":",
"handleRef",
"}",
")",
"}",
"\n ",
"<",
"EventListener",
"target",
"=",
"\"document\"",
"{",
"...",
"listenerProps",
"}",
"/",
">",
"\n ",
"<",
"/",
"React",
".",
"Fragment",
">",
")",
";",
"}"
] | Listen for click events that occur somewhere in the document, outside of the element itself.
For instance, if you need to hide a menu when people click anywhere else on your page. | [
"Listen",
"for",
"click",
"events",
"that",
"occur",
"somewhere",
"in",
"the",
"document",
"outside",
"of",
"the",
"element",
"itself",
".",
"For",
"instance",
"if",
"you",
"need",
"to",
"hide",
"a",
"menu",
"when",
"people",
"click",
"anywhere",
"else",
"on",
"your",
"page",
"."
] | 1555e52367835946382fbf2a8f681de71318915d | https://github.com/mui-org/material-ui/blob/1555e52367835946382fbf2a8f681de71318915d/packages/material-ui/src/ClickAwayListener/ClickAwayListener.js#L25-L94 |
170 | mui-org/material-ui | docs/src/pages/discover-more/showcase/Showcase.js | sortFactory | function sortFactory(key) {
return function sortNumeric(a, b) {
if (b[key] < a[key]) {
return -1;
}
if (b[key] > a[key]) {
return 1;
}
return 0;
};
} | javascript | function sortFactory(key) {
return function sortNumeric(a, b) {
if (b[key] < a[key]) {
return -1;
}
if (b[key] > a[key]) {
return 1;
}
return 0;
};
} | [
"function",
"sortFactory",
"(",
"key",
")",
"{",
"return",
"function",
"sortNumeric",
"(",
"a",
",",
"b",
")",
"{",
"if",
"(",
"b",
"[",
"key",
"]",
"<",
"a",
"[",
"key",
"]",
")",
"{",
"return",
"-",
"1",
";",
"}",
"if",
"(",
"b",
"[",
"key",
"]",
">",
"a",
"[",
"key",
"]",
")",
"{",
"return",
"1",
";",
"}",
"return",
"0",
";",
"}",
";",
"}"
] | Returns a function that sorts reverse numerically by value of `key` | [
"Returns",
"a",
"function",
"that",
"sorts",
"reverse",
"numerically",
"by",
"value",
"of",
"key"
] | 1555e52367835946382fbf2a8f681de71318915d | https://github.com/mui-org/material-ui/blob/1555e52367835946382fbf2a8f681de71318915d/docs/src/pages/discover-more/showcase/Showcase.js#L60-L70 |
171 | mui-org/material-ui | docs/src/pages/guides/interoperability/EmotionCSS.js | EmotionCSS | function EmotionCSS() {
return (
<div>
<Button>Material-UI</Button>
<Button
css={css`
background: linear-gradient(45deg, #fe6b8b 30%, #ff8e53 90%);
border-radius: 3px;
border: 0;
color: white;
height: 48px;
padding: 0 30px;
box-shadow: 0 3px 5px 2px rgba(255, 105, 135, 0.3);
`}
>
Emotion
</Button>
</div>
);
} | javascript | function EmotionCSS() {
return (
<div>
<Button>Material-UI</Button>
<Button
css={css`
background: linear-gradient(45deg, #fe6b8b 30%, #ff8e53 90%);
border-radius: 3px;
border: 0;
color: white;
height: 48px;
padding: 0 30px;
box-shadow: 0 3px 5px 2px rgba(255, 105, 135, 0.3);
`}
>
Emotion
</Button>
</div>
);
} | [
"function",
"EmotionCSS",
"(",
")",
"{",
"return",
"(",
"<",
"div",
">",
"\n ",
"<",
"Button",
">",
"Material-UI",
"<",
"/",
"Button",
">",
"\n ",
"<",
"Button",
"css",
"=",
"{",
"css",
"`",
"`",
"}",
">",
"\n Emotion\n ",
"<",
"/",
"Button",
">",
"\n ",
"<",
"/",
"div",
">",
")",
";",
"}"
] | We just assign them the Button's className attribute | [
"We",
"just",
"assign",
"them",
"the",
"Button",
"s",
"className",
"attribute"
] | 1555e52367835946382fbf2a8f681de71318915d | https://github.com/mui-org/material-ui/blob/1555e52367835946382fbf2a8f681de71318915d/docs/src/pages/guides/interoperability/EmotionCSS.js#L6-L25 |
172 | mui-org/material-ui | packages/material-ui-icons/builder.js | getComponentName | function getComponentName(destPath) {
const splitregex = new RegExp(`[\\${path.sep}-]+`);
const parts = destPath
.replace('.js', '')
.split(splitregex)
.map(part => part.charAt(0).toUpperCase() + part.substring(1));
return parts.join('');
} | javascript | function getComponentName(destPath) {
const splitregex = new RegExp(`[\\${path.sep}-]+`);
const parts = destPath
.replace('.js', '')
.split(splitregex)
.map(part => part.charAt(0).toUpperCase() + part.substring(1));
return parts.join('');
} | [
"function",
"getComponentName",
"(",
"destPath",
")",
"{",
"const",
"splitregex",
"=",
"new",
"RegExp",
"(",
"`",
"\\\\",
"${",
"path",
".",
"sep",
"}",
"`",
")",
";",
"const",
"parts",
"=",
"destPath",
".",
"replace",
"(",
"'.js'",
",",
"''",
")",
".",
"split",
"(",
"splitregex",
")",
".",
"map",
"(",
"part",
"=>",
"part",
".",
"charAt",
"(",
"0",
")",
".",
"toUpperCase",
"(",
")",
"+",
"part",
".",
"substring",
"(",
"1",
")",
")",
";",
"return",
"parts",
".",
"join",
"(",
"''",
")",
";",
"}"
] | Return Pascal-Cased component name.
@param {string} destPath
@returns {string} class name | [
"Return",
"Pascal",
"-",
"Cased",
"component",
"name",
"."
] | 1555e52367835946382fbf2a8f681de71318915d | https://github.com/mui-org/material-ui/blob/1555e52367835946382fbf2a8f681de71318915d/packages/material-ui-icons/builder.js#L70-L79 |
173 | mui-org/material-ui | packages/material-ui/src/CssBaseline/CssBaseline.js | CssBaseline | function CssBaseline(props) {
const { children = null } = props;
useStyles();
return <React.Fragment>{children}</React.Fragment>;
} | javascript | function CssBaseline(props) {
const { children = null } = props;
useStyles();
return <React.Fragment>{children}</React.Fragment>;
} | [
"function",
"CssBaseline",
"(",
"props",
")",
"{",
"const",
"{",
"children",
"=",
"null",
"}",
"=",
"props",
";",
"useStyles",
"(",
")",
";",
"return",
"<",
"React",
".",
"Fragment",
">",
"{",
"children",
"}",
"<",
"/",
"React",
".",
"Fragment",
">",
";",
"}"
] | Kickstart an elegant, consistent, and simple baseline to build upon. | [
"Kickstart",
"an",
"elegant",
"consistent",
"and",
"simple",
"baseline",
"to",
"build",
"upon",
"."
] | 1555e52367835946382fbf2a8f681de71318915d | https://github.com/mui-org/material-ui/blob/1555e52367835946382fbf2a8f681de71318915d/packages/material-ui/src/CssBaseline/CssBaseline.js#L37-L41 |
174 | mui-org/material-ui | packages/material-ui-styles/src/ThemeProvider/ThemeProvider.js | mergeOuterLocalTheme | function mergeOuterLocalTheme(outerTheme, localTheme) {
if (typeof localTheme === 'function') {
const mergedTheme = localTheme(outerTheme);
warning(
mergedTheme,
[
'Material-UI: you should return an object from your theme function, i.e.',
'<ThemeProvider theme={() => ({})} />',
].join('\n'),
);
return mergedTheme;
}
return { ...outerTheme, ...localTheme };
} | javascript | function mergeOuterLocalTheme(outerTheme, localTheme) {
if (typeof localTheme === 'function') {
const mergedTheme = localTheme(outerTheme);
warning(
mergedTheme,
[
'Material-UI: you should return an object from your theme function, i.e.',
'<ThemeProvider theme={() => ({})} />',
].join('\n'),
);
return mergedTheme;
}
return { ...outerTheme, ...localTheme };
} | [
"function",
"mergeOuterLocalTheme",
"(",
"outerTheme",
",",
"localTheme",
")",
"{",
"if",
"(",
"typeof",
"localTheme",
"===",
"'function'",
")",
"{",
"const",
"mergedTheme",
"=",
"localTheme",
"(",
"outerTheme",
")",
";",
"warning",
"(",
"mergedTheme",
",",
"[",
"'Material-UI: you should return an object from your theme function, i.e.'",
",",
"'<ThemeProvider theme={() => ({})} />'",
",",
"]",
".",
"join",
"(",
"'\\n'",
")",
",",
")",
";",
"return",
"mergedTheme",
";",
"}",
"return",
"{",
"...",
"outerTheme",
",",
"...",
"localTheme",
"}",
";",
"}"
] | To support composition of theme. | [
"To",
"support",
"composition",
"of",
"theme",
"."
] | 1555e52367835946382fbf2a8f681de71318915d | https://github.com/mui-org/material-ui/blob/1555e52367835946382fbf2a8f681de71318915d/packages/material-ui-styles/src/ThemeProvider/ThemeProvider.js#L10-L26 |
175 | mui-org/material-ui | packages/material-ui/src/Popover/Popover.js | getScrollParent | function getScrollParent(parent, child) {
let element = child;
let scrollTop = 0;
while (element && element !== parent) {
element = element.parentNode;
scrollTop += element.scrollTop;
}
return scrollTop;
} | javascript | function getScrollParent(parent, child) {
let element = child;
let scrollTop = 0;
while (element && element !== parent) {
element = element.parentNode;
scrollTop += element.scrollTop;
}
return scrollTop;
} | [
"function",
"getScrollParent",
"(",
"parent",
",",
"child",
")",
"{",
"let",
"element",
"=",
"child",
";",
"let",
"scrollTop",
"=",
"0",
";",
"while",
"(",
"element",
"&&",
"element",
"!==",
"parent",
")",
"{",
"element",
"=",
"element",
".",
"parentNode",
";",
"scrollTop",
"+=",
"element",
".",
"scrollTop",
";",
"}",
"return",
"scrollTop",
";",
"}"
] | Sum the scrollTop between two elements. | [
"Sum",
"the",
"scrollTop",
"between",
"two",
"elements",
"."
] | 1555e52367835946382fbf2a8f681de71318915d | https://github.com/mui-org/material-ui/blob/1555e52367835946382fbf2a8f681de71318915d/packages/material-ui/src/Popover/Popover.js#L53-L62 |
176 | jaywcjlove/linux-command | build/build.js | emptyDir | function emptyDir(dir) {
return new Promise((resolve, reject) => {
FS.emptyDir(dir, err => {
err ? reject(err) : resolve(dir);
})
});
} | javascript | function emptyDir(dir) {
return new Promise((resolve, reject) => {
FS.emptyDir(dir, err => {
err ? reject(err) : resolve(dir);
})
});
} | [
"function",
"emptyDir",
"(",
"dir",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"FS",
".",
"emptyDir",
"(",
"dir",
",",
"err",
"=>",
"{",
"err",
"?",
"reject",
"(",
"err",
")",
":",
"resolve",
"(",
"dir",
")",
";",
"}",
")",
"}",
")",
";",
"}"
] | Empty a directory
@param {String} dir | [
"Empty",
"a",
"directory"
] | 7d6c8c6b3468a0dd5311ee68934c9b8db64469f7 | https://github.com/jaywcjlove/linux-command/blob/7d6c8c6b3468a0dd5311ee68934c9b8db64469f7/build/build.js#L158-L164 |
177 | apache/incubator-echarts | src/scale/Log.js | function (approxTickNum) {
approxTickNum = approxTickNum || 10;
var extent = this._extent;
var span = extent[1] - extent[0];
if (span === Infinity || span <= 0) {
return;
}
var interval = numberUtil.quantity(span);
var err = approxTickNum / span * interval;
// Filter ticks to get closer to the desired count.
if (err <= 0.5) {
interval *= 10;
}
// Interval should be integer
while (!isNaN(interval) && Math.abs(interval) < 1 && Math.abs(interval) > 0) {
interval *= 10;
}
var niceExtent = [
numberUtil.round(mathCeil(extent[0] / interval) * interval),
numberUtil.round(mathFloor(extent[1] / interval) * interval)
];
this._interval = interval;
this._niceExtent = niceExtent;
} | javascript | function (approxTickNum) {
approxTickNum = approxTickNum || 10;
var extent = this._extent;
var span = extent[1] - extent[0];
if (span === Infinity || span <= 0) {
return;
}
var interval = numberUtil.quantity(span);
var err = approxTickNum / span * interval;
// Filter ticks to get closer to the desired count.
if (err <= 0.5) {
interval *= 10;
}
// Interval should be integer
while (!isNaN(interval) && Math.abs(interval) < 1 && Math.abs(interval) > 0) {
interval *= 10;
}
var niceExtent = [
numberUtil.round(mathCeil(extent[0] / interval) * interval),
numberUtil.round(mathFloor(extent[1] / interval) * interval)
];
this._interval = interval;
this._niceExtent = niceExtent;
} | [
"function",
"(",
"approxTickNum",
")",
"{",
"approxTickNum",
"=",
"approxTickNum",
"||",
"10",
";",
"var",
"extent",
"=",
"this",
".",
"_extent",
";",
"var",
"span",
"=",
"extent",
"[",
"1",
"]",
"-",
"extent",
"[",
"0",
"]",
";",
"if",
"(",
"span",
"===",
"Infinity",
"||",
"span",
"<=",
"0",
")",
"{",
"return",
";",
"}",
"var",
"interval",
"=",
"numberUtil",
".",
"quantity",
"(",
"span",
")",
";",
"var",
"err",
"=",
"approxTickNum",
"/",
"span",
"*",
"interval",
";",
"// Filter ticks to get closer to the desired count.",
"if",
"(",
"err",
"<=",
"0.5",
")",
"{",
"interval",
"*=",
"10",
";",
"}",
"// Interval should be integer",
"while",
"(",
"!",
"isNaN",
"(",
"interval",
")",
"&&",
"Math",
".",
"abs",
"(",
"interval",
")",
"<",
"1",
"&&",
"Math",
".",
"abs",
"(",
"interval",
")",
">",
"0",
")",
"{",
"interval",
"*=",
"10",
";",
"}",
"var",
"niceExtent",
"=",
"[",
"numberUtil",
".",
"round",
"(",
"mathCeil",
"(",
"extent",
"[",
"0",
"]",
"/",
"interval",
")",
"*",
"interval",
")",
",",
"numberUtil",
".",
"round",
"(",
"mathFloor",
"(",
"extent",
"[",
"1",
"]",
"/",
"interval",
")",
"*",
"interval",
")",
"]",
";",
"this",
".",
"_interval",
"=",
"interval",
";",
"this",
".",
"_niceExtent",
"=",
"niceExtent",
";",
"}"
] | Update interval and extent of intervals for nice ticks
@param {number} [approxTickNum = 10] Given approx tick number | [
"Update",
"interval",
"and",
"extent",
"of",
"intervals",
"for",
"nice",
"ticks"
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/scale/Log.js#L147-L175 |
|
178 | apache/incubator-echarts | src/scale/Log.js | function (opt) {
intervalScaleProto.niceExtent.call(this, opt);
var originalScale = this._originalScale;
originalScale.__fixMin = opt.fixMin;
originalScale.__fixMax = opt.fixMax;
} | javascript | function (opt) {
intervalScaleProto.niceExtent.call(this, opt);
var originalScale = this._originalScale;
originalScale.__fixMin = opt.fixMin;
originalScale.__fixMax = opt.fixMax;
} | [
"function",
"(",
"opt",
")",
"{",
"intervalScaleProto",
".",
"niceExtent",
".",
"call",
"(",
"this",
",",
"opt",
")",
";",
"var",
"originalScale",
"=",
"this",
".",
"_originalScale",
";",
"originalScale",
".",
"__fixMin",
"=",
"opt",
".",
"fixMin",
";",
"originalScale",
".",
"__fixMax",
"=",
"opt",
".",
"fixMax",
";",
"}"
] | Nice extent.
@override | [
"Nice",
"extent",
"."
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/scale/Log.js#L181-L187 |
|
179 | apache/incubator-echarts | src/data/Tree.js | function (depth) {
var height = 0;
this.depth = depth;
for (var i = 0; i < this.children.length; i++) {
var child = this.children[i];
child.updateDepthAndHeight(depth + 1);
if (child.height > height) {
height = child.height;
}
}
this.height = height + 1;
} | javascript | function (depth) {
var height = 0;
this.depth = depth;
for (var i = 0; i < this.children.length; i++) {
var child = this.children[i];
child.updateDepthAndHeight(depth + 1);
if (child.height > height) {
height = child.height;
}
}
this.height = height + 1;
} | [
"function",
"(",
"depth",
")",
"{",
"var",
"height",
"=",
"0",
";",
"this",
".",
"depth",
"=",
"depth",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"children",
".",
"length",
";",
"i",
"++",
")",
"{",
"var",
"child",
"=",
"this",
".",
"children",
"[",
"i",
"]",
";",
"child",
".",
"updateDepthAndHeight",
"(",
"depth",
"+",
"1",
")",
";",
"if",
"(",
"child",
".",
"height",
">",
"height",
")",
"{",
"height",
"=",
"child",
".",
"height",
";",
"}",
"}",
"this",
".",
"height",
"=",
"height",
"+",
"1",
";",
"}"
] | Update depth and height of this subtree.
@param {number} depth | [
"Update",
"depth",
"and",
"height",
"of",
"this",
"subtree",
"."
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/data/Tree.js#L155-L166 |
|
180 | apache/incubator-echarts | src/data/Tree.js | function (node) {
var parent = node.parentNode;
while (parent) {
if (parent === this) {
return true;
}
parent = parent.parentNode;
}
return false;
} | javascript | function (node) {
var parent = node.parentNode;
while (parent) {
if (parent === this) {
return true;
}
parent = parent.parentNode;
}
return false;
} | [
"function",
"(",
"node",
")",
"{",
"var",
"parent",
"=",
"node",
".",
"parentNode",
";",
"while",
"(",
"parent",
")",
"{",
"if",
"(",
"parent",
"===",
"this",
")",
"{",
"return",
"true",
";",
"}",
"parent",
"=",
"parent",
".",
"parentNode",
";",
"}",
"return",
"false",
";",
"}"
] | if this is an ancestor of another node
@public
@param {TreeNode} node another node
@return {boolean} if is ancestor | [
"if",
"this",
"is",
"an",
"ancestor",
"of",
"another",
"node"
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/data/Tree.js#L314-L323 |
|
181 | apache/incubator-echarts | src/data/Tree.js | function () {
var data = this.data;
var nodes = this._nodes;
for (var i = 0, len = nodes.length; i < len; i++) {
nodes[i].dataIndex = -1;
}
for (var i = 0, len = data.count(); i < len; i++) {
nodes[data.getRawIndex(i)].dataIndex = i;
}
} | javascript | function () {
var data = this.data;
var nodes = this._nodes;
for (var i = 0, len = nodes.length; i < len; i++) {
nodes[i].dataIndex = -1;
}
for (var i = 0, len = data.count(); i < len; i++) {
nodes[data.getRawIndex(i)].dataIndex = i;
}
} | [
"function",
"(",
")",
"{",
"var",
"data",
"=",
"this",
".",
"data",
";",
"var",
"nodes",
"=",
"this",
".",
"_nodes",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"len",
"=",
"nodes",
".",
"length",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"nodes",
"[",
"i",
"]",
".",
"dataIndex",
"=",
"-",
"1",
";",
"}",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"len",
"=",
"data",
".",
"count",
"(",
")",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"nodes",
"[",
"data",
".",
"getRawIndex",
"(",
"i",
")",
"]",
".",
"dataIndex",
"=",
"i",
";",
"}",
"}"
] | Update item available by list,
when list has been performed options like 'filterSelf' or 'map'. | [
"Update",
"item",
"available",
"by",
"list",
"when",
"list",
"has",
"been",
"performed",
"options",
"like",
"filterSelf",
"or",
"map",
"."
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/data/Tree.js#L431-L442 |
|
182 | apache/incubator-echarts | src/data/Tree.js | addChild | function addChild(child, node) {
var children = node.children;
if (child.parentNode === node) {
return;
}
children.push(child);
child.parentNode = node;
} | javascript | function addChild(child, node) {
var children = node.children;
if (child.parentNode === node) {
return;
}
children.push(child);
child.parentNode = node;
} | [
"function",
"addChild",
"(",
"child",
",",
"node",
")",
"{",
"var",
"children",
"=",
"node",
".",
"children",
";",
"if",
"(",
"child",
".",
"parentNode",
"===",
"node",
")",
"{",
"return",
";",
"}",
"children",
".",
"push",
"(",
"child",
")",
";",
"child",
".",
"parentNode",
"=",
"node",
";",
"}"
] | It is needed to consider the mess of 'list', 'hostModel' when creating a TreeNote,
so this function is not ready and not necessary to be public.
@param {(module:echarts/data/Tree~TreeNode|Object)} child | [
"It",
"is",
"needed",
"to",
"consider",
"the",
"mess",
"of",
"list",
"hostModel",
"when",
"creating",
"a",
"TreeNote",
"so",
"this",
"function",
"is",
"not",
"ready",
"and",
"not",
"necessary",
"to",
"be",
"public",
"."
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/data/Tree.js#L531-L539 |
183 | apache/incubator-echarts | src/ExtensionAPI.js | ExtensionAPI | function ExtensionAPI(chartInstance) {
zrUtil.each(echartsAPIList, function (name) {
this[name] = zrUtil.bind(chartInstance[name], chartInstance);
}, this);
} | javascript | function ExtensionAPI(chartInstance) {
zrUtil.each(echartsAPIList, function (name) {
this[name] = zrUtil.bind(chartInstance[name], chartInstance);
}, this);
} | [
"function",
"ExtensionAPI",
"(",
"chartInstance",
")",
"{",
"zrUtil",
".",
"each",
"(",
"echartsAPIList",
",",
"function",
"(",
"name",
")",
"{",
"this",
"[",
"name",
"]",
"=",
"zrUtil",
".",
"bind",
"(",
"chartInstance",
"[",
"name",
"]",
",",
"chartInstance",
")",
";",
"}",
",",
"this",
")",
";",
"}"
] | And `getCoordinateSystems` and `getComponentByElement` will be injected in echarts.js | [
"And",
"getCoordinateSystems",
"and",
"getComponentByElement",
"will",
"be",
"injected",
"in",
"echarts",
".",
"js"
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/ExtensionAPI.js#L29-L33 |
184 | apache/incubator-echarts | src/chart/boxplot/boxplotLayout.js | groupSeriesByAxis | function groupSeriesByAxis(ecModel) {
var result = [];
var axisList = [];
ecModel.eachSeriesByType('boxplot', function (seriesModel) {
var baseAxis = seriesModel.getBaseAxis();
var idx = zrUtil.indexOf(axisList, baseAxis);
if (idx < 0) {
idx = axisList.length;
axisList[idx] = baseAxis;
result[idx] = {axis: baseAxis, seriesModels: []};
}
result[idx].seriesModels.push(seriesModel);
});
return result;
} | javascript | function groupSeriesByAxis(ecModel) {
var result = [];
var axisList = [];
ecModel.eachSeriesByType('boxplot', function (seriesModel) {
var baseAxis = seriesModel.getBaseAxis();
var idx = zrUtil.indexOf(axisList, baseAxis);
if (idx < 0) {
idx = axisList.length;
axisList[idx] = baseAxis;
result[idx] = {axis: baseAxis, seriesModels: []};
}
result[idx].seriesModels.push(seriesModel);
});
return result;
} | [
"function",
"groupSeriesByAxis",
"(",
"ecModel",
")",
"{",
"var",
"result",
"=",
"[",
"]",
";",
"var",
"axisList",
"=",
"[",
"]",
";",
"ecModel",
".",
"eachSeriesByType",
"(",
"'boxplot'",
",",
"function",
"(",
"seriesModel",
")",
"{",
"var",
"baseAxis",
"=",
"seriesModel",
".",
"getBaseAxis",
"(",
")",
";",
"var",
"idx",
"=",
"zrUtil",
".",
"indexOf",
"(",
"axisList",
",",
"baseAxis",
")",
";",
"if",
"(",
"idx",
"<",
"0",
")",
"{",
"idx",
"=",
"axisList",
".",
"length",
";",
"axisList",
"[",
"idx",
"]",
"=",
"baseAxis",
";",
"result",
"[",
"idx",
"]",
"=",
"{",
"axis",
":",
"baseAxis",
",",
"seriesModels",
":",
"[",
"]",
"}",
";",
"}",
"result",
"[",
"idx",
"]",
".",
"seriesModels",
".",
"push",
"(",
"seriesModel",
")",
";",
"}",
")",
";",
"return",
"result",
";",
"}"
] | Group series by axis. | [
"Group",
"series",
"by",
"axis",
"."
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/chart/boxplot/boxplotLayout.js#L51-L69 |
185 | apache/incubator-echarts | src/chart/boxplot/boxplotLayout.js | calculateBase | function calculateBase(groupItem) {
var extent;
var baseAxis = groupItem.axis;
var seriesModels = groupItem.seriesModels;
var seriesCount = seriesModels.length;
var boxWidthList = groupItem.boxWidthList = [];
var boxOffsetList = groupItem.boxOffsetList = [];
var boundList = [];
var bandWidth;
if (baseAxis.type === 'category') {
bandWidth = baseAxis.getBandWidth();
}
else {
var maxDataCount = 0;
each(seriesModels, function (seriesModel) {
maxDataCount = Math.max(maxDataCount, seriesModel.getData().count());
});
extent = baseAxis.getExtent(),
Math.abs(extent[1] - extent[0]) / maxDataCount;
}
each(seriesModels, function (seriesModel) {
var boxWidthBound = seriesModel.get('boxWidth');
if (!zrUtil.isArray(boxWidthBound)) {
boxWidthBound = [boxWidthBound, boxWidthBound];
}
boundList.push([
parsePercent(boxWidthBound[0], bandWidth) || 0,
parsePercent(boxWidthBound[1], bandWidth) || 0
]);
});
var availableWidth = bandWidth * 0.8 - 2;
var boxGap = availableWidth / seriesCount * 0.3;
var boxWidth = (availableWidth - boxGap * (seriesCount - 1)) / seriesCount;
var base = boxWidth / 2 - availableWidth / 2;
each(seriesModels, function (seriesModel, idx) {
boxOffsetList.push(base);
base += boxGap + boxWidth;
boxWidthList.push(
Math.min(Math.max(boxWidth, boundList[idx][0]), boundList[idx][1])
);
});
} | javascript | function calculateBase(groupItem) {
var extent;
var baseAxis = groupItem.axis;
var seriesModels = groupItem.seriesModels;
var seriesCount = seriesModels.length;
var boxWidthList = groupItem.boxWidthList = [];
var boxOffsetList = groupItem.boxOffsetList = [];
var boundList = [];
var bandWidth;
if (baseAxis.type === 'category') {
bandWidth = baseAxis.getBandWidth();
}
else {
var maxDataCount = 0;
each(seriesModels, function (seriesModel) {
maxDataCount = Math.max(maxDataCount, seriesModel.getData().count());
});
extent = baseAxis.getExtent(),
Math.abs(extent[1] - extent[0]) / maxDataCount;
}
each(seriesModels, function (seriesModel) {
var boxWidthBound = seriesModel.get('boxWidth');
if (!zrUtil.isArray(boxWidthBound)) {
boxWidthBound = [boxWidthBound, boxWidthBound];
}
boundList.push([
parsePercent(boxWidthBound[0], bandWidth) || 0,
parsePercent(boxWidthBound[1], bandWidth) || 0
]);
});
var availableWidth = bandWidth * 0.8 - 2;
var boxGap = availableWidth / seriesCount * 0.3;
var boxWidth = (availableWidth - boxGap * (seriesCount - 1)) / seriesCount;
var base = boxWidth / 2 - availableWidth / 2;
each(seriesModels, function (seriesModel, idx) {
boxOffsetList.push(base);
base += boxGap + boxWidth;
boxWidthList.push(
Math.min(Math.max(boxWidth, boundList[idx][0]), boundList[idx][1])
);
});
} | [
"function",
"calculateBase",
"(",
"groupItem",
")",
"{",
"var",
"extent",
";",
"var",
"baseAxis",
"=",
"groupItem",
".",
"axis",
";",
"var",
"seriesModels",
"=",
"groupItem",
".",
"seriesModels",
";",
"var",
"seriesCount",
"=",
"seriesModels",
".",
"length",
";",
"var",
"boxWidthList",
"=",
"groupItem",
".",
"boxWidthList",
"=",
"[",
"]",
";",
"var",
"boxOffsetList",
"=",
"groupItem",
".",
"boxOffsetList",
"=",
"[",
"]",
";",
"var",
"boundList",
"=",
"[",
"]",
";",
"var",
"bandWidth",
";",
"if",
"(",
"baseAxis",
".",
"type",
"===",
"'category'",
")",
"{",
"bandWidth",
"=",
"baseAxis",
".",
"getBandWidth",
"(",
")",
";",
"}",
"else",
"{",
"var",
"maxDataCount",
"=",
"0",
";",
"each",
"(",
"seriesModels",
",",
"function",
"(",
"seriesModel",
")",
"{",
"maxDataCount",
"=",
"Math",
".",
"max",
"(",
"maxDataCount",
",",
"seriesModel",
".",
"getData",
"(",
")",
".",
"count",
"(",
")",
")",
";",
"}",
")",
";",
"extent",
"=",
"baseAxis",
".",
"getExtent",
"(",
")",
",",
"Math",
".",
"abs",
"(",
"extent",
"[",
"1",
"]",
"-",
"extent",
"[",
"0",
"]",
")",
"/",
"maxDataCount",
";",
"}",
"each",
"(",
"seriesModels",
",",
"function",
"(",
"seriesModel",
")",
"{",
"var",
"boxWidthBound",
"=",
"seriesModel",
".",
"get",
"(",
"'boxWidth'",
")",
";",
"if",
"(",
"!",
"zrUtil",
".",
"isArray",
"(",
"boxWidthBound",
")",
")",
"{",
"boxWidthBound",
"=",
"[",
"boxWidthBound",
",",
"boxWidthBound",
"]",
";",
"}",
"boundList",
".",
"push",
"(",
"[",
"parsePercent",
"(",
"boxWidthBound",
"[",
"0",
"]",
",",
"bandWidth",
")",
"||",
"0",
",",
"parsePercent",
"(",
"boxWidthBound",
"[",
"1",
"]",
",",
"bandWidth",
")",
"||",
"0",
"]",
")",
";",
"}",
")",
";",
"var",
"availableWidth",
"=",
"bandWidth",
"*",
"0.8",
"-",
"2",
";",
"var",
"boxGap",
"=",
"availableWidth",
"/",
"seriesCount",
"*",
"0.3",
";",
"var",
"boxWidth",
"=",
"(",
"availableWidth",
"-",
"boxGap",
"*",
"(",
"seriesCount",
"-",
"1",
")",
")",
"/",
"seriesCount",
";",
"var",
"base",
"=",
"boxWidth",
"/",
"2",
"-",
"availableWidth",
"/",
"2",
";",
"each",
"(",
"seriesModels",
",",
"function",
"(",
"seriesModel",
",",
"idx",
")",
"{",
"boxOffsetList",
".",
"push",
"(",
"base",
")",
";",
"base",
"+=",
"boxGap",
"+",
"boxWidth",
";",
"boxWidthList",
".",
"push",
"(",
"Math",
".",
"min",
"(",
"Math",
".",
"max",
"(",
"boxWidth",
",",
"boundList",
"[",
"idx",
"]",
"[",
"0",
"]",
")",
",",
"boundList",
"[",
"idx",
"]",
"[",
"1",
"]",
")",
")",
";",
"}",
")",
";",
"}"
] | Calculate offset and box width for each series. | [
"Calculate",
"offset",
"and",
"box",
"width",
"for",
"each",
"series",
"."
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/chart/boxplot/boxplotLayout.js#L74-L121 |
186 | apache/incubator-echarts | src/chart/boxplot/boxplotLayout.js | layoutSingleSeries | function layoutSingleSeries(seriesModel, offset, boxWidth) {
var coordSys = seriesModel.coordinateSystem;
var data = seriesModel.getData();
var halfWidth = boxWidth / 2;
var cDimIdx = seriesModel.get('layout') === 'horizontal' ? 0 : 1;
var vDimIdx = 1 - cDimIdx;
var coordDims = ['x', 'y'];
var cDim = data.mapDimension(coordDims[cDimIdx]);
var vDims = data.mapDimension(coordDims[vDimIdx], true);
if (cDim == null || vDims.length < 5) {
return;
}
for (var dataIndex = 0; dataIndex < data.count(); dataIndex++) {
var axisDimVal = data.get(cDim, dataIndex);
var median = getPoint(axisDimVal, vDims[2], dataIndex);
var end1 = getPoint(axisDimVal, vDims[0], dataIndex);
var end2 = getPoint(axisDimVal, vDims[1], dataIndex);
var end4 = getPoint(axisDimVal, vDims[3], dataIndex);
var end5 = getPoint(axisDimVal, vDims[4], dataIndex);
var ends = [];
addBodyEnd(ends, end2, 0);
addBodyEnd(ends, end4, 1);
ends.push(end1, end2, end5, end4);
layEndLine(ends, end1);
layEndLine(ends, end5);
layEndLine(ends, median);
data.setItemLayout(dataIndex, {
initBaseline: median[vDimIdx],
ends: ends
});
}
function getPoint(axisDimVal, dimIdx, dataIndex) {
var val = data.get(dimIdx, dataIndex);
var p = [];
p[cDimIdx] = axisDimVal;
p[vDimIdx] = val;
var point;
if (isNaN(axisDimVal) || isNaN(val)) {
point = [NaN, NaN];
}
else {
point = coordSys.dataToPoint(p);
point[cDimIdx] += offset;
}
return point;
}
function addBodyEnd(ends, point, start) {
var point1 = point.slice();
var point2 = point.slice();
point1[cDimIdx] += halfWidth;
point2[cDimIdx] -= halfWidth;
start
? ends.push(point1, point2)
: ends.push(point2, point1);
}
function layEndLine(ends, endCenter) {
var from = endCenter.slice();
var to = endCenter.slice();
from[cDimIdx] -= halfWidth;
to[cDimIdx] += halfWidth;
ends.push(from, to);
}
} | javascript | function layoutSingleSeries(seriesModel, offset, boxWidth) {
var coordSys = seriesModel.coordinateSystem;
var data = seriesModel.getData();
var halfWidth = boxWidth / 2;
var cDimIdx = seriesModel.get('layout') === 'horizontal' ? 0 : 1;
var vDimIdx = 1 - cDimIdx;
var coordDims = ['x', 'y'];
var cDim = data.mapDimension(coordDims[cDimIdx]);
var vDims = data.mapDimension(coordDims[vDimIdx], true);
if (cDim == null || vDims.length < 5) {
return;
}
for (var dataIndex = 0; dataIndex < data.count(); dataIndex++) {
var axisDimVal = data.get(cDim, dataIndex);
var median = getPoint(axisDimVal, vDims[2], dataIndex);
var end1 = getPoint(axisDimVal, vDims[0], dataIndex);
var end2 = getPoint(axisDimVal, vDims[1], dataIndex);
var end4 = getPoint(axisDimVal, vDims[3], dataIndex);
var end5 = getPoint(axisDimVal, vDims[4], dataIndex);
var ends = [];
addBodyEnd(ends, end2, 0);
addBodyEnd(ends, end4, 1);
ends.push(end1, end2, end5, end4);
layEndLine(ends, end1);
layEndLine(ends, end5);
layEndLine(ends, median);
data.setItemLayout(dataIndex, {
initBaseline: median[vDimIdx],
ends: ends
});
}
function getPoint(axisDimVal, dimIdx, dataIndex) {
var val = data.get(dimIdx, dataIndex);
var p = [];
p[cDimIdx] = axisDimVal;
p[vDimIdx] = val;
var point;
if (isNaN(axisDimVal) || isNaN(val)) {
point = [NaN, NaN];
}
else {
point = coordSys.dataToPoint(p);
point[cDimIdx] += offset;
}
return point;
}
function addBodyEnd(ends, point, start) {
var point1 = point.slice();
var point2 = point.slice();
point1[cDimIdx] += halfWidth;
point2[cDimIdx] -= halfWidth;
start
? ends.push(point1, point2)
: ends.push(point2, point1);
}
function layEndLine(ends, endCenter) {
var from = endCenter.slice();
var to = endCenter.slice();
from[cDimIdx] -= halfWidth;
to[cDimIdx] += halfWidth;
ends.push(from, to);
}
} | [
"function",
"layoutSingleSeries",
"(",
"seriesModel",
",",
"offset",
",",
"boxWidth",
")",
"{",
"var",
"coordSys",
"=",
"seriesModel",
".",
"coordinateSystem",
";",
"var",
"data",
"=",
"seriesModel",
".",
"getData",
"(",
")",
";",
"var",
"halfWidth",
"=",
"boxWidth",
"/",
"2",
";",
"var",
"cDimIdx",
"=",
"seriesModel",
".",
"get",
"(",
"'layout'",
")",
"===",
"'horizontal'",
"?",
"0",
":",
"1",
";",
"var",
"vDimIdx",
"=",
"1",
"-",
"cDimIdx",
";",
"var",
"coordDims",
"=",
"[",
"'x'",
",",
"'y'",
"]",
";",
"var",
"cDim",
"=",
"data",
".",
"mapDimension",
"(",
"coordDims",
"[",
"cDimIdx",
"]",
")",
";",
"var",
"vDims",
"=",
"data",
".",
"mapDimension",
"(",
"coordDims",
"[",
"vDimIdx",
"]",
",",
"true",
")",
";",
"if",
"(",
"cDim",
"==",
"null",
"||",
"vDims",
".",
"length",
"<",
"5",
")",
"{",
"return",
";",
"}",
"for",
"(",
"var",
"dataIndex",
"=",
"0",
";",
"dataIndex",
"<",
"data",
".",
"count",
"(",
")",
";",
"dataIndex",
"++",
")",
"{",
"var",
"axisDimVal",
"=",
"data",
".",
"get",
"(",
"cDim",
",",
"dataIndex",
")",
";",
"var",
"median",
"=",
"getPoint",
"(",
"axisDimVal",
",",
"vDims",
"[",
"2",
"]",
",",
"dataIndex",
")",
";",
"var",
"end1",
"=",
"getPoint",
"(",
"axisDimVal",
",",
"vDims",
"[",
"0",
"]",
",",
"dataIndex",
")",
";",
"var",
"end2",
"=",
"getPoint",
"(",
"axisDimVal",
",",
"vDims",
"[",
"1",
"]",
",",
"dataIndex",
")",
";",
"var",
"end4",
"=",
"getPoint",
"(",
"axisDimVal",
",",
"vDims",
"[",
"3",
"]",
",",
"dataIndex",
")",
";",
"var",
"end5",
"=",
"getPoint",
"(",
"axisDimVal",
",",
"vDims",
"[",
"4",
"]",
",",
"dataIndex",
")",
";",
"var",
"ends",
"=",
"[",
"]",
";",
"addBodyEnd",
"(",
"ends",
",",
"end2",
",",
"0",
")",
";",
"addBodyEnd",
"(",
"ends",
",",
"end4",
",",
"1",
")",
";",
"ends",
".",
"push",
"(",
"end1",
",",
"end2",
",",
"end5",
",",
"end4",
")",
";",
"layEndLine",
"(",
"ends",
",",
"end1",
")",
";",
"layEndLine",
"(",
"ends",
",",
"end5",
")",
";",
"layEndLine",
"(",
"ends",
",",
"median",
")",
";",
"data",
".",
"setItemLayout",
"(",
"dataIndex",
",",
"{",
"initBaseline",
":",
"median",
"[",
"vDimIdx",
"]",
",",
"ends",
":",
"ends",
"}",
")",
";",
"}",
"function",
"getPoint",
"(",
"axisDimVal",
",",
"dimIdx",
",",
"dataIndex",
")",
"{",
"var",
"val",
"=",
"data",
".",
"get",
"(",
"dimIdx",
",",
"dataIndex",
")",
";",
"var",
"p",
"=",
"[",
"]",
";",
"p",
"[",
"cDimIdx",
"]",
"=",
"axisDimVal",
";",
"p",
"[",
"vDimIdx",
"]",
"=",
"val",
";",
"var",
"point",
";",
"if",
"(",
"isNaN",
"(",
"axisDimVal",
")",
"||",
"isNaN",
"(",
"val",
")",
")",
"{",
"point",
"=",
"[",
"NaN",
",",
"NaN",
"]",
";",
"}",
"else",
"{",
"point",
"=",
"coordSys",
".",
"dataToPoint",
"(",
"p",
")",
";",
"point",
"[",
"cDimIdx",
"]",
"+=",
"offset",
";",
"}",
"return",
"point",
";",
"}",
"function",
"addBodyEnd",
"(",
"ends",
",",
"point",
",",
"start",
")",
"{",
"var",
"point1",
"=",
"point",
".",
"slice",
"(",
")",
";",
"var",
"point2",
"=",
"point",
".",
"slice",
"(",
")",
";",
"point1",
"[",
"cDimIdx",
"]",
"+=",
"halfWidth",
";",
"point2",
"[",
"cDimIdx",
"]",
"-=",
"halfWidth",
";",
"start",
"?",
"ends",
".",
"push",
"(",
"point1",
",",
"point2",
")",
":",
"ends",
".",
"push",
"(",
"point2",
",",
"point1",
")",
";",
"}",
"function",
"layEndLine",
"(",
"ends",
",",
"endCenter",
")",
"{",
"var",
"from",
"=",
"endCenter",
".",
"slice",
"(",
")",
";",
"var",
"to",
"=",
"endCenter",
".",
"slice",
"(",
")",
";",
"from",
"[",
"cDimIdx",
"]",
"-=",
"halfWidth",
";",
"to",
"[",
"cDimIdx",
"]",
"+=",
"halfWidth",
";",
"ends",
".",
"push",
"(",
"from",
",",
"to",
")",
";",
"}",
"}"
] | Calculate points location for each series. | [
"Calculate",
"points",
"location",
"for",
"each",
"series",
"."
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/chart/boxplot/boxplotLayout.js#L126-L197 |
187 | apache/incubator-echarts | src/component/axisPointer/viewHelper.js | confineInContainer | function confineInContainer(position, width, height, api) {
var viewWidth = api.getWidth();
var viewHeight = api.getHeight();
position[0] = Math.min(position[0] + width, viewWidth) - width;
position[1] = Math.min(position[1] + height, viewHeight) - height;
position[0] = Math.max(position[0], 0);
position[1] = Math.max(position[1], 0);
} | javascript | function confineInContainer(position, width, height, api) {
var viewWidth = api.getWidth();
var viewHeight = api.getHeight();
position[0] = Math.min(position[0] + width, viewWidth) - width;
position[1] = Math.min(position[1] + height, viewHeight) - height;
position[0] = Math.max(position[0], 0);
position[1] = Math.max(position[1], 0);
} | [
"function",
"confineInContainer",
"(",
"position",
",",
"width",
",",
"height",
",",
"api",
")",
"{",
"var",
"viewWidth",
"=",
"api",
".",
"getWidth",
"(",
")",
";",
"var",
"viewHeight",
"=",
"api",
".",
"getHeight",
"(",
")",
";",
"position",
"[",
"0",
"]",
"=",
"Math",
".",
"min",
"(",
"position",
"[",
"0",
"]",
"+",
"width",
",",
"viewWidth",
")",
"-",
"width",
";",
"position",
"[",
"1",
"]",
"=",
"Math",
".",
"min",
"(",
"position",
"[",
"1",
"]",
"+",
"height",
",",
"viewHeight",
")",
"-",
"height",
";",
"position",
"[",
"0",
"]",
"=",
"Math",
".",
"max",
"(",
"position",
"[",
"0",
"]",
",",
"0",
")",
";",
"position",
"[",
"1",
"]",
"=",
"Math",
".",
"max",
"(",
"position",
"[",
"1",
"]",
",",
"0",
")",
";",
"}"
] | Do not overflow ec container | [
"Do",
"not",
"overflow",
"ec",
"container"
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/component/axisPointer/viewHelper.js#L110-L117 |
188 | apache/incubator-echarts | src/component/marker/markerHelper.js | markerTypeCalculatorWithExtent | function markerTypeCalculatorWithExtent(
mlType, data, otherDataDim, targetDataDim, otherCoordIndex, targetCoordIndex
) {
var coordArr = [];
var stacked = isDimensionStacked(data, targetDataDim /*, otherDataDim*/);
var calcDataDim = stacked
? data.getCalculationInfo('stackResultDimension')
: targetDataDim;
var value = numCalculate(data, calcDataDim, mlType);
var dataIndex = data.indicesOfNearest(calcDataDim, value)[0];
coordArr[otherCoordIndex] = data.get(otherDataDim, dataIndex);
coordArr[targetCoordIndex] = data.get(targetDataDim, dataIndex);
// Make it simple, do not visit all stacked value to count precision.
var precision = numberUtil.getPrecision(data.get(targetDataDim, dataIndex));
precision = Math.min(precision, 20);
if (precision >= 0) {
coordArr[targetCoordIndex] = +coordArr[targetCoordIndex].toFixed(precision);
}
return coordArr;
} | javascript | function markerTypeCalculatorWithExtent(
mlType, data, otherDataDim, targetDataDim, otherCoordIndex, targetCoordIndex
) {
var coordArr = [];
var stacked = isDimensionStacked(data, targetDataDim /*, otherDataDim*/);
var calcDataDim = stacked
? data.getCalculationInfo('stackResultDimension')
: targetDataDim;
var value = numCalculate(data, calcDataDim, mlType);
var dataIndex = data.indicesOfNearest(calcDataDim, value)[0];
coordArr[otherCoordIndex] = data.get(otherDataDim, dataIndex);
coordArr[targetCoordIndex] = data.get(targetDataDim, dataIndex);
// Make it simple, do not visit all stacked value to count precision.
var precision = numberUtil.getPrecision(data.get(targetDataDim, dataIndex));
precision = Math.min(precision, 20);
if (precision >= 0) {
coordArr[targetCoordIndex] = +coordArr[targetCoordIndex].toFixed(precision);
}
return coordArr;
} | [
"function",
"markerTypeCalculatorWithExtent",
"(",
"mlType",
",",
"data",
",",
"otherDataDim",
",",
"targetDataDim",
",",
"otherCoordIndex",
",",
"targetCoordIndex",
")",
"{",
"var",
"coordArr",
"=",
"[",
"]",
";",
"var",
"stacked",
"=",
"isDimensionStacked",
"(",
"data",
",",
"targetDataDim",
"/*, otherDataDim*/",
")",
";",
"var",
"calcDataDim",
"=",
"stacked",
"?",
"data",
".",
"getCalculationInfo",
"(",
"'stackResultDimension'",
")",
":",
"targetDataDim",
";",
"var",
"value",
"=",
"numCalculate",
"(",
"data",
",",
"calcDataDim",
",",
"mlType",
")",
";",
"var",
"dataIndex",
"=",
"data",
".",
"indicesOfNearest",
"(",
"calcDataDim",
",",
"value",
")",
"[",
"0",
"]",
";",
"coordArr",
"[",
"otherCoordIndex",
"]",
"=",
"data",
".",
"get",
"(",
"otherDataDim",
",",
"dataIndex",
")",
";",
"coordArr",
"[",
"targetCoordIndex",
"]",
"=",
"data",
".",
"get",
"(",
"targetDataDim",
",",
"dataIndex",
")",
";",
"// Make it simple, do not visit all stacked value to count precision.",
"var",
"precision",
"=",
"numberUtil",
".",
"getPrecision",
"(",
"data",
".",
"get",
"(",
"targetDataDim",
",",
"dataIndex",
")",
")",
";",
"precision",
"=",
"Math",
".",
"min",
"(",
"precision",
",",
"20",
")",
";",
"if",
"(",
"precision",
">=",
"0",
")",
"{",
"coordArr",
"[",
"targetCoordIndex",
"]",
"=",
"+",
"coordArr",
"[",
"targetCoordIndex",
"]",
".",
"toFixed",
"(",
"precision",
")",
";",
"}",
"return",
"coordArr",
";",
"}"
] | return precision; } | [
"return",
"precision",
";",
"}"
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/component/marker/markerHelper.js#L58-L82 |
189 | apache/incubator-echarts | src/model/Series.js | function (option, ecModel) {
var layoutMode = this.layoutMode;
var inputPositionParams = layoutMode
? getLayoutParams(option) : {};
// Backward compat: using subType on theme.
// But if name duplicate between series subType
// (for example: parallel) add component mainType,
// add suffix 'Series'.
var themeSubType = this.subType;
if (ComponentModel.hasClass(themeSubType)) {
themeSubType += 'Series';
}
zrUtil.merge(
option,
ecModel.getTheme().get(this.subType)
);
zrUtil.merge(option, this.getDefaultOption());
// Default label emphasis `show`
modelUtil.defaultEmphasis(option, 'label', ['show']);
this.fillDataTextStyle(option.data);
if (layoutMode) {
mergeLayoutParam(option, inputPositionParams, layoutMode);
}
} | javascript | function (option, ecModel) {
var layoutMode = this.layoutMode;
var inputPositionParams = layoutMode
? getLayoutParams(option) : {};
// Backward compat: using subType on theme.
// But if name duplicate between series subType
// (for example: parallel) add component mainType,
// add suffix 'Series'.
var themeSubType = this.subType;
if (ComponentModel.hasClass(themeSubType)) {
themeSubType += 'Series';
}
zrUtil.merge(
option,
ecModel.getTheme().get(this.subType)
);
zrUtil.merge(option, this.getDefaultOption());
// Default label emphasis `show`
modelUtil.defaultEmphasis(option, 'label', ['show']);
this.fillDataTextStyle(option.data);
if (layoutMode) {
mergeLayoutParam(option, inputPositionParams, layoutMode);
}
} | [
"function",
"(",
"option",
",",
"ecModel",
")",
"{",
"var",
"layoutMode",
"=",
"this",
".",
"layoutMode",
";",
"var",
"inputPositionParams",
"=",
"layoutMode",
"?",
"getLayoutParams",
"(",
"option",
")",
":",
"{",
"}",
";",
"// Backward compat: using subType on theme.",
"// But if name duplicate between series subType",
"// (for example: parallel) add component mainType,",
"// add suffix 'Series'.",
"var",
"themeSubType",
"=",
"this",
".",
"subType",
";",
"if",
"(",
"ComponentModel",
".",
"hasClass",
"(",
"themeSubType",
")",
")",
"{",
"themeSubType",
"+=",
"'Series'",
";",
"}",
"zrUtil",
".",
"merge",
"(",
"option",
",",
"ecModel",
".",
"getTheme",
"(",
")",
".",
"get",
"(",
"this",
".",
"subType",
")",
")",
";",
"zrUtil",
".",
"merge",
"(",
"option",
",",
"this",
".",
"getDefaultOption",
"(",
")",
")",
";",
"// Default label emphasis `show`",
"modelUtil",
".",
"defaultEmphasis",
"(",
"option",
",",
"'label'",
",",
"[",
"'show'",
"]",
")",
";",
"this",
".",
"fillDataTextStyle",
"(",
"option",
".",
"data",
")",
";",
"if",
"(",
"layoutMode",
")",
"{",
"mergeLayoutParam",
"(",
"option",
",",
"inputPositionParams",
",",
"layoutMode",
")",
";",
"}",
"}"
] | Util for merge default and theme to option
@param {Object} option
@param {module:echarts/model/Global} ecModel | [
"Util",
"for",
"merge",
"default",
"and",
"theme",
"to",
"option"
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/model/Series.js#L137-L164 |
|
190 | apache/incubator-echarts | src/model/Series.js | autoSeriesName | function autoSeriesName(seriesModel) {
// User specified name has higher priority, otherwise it may cause
// series can not be queried unexpectedly.
var name = seriesModel.name;
if (!modelUtil.isNameSpecified(seriesModel)) {
seriesModel.name = getSeriesAutoName(seriesModel) || name;
}
} | javascript | function autoSeriesName(seriesModel) {
// User specified name has higher priority, otherwise it may cause
// series can not be queried unexpectedly.
var name = seriesModel.name;
if (!modelUtil.isNameSpecified(seriesModel)) {
seriesModel.name = getSeriesAutoName(seriesModel) || name;
}
} | [
"function",
"autoSeriesName",
"(",
"seriesModel",
")",
"{",
"// User specified name has higher priority, otherwise it may cause",
"// series can not be queried unexpectedly.",
"var",
"name",
"=",
"seriesModel",
".",
"name",
";",
"if",
"(",
"!",
"modelUtil",
".",
"isNameSpecified",
"(",
"seriesModel",
")",
")",
"{",
"seriesModel",
".",
"name",
"=",
"getSeriesAutoName",
"(",
"seriesModel",
")",
"||",
"name",
";",
"}",
"}"
] | MUST be called after `prepareSource` called
Here we need to make auto series, especially for auto legend. But we
do not modify series.name in option to avoid side effects. | [
"MUST",
"be",
"called",
"after",
"prepareSource",
"called",
"Here",
"we",
"need",
"to",
"make",
"auto",
"series",
"especially",
"for",
"auto",
"legend",
".",
"But",
"we",
"do",
"not",
"modify",
"series",
".",
"name",
"in",
"option",
"to",
"avoid",
"side",
"effects",
"."
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/model/Series.js#L550-L557 |
191 | apache/incubator-echarts | src/chart/bar/BarView.js | getLineWidth | function getLineWidth(itemModel, rawLayout) {
var lineWidth = itemModel.get(BAR_BORDER_WIDTH_QUERY) || 0;
return Math.min(lineWidth, Math.abs(rawLayout.width), Math.abs(rawLayout.height));
} | javascript | function getLineWidth(itemModel, rawLayout) {
var lineWidth = itemModel.get(BAR_BORDER_WIDTH_QUERY) || 0;
return Math.min(lineWidth, Math.abs(rawLayout.width), Math.abs(rawLayout.height));
} | [
"function",
"getLineWidth",
"(",
"itemModel",
",",
"rawLayout",
")",
"{",
"var",
"lineWidth",
"=",
"itemModel",
".",
"get",
"(",
"BAR_BORDER_WIDTH_QUERY",
")",
"||",
"0",
";",
"return",
"Math",
".",
"min",
"(",
"lineWidth",
",",
"Math",
".",
"abs",
"(",
"rawLayout",
".",
"width",
")",
",",
"Math",
".",
"abs",
"(",
"rawLayout",
".",
"height",
")",
")",
";",
"}"
] | In case width or height are too small. | [
"In",
"case",
"width",
"or",
"height",
"are",
"too",
"small",
"."
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/chart/bar/BarView.js#L335-L338 |
192 | apache/incubator-echarts | src/coord/geo/geoCreator.js | resizeGeo | function resizeGeo(geoModel, api) {
var boundingCoords = geoModel.get('boundingCoords');
if (boundingCoords != null) {
var leftTop = boundingCoords[0];
var rightBottom = boundingCoords[1];
if (isNaN(leftTop[0]) || isNaN(leftTop[1]) || isNaN(rightBottom[0]) || isNaN(rightBottom[1])) {
if (__DEV__) {
console.error('Invalid boundingCoords');
}
}
else {
this.setBoundingRect(leftTop[0], leftTop[1], rightBottom[0] - leftTop[0], rightBottom[1] - leftTop[1]);
}
}
var rect = this.getBoundingRect();
var boxLayoutOption;
var center = geoModel.get('layoutCenter');
var size = geoModel.get('layoutSize');
var viewWidth = api.getWidth();
var viewHeight = api.getHeight();
var aspect = rect.width / rect.height * this.aspectScale;
var useCenterAndSize = false;
if (center && size) {
center = [
numberUtil.parsePercent(center[0], viewWidth),
numberUtil.parsePercent(center[1], viewHeight)
];
size = numberUtil.parsePercent(size, Math.min(viewWidth, viewHeight));
if (!isNaN(center[0]) && !isNaN(center[1]) && !isNaN(size)) {
useCenterAndSize = true;
}
else {
if (__DEV__) {
console.warn('Given layoutCenter or layoutSize data are invalid. Use left/top/width/height instead.');
}
}
}
var viewRect;
if (useCenterAndSize) {
var viewRect = {};
if (aspect > 1) {
// Width is same with size
viewRect.width = size;
viewRect.height = size / aspect;
}
else {
viewRect.height = size;
viewRect.width = size * aspect;
}
viewRect.y = center[1] - viewRect.height / 2;
viewRect.x = center[0] - viewRect.width / 2;
}
else {
// Use left/top/width/height
boxLayoutOption = geoModel.getBoxLayoutParams();
// 0.75 rate
boxLayoutOption.aspect = aspect;
viewRect = layout.getLayoutRect(boxLayoutOption, {
width: viewWidth,
height: viewHeight
});
}
this.setViewRect(viewRect.x, viewRect.y, viewRect.width, viewRect.height);
this.setCenter(geoModel.get('center'));
this.setZoom(geoModel.get('zoom'));
} | javascript | function resizeGeo(geoModel, api) {
var boundingCoords = geoModel.get('boundingCoords');
if (boundingCoords != null) {
var leftTop = boundingCoords[0];
var rightBottom = boundingCoords[1];
if (isNaN(leftTop[0]) || isNaN(leftTop[1]) || isNaN(rightBottom[0]) || isNaN(rightBottom[1])) {
if (__DEV__) {
console.error('Invalid boundingCoords');
}
}
else {
this.setBoundingRect(leftTop[0], leftTop[1], rightBottom[0] - leftTop[0], rightBottom[1] - leftTop[1]);
}
}
var rect = this.getBoundingRect();
var boxLayoutOption;
var center = geoModel.get('layoutCenter');
var size = geoModel.get('layoutSize');
var viewWidth = api.getWidth();
var viewHeight = api.getHeight();
var aspect = rect.width / rect.height * this.aspectScale;
var useCenterAndSize = false;
if (center && size) {
center = [
numberUtil.parsePercent(center[0], viewWidth),
numberUtil.parsePercent(center[1], viewHeight)
];
size = numberUtil.parsePercent(size, Math.min(viewWidth, viewHeight));
if (!isNaN(center[0]) && !isNaN(center[1]) && !isNaN(size)) {
useCenterAndSize = true;
}
else {
if (__DEV__) {
console.warn('Given layoutCenter or layoutSize data are invalid. Use left/top/width/height instead.');
}
}
}
var viewRect;
if (useCenterAndSize) {
var viewRect = {};
if (aspect > 1) {
// Width is same with size
viewRect.width = size;
viewRect.height = size / aspect;
}
else {
viewRect.height = size;
viewRect.width = size * aspect;
}
viewRect.y = center[1] - viewRect.height / 2;
viewRect.x = center[0] - viewRect.width / 2;
}
else {
// Use left/top/width/height
boxLayoutOption = geoModel.getBoxLayoutParams();
// 0.75 rate
boxLayoutOption.aspect = aspect;
viewRect = layout.getLayoutRect(boxLayoutOption, {
width: viewWidth,
height: viewHeight
});
}
this.setViewRect(viewRect.x, viewRect.y, viewRect.width, viewRect.height);
this.setCenter(geoModel.get('center'));
this.setZoom(geoModel.get('zoom'));
} | [
"function",
"resizeGeo",
"(",
"geoModel",
",",
"api",
")",
"{",
"var",
"boundingCoords",
"=",
"geoModel",
".",
"get",
"(",
"'boundingCoords'",
")",
";",
"if",
"(",
"boundingCoords",
"!=",
"null",
")",
"{",
"var",
"leftTop",
"=",
"boundingCoords",
"[",
"0",
"]",
";",
"var",
"rightBottom",
"=",
"boundingCoords",
"[",
"1",
"]",
";",
"if",
"(",
"isNaN",
"(",
"leftTop",
"[",
"0",
"]",
")",
"||",
"isNaN",
"(",
"leftTop",
"[",
"1",
"]",
")",
"||",
"isNaN",
"(",
"rightBottom",
"[",
"0",
"]",
")",
"||",
"isNaN",
"(",
"rightBottom",
"[",
"1",
"]",
")",
")",
"{",
"if",
"(",
"__DEV__",
")",
"{",
"console",
".",
"error",
"(",
"'Invalid boundingCoords'",
")",
";",
"}",
"}",
"else",
"{",
"this",
".",
"setBoundingRect",
"(",
"leftTop",
"[",
"0",
"]",
",",
"leftTop",
"[",
"1",
"]",
",",
"rightBottom",
"[",
"0",
"]",
"-",
"leftTop",
"[",
"0",
"]",
",",
"rightBottom",
"[",
"1",
"]",
"-",
"leftTop",
"[",
"1",
"]",
")",
";",
"}",
"}",
"var",
"rect",
"=",
"this",
".",
"getBoundingRect",
"(",
")",
";",
"var",
"boxLayoutOption",
";",
"var",
"center",
"=",
"geoModel",
".",
"get",
"(",
"'layoutCenter'",
")",
";",
"var",
"size",
"=",
"geoModel",
".",
"get",
"(",
"'layoutSize'",
")",
";",
"var",
"viewWidth",
"=",
"api",
".",
"getWidth",
"(",
")",
";",
"var",
"viewHeight",
"=",
"api",
".",
"getHeight",
"(",
")",
";",
"var",
"aspect",
"=",
"rect",
".",
"width",
"/",
"rect",
".",
"height",
"*",
"this",
".",
"aspectScale",
";",
"var",
"useCenterAndSize",
"=",
"false",
";",
"if",
"(",
"center",
"&&",
"size",
")",
"{",
"center",
"=",
"[",
"numberUtil",
".",
"parsePercent",
"(",
"center",
"[",
"0",
"]",
",",
"viewWidth",
")",
",",
"numberUtil",
".",
"parsePercent",
"(",
"center",
"[",
"1",
"]",
",",
"viewHeight",
")",
"]",
";",
"size",
"=",
"numberUtil",
".",
"parsePercent",
"(",
"size",
",",
"Math",
".",
"min",
"(",
"viewWidth",
",",
"viewHeight",
")",
")",
";",
"if",
"(",
"!",
"isNaN",
"(",
"center",
"[",
"0",
"]",
")",
"&&",
"!",
"isNaN",
"(",
"center",
"[",
"1",
"]",
")",
"&&",
"!",
"isNaN",
"(",
"size",
")",
")",
"{",
"useCenterAndSize",
"=",
"true",
";",
"}",
"else",
"{",
"if",
"(",
"__DEV__",
")",
"{",
"console",
".",
"warn",
"(",
"'Given layoutCenter or layoutSize data are invalid. Use left/top/width/height instead.'",
")",
";",
"}",
"}",
"}",
"var",
"viewRect",
";",
"if",
"(",
"useCenterAndSize",
")",
"{",
"var",
"viewRect",
"=",
"{",
"}",
";",
"if",
"(",
"aspect",
">",
"1",
")",
"{",
"// Width is same with size",
"viewRect",
".",
"width",
"=",
"size",
";",
"viewRect",
".",
"height",
"=",
"size",
"/",
"aspect",
";",
"}",
"else",
"{",
"viewRect",
".",
"height",
"=",
"size",
";",
"viewRect",
".",
"width",
"=",
"size",
"*",
"aspect",
";",
"}",
"viewRect",
".",
"y",
"=",
"center",
"[",
"1",
"]",
"-",
"viewRect",
".",
"height",
"/",
"2",
";",
"viewRect",
".",
"x",
"=",
"center",
"[",
"0",
"]",
"-",
"viewRect",
".",
"width",
"/",
"2",
";",
"}",
"else",
"{",
"// Use left/top/width/height",
"boxLayoutOption",
"=",
"geoModel",
".",
"getBoxLayoutParams",
"(",
")",
";",
"// 0.75 rate",
"boxLayoutOption",
".",
"aspect",
"=",
"aspect",
";",
"viewRect",
"=",
"layout",
".",
"getLayoutRect",
"(",
"boxLayoutOption",
",",
"{",
"width",
":",
"viewWidth",
",",
"height",
":",
"viewHeight",
"}",
")",
";",
"}",
"this",
".",
"setViewRect",
"(",
"viewRect",
".",
"x",
",",
"viewRect",
".",
"y",
",",
"viewRect",
".",
"width",
",",
"viewRect",
".",
"height",
")",
";",
"this",
".",
"setCenter",
"(",
"geoModel",
".",
"get",
"(",
"'center'",
")",
")",
";",
"this",
".",
"setZoom",
"(",
"geoModel",
".",
"get",
"(",
"'zoom'",
")",
")",
";",
"}"
] | Resize method bound to the geo
@param {module:echarts/coord/geo/GeoModel|module:echarts/chart/map/MapModel} geoModel
@param {module:echarts/ExtensionAPI} api | [
"Resize",
"method",
"bound",
"to",
"the",
"geo"
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/coord/geo/geoCreator.js#L34-L113 |
193 | apache/incubator-echarts | src/coord/geo/geoCreator.js | function (originRegionArr, mapName, nameMap) {
// Not use the original
var regionsArr = (originRegionArr || []).slice();
var dataNameMap = zrUtil.createHashMap();
for (var i = 0; i < regionsArr.length; i++) {
dataNameMap.set(regionsArr[i].name, regionsArr[i]);
}
var source = geoSourceManager.load(mapName, nameMap);
zrUtil.each(source.regions, function (region) {
var name = region.name;
!dataNameMap.get(name) && regionsArr.push({name: name});
});
return regionsArr;
} | javascript | function (originRegionArr, mapName, nameMap) {
// Not use the original
var regionsArr = (originRegionArr || []).slice();
var dataNameMap = zrUtil.createHashMap();
for (var i = 0; i < regionsArr.length; i++) {
dataNameMap.set(regionsArr[i].name, regionsArr[i]);
}
var source = geoSourceManager.load(mapName, nameMap);
zrUtil.each(source.regions, function (region) {
var name = region.name;
!dataNameMap.get(name) && regionsArr.push({name: name});
});
return regionsArr;
} | [
"function",
"(",
"originRegionArr",
",",
"mapName",
",",
"nameMap",
")",
"{",
"// Not use the original",
"var",
"regionsArr",
"=",
"(",
"originRegionArr",
"||",
"[",
"]",
")",
".",
"slice",
"(",
")",
";",
"var",
"dataNameMap",
"=",
"zrUtil",
".",
"createHashMap",
"(",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"regionsArr",
".",
"length",
";",
"i",
"++",
")",
"{",
"dataNameMap",
".",
"set",
"(",
"regionsArr",
"[",
"i",
"]",
".",
"name",
",",
"regionsArr",
"[",
"i",
"]",
")",
";",
"}",
"var",
"source",
"=",
"geoSourceManager",
".",
"load",
"(",
"mapName",
",",
"nameMap",
")",
";",
"zrUtil",
".",
"each",
"(",
"source",
".",
"regions",
",",
"function",
"(",
"region",
")",
"{",
"var",
"name",
"=",
"region",
".",
"name",
";",
"!",
"dataNameMap",
".",
"get",
"(",
"name",
")",
"&&",
"regionsArr",
".",
"push",
"(",
"{",
"name",
":",
"name",
"}",
")",
";",
"}",
")",
";",
"return",
"regionsArr",
";",
"}"
] | Fill given regions array
@param {Array.<Object>} originRegionArr
@param {string} mapName
@param {Object} [nameMap]
@return {Array} | [
"Fill",
"given",
"regions",
"array"
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/coord/geo/geoCreator.js#L219-L235 |
|
194 | apache/incubator-echarts | src/chart/sankey/SankeyView.js | createGridClipShape | function createGridClipShape(rect, seriesModel, cb) {
var rectEl = new graphic.Rect({
shape: {
x: rect.x - 10,
y: rect.y - 10,
width: 0,
height: rect.height + 20
}
});
graphic.initProps(rectEl, {
shape: {
width: rect.width + 20,
height: rect.height + 20
}
}, seriesModel, cb);
return rectEl;
} | javascript | function createGridClipShape(rect, seriesModel, cb) {
var rectEl = new graphic.Rect({
shape: {
x: rect.x - 10,
y: rect.y - 10,
width: 0,
height: rect.height + 20
}
});
graphic.initProps(rectEl, {
shape: {
width: rect.width + 20,
height: rect.height + 20
}
}, seriesModel, cb);
return rectEl;
} | [
"function",
"createGridClipShape",
"(",
"rect",
",",
"seriesModel",
",",
"cb",
")",
"{",
"var",
"rectEl",
"=",
"new",
"graphic",
".",
"Rect",
"(",
"{",
"shape",
":",
"{",
"x",
":",
"rect",
".",
"x",
"-",
"10",
",",
"y",
":",
"rect",
".",
"y",
"-",
"10",
",",
"width",
":",
"0",
",",
"height",
":",
"rect",
".",
"height",
"+",
"20",
"}",
"}",
")",
";",
"graphic",
".",
"initProps",
"(",
"rectEl",
",",
"{",
"shape",
":",
"{",
"width",
":",
"rect",
".",
"width",
"+",
"20",
",",
"height",
":",
"rect",
".",
"height",
"+",
"20",
"}",
"}",
",",
"seriesModel",
",",
"cb",
")",
";",
"return",
"rectEl",
";",
"}"
] | Add animation to the view | [
"Add",
"animation",
"to",
"the",
"view"
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/chart/sankey/SankeyView.js#L409-L426 |
195 | apache/incubator-echarts | src/component/marker/MarkAreaView.js | ifMarkLineHasOnlyDim | function ifMarkLineHasOnlyDim(dimIndex, fromCoord, toCoord, coordSys) {
var otherDimIndex = 1 - dimIndex;
return isInifinity(fromCoord[otherDimIndex]) && isInifinity(toCoord[otherDimIndex]);
} | javascript | function ifMarkLineHasOnlyDim(dimIndex, fromCoord, toCoord, coordSys) {
var otherDimIndex = 1 - dimIndex;
return isInifinity(fromCoord[otherDimIndex]) && isInifinity(toCoord[otherDimIndex]);
} | [
"function",
"ifMarkLineHasOnlyDim",
"(",
"dimIndex",
",",
"fromCoord",
",",
"toCoord",
",",
"coordSys",
")",
"{",
"var",
"otherDimIndex",
"=",
"1",
"-",
"dimIndex",
";",
"return",
"isInifinity",
"(",
"fromCoord",
"[",
"otherDimIndex",
"]",
")",
"&&",
"isInifinity",
"(",
"toCoord",
"[",
"otherDimIndex",
"]",
")",
";",
"}"
] | If a markArea has one dim | [
"If",
"a",
"markArea",
"has",
"one",
"dim"
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/component/marker/MarkAreaView.js#L63-L66 |
196 | apache/incubator-echarts | src/chart/treemap/TreemapSeries.js | function (dataIndex) {
var params = SeriesModel.prototype.getDataParams.apply(this, arguments);
var node = this.getData().tree.getNodeByDataIndex(dataIndex);
params.treePathInfo = wrapTreePathInfo(node, this);
return params;
} | javascript | function (dataIndex) {
var params = SeriesModel.prototype.getDataParams.apply(this, arguments);
var node = this.getData().tree.getNodeByDataIndex(dataIndex);
params.treePathInfo = wrapTreePathInfo(node, this);
return params;
} | [
"function",
"(",
"dataIndex",
")",
"{",
"var",
"params",
"=",
"SeriesModel",
".",
"prototype",
".",
"getDataParams",
".",
"apply",
"(",
"this",
",",
"arguments",
")",
";",
"var",
"node",
"=",
"this",
".",
"getData",
"(",
")",
".",
"tree",
".",
"getNodeByDataIndex",
"(",
"dataIndex",
")",
";",
"params",
".",
"treePathInfo",
"=",
"wrapTreePathInfo",
"(",
"node",
",",
"this",
")",
";",
"return",
"params",
";",
"}"
] | Add tree path to tooltip param
@override
@param {number} dataIndex
@return {Object} | [
"Add",
"tree",
"path",
"to",
"tooltip",
"param"
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/chart/treemap/TreemapSeries.js#L222-L229 |
|
197 | apache/incubator-echarts | src/chart/treemap/TreemapSeries.js | setDefault | function setDefault(levels, ecModel) {
var globalColorList = ecModel.get('color');
if (!globalColorList) {
return;
}
levels = levels || [];
var hasColorDefine;
zrUtil.each(levels, function (levelDefine) {
var model = new Model(levelDefine);
var modelColor = model.get('color');
if (model.get('itemStyle.color')
|| (modelColor && modelColor !== 'none')
) {
hasColorDefine = true;
}
});
if (!hasColorDefine) {
var level0 = levels[0] || (levels[0] = {});
level0.color = globalColorList.slice();
}
return levels;
} | javascript | function setDefault(levels, ecModel) {
var globalColorList = ecModel.get('color');
if (!globalColorList) {
return;
}
levels = levels || [];
var hasColorDefine;
zrUtil.each(levels, function (levelDefine) {
var model = new Model(levelDefine);
var modelColor = model.get('color');
if (model.get('itemStyle.color')
|| (modelColor && modelColor !== 'none')
) {
hasColorDefine = true;
}
});
if (!hasColorDefine) {
var level0 = levels[0] || (levels[0] = {});
level0.color = globalColorList.slice();
}
return levels;
} | [
"function",
"setDefault",
"(",
"levels",
",",
"ecModel",
")",
"{",
"var",
"globalColorList",
"=",
"ecModel",
".",
"get",
"(",
"'color'",
")",
";",
"if",
"(",
"!",
"globalColorList",
")",
"{",
"return",
";",
"}",
"levels",
"=",
"levels",
"||",
"[",
"]",
";",
"var",
"hasColorDefine",
";",
"zrUtil",
".",
"each",
"(",
"levels",
",",
"function",
"(",
"levelDefine",
")",
"{",
"var",
"model",
"=",
"new",
"Model",
"(",
"levelDefine",
")",
";",
"var",
"modelColor",
"=",
"model",
".",
"get",
"(",
"'color'",
")",
";",
"if",
"(",
"model",
".",
"get",
"(",
"'itemStyle.color'",
")",
"||",
"(",
"modelColor",
"&&",
"modelColor",
"!==",
"'none'",
")",
")",
"{",
"hasColorDefine",
"=",
"true",
";",
"}",
"}",
")",
";",
"if",
"(",
"!",
"hasColorDefine",
")",
"{",
"var",
"level0",
"=",
"levels",
"[",
"0",
"]",
"||",
"(",
"levels",
"[",
"0",
"]",
"=",
"{",
"}",
")",
";",
"level0",
".",
"color",
"=",
"globalColorList",
".",
"slice",
"(",
")",
";",
"}",
"return",
"levels",
";",
"}"
] | set default to level configuration | [
"set",
"default",
"to",
"level",
"configuration"
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/chart/treemap/TreemapSeries.js#L347-L373 |
198 | apache/incubator-echarts | src/component/marker/MarkLineView.js | ifMarkLineHasOnlyDim | function ifMarkLineHasOnlyDim(dimIndex, fromCoord, toCoord, coordSys) {
var otherDimIndex = 1 - dimIndex;
var dimName = coordSys.dimensions[dimIndex];
return isInifinity(fromCoord[otherDimIndex]) && isInifinity(toCoord[otherDimIndex])
&& fromCoord[dimIndex] === toCoord[dimIndex] && coordSys.getAxis(dimName).containData(fromCoord[dimIndex]);
} | javascript | function ifMarkLineHasOnlyDim(dimIndex, fromCoord, toCoord, coordSys) {
var otherDimIndex = 1 - dimIndex;
var dimName = coordSys.dimensions[dimIndex];
return isInifinity(fromCoord[otherDimIndex]) && isInifinity(toCoord[otherDimIndex])
&& fromCoord[dimIndex] === toCoord[dimIndex] && coordSys.getAxis(dimName).containData(fromCoord[dimIndex]);
} | [
"function",
"ifMarkLineHasOnlyDim",
"(",
"dimIndex",
",",
"fromCoord",
",",
"toCoord",
",",
"coordSys",
")",
"{",
"var",
"otherDimIndex",
"=",
"1",
"-",
"dimIndex",
";",
"var",
"dimName",
"=",
"coordSys",
".",
"dimensions",
"[",
"dimIndex",
"]",
";",
"return",
"isInifinity",
"(",
"fromCoord",
"[",
"otherDimIndex",
"]",
")",
"&&",
"isInifinity",
"(",
"toCoord",
"[",
"otherDimIndex",
"]",
")",
"&&",
"fromCoord",
"[",
"dimIndex",
"]",
"===",
"toCoord",
"[",
"dimIndex",
"]",
"&&",
"coordSys",
".",
"getAxis",
"(",
"dimName",
")",
".",
"containData",
"(",
"fromCoord",
"[",
"dimIndex",
"]",
")",
";",
"}"
] | If a markLine has one dim | [
"If",
"a",
"markLine",
"has",
"one",
"dim"
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/component/marker/MarkLineView.js#L107-L112 |
199 | apache/incubator-echarts | src/component/marker/MarkLineView.js | function (markLineModel, ecModel, api) {
ecModel.eachSeries(function (seriesModel) {
var mlModel = seriesModel.markLineModel;
if (mlModel) {
var mlData = mlModel.getData();
var fromData = mlModel.__from;
var toData = mlModel.__to;
// Update visual and layout of from symbol and to symbol
fromData.each(function (idx) {
updateSingleMarkerEndLayout(fromData, idx, true, seriesModel, api);
updateSingleMarkerEndLayout(toData, idx, false, seriesModel, api);
});
// Update layout of line
mlData.each(function (idx) {
mlData.setItemLayout(idx, [
fromData.getItemLayout(idx),
toData.getItemLayout(idx)
]);
});
this.markerGroupMap.get(seriesModel.id).updateLayout();
}
}, this);
} | javascript | function (markLineModel, ecModel, api) {
ecModel.eachSeries(function (seriesModel) {
var mlModel = seriesModel.markLineModel;
if (mlModel) {
var mlData = mlModel.getData();
var fromData = mlModel.__from;
var toData = mlModel.__to;
// Update visual and layout of from symbol and to symbol
fromData.each(function (idx) {
updateSingleMarkerEndLayout(fromData, idx, true, seriesModel, api);
updateSingleMarkerEndLayout(toData, idx, false, seriesModel, api);
});
// Update layout of line
mlData.each(function (idx) {
mlData.setItemLayout(idx, [
fromData.getItemLayout(idx),
toData.getItemLayout(idx)
]);
});
this.markerGroupMap.get(seriesModel.id).updateLayout();
}
}, this);
} | [
"function",
"(",
"markLineModel",
",",
"ecModel",
",",
"api",
")",
"{",
"ecModel",
".",
"eachSeries",
"(",
"function",
"(",
"seriesModel",
")",
"{",
"var",
"mlModel",
"=",
"seriesModel",
".",
"markLineModel",
";",
"if",
"(",
"mlModel",
")",
"{",
"var",
"mlData",
"=",
"mlModel",
".",
"getData",
"(",
")",
";",
"var",
"fromData",
"=",
"mlModel",
".",
"__from",
";",
"var",
"toData",
"=",
"mlModel",
".",
"__to",
";",
"// Update visual and layout of from symbol and to symbol",
"fromData",
".",
"each",
"(",
"function",
"(",
"idx",
")",
"{",
"updateSingleMarkerEndLayout",
"(",
"fromData",
",",
"idx",
",",
"true",
",",
"seriesModel",
",",
"api",
")",
";",
"updateSingleMarkerEndLayout",
"(",
"toData",
",",
"idx",
",",
"false",
",",
"seriesModel",
",",
"api",
")",
";",
"}",
")",
";",
"// Update layout of line",
"mlData",
".",
"each",
"(",
"function",
"(",
"idx",
")",
"{",
"mlData",
".",
"setItemLayout",
"(",
"idx",
",",
"[",
"fromData",
".",
"getItemLayout",
"(",
"idx",
")",
",",
"toData",
".",
"getItemLayout",
"(",
"idx",
")",
"]",
")",
";",
"}",
")",
";",
"this",
".",
"markerGroupMap",
".",
"get",
"(",
"seriesModel",
".",
"id",
")",
".",
"updateLayout",
"(",
")",
";",
"}",
"}",
",",
"this",
")",
";",
"}"
] | } }, this); }, | [
"}",
"}",
"this",
")",
";",
"}"
] | 4d0ea095dc3929cb6de40c45748826e7999c7aa8 | https://github.com/apache/incubator-echarts/blob/4d0ea095dc3929cb6de40c45748826e7999c7aa8/src/component/marker/MarkLineView.js#L225-L249 |