repo stringlengths 5 67 | path stringlengths 4 116 | func_name stringlengths 0 58 | original_string stringlengths 52 373k | language stringclasses 1
value | code stringlengths 52 373k | code_tokens list | docstring stringlengths 4 11.8k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 86 226 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
priologic/easyrtc | api/easyrtc.js | event | function event(eventName, callingFunction) {
if (typeof eventName !== 'string') {
self.showError(self.errCodes.DEVELOPER_ERR, callingFunction + " called without a string as the first argument");
throw "developer error";
}
if (!allowedEvents[eventName]) {
self.... | javascript | function event(eventName, callingFunction) {
if (typeof eventName !== 'string') {
self.showError(self.errCodes.DEVELOPER_ERR, callingFunction + " called without a string as the first argument");
throw "developer error";
}
if (!allowedEvents[eventName]) {
self.... | [
"function",
"event",
"(",
"eventName",
",",
"callingFunction",
")",
"{",
"if",
"(",
"typeof",
"eventName",
"!==",
"'string'",
")",
"{",
"self",
".",
"showError",
"(",
"self",
".",
"errCodes",
".",
"DEVELOPER_ERR",
",",
"callingFunction",
"+",
"\" called withou... | This function checks if an attempt was made to add an event listener or
or emit an unlisted event, since such is typically a typo.
@private
@param {String} eventName
@param {String} callingFunction the name of the calling function. | [
"This",
"function",
"checks",
"if",
"an",
"attempt",
"was",
"made",
"to",
"add",
"an",
"event",
"listener",
"or",
"or",
"emit",
"an",
"unlisted",
"event",
"since",
"such",
"is",
"typically",
"a",
"typo",
"."
] | 5ea69776f319fab15a784f94db91a2c1f5154ef5 | https://github.com/priologic/easyrtc/blob/5ea69776f319fab15a784f94db91a2c1f5154ef5/api/easyrtc.js#L5857-L5866 | train |
priologic/easyrtc | api/easyrtc.js | disconnectBody | function disconnectBody() {
var key;
self.loggingOut = true;
offersPending = {};
acceptancePending = {};
self.disconnecting = true;
closedChannel = self.webSocket;
if( stillAliveTimer ) {
clearTimeout(stillAliveTimer);
stillAliveTimer = null... | javascript | function disconnectBody() {
var key;
self.loggingOut = true;
offersPending = {};
acceptancePending = {};
self.disconnecting = true;
closedChannel = self.webSocket;
if( stillAliveTimer ) {
clearTimeout(stillAliveTimer);
stillAliveTimer = null... | [
"function",
"disconnectBody",
"(",
")",
"{",
"var",
"key",
";",
"self",
".",
"loggingOut",
"=",
"true",
";",
"offersPending",
"=",
"{",
"}",
";",
"acceptancePending",
"=",
"{",
"}",
";",
"self",
".",
"disconnecting",
"=",
"true",
";",
"closedChannel",
"=... | easyrtc.disconnect performs a clean disconnection of the client from the server. | [
"easyrtc",
".",
"disconnect",
"performs",
"a",
"clean",
"disconnection",
"of",
"the",
"client",
"from",
"the",
"server",
"."
] | 5ea69776f319fab15a784f94db91a2c1f5154ef5 | https://github.com/priologic/easyrtc/blob/5ea69776f319fab15a784f94db91a2c1f5154ef5/api/easyrtc.js#L8392-L8427 | train |
priologic/easyrtc | api/easyrtc.js | function() {
var alteredData = findDeltas(oldConfig, newConfig);
//
// send all the configuration information that changes during the session
//
if (alteredData) {
logDebug("cfg=" + JSON.stringify(alteredData.added));
if (self.... | javascript | function() {
var alteredData = findDeltas(oldConfig, newConfig);
//
// send all the configuration information that changes during the session
//
if (alteredData) {
logDebug("cfg=" + JSON.stringify(alteredData.added));
if (self.... | [
"function",
"(",
")",
"{",
"var",
"alteredData",
"=",
"findDeltas",
"(",
"oldConfig",
",",
"newConfig",
")",
";",
"//",
"// send all the configuration information that changes during the session",
"//",
"if",
"(",
"alteredData",
")",
"{",
"logDebug",
"(",
"\"cfg=\"",
... | we need to give the getStats calls a chance to fish out the data. The longest I've seen it take is 5 milliseconds so 100 should be overkill. | [
"we",
"need",
"to",
"give",
"the",
"getStats",
"calls",
"a",
"chance",
"to",
"fish",
"out",
"the",
"data",
".",
"The",
"longest",
"I",
"ve",
"seen",
"it",
"take",
"is",
"5",
"milliseconds",
"so",
"100",
"should",
"be",
"overkill",
"."
] | 5ea69776f319fab15a784f94db91a2c1f5154ef5 | https://github.com/priologic/easyrtc/blob/5ea69776f319fab15a784f94db91a2c1f5154ef5/api/easyrtc.js#L8993-L9006 | train | |
priologic/easyrtc | api/easyrtc.js | checkIceGatheringState | function checkIceGatheringState(otherPeer) {
console.log("entered checkIceGatheringState");
if( peerConns[otherPeer] && peerConns[otherPeer].pc && peerConns[otherPeer].pc.iceGatheringState ) {
if( peerConns[otherPeer].pc.iceGatheringState === "complete" ) {
self.sendPeerMessage... | javascript | function checkIceGatheringState(otherPeer) {
console.log("entered checkIceGatheringState");
if( peerConns[otherPeer] && peerConns[otherPeer].pc && peerConns[otherPeer].pc.iceGatheringState ) {
if( peerConns[otherPeer].pc.iceGatheringState === "complete" ) {
self.sendPeerMessage... | [
"function",
"checkIceGatheringState",
"(",
"otherPeer",
")",
"{",
"console",
".",
"log",
"(",
"\"entered checkIceGatheringState\"",
")",
";",
"if",
"(",
"peerConns",
"[",
"otherPeer",
"]",
"&&",
"peerConns",
"[",
"otherPeer",
"]",
".",
"pc",
"&&",
"peerConns",
... | this is a support function for halfTrickIce support. it sends a message to the peer when ice collection has finished on this side. it is only invoked for peers that have sent us a supportHalfTrickIce message. | [
"this",
"is",
"a",
"support",
"function",
"for",
"halfTrickIce",
"support",
".",
"it",
"sends",
"a",
"message",
"to",
"the",
"peer",
"when",
"ice",
"collection",
"has",
"finished",
"on",
"this",
"side",
".",
"it",
"is",
"only",
"invoked",
"for",
"peers",
... | 5ea69776f319fab15a784f94db91a2c1f5154ef5 | https://github.com/priologic/easyrtc/blob/5ea69776f319fab15a784f94db91a2c1f5154ef5/api/easyrtc.js#L11194-L11211 | train |
priologic/easyrtc | api/easyrtc.js | validateVideoIds | function validateVideoIds(monitorVideoId, videoIds) {
var i;
// verify that video ids were not typos.
if (monitorVideoId && !document.getElementById(monitorVideoId)) {
easyrtc.showError(easyrtc.errCodes.DEVELOPER_ERR, "The monitor video id passed to easyApp was bad, s... | javascript | function validateVideoIds(monitorVideoId, videoIds) {
var i;
// verify that video ids were not typos.
if (monitorVideoId && !document.getElementById(monitorVideoId)) {
easyrtc.showError(easyrtc.errCodes.DEVELOPER_ERR, "The monitor video id passed to easyApp was bad, s... | [
"function",
"validateVideoIds",
"(",
"monitorVideoId",
",",
"videoIds",
")",
"{",
"var",
"i",
";",
"// verify that video ids were not typos.",
"if",
"(",
"monitorVideoId",
"&&",
"!",
"document",
".",
"getElementById",
"(",
"monitorVideoId",
")",
")",
"{",
"easyrtc",... | Validates that the video ids correspond to dom objects.
@param {String} monitorVideoId
@param {Array} videoIds
@returns {Boolean}
@private | [
"Validates",
"that",
"the",
"video",
"ids",
"correspond",
"to",
"dom",
"objects",
"."
] | 5ea69776f319fab15a784f94db91a2c1f5154ef5 | https://github.com/priologic/easyrtc/blob/5ea69776f319fab15a784f94db91a2c1f5154ef5/api/easyrtc.js#L11375-L11394 | train |
priologic/easyrtc | demos/js/demo_data_channel_messaging.js | connect | function connect() {
easyrtc.enableDebug(false);
easyrtc.enableDataChannels(true);
easyrtc.enableVideo(false);
easyrtc.enableAudio(false);
easyrtc.enableVideoReceive(false);
easyrtc.enableAudioReceive(false);
easyrtc.setDataChannelOpenListener(openListener);
easyrtc.setDataChanne... | javascript | function connect() {
easyrtc.enableDebug(false);
easyrtc.enableDataChannels(true);
easyrtc.enableVideo(false);
easyrtc.enableAudio(false);
easyrtc.enableVideoReceive(false);
easyrtc.enableAudioReceive(false);
easyrtc.setDataChannelOpenListener(openListener);
easyrtc.setDataChanne... | [
"function",
"connect",
"(",
")",
"{",
"easyrtc",
".",
"enableDebug",
"(",
"false",
")",
";",
"easyrtc",
".",
"enableDataChannels",
"(",
"true",
")",
";",
"easyrtc",
".",
"enableVideo",
"(",
"false",
")",
";",
"easyrtc",
".",
"enableAudio",
"(",
"false",
... | tracks which channels are active | [
"tracks",
"which",
"channels",
"are",
"active"
] | 5ea69776f319fab15a784f94db91a2c1f5154ef5 | https://github.com/priologic/easyrtc/blob/5ea69776f319fab15a784f94db91a2c1f5154ef5/demos/js/demo_data_channel_messaging.js#L31-L43 | train |
priologic/easyrtc | api/labs/easyrtc_sc_extension/background-script.js | onAccessApproved | function onAccessApproved(sourceId) {
pending = false;
// if "cancel" button is clicked
if(!sourceId || !sourceId.length) {
return port.postMessage('PermissionDeniedError');
}
// "ok" button is clicked; share "sourceId" with the
// content-s... | javascript | function onAccessApproved(sourceId) {
pending = false;
// if "cancel" button is clicked
if(!sourceId || !sourceId.length) {
return port.postMessage('PermissionDeniedError');
}
// "ok" button is clicked; share "sourceId" with the
// content-s... | [
"function",
"onAccessApproved",
"(",
"sourceId",
")",
"{",
"pending",
"=",
"false",
";",
"// if \"cancel\" button is clicked",
"if",
"(",
"!",
"sourceId",
"||",
"!",
"sourceId",
".",
"length",
")",
"{",
"return",
"port",
".",
"postMessage",
"(",
"'PermissionDeni... | on getting sourceId "sourceId" will be empty if permission is denied. | [
"on",
"getting",
"sourceId",
"sourceId",
"will",
"be",
"empty",
"if",
"permission",
"is",
"denied",
"."
] | 5ea69776f319fab15a784f94db91a2c1f5154ef5 | https://github.com/priologic/easyrtc/blob/5ea69776f319fab15a784f94db91a2c1f5154ef5/api/labs/easyrtc_sc_extension/background-script.js#L12-L26 | train |
priologic/easyrtc | api/labs/easyrtc_sc_extension/background-script.js | portOnMessageHanlder | function portOnMessageHanlder(message) {
if(message === 'get-sourceId' && !pending) {
pending = true;
chrome.desktopCapture.chooseDesktopMedia(session, port.sender.tab, onAccessApproved);
}
} | javascript | function portOnMessageHanlder(message) {
if(message === 'get-sourceId' && !pending) {
pending = true;
chrome.desktopCapture.chooseDesktopMedia(session, port.sender.tab, onAccessApproved);
}
} | [
"function",
"portOnMessageHanlder",
"(",
"message",
")",
"{",
"if",
"(",
"message",
"===",
"'get-sourceId'",
"&&",
"!",
"pending",
")",
"{",
"pending",
"=",
"true",
";",
"chrome",
".",
"desktopCapture",
".",
"chooseDesktopMedia",
"(",
"session",
",",
"port",
... | this one is called for each message from "content-script.js" | [
"this",
"one",
"is",
"called",
"for",
"each",
"message",
"from",
"content",
"-",
"script",
".",
"js"
] | 5ea69776f319fab15a784f94db91a2c1f5154ef5 | https://github.com/priologic/easyrtc/blob/5ea69776f319fab15a784f94db91a2c1f5154ef5/api/labs/easyrtc_sc_extension/background-script.js#L29-L34 | train |
yaronn/blessed-contrib | examples/dashboard.js | fillBar | function fillBar() {
var arr = []
for (var i=0; i<servers.length; i++) {
arr.push(Math.round(Math.random()*10))
}
bar.setData({titles: servers, data: arr})
} | javascript | function fillBar() {
var arr = []
for (var i=0; i<servers.length; i++) {
arr.push(Math.round(Math.random()*10))
}
bar.setData({titles: servers, data: arr})
} | [
"function",
"fillBar",
"(",
")",
"{",
"var",
"arr",
"=",
"[",
"]",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"servers",
".",
"length",
";",
"i",
"++",
")",
"{",
"arr",
".",
"push",
"(",
"Math",
".",
"round",
"(",
"Math",
".",
"random",... | set dummy data on bar chart | [
"set",
"dummy",
"data",
"on",
"bar",
"chart"
] | a497e6d3a54f3947f94a22823dfed832837e2802 | https://github.com/yaronn/blessed-contrib/blob/a497e6d3a54f3947f94a22823dfed832837e2802/examples/dashboard.js#L130-L136 | train |
yaronn/blessed-contrib | lib/widget/charts/line.js | getMaxY | function getMaxY() {
if (self.options.maxY) {
return self.options.maxY;
}
var max = -Infinity;
for(let i = 0; i < data.length; i++) {
if (data[i].y.length) {
var current = _.max(data[i].y, parseFloat);
if (current > max) {
max = current;
}
}
}
... | javascript | function getMaxY() {
if (self.options.maxY) {
return self.options.maxY;
}
var max = -Infinity;
for(let i = 0; i < data.length; i++) {
if (data[i].y.length) {
var current = _.max(data[i].y, parseFloat);
if (current > max) {
max = current;
}
}
}
... | [
"function",
"getMaxY",
"(",
")",
"{",
"if",
"(",
"self",
".",
"options",
".",
"maxY",
")",
"{",
"return",
"self",
".",
"options",
".",
"maxY",
";",
"}",
"var",
"max",
"=",
"-",
"Infinity",
";",
"for",
"(",
"let",
"i",
"=",
"0",
";",
"i",
"<",
... | iteratee for lodash _.max | [
"iteratee",
"for",
"lodash",
"_",
".",
"max"
] | a497e6d3a54f3947f94a22823dfed832837e2802 | https://github.com/yaronn/blessed-contrib/blob/a497e6d3a54f3947f94a22823dfed832837e2802/lib/widget/charts/line.js#L87-L104 | train |
yaronn/blessed-contrib | lib/widget/charts/line.js | drawLine | function drawLine(values, style, minY) {
style = style || {}
var color = self.options.style.line
c.strokeStyle = style.line || color
c.moveTo(0, 0)
c.beginPath();
c.lineTo(getXPixel(0), getYPixel(values[0], minY));
for(var k = 1; k < values.length; k++) {
c.lineTo(getXPixel(k), getYP... | javascript | function drawLine(values, style, minY) {
style = style || {}
var color = self.options.style.line
c.strokeStyle = style.line || color
c.moveTo(0, 0)
c.beginPath();
c.lineTo(getXPixel(0), getYPixel(values[0], minY));
for(var k = 1; k < values.length; k++) {
c.lineTo(getXPixel(k), getYP... | [
"function",
"drawLine",
"(",
"values",
",",
"style",
",",
"minY",
")",
"{",
"style",
"=",
"style",
"||",
"{",
"}",
"var",
"color",
"=",
"self",
".",
"options",
".",
"style",
".",
"line",
"c",
".",
"strokeStyle",
"=",
"style",
".",
"line",
"||",
"co... | Draw the line graph | [
"Draw",
"the",
"line",
"graph"
] | a497e6d3a54f3947f94a22823dfed832837e2802 | https://github.com/yaronn/blessed-contrib/blob/a497e6d3a54f3947f94a22823dfed832837e2802/lib/widget/charts/line.js#L152-L166 | train |
Streamedian/html5_rtsp_player | streamedian.min.js | function(ev) {
this.count = this.count || 0;
if (this.count >= 256 || rng_pptr >= rng_psize) {
if (window.removeEventListener)
window.removeEventListener("mousemove", onMouseMoveListener, false);
else if (window.detachEvent)
window.detachEvent("onmousemove", onMouseMoveListener);
... | javascript | function(ev) {
this.count = this.count || 0;
if (this.count >= 256 || rng_pptr >= rng_psize) {
if (window.removeEventListener)
window.removeEventListener("mousemove", onMouseMoveListener, false);
else if (window.detachEvent)
window.detachEvent("onmousemove", onMouseMoveListener);
... | [
"function",
"(",
"ev",
")",
"{",
"this",
".",
"count",
"=",
"this",
".",
"count",
"||",
"0",
";",
"if",
"(",
"this",
".",
"count",
">=",
"256",
"||",
"rng_pptr",
">=",
"rng_psize",
")",
"{",
"if",
"(",
"window",
".",
"removeEventListener",
")",
"wi... | Use mouse events for entropy, if we do not have enough entropy by the time we need it, entropy will be generated by Math.random. | [
"Use",
"mouse",
"events",
"for",
"entropy",
"if",
"we",
"do",
"not",
"have",
"enough",
"entropy",
"by",
"the",
"time",
"we",
"need",
"it",
"entropy",
"will",
"be",
"generated",
"by",
"Math",
".",
"random",
"."
] | 4d04d4a075992cc5ef828ed644d9a3e4a00606d7 | https://github.com/Streamedian/html5_rtsp_player/blob/4d04d4a075992cc5ef828ed644d9a3e4a00606d7/streamedian.min.js#L5133-L5149 | train | |
CJex/regulex | src/Kit.js | hashUnique | function hashUnique(a) {
var table={},i=0,j=0,l=a.length,x;
for (;i<l;i++) {
x=a[i];
if (table.hasOwnProperty(x)) continue;
table[x]=1;
a[j++]=x;
}
a.length=j;
return a;
} | javascript | function hashUnique(a) {
var table={},i=0,j=0,l=a.length,x;
for (;i<l;i++) {
x=a[i];
if (table.hasOwnProperty(x)) continue;
table[x]=1;
a[j++]=x;
}
a.length=j;
return a;
} | [
"function",
"hashUnique",
"(",
"a",
")",
"{",
"var",
"table",
"=",
"{",
"}",
",",
"i",
"=",
"0",
",",
"j",
"=",
"0",
",",
"l",
"=",
"a",
".",
"length",
",",
"x",
";",
"for",
"(",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"{",
"x",
"=",
... | Unique by toString.
This function will corrupt the original array but preserve the original order. | [
"Unique",
"by",
"toString",
".",
"This",
"function",
"will",
"corrupt",
"the",
"original",
"array",
"but",
"preserve",
"the",
"original",
"order",
"."
] | 398d0b6d8b30a4d47999e4400c935ffddf30a4f1 | https://github.com/CJex/regulex/blob/398d0b6d8b30a4d47999e4400c935ffddf30a4f1/src/Kit.js#L112-L122 | train |
CJex/regulex | src/Kit.js | parseCharset | function parseCharset(charset /*:String*/) {
charset=charset.split('');
var chars=[],ranges=[],
exclude = charset[0]==='^' && charset.length > 1 && charset.shift();
charset.forEach(function (c) {
if (chars[0]=='-' && chars.length>1) {//chars=['-','a'],c=='z'
if (chars[1] > c ) // z-a is invalid
... | javascript | function parseCharset(charset /*:String*/) {
charset=charset.split('');
var chars=[],ranges=[],
exclude = charset[0]==='^' && charset.length > 1 && charset.shift();
charset.forEach(function (c) {
if (chars[0]=='-' && chars.length>1) {//chars=['-','a'],c=='z'
if (chars[1] > c ) // z-a is invalid
... | [
"function",
"parseCharset",
"(",
"charset",
"/*:String*/",
")",
"{",
"charset",
"=",
"charset",
".",
"split",
"(",
"''",
")",
";",
"var",
"chars",
"=",
"[",
"]",
",",
"ranges",
"=",
"[",
"]",
",",
"exclude",
"=",
"charset",
"[",
"0",
"]",
"===",
"'... | Parse simple regex style charset string like '^a-bcdf' to disjoint ranges.
Character classes like "\w\s" are not supported!
@param {String} charset Valid regex charset [^a-z0-9_] input as "^a-z0-9_".
@return {[Range]} return sorted disjoint ranges | [
"Parse",
"simple",
"regex",
"style",
"charset",
"string",
"like",
"^a",
"-",
"bcdf",
"to",
"disjoint",
"ranges",
".",
"Character",
"classes",
"like",
"\\",
"w",
"\\",
"s",
"are",
"not",
"supported!"
] | 398d0b6d8b30a4d47999e4400c935ffddf30a4f1 | https://github.com/CJex/regulex/blob/398d0b6d8b30a4d47999e4400c935ffddf30a4f1/src/Kit.js#L288-L303 | train |
CJex/regulex | src/Kit.js | toPrint | function toPrint(s,isRaw) {
var ctrl=/[\x00-\x1F\x7F-\x9F]/,unicode=/[\u009F-\uFFFF]/;
s=s.split('').map(function (c) {
if (!isRaw && printEscapeMap.hasOwnProperty(c)) return printEscapeMap[c];
else if (unicode.test(c)) return '\\u'+('00'+ord(c).toString(16).toUpperCase()).slice(-4);
else if (ctrl.test(... | javascript | function toPrint(s,isRaw) {
var ctrl=/[\x00-\x1F\x7F-\x9F]/,unicode=/[\u009F-\uFFFF]/;
s=s.split('').map(function (c) {
if (!isRaw && printEscapeMap.hasOwnProperty(c)) return printEscapeMap[c];
else if (unicode.test(c)) return '\\u'+('00'+ord(c).toString(16).toUpperCase()).slice(-4);
else if (ctrl.test(... | [
"function",
"toPrint",
"(",
"s",
",",
"isRaw",
")",
"{",
"var",
"ctrl",
"=",
"/",
"[\\x00-\\x1F\\x7F-\\x9F]",
"/",
",",
"unicode",
"=",
"/",
"[\\u009F-\\uFFFF]",
"/",
";",
"s",
"=",
"s",
".",
"split",
"(",
"''",
")",
".",
"map",
"(",
"function",
"(",... | Convert string to printable,replace all control chars and unicode to hex escape | [
"Convert",
"string",
"to",
"printable",
"replace",
"all",
"control",
"chars",
"and",
"unicode",
"to",
"hex",
"escape"
] | 398d0b6d8b30a4d47999e4400c935ffddf30a4f1 | https://github.com/CJex/regulex/blob/398d0b6d8b30a4d47999e4400c935ffddf30a4f1/src/Kit.js#L343-L352 | train |
CJex/regulex | src/parse.js | endChoice | function endChoice(stack) {
if (stack._parentChoice) {
var choice=stack._parentChoice;
delete stack._parentChoice;
delete stack._parentGroup;
delete stack.groupCounter;
var parentStack=choice._parentStack;
delete choice._parentStack;
return parentStack;
}
ret... | javascript | function endChoice(stack) {
if (stack._parentChoice) {
var choice=stack._parentChoice;
delete stack._parentChoice;
delete stack._parentGroup;
delete stack.groupCounter;
var parentStack=choice._parentStack;
delete choice._parentStack;
return parentStack;
}
ret... | [
"function",
"endChoice",
"(",
"stack",
")",
"{",
"if",
"(",
"stack",
".",
"_parentChoice",
")",
"{",
"var",
"choice",
"=",
"stack",
".",
"_parentChoice",
";",
"delete",
"stack",
".",
"_parentChoice",
";",
"delete",
"stack",
".",
"_parentGroup",
";",
"delet... | if current stack is a choice's branch,return the original parent stack | [
"if",
"current",
"stack",
"is",
"a",
"choice",
"s",
"branch",
"return",
"the",
"original",
"parent",
"stack"
] | 398d0b6d8b30a4d47999e4400c935ffddf30a4f1 | https://github.com/CJex/regulex/blob/398d0b6d8b30a4d47999e4400c935ffddf30a4f1/src/parse.js#L633-L645 | train |
CJex/regulex | src/NFA.js | structure | function structure(a) {
a.accepts=a.accepts.split(',');
var ts=a.trans,
i=ts.length,t,s,from,to;
while (i--) {
t=ts[i];
s=t[0].split('>');
from=s[0].split(',');
to=s[1].split(',');
ts[i]={from:from,to:to,charset:t[1],action:t[2],assert:t[3]};
}
a.compact=false;
return a;
} | javascript | function structure(a) {
a.accepts=a.accepts.split(',');
var ts=a.trans,
i=ts.length,t,s,from,to;
while (i--) {
t=ts[i];
s=t[0].split('>');
from=s[0].split(',');
to=s[1].split(',');
ts[i]={from:from,to:to,charset:t[1],action:t[2],assert:t[3]};
}
a.compact=false;
return a;
} | [
"function",
"structure",
"(",
"a",
")",
"{",
"a",
".",
"accepts",
"=",
"a",
".",
"accepts",
".",
"split",
"(",
"','",
")",
";",
"var",
"ts",
"=",
"a",
".",
"trans",
",",
"i",
"=",
"ts",
".",
"length",
",",
"t",
",",
"s",
",",
"from",
",",
"... | Convert CompactNFAConfig to NFAConfig
@param {CompactNFAConfig} a
type CompactNFAConfig={compact:true,accepts:CompactStateSet,trans:[CompactTransition]}
type CompactStateSet = StateSet.join(",")
type CompactTransition = [CompactStateMap,Charset,Action,Assert]
type CompactStateMap = FromStateSet.join(",")+">"+ToStateSet... | [
"Convert",
"CompactNFAConfig",
"to",
"NFAConfig"
] | 398d0b6d8b30a4d47999e4400c935ffddf30a4f1 | https://github.com/CJex/regulex/blob/398d0b6d8b30a4d47999e4400c935ffddf30a4f1/src/NFA.js#L289-L302 | train |
petkaantonov/bluebird | src/util.js | function(Child, Parent) {
var hasProp = {}.hasOwnProperty;
function T() {
this.constructor = Child;
this.constructor$ = Parent;
for (var propertyName in Parent.prototype) {
if (hasProp.call(Parent.prototype, propertyName) &&
propertyName.charAt(propertyName.l... | javascript | function(Child, Parent) {
var hasProp = {}.hasOwnProperty;
function T() {
this.constructor = Child;
this.constructor$ = Parent;
for (var propertyName in Parent.prototype) {
if (hasProp.call(Parent.prototype, propertyName) &&
propertyName.charAt(propertyName.l... | [
"function",
"(",
"Child",
",",
"Parent",
")",
"{",
"var",
"hasProp",
"=",
"{",
"}",
".",
"hasOwnProperty",
";",
"function",
"T",
"(",
")",
"{",
"this",
".",
"constructor",
"=",
"Child",
";",
"this",
".",
"constructor$",
"=",
"Parent",
";",
"for",
"("... | Un-magical enough that using this doesn't prevent extending classes from outside using any convention | [
"Un",
"-",
"magical",
"enough",
"that",
"using",
"this",
"doesn",
"t",
"prevent",
"extending",
"classes",
"from",
"outside",
"using",
"any",
"convention"
] | 17f69f3b0fa89a0b7a5cfb9a6546d1180a3610e0 | https://github.com/petkaantonov/bluebird/blob/17f69f3b0fa89a0b7a5cfb9a6546d1180a3610e0/src/util.js#L34-L51 | train | |
petkaantonov/bluebird | src/async.js | AsyncInvokeLater | function AsyncInvokeLater(fn, receiver, arg) {
ASSERT(arguments.length === 3);
this._lateQueue.push(fn, receiver, arg);
this._queueTick();
} | javascript | function AsyncInvokeLater(fn, receiver, arg) {
ASSERT(arguments.length === 3);
this._lateQueue.push(fn, receiver, arg);
this._queueTick();
} | [
"function",
"AsyncInvokeLater",
"(",
"fn",
",",
"receiver",
",",
"arg",
")",
"{",
"ASSERT",
"(",
"arguments",
".",
"length",
"===",
"3",
")",
";",
"this",
".",
"_lateQueue",
".",
"push",
"(",
"fn",
",",
"receiver",
",",
"arg",
")",
";",
"this",
".",
... | When the fn absolutely needs to be called after the queue has been completely flushed | [
"When",
"the",
"fn",
"absolutely",
"needs",
"to",
"be",
"called",
"after",
"the",
"queue",
"has",
"been",
"completely",
"flushed"
] | 17f69f3b0fa89a0b7a5cfb9a6546d1180a3610e0 | https://github.com/petkaantonov/bluebird/blob/17f69f3b0fa89a0b7a5cfb9a6546d1180a3610e0/src/async.js#L80-L84 | train |
petkaantonov/bluebird | src/async.js | _drainQueueStep | function _drainQueueStep(queue) {
var fn = queue.shift();
if (typeof fn !== "function") {
fn._settlePromises();
} else {
var receiver = queue.shift();
var arg = queue.shift();
fn.call(receiver, arg);
}
} | javascript | function _drainQueueStep(queue) {
var fn = queue.shift();
if (typeof fn !== "function") {
fn._settlePromises();
} else {
var receiver = queue.shift();
var arg = queue.shift();
fn.call(receiver, arg);
}
} | [
"function",
"_drainQueueStep",
"(",
"queue",
")",
"{",
"var",
"fn",
"=",
"queue",
".",
"shift",
"(",
")",
";",
"if",
"(",
"typeof",
"fn",
"!==",
"\"function\"",
")",
"{",
"fn",
".",
"_settlePromises",
"(",
")",
";",
"}",
"else",
"{",
"var",
"receiver... | Shift the queue in a separate function to allow garbage collection after each step | [
"Shift",
"the",
"queue",
"in",
"a",
"separate",
"function",
"to",
"allow",
"garbage",
"collection",
"after",
"each",
"step"
] | 17f69f3b0fa89a0b7a5cfb9a6546d1180a3610e0 | https://github.com/petkaantonov/bluebird/blob/17f69f3b0fa89a0b7a5cfb9a6546d1180a3610e0/src/async.js#L143-L152 | train |
petkaantonov/bluebird | benchmark/lib/timers-ctx.js | insert | function insert(item, msecs) {
item._idleStart = Timer.now();
item._idleTimeout = msecs;
if (msecs < 0) return;
var list;
if (lists[msecs]) {
list = lists[msecs];
} else {
list = new Timer();
list.start(msecs, 0);
L.init(list);
lists[msecs] = list;
list.msecs = msecs;
list[k... | javascript | function insert(item, msecs) {
item._idleStart = Timer.now();
item._idleTimeout = msecs;
if (msecs < 0) return;
var list;
if (lists[msecs]) {
list = lists[msecs];
} else {
list = new Timer();
list.start(msecs, 0);
L.init(list);
lists[msecs] = list;
list.msecs = msecs;
list[k... | [
"function",
"insert",
"(",
"item",
",",
"msecs",
")",
"{",
"item",
".",
"_idleStart",
"=",
"Timer",
".",
"now",
"(",
")",
";",
"item",
".",
"_idleTimeout",
"=",
"msecs",
";",
"if",
"(",
"msecs",
"<",
"0",
")",
"return",
";",
"var",
"list",
";",
"... | the main function - creates lists on demand and the watchers associated with them. | [
"the",
"main",
"function",
"-",
"creates",
"lists",
"on",
"demand",
"and",
"the",
"watchers",
"associated",
"with",
"them",
"."
] | 17f69f3b0fa89a0b7a5cfb9a6546d1180a3610e0 | https://github.com/petkaantonov/bluebird/blob/17f69f3b0fa89a0b7a5cfb9a6546d1180a3610e0/benchmark/lib/timers-ctx.js#L50-L73 | train |
petkaantonov/bluebird | benchmark/lib/fakesP-ctx.js | dummyP | function dummyP(n) {
return function lifted() {
var deferred = Promise.pending();
timers.setTimeout(nodeback, deferred, global.asyncTime || 100);
return deferred.promise;
}
} | javascript | function dummyP(n) {
return function lifted() {
var deferred = Promise.pending();
timers.setTimeout(nodeback, deferred, global.asyncTime || 100);
return deferred.promise;
}
} | [
"function",
"dummyP",
"(",
"n",
")",
"{",
"return",
"function",
"lifted",
"(",
")",
"{",
"var",
"deferred",
"=",
"Promise",
".",
"pending",
"(",
")",
";",
"timers",
".",
"setTimeout",
"(",
"nodeback",
",",
"deferred",
",",
"global",
".",
"asyncTime",
"... | A function taking n values or promises and returning a promise | [
"A",
"function",
"taking",
"n",
"values",
"or",
"promises",
"and",
"returning",
"a",
"promise"
] | 17f69f3b0fa89a0b7a5cfb9a6546d1180a3610e0 | https://github.com/petkaantonov/bluebird/blob/17f69f3b0fa89a0b7a5cfb9a6546d1180a3610e0/benchmark/lib/fakesP-ctx.js#L65-L71 | train |
petkaantonov/bluebird | tools/ast_passes.js | function( src, fileName ) {
var ast = parse(src, fileName);
walk.simple(ast, {
ExpressionStatement: function( node ) {
if( node.expression.type !== 'CallExpression' ) {
return;
}
var start = node.start;
var ... | javascript | function( src, fileName ) {
var ast = parse(src, fileName);
walk.simple(ast, {
ExpressionStatement: function( node ) {
if( node.expression.type !== 'CallExpression' ) {
return;
}
var start = node.start;
var ... | [
"function",
"(",
"src",
",",
"fileName",
")",
"{",
"var",
"ast",
"=",
"parse",
"(",
"src",
",",
"fileName",
")",
";",
"walk",
".",
"simple",
"(",
"ast",
",",
"{",
"ExpressionStatement",
":",
"function",
"(",
"node",
")",
"{",
"if",
"(",
"node",
"."... | Parse constants in from constants.js | [
"Parse",
"constants",
"in",
"from",
"constants",
".",
"js"
] | 17f69f3b0fa89a0b7a5cfb9a6546d1180a3610e0 | https://github.com/petkaantonov/bluebird/blob/17f69f3b0fa89a0b7a5cfb9a6546d1180a3610e0/tools/ast_passes.js#L492-L539 | train | |
petkaantonov/bluebird | tools/ast_passes.js | function( src, fileName ) {
var results = [];
var identifiers = [];
var ast = parse(src, fileName);
walk.simple(ast, {
Identifier: function( node ) {
identifiers.push( node );
}
});
for( var i = 0, len = identifiers.length; i < len... | javascript | function( src, fileName ) {
var results = [];
var identifiers = [];
var ast = parse(src, fileName);
walk.simple(ast, {
Identifier: function( node ) {
identifiers.push( node );
}
});
for( var i = 0, len = identifiers.length; i < len... | [
"function",
"(",
"src",
",",
"fileName",
")",
"{",
"var",
"results",
"=",
"[",
"]",
";",
"var",
"identifiers",
"=",
"[",
"]",
";",
"var",
"ast",
"=",
"parse",
"(",
"src",
",",
"fileName",
")",
";",
"walk",
".",
"simple",
"(",
"ast",
",",
"{",
"... | Expand constants in normal source files | [
"Expand",
"constants",
"in",
"normal",
"source",
"files"
] | 17f69f3b0fa89a0b7a5cfb9a6546d1180a3610e0 | https://github.com/petkaantonov/bluebird/blob/17f69f3b0fa89a0b7a5cfb9a6546d1180a3610e0/tools/ast_passes.js#L542-L569 | train | |
electron-userland/electron-packager | targets.js | validateListFromOptions | function validateListFromOptions (opts, name) {
if (opts.all) return Array.from(supported[name].values())
let list = opts[name]
if (!list) {
if (name === 'arch') {
list = hostArch()
} else {
list = process[name]
}
} else if (list === 'all') {
return Array.from(su... | javascript | function validateListFromOptions (opts, name) {
if (opts.all) return Array.from(supported[name].values())
let list = opts[name]
if (!list) {
if (name === 'arch') {
list = hostArch()
} else {
list = process[name]
}
} else if (list === 'all') {
return Array.from(su... | [
"function",
"validateListFromOptions",
"(",
"opts",
",",
"name",
")",
"{",
"if",
"(",
"opts",
".",
"all",
")",
"return",
"Array",
".",
"from",
"(",
"supported",
"[",
"name",
"]",
".",
"values",
"(",
")",
")",
"let",
"list",
"=",
"opts",
"[",
"name",
... | Validates list of architectures or platforms. Returns a normalized array if successful, or throws an Error. | [
"Validates",
"list",
"of",
"architectures",
"or",
"platforms",
".",
"Returns",
"a",
"normalized",
"array",
"if",
"successful",
"or",
"throws",
"an",
"Error",
"."
] | e65bc99ea3e06f9b72305d3fcf6589bdcb54810b | https://github.com/electron-userland/electron-packager/blob/e65bc99ea3e06f9b72305d3fcf6589bdcb54810b/targets.js#L104-L135 | train |
FineUploader/fine-uploader | client/js/azure/azure.xhr.upload.handler.js | function(reason) {
log(qq.format("Failed to determine blob name for ID {} - {}", id, reason), "error");
promise.failure({error: reason});
} | javascript | function(reason) {
log(qq.format("Failed to determine blob name for ID {} - {}", id, reason), "error");
promise.failure({error: reason});
} | [
"function",
"(",
"reason",
")",
"{",
"log",
"(",
"qq",
".",
"format",
"(",
"\"Failed to determine blob name for ID {} - {}\"",
",",
"id",
",",
"reason",
")",
",",
"\"error\"",
")",
";",
"promise",
".",
"failure",
"(",
"{",
"error",
":",
"reason",
"}",
")",... | We may have multiple SAS requests in progress for the same file, so we must include the chunk idx as part of the ID when communicating with the SAS ajax requester to avoid collisions. | [
"We",
"may",
"have",
"multiple",
"SAS",
"requests",
"in",
"progress",
"for",
"the",
"same",
"file",
"so",
"we",
"must",
"include",
"the",
"chunk",
"idx",
"as",
"part",
"of",
"the",
"ID",
"when",
"communicating",
"with",
"the",
"SAS",
"ajax",
"requester",
... | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/azure/azure.xhr.upload.handler.js#L121-L124 | train | |
FineUploader/fine-uploader | client/js/ui.handler.edit.filename.js | handleNameUpdate | function handleNameUpdate(newFilenameInputEl, fileId) {
var newName = newFilenameInputEl.value,
origExtension;
if (newName !== undefined && qq.trimStr(newName).length > 0) {
origExtension = getOriginalExtension(fileId);
if (origExtension !== undefined) {
... | javascript | function handleNameUpdate(newFilenameInputEl, fileId) {
var newName = newFilenameInputEl.value,
origExtension;
if (newName !== undefined && qq.trimStr(newName).length > 0) {
origExtension = getOriginalExtension(fileId);
if (origExtension !== undefined) {
... | [
"function",
"handleNameUpdate",
"(",
"newFilenameInputEl",
",",
"fileId",
")",
"{",
"var",
"newName",
"=",
"newFilenameInputEl",
".",
"value",
",",
"origExtension",
";",
"if",
"(",
"newName",
"!==",
"undefined",
"&&",
"qq",
".",
"trimStr",
"(",
"newName",
")",... | Callback iff the name has been changed | [
"Callback",
"iff",
"the",
"name",
"has",
"been",
"changed"
] | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/ui.handler.edit.filename.js#L33-L48 | train |
FineUploader/fine-uploader | client/js/ui.handler.edit.filename.js | registerInputBlurHandler | function registerInputBlurHandler(inputEl, fileId) {
inheritedInternalApi.getDisposeSupport().attach(inputEl, "blur", function() {
handleNameUpdate(inputEl, fileId);
});
} | javascript | function registerInputBlurHandler(inputEl, fileId) {
inheritedInternalApi.getDisposeSupport().attach(inputEl, "blur", function() {
handleNameUpdate(inputEl, fileId);
});
} | [
"function",
"registerInputBlurHandler",
"(",
"inputEl",
",",
"fileId",
")",
"{",
"inheritedInternalApi",
".",
"getDisposeSupport",
"(",
")",
".",
"attach",
"(",
"inputEl",
",",
"\"blur\"",
",",
"function",
"(",
")",
"{",
"handleNameUpdate",
"(",
"inputEl",
",",
... | The name has been updated if the filename edit input loses focus. | [
"The",
"name",
"has",
"been",
"updated",
"if",
"the",
"filename",
"edit",
"input",
"loses",
"focus",
"."
] | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/ui.handler.edit.filename.js#L51-L55 | train |
FineUploader/fine-uploader | client/js/ui.handler.edit.filename.js | registerInputEnterKeyHandler | function registerInputEnterKeyHandler(inputEl, fileId) {
inheritedInternalApi.getDisposeSupport().attach(inputEl, "keyup", function(event) {
var code = event.keyCode || event.which;
if (code === 13) {
handleNameUpdate(inputEl, fileId);
}
});
} | javascript | function registerInputEnterKeyHandler(inputEl, fileId) {
inheritedInternalApi.getDisposeSupport().attach(inputEl, "keyup", function(event) {
var code = event.keyCode || event.which;
if (code === 13) {
handleNameUpdate(inputEl, fileId);
}
});
} | [
"function",
"registerInputEnterKeyHandler",
"(",
"inputEl",
",",
"fileId",
")",
"{",
"inheritedInternalApi",
".",
"getDisposeSupport",
"(",
")",
".",
"attach",
"(",
"inputEl",
",",
"\"keyup\"",
",",
"function",
"(",
"event",
")",
"{",
"var",
"code",
"=",
"even... | The name has been updated if the user presses enter. | [
"The",
"name",
"has",
"been",
"updated",
"if",
"the",
"user",
"presses",
"enter",
"."
] | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/ui.handler.edit.filename.js#L58-L67 | train |
FineUploader/fine-uploader | client/js/dnd.js | getFilesInDirectory | function getFilesInDirectory(entry, reader, accumEntries, existingPromise) {
var promise = existingPromise || new qq.Promise(),
dirReader = reader || entry.createReader();
dirReader.readEntries(
function readSuccess(entries) {
var newEntries = accumEntries ? accu... | javascript | function getFilesInDirectory(entry, reader, accumEntries, existingPromise) {
var promise = existingPromise || new qq.Promise(),
dirReader = reader || entry.createReader();
dirReader.readEntries(
function readSuccess(entries) {
var newEntries = accumEntries ? accu... | [
"function",
"getFilesInDirectory",
"(",
"entry",
",",
"reader",
",",
"accumEntries",
",",
"existingPromise",
")",
"{",
"var",
"promise",
"=",
"existingPromise",
"||",
"new",
"qq",
".",
"Promise",
"(",
")",
",",
"dirReader",
"=",
"reader",
"||",
"entry",
".",... | Promissory. Guaranteed to read all files in the root of the passed directory. | [
"Promissory",
".",
"Guaranteed",
"to",
"read",
"all",
"files",
"in",
"the",
"root",
"of",
"the",
"passed",
"directory",
"."
] | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/dnd.js#L93-L115 | train |
FineUploader/fine-uploader | client/js/jquery-plugin.js | addCallbacks | function addCallbacks(transformedOpts, newUploaderInstance) {
var callbacks = transformedOpts.callbacks = {};
$.each(newUploaderInstance._options.callbacks, function(prop, nonJqueryCallback) {
var name, callbackEventTarget;
name = /^on(\w+)/.exec(prop)[1];
name = na... | javascript | function addCallbacks(transformedOpts, newUploaderInstance) {
var callbacks = transformedOpts.callbacks = {};
$.each(newUploaderInstance._options.callbacks, function(prop, nonJqueryCallback) {
var name, callbackEventTarget;
name = /^on(\w+)/.exec(prop)[1];
name = na... | [
"function",
"addCallbacks",
"(",
"transformedOpts",
",",
"newUploaderInstance",
")",
"{",
"var",
"callbacks",
"=",
"transformedOpts",
".",
"callbacks",
"=",
"{",
"}",
";",
"$",
".",
"each",
"(",
"newUploaderInstance",
".",
"_options",
".",
"callbacks",
",",
"f... | Implement all callbacks defined in Fine Uploader as functions that trigger appropriately names events and return the result of executing the bound handler back to Fine Uploader | [
"Implement",
"all",
"callbacks",
"defined",
"in",
"Fine",
"Uploader",
"as",
"functions",
"that",
"trigger",
"appropriately",
"names",
"events",
"and",
"return",
"the",
"result",
"of",
"executing",
"the",
"bound",
"handler",
"back",
"to",
"Fine",
"Uploader"
] | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/jquery-plugin.js#L72-L109 | train |
FineUploader/fine-uploader | client/js/jquery-plugin.js | maybeWrapInJquery | function maybeWrapInJquery(val) {
var transformedVal = val;
// If the command is returning an `HTMLElement` or `HTMLDocument`, wrap it in a `jQuery` object
/*jshint -W116*/
if (val != null && typeof val === "object" &&
(val.nodeType === 1 || val.nodeType === 9) && val.cloneNo... | javascript | function maybeWrapInJquery(val) {
var transformedVal = val;
// If the command is returning an `HTMLElement` or `HTMLDocument`, wrap it in a `jQuery` object
/*jshint -W116*/
if (val != null && typeof val === "object" &&
(val.nodeType === 1 || val.nodeType === 9) && val.cloneNo... | [
"function",
"maybeWrapInJquery",
"(",
"val",
")",
"{",
"var",
"transformedVal",
"=",
"val",
";",
"// If the command is returning an `HTMLElement` or `HTMLDocument`, wrap it in a `jQuery` object",
"/*jshint -W116*/",
"if",
"(",
"val",
"!=",
"null",
"&&",
"typeof",
"val",
"==... | If the value is an `HTMLElement` or `HTMLDocument`, wrap it in a `jQuery` object | [
"If",
"the",
"value",
"is",
"an",
"HTMLElement",
"or",
"HTMLDocument",
"wrap",
"it",
"in",
"a",
"jQuery",
"object"
] | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/jquery-plugin.js#L187-L199 | train |
FineUploader/fine-uploader | client/js/total-progress.js | function(id, loaded, total) {
updateTotalProgress(id, loaded, total);
perFileProgress[id] = {loaded: loaded, total: total};
} | javascript | function(id, loaded, total) {
updateTotalProgress(id, loaded, total);
perFileProgress[id] = {loaded: loaded, total: total};
} | [
"function",
"(",
"id",
",",
"loaded",
",",
"total",
")",
"{",
"updateTotalProgress",
"(",
"id",
",",
"loaded",
",",
"total",
")",
";",
"perFileProgress",
"[",
"id",
"]",
"=",
"{",
"loaded",
":",
"loaded",
",",
"total",
":",
"total",
"}",
";",
"}"
] | Called whenever the upload progress of an individual file has changed. | [
"Called",
"whenever",
"the",
"upload",
"progress",
"of",
"an",
"individual",
"file",
"has",
"changed",
"."
] | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/total-progress.js#L110-L113 | train | |
FineUploader/fine-uploader | client/js/ui.handler.click.filename.js | examineEvent | function examineEvent(target, event) {
if (spec.templating.isFileName(target) || spec.templating.isEditIcon(target)) {
var fileId = spec.templating.getFileId(target),
status = spec.onGetUploadStatus(fileId);
// We only allow users to change filenames of files that have b... | javascript | function examineEvent(target, event) {
if (spec.templating.isFileName(target) || spec.templating.isEditIcon(target)) {
var fileId = spec.templating.getFileId(target),
status = spec.onGetUploadStatus(fileId);
// We only allow users to change filenames of files that have b... | [
"function",
"examineEvent",
"(",
"target",
",",
"event",
")",
"{",
"if",
"(",
"spec",
".",
"templating",
".",
"isFileName",
"(",
"target",
")",
"||",
"spec",
".",
"templating",
".",
"isEditIcon",
"(",
"target",
")",
")",
"{",
"var",
"fileId",
"=",
"spe... | This will be called by the parent handler when a `click` event is received on the list element. | [
"This",
"will",
"be",
"called",
"by",
"the",
"parent",
"handler",
"when",
"a",
"click",
"event",
"is",
"received",
"on",
"the",
"list",
"element",
"."
] | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/ui.handler.click.filename.js#L21-L34 | train |
FineUploader/fine-uploader | client/js/image-support/exif.js | getDirEntryCount | function getDirEntryCount(app1Start, littleEndian) {
var promise = new qq.Promise();
qq.readBlobToHex(fileOrBlob, app1Start + 18, 2).then(function(hex) {
if (littleEndian) {
return promise.success(parseLittleEndian(hex));
}
else {
prom... | javascript | function getDirEntryCount(app1Start, littleEndian) {
var promise = new qq.Promise();
qq.readBlobToHex(fileOrBlob, app1Start + 18, 2).then(function(hex) {
if (littleEndian) {
return promise.success(parseLittleEndian(hex));
}
else {
prom... | [
"function",
"getDirEntryCount",
"(",
"app1Start",
",",
"littleEndian",
")",
"{",
"var",
"promise",
"=",
"new",
"qq",
".",
"Promise",
"(",
")",
";",
"qq",
".",
"readBlobToHex",
"(",
"fileOrBlob",
",",
"app1Start",
"+",
"18",
",",
"2",
")",
".",
"then",
... | Determine the number of directory entries in the EXIF header. | [
"Determine",
"the",
"number",
"of",
"directory",
"entries",
"in",
"the",
"EXIF",
"header",
"."
] | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/image-support/exif.js#L99-L112 | train |
FineUploader/fine-uploader | client/js/image-support/exif.js | getIfd | function getIfd(app1Start, dirEntries) {
var offset = app1Start + 20,
bytes = dirEntries * 12;
return qq.readBlobToHex(fileOrBlob, offset, bytes);
} | javascript | function getIfd(app1Start, dirEntries) {
var offset = app1Start + 20,
bytes = dirEntries * 12;
return qq.readBlobToHex(fileOrBlob, offset, bytes);
} | [
"function",
"getIfd",
"(",
"app1Start",
",",
"dirEntries",
")",
"{",
"var",
"offset",
"=",
"app1Start",
"+",
"20",
",",
"bytes",
"=",
"dirEntries",
"*",
"12",
";",
"return",
"qq",
".",
"readBlobToHex",
"(",
"fileOrBlob",
",",
"offset",
",",
"bytes",
")",... | Get the IFD portion of the EXIF header as a hex string. | [
"Get",
"the",
"IFD",
"portion",
"of",
"the",
"EXIF",
"header",
"as",
"a",
"hex",
"string",
"."
] | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/image-support/exif.js#L115-L120 | train |
FineUploader/fine-uploader | client/js/image-support/exif.js | getTagValues | function getTagValues(littleEndian, dirEntries) {
var TAG_VAL_OFFSET = 16,
tagsToFind = qq.extend([], TAG_IDS),
vals = {};
qq.each(dirEntries, function(idx, entry) {
var idHex = entry.slice(0, 4),
id = littleEndian ? parseLittleEndian(idHex) : parseIn... | javascript | function getTagValues(littleEndian, dirEntries) {
var TAG_VAL_OFFSET = 16,
tagsToFind = qq.extend([], TAG_IDS),
vals = {};
qq.each(dirEntries, function(idx, entry) {
var idHex = entry.slice(0, 4),
id = littleEndian ? parseLittleEndian(idHex) : parseIn... | [
"function",
"getTagValues",
"(",
"littleEndian",
",",
"dirEntries",
")",
"{",
"var",
"TAG_VAL_OFFSET",
"=",
"16",
",",
"tagsToFind",
"=",
"qq",
".",
"extend",
"(",
"[",
"]",
",",
"TAG_IDS",
")",
",",
"vals",
"=",
"{",
"}",
";",
"qq",
".",
"each",
"("... | Obtain values for all relevant tags and return them. | [
"Obtain",
"values",
"for",
"all",
"relevant",
"tags",
"and",
"return",
"them",
"."
] | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/image-support/exif.js#L136-L162 | train |
FineUploader/fine-uploader | client/js/s3/multipart.complete.ajax.requester.js | handleCompleteRequestComplete | function handleCompleteRequestComplete(id, xhr, isError) {
var promise = pendingCompleteRequests[id],
domParser = new DOMParser(),
bucket = options.getBucket(id),
key = options.getKey(id),
responseDoc = domParser.parseFromString(xhr.responseText, "application/xml"... | javascript | function handleCompleteRequestComplete(id, xhr, isError) {
var promise = pendingCompleteRequests[id],
domParser = new DOMParser(),
bucket = options.getBucket(id),
key = options.getKey(id),
responseDoc = domParser.parseFromString(xhr.responseText, "application/xml"... | [
"function",
"handleCompleteRequestComplete",
"(",
"id",
",",
"xhr",
",",
"isError",
")",
"{",
"var",
"promise",
"=",
"pendingCompleteRequests",
"[",
"id",
"]",
",",
"domParser",
"=",
"new",
"DOMParser",
"(",
")",
",",
"bucket",
"=",
"options",
".",
"getBucke... | Called by the base ajax requester when the response has been received. We definitively determine here if the
"Complete MPU" request has been a success or not.
@param id ID associated with the file.
@param xhr `XMLHttpRequest` object containing the response, among other things.
@param isError A boolean indicating succ... | [
"Called",
"by",
"the",
"base",
"ajax",
"requester",
"when",
"the",
"response",
"has",
"been",
"received",
".",
"We",
"definitively",
"determine",
"here",
"if",
"the",
"Complete",
"MPU",
"request",
"has",
"been",
"a",
"success",
"or",
"not",
"."
] | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/s3/multipart.complete.ajax.requester.js#L69-L108 | train |
FineUploader/fine-uploader | client/js/s3/multipart.complete.ajax.requester.js | function(id, uploadId, etagEntries) {
var promise = new qq.Promise(),
body = getCompleteRequestBody(etagEntries);
getHeaders(id, uploadId, body).then(function(headers, endOfUrl) {
options.log("Submitting S3 complete multipart upload request for " + id);
... | javascript | function(id, uploadId, etagEntries) {
var promise = new qq.Promise(),
body = getCompleteRequestBody(etagEntries);
getHeaders(id, uploadId, body).then(function(headers, endOfUrl) {
options.log("Submitting S3 complete multipart upload request for " + id);
... | [
"function",
"(",
"id",
",",
"uploadId",
",",
"etagEntries",
")",
"{",
"var",
"promise",
"=",
"new",
"qq",
".",
"Promise",
"(",
")",
",",
"body",
"=",
"getCompleteRequestBody",
"(",
"etagEntries",
")",
";",
"getHeaders",
"(",
"id",
",",
"uploadId",
",",
... | Sends the "Complete" request and fulfills the returned promise when the success of this request is known.
@param id ID associated with the file.
@param uploadId AWS uploadId for this file
@param etagEntries Array of objects containing `etag` values and their associated `part` numbers.
@returns {qq.Promise} | [
"Sends",
"the",
"Complete",
"request",
"and",
"fulfills",
"the",
"returned",
"promise",
"when",
"the",
"success",
"of",
"this",
"request",
"is",
"known",
"."
] | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/s3/multipart.complete.ajax.requester.js#L165-L183 | train | |
FineUploader/fine-uploader | client/js/identify.js | function() {
var self = this,
identifier = new qq.Promise(),
previewable = false,
name = fileOrBlob.name === undefined ? "blob" : fileOrBlob.name;
log(qq.format("Attempting to determine if {} can be rendered in this browser", name));
... | javascript | function() {
var self = this,
identifier = new qq.Promise(),
previewable = false,
name = fileOrBlob.name === undefined ? "blob" : fileOrBlob.name;
log(qq.format("Attempting to determine if {} can be rendered in this browser", name));
... | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
",",
"identifier",
"=",
"new",
"qq",
".",
"Promise",
"(",
")",
",",
"previewable",
"=",
"false",
",",
"name",
"=",
"fileOrBlob",
".",
"name",
"===",
"undefined",
"?",
"\"blob\"",
":",
"fileOrBlob",... | Determines if a Blob can be displayed natively in the current browser. This is done by reading magic
bytes in the beginning of the file, so this is an asynchronous operation. Before we attempt to read the
file, we will examine the blob's type attribute to save CPU cycles.
@returns {qq.Promise} Promise that is fulfil... | [
"Determines",
"if",
"a",
"Blob",
"can",
"be",
"displayed",
"natively",
"in",
"the",
"current",
"browser",
".",
"This",
"is",
"done",
"by",
"reading",
"magic",
"bytes",
"in",
"the",
"beginning",
"of",
"the",
"file",
"so",
"this",
"is",
"an",
"asynchronous",... | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/identify.js#L28-L71 | train | |
FineUploader/fine-uploader | client/js/s3/s3.xhr.upload.handler.js | function(id, xhr, chunkIdx) {
var response = upload.response.parse(id, xhr),
etag;
if (response.success) {
etag = xhr.getResponseHeader("ETag");
if (!handler._getPersistableData(id).etags) {
handler._ge... | javascript | function(id, xhr, chunkIdx) {
var response = upload.response.parse(id, xhr),
etag;
if (response.success) {
etag = xhr.getResponseHeader("ETag");
if (!handler._getPersistableData(id).etags) {
handler._ge... | [
"function",
"(",
"id",
",",
"xhr",
",",
"chunkIdx",
")",
"{",
"var",
"response",
"=",
"upload",
".",
"response",
".",
"parse",
"(",
"id",
",",
"xhr",
")",
",",
"etag",
";",
"if",
"(",
"response",
".",
"success",
")",
"{",
"etag",
"=",
"xhr",
".",... | The last step in handling a chunked upload. This is called after each chunk has been sent. The request may be successful, or not. If it was successful, we must extract the "ETag" element in the XML response and store that along with the associated part number. We need these items to "Complete" the multipart upload af... | [
"The",
"last",
"step",
"in",
"handling",
"a",
"chunked",
"upload",
".",
"This",
"is",
"called",
"after",
"each",
"chunk",
"has",
"been",
"sent",
".",
"The",
"request",
"may",
"be",
"successful",
"or",
"not",
".",
"If",
"it",
"was",
"successful",
"we",
... | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/s3/s3.xhr.upload.handler.js#L56-L68 | train | |
FineUploader/fine-uploader | client/js/s3/s3.xhr.upload.handler.js | function(awsParams) {
xhr.open("POST", url, true);
qq.obj2FormData(awsParams, formData);
// AWS requires the file field be named "file".
formData.append("file", fileOrBlob);
promise.success(formDat... | javascript | function(awsParams) {
xhr.open("POST", url, true);
qq.obj2FormData(awsParams, formData);
// AWS requires the file field be named "file".
formData.append("file", fileOrBlob);
promise.success(formDat... | [
"function",
"(",
"awsParams",
")",
"{",
"xhr",
".",
"open",
"(",
"\"POST\"",
",",
"url",
",",
"true",
")",
";",
"qq",
".",
"obj2FormData",
"(",
"awsParams",
",",
"formData",
")",
";",
"// AWS requires the file field be named \"file\".",
"formData",
".",
"appen... | Success - all params determined | [
"Success",
"-",
"all",
"params",
"determined"
] | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/s3/s3.xhr.upload.handler.js#L349-L358 | train | |
FineUploader/fine-uploader | client/js/s3/s3.xhr.upload.handler.js | function(awsResponseXml) {
var parser = new DOMParser(),
parsedDoc = parser.parseFromString(awsResponseXml, "application/xml"),
errorEls = parsedDoc.getElementsByTagName("Error"),
errorDetails = {},
codeE... | javascript | function(awsResponseXml) {
var parser = new DOMParser(),
parsedDoc = parser.parseFromString(awsResponseXml, "application/xml"),
errorEls = parsedDoc.getElementsByTagName("Error"),
errorDetails = {},
codeE... | [
"function",
"(",
"awsResponseXml",
")",
"{",
"var",
"parser",
"=",
"new",
"DOMParser",
"(",
")",
",",
"parsedDoc",
"=",
"parser",
".",
"parseFromString",
"(",
"awsResponseXml",
",",
"\"application/xml\"",
")",
",",
"errorEls",
"=",
"parsedDoc",
".",
"getElemen... | This parses an XML response by extracting the "Message" and "Code" elements that accompany AWS error responses.
@param awsResponseXml XML response from AWS
@returns {object} Object w/ `code` and `message` properties, or undefined if we couldn't find error info in the XML document. | [
"This",
"parses",
"an",
"XML",
"response",
"by",
"extracting",
"the",
"Message",
"and",
"Code",
"elements",
"that",
"accompany",
"AWS",
"error",
"responses",
"."
] | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/s3/s3.xhr.upload.handler.js#L507-L528 | train | |
FineUploader/fine-uploader | client/js/s3/multipart.abort.ajax.requester.js | function(id, uploadId) {
getHeaders(id, uploadId).then(function(headers, endOfUrl) {
options.log("Submitting S3 Abort multipart upload request for " + id);
requester.initTransport(id)
.withPath(endOfUrl)
.withHeaders(headers)
... | javascript | function(id, uploadId) {
getHeaders(id, uploadId).then(function(headers, endOfUrl) {
options.log("Submitting S3 Abort multipart upload request for " + id);
requester.initTransport(id)
.withPath(endOfUrl)
.withHeaders(headers)
... | [
"function",
"(",
"id",
",",
"uploadId",
")",
"{",
"getHeaders",
"(",
"id",
",",
"uploadId",
")",
".",
"then",
"(",
"function",
"(",
"headers",
",",
"endOfUrl",
")",
"{",
"options",
".",
"log",
"(",
"\"Submitting S3 Abort multipart upload request for \"",
"+",
... | Sends the "Abort" request.
@param id ID associated with the file.
@param uploadId AWS uploadId for this file | [
"Sends",
"the",
"Abort",
"request",
"."
] | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/s3/multipart.abort.ajax.requester.js#L113-L121 | train | |
FineUploader/fine-uploader | client/js/uploader.basic.api.js | function(fileId, imgOrCanvas, maxSize, fromServer, customResizeFunction) {
var promiseToReturn = new qq.Promise(),
fileOrUrl, options;
if (this._imageGenerator) {
fileOrUrl = this._thumbnailUrls[fileId];
options = {
customResiz... | javascript | function(fileId, imgOrCanvas, maxSize, fromServer, customResizeFunction) {
var promiseToReturn = new qq.Promise(),
fileOrUrl, options;
if (this._imageGenerator) {
fileOrUrl = this._thumbnailUrls[fileId];
options = {
customResiz... | [
"function",
"(",
"fileId",
",",
"imgOrCanvas",
",",
"maxSize",
",",
"fromServer",
",",
"customResizeFunction",
")",
"{",
"var",
"promiseToReturn",
"=",
"new",
"qq",
".",
"Promise",
"(",
")",
",",
"fileOrUrl",
",",
"options",
";",
"if",
"(",
"this",
".",
... | Generate a variable size thumbnail on an img or canvas, returning a promise that is fulfilled when the attempt completes. Thumbnail can either be based off of a URL for an image returned by the server in the upload response, or the associated `Blob`. | [
"Generate",
"a",
"variable",
"size",
"thumbnail",
"on",
"an",
"img",
"or",
"canvas",
"returning",
"a",
"promise",
"that",
"is",
"fulfilled",
"when",
"the",
"attempt",
"completes",
".",
"Thumbnail",
"can",
"either",
"be",
"based",
"off",
"of",
"a",
"URL",
"... | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/uploader.basic.api.js#L173-L212 | train | |
FineUploader/fine-uploader | client/js/uploader.basic.api.js | function(id) {
var uploadDataEntry = this.getUploads({id: id}),
parentId = null;
if (uploadDataEntry) {
if (uploadDataEntry.parentId !== undefined) {
parentId = uploadDataEntry.parentId;
}
}
return pare... | javascript | function(id) {
var uploadDataEntry = this.getUploads({id: id}),
parentId = null;
if (uploadDataEntry) {
if (uploadDataEntry.parentId !== undefined) {
parentId = uploadDataEntry.parentId;
}
}
return pare... | [
"function",
"(",
"id",
")",
"{",
"var",
"uploadDataEntry",
"=",
"this",
".",
"getUploads",
"(",
"{",
"id",
":",
"id",
"}",
")",
",",
"parentId",
"=",
"null",
";",
"if",
"(",
"uploadDataEntry",
")",
"{",
"if",
"(",
"uploadDataEntry",
".",
"parentId",
... | Parent ID for a specific file, or null if this is the parent, or if it has no parent. | [
"Parent",
"ID",
"for",
"a",
"specific",
"file",
"or",
"null",
"if",
"this",
"is",
"the",
"parent",
"or",
"if",
"it",
"has",
"no",
"parent",
"."
] | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/uploader.basic.api.js#L252-L263 | train | |
FineUploader/fine-uploader | client/js/uploader.basic.api.js | function(spec) {
var self = this,
acceptFiles = spec.accept || this._options.validation.acceptFiles,
allowedExtensions = spec.allowedExtensions || this._options.validation.allowedExtensions,
button;
function allowMultiple() {
if (q... | javascript | function(spec) {
var self = this,
acceptFiles = spec.accept || this._options.validation.acceptFiles,
allowedExtensions = spec.allowedExtensions || this._options.validation.allowedExtensions,
button;
function allowMultiple() {
if (q... | [
"function",
"(",
"spec",
")",
"{",
"var",
"self",
"=",
"this",
",",
"acceptFiles",
"=",
"spec",
".",
"accept",
"||",
"this",
".",
"_options",
".",
"validation",
".",
"acceptFiles",
",",
"allowedExtensions",
"=",
"spec",
".",
"allowedExtensions",
"||",
"thi... | Generate a tracked upload button.
@param spec Object containing a required `element` property
along with optional `multiple`, `accept`, and `folders`.
@returns {qq.UploadButton}
@private | [
"Generate",
"a",
"tracked",
"upload",
"button",
"."
] | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/uploader.basic.api.js#L670-L719 | train | |
FineUploader/fine-uploader | client/js/uploader.basic.api.js | function(buttonOrFileInputOrFile) {
var inputs, fileInput,
fileBlobOrInput = buttonOrFileInputOrFile;
// We want the reference file/blob here if this is a proxy (a file that will be generated on-demand later)
if (fileBlobOrInput instanceof qq.BlobProxy) {
... | javascript | function(buttonOrFileInputOrFile) {
var inputs, fileInput,
fileBlobOrInput = buttonOrFileInputOrFile;
// We want the reference file/blob here if this is a proxy (a file that will be generated on-demand later)
if (fileBlobOrInput instanceof qq.BlobProxy) {
... | [
"function",
"(",
"buttonOrFileInputOrFile",
")",
"{",
"var",
"inputs",
",",
"fileInput",
",",
"fileBlobOrInput",
"=",
"buttonOrFileInputOrFile",
";",
"// We want the reference file/blob here if this is a proxy (a file that will be generated on-demand later)",
"if",
"(",
"fileBlobOr... | Gets the internally used tracking ID for a button.
@param buttonOrFileInputOrFile `File`, `<input type="file">`, or a button container element
@returns {*} The button's ID, or undefined if no ID is recoverable
@private | [
"Gets",
"the",
"internally",
"used",
"tracking",
"ID",
"for",
"a",
"button",
"."
] | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/uploader.basic.api.js#L942-L975 | train | |
FineUploader/fine-uploader | client/js/uploader.basic.api.js | function() {
if (this._options.camera.ios && qq.ios()) {
var acceptIosCamera = "image/*;capture=camera",
button = this._options.camera.button,
buttonId = button ? this._getButtonId(button) : this._defaultButtonId,
optionRoot = this.... | javascript | function() {
if (this._options.camera.ios && qq.ios()) {
var acceptIosCamera = "image/*;capture=camera",
button = this._options.camera.button,
buttonId = button ? this._getButtonId(button) : this._defaultButtonId,
optionRoot = this.... | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"_options",
".",
"camera",
".",
"ios",
"&&",
"qq",
".",
"ios",
"(",
")",
")",
"{",
"var",
"acceptIosCamera",
"=",
"\"image/*;capture=camera\"",
",",
"button",
"=",
"this",
".",
"_options",
".",
"camera... | Allows camera access on either the default or an extra button for iOS devices. | [
"Allows",
"camera",
"access",
"on",
"either",
"the",
"default",
"or",
"an",
"extra",
"button",
"for",
"iOS",
"devices",
"."
] | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/uploader.basic.api.js#L1028-L1061 | train | |
FineUploader/fine-uploader | client/js/uploader.basic.api.js | function(spec) {
var button = this._createUploadButton({
accept: spec.validation.acceptFiles,
allowedExtensions: spec.validation.allowedExtensions,
element: spec.element,
folders: spec.folders,
multiple: spec.multiple,
... | javascript | function(spec) {
var button = this._createUploadButton({
accept: spec.validation.acceptFiles,
allowedExtensions: spec.validation.allowedExtensions,
element: spec.element,
folders: spec.folders,
multiple: spec.multiple,
... | [
"function",
"(",
"spec",
")",
"{",
"var",
"button",
"=",
"this",
".",
"_createUploadButton",
"(",
"{",
"accept",
":",
"spec",
".",
"validation",
".",
"acceptFiles",
",",
"allowedExtensions",
":",
"spec",
".",
"validation",
".",
"allowedExtensions",
",",
"ele... | Creates an extra button element | [
"Creates",
"an",
"extra",
"button",
"element"
] | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/uploader.basic.api.js#L1192-L1203 | train | |
FineUploader/fine-uploader | client/js/uploader.basic.api.js | function(id) {
var buttonId;
if (qq.supportedFeatures.ajaxUploading) {
buttonId = this._handler.getFile(id).qqButtonId;
}
else {
buttonId = this._getButtonId(this._handler.getInput(id));
}
if (buttonId) {
... | javascript | function(id) {
var buttonId;
if (qq.supportedFeatures.ajaxUploading) {
buttonId = this._handler.getFile(id).qqButtonId;
}
else {
buttonId = this._getButtonId(this._handler.getInput(id));
}
if (buttonId) {
... | [
"function",
"(",
"id",
")",
"{",
"var",
"buttonId",
";",
"if",
"(",
"qq",
".",
"supportedFeatures",
".",
"ajaxUploading",
")",
"{",
"buttonId",
"=",
"this",
".",
"_handler",
".",
"getFile",
"(",
"id",
")",
".",
"qqButtonId",
";",
"}",
"else",
"{",
"b... | Maps a file with the button that was used to select it. | [
"Maps",
"a",
"file",
"with",
"the",
"button",
"that",
"was",
"used",
"to",
"select",
"it",
"."
] | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/uploader.basic.api.js#L1810-L1823 | train | |
FineUploader/fine-uploader | client/js/uploader.basic.api.js | function(fileWrapper, validationDescriptor) {
var self = this,
file = (function() {
if (fileWrapper.file instanceof qq.BlobProxy) {
return fileWrapper.file.referenceBlob;
}
return fileWrapper.file;
... | javascript | function(fileWrapper, validationDescriptor) {
var self = this,
file = (function() {
if (fileWrapper.file instanceof qq.BlobProxy) {
return fileWrapper.file.referenceBlob;
}
return fileWrapper.file;
... | [
"function",
"(",
"fileWrapper",
",",
"validationDescriptor",
")",
"{",
"var",
"self",
"=",
"this",
",",
"file",
"=",
"(",
"function",
"(",
")",
"{",
"if",
"(",
"fileWrapper",
".",
"file",
"instanceof",
"qq",
".",
"BlobProxy",
")",
"{",
"return",
"fileWra... | Performs some internal validation checks on an item, defined in the `validation` option.
@param fileWrapper Wrapper containing a `file` along with an `id`
@param validationDescriptor Normalized information about the item (`size`, `name`).
@returns qq.Promise with appropriate callbacks invoked depending on the validity... | [
"Performs",
"some",
"internal",
"validation",
"checks",
"on",
"an",
"item",
"defined",
"in",
"the",
"validation",
"option",
"."
] | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/uploader.basic.api.js#L1895-L1949 | train | |
FineUploader/fine-uploader | client/js/image-support/scaler.js | function(sizes) {
"use strict";
sizes = qq.extend([], sizes);
return sizes.sort(function(a, b) {
if (a.maxSize > b.maxSize) {
return 1;
}
if (a.maxSize < b.maxSize) {
return -1;
}
return 0;
});
... | javascript | function(sizes) {
"use strict";
sizes = qq.extend([], sizes);
return sizes.sort(function(a, b) {
if (a.maxSize > b.maxSize) {
return 1;
}
if (a.maxSize < b.maxSize) {
return -1;
}
return 0;
});
... | [
"function",
"(",
"sizes",
")",
"{",
"\"use strict\"",
";",
"sizes",
"=",
"qq",
".",
"extend",
"(",
"[",
"]",
",",
"sizes",
")",
";",
"return",
"sizes",
".",
"sort",
"(",
"function",
"(",
"a",
",",
"b",
")",
"{",
"if",
"(",
"a",
".",
"maxSize",
... | We want the smallest scaled file to be uploaded first | [
"We",
"want",
"the",
"smallest",
"scaled",
"file",
"to",
"be",
"uploaded",
"first"
] | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/image-support/scaler.js#L276-L290 | train | |
FineUploader/fine-uploader | client/js/image-support/scaler.js | function(originalImage, scaledImageDataUri, log) {
"use strict";
var reader = new FileReader(),
insertionEffort = new qq.Promise(),
originalImageDataUri = "";
reader.onload = function() {
originalImageDataUri = reader.result;
insertionEffort.succ... | javascript | function(originalImage, scaledImageDataUri, log) {
"use strict";
var reader = new FileReader(),
insertionEffort = new qq.Promise(),
originalImageDataUri = "";
reader.onload = function() {
originalImageDataUri = reader.result;
insertionEffort.succ... | [
"function",
"(",
"originalImage",
",",
"scaledImageDataUri",
",",
"log",
")",
"{",
"\"use strict\"",
";",
"var",
"reader",
"=",
"new",
"FileReader",
"(",
")",
",",
"insertionEffort",
"=",
"new",
"qq",
".",
"Promise",
"(",
")",
",",
"originalImageDataUri",
"=... | Attempt to insert the original image's EXIF header into a scaled version. | [
"Attempt",
"to",
"insert",
"the",
"original",
"image",
"s",
"EXIF",
"header",
"into",
"a",
"scaled",
"version",
"."
] | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/image-support/scaler.js#L340-L360 | train | |
FineUploader/fine-uploader | client/js/form-support.js | maybeUploadOnSubmit | function maybeUploadOnSubmit(formEl) {
var nativeSubmit = formEl.submit;
// Intercept and squelch submit events.
qq(formEl).attach("submit", function(event) {
event = event || window.event;
if (event.preventDefault) {
event.preventDefault();
... | javascript | function maybeUploadOnSubmit(formEl) {
var nativeSubmit = formEl.submit;
// Intercept and squelch submit events.
qq(formEl).attach("submit", function(event) {
event = event || window.event;
if (event.preventDefault) {
event.preventDefault();
... | [
"function",
"maybeUploadOnSubmit",
"(",
"formEl",
")",
"{",
"var",
"nativeSubmit",
"=",
"formEl",
".",
"submit",
";",
"// Intercept and squelch submit events.",
"qq",
"(",
"formEl",
")",
".",
"attach",
"(",
"\"submit\"",
",",
"function",
"(",
"event",
")",
"{",
... | Intercept form submit attempts, unless the integrator has told us not to do this. | [
"Intercept",
"form",
"submit",
"attempts",
"unless",
"the",
"integrator",
"has",
"told",
"us",
"not",
"to",
"do",
"this",
"."
] | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/form-support.js#L62-L84 | train |
FineUploader/fine-uploader | client/js/upload-data.js | function(spec) {
var status = spec.status || qq.status.SUBMITTING,
id = data.push({
name: spec.name,
originalName: spec.name,
uuid: spec.uuid,
size: spec.size == null ? -1 : spec.size,
status:... | javascript | function(spec) {
var status = spec.status || qq.status.SUBMITTING,
id = data.push({
name: spec.name,
originalName: spec.name,
uuid: spec.uuid,
size: spec.size == null ? -1 : spec.size,
status:... | [
"function",
"(",
"spec",
")",
"{",
"var",
"status",
"=",
"spec",
".",
"status",
"||",
"qq",
".",
"status",
".",
"SUBMITTING",
",",
"id",
"=",
"data",
".",
"push",
"(",
"{",
"name",
":",
"spec",
".",
"name",
",",
"originalName",
":",
"spec",
".",
... | Adds a new file to the data cache for tracking purposes.
@param spec Data that describes this file. Possible properties are:
- uuid: Initial UUID for this file.
- name: Initial name of this file.
- size: Size of this file, omit if this cannot be determined
- status: Initial `qq.status` for this file. Omit for `qq.s... | [
"Adds",
"a",
"new",
"file",
"to",
"the",
"data",
"cache",
"for",
"tracking",
"purposes",
"."
] | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/upload-data.js#L72-L113 | train | |
FineUploader/fine-uploader | client/js/azure/util.js | function(name) {
if (qq.azure.util._paramNameMatchesAzureParameter(name)) {
return name;
}
else {
return qq.azure.util.AZURE_PARAM_PREFIX + name;
}
} | javascript | function(name) {
if (qq.azure.util._paramNameMatchesAzureParameter(name)) {
return name;
}
else {
return qq.azure.util.AZURE_PARAM_PREFIX + name;
}
} | [
"function",
"(",
"name",
")",
"{",
"if",
"(",
"qq",
".",
"azure",
".",
"util",
".",
"_paramNameMatchesAzureParameter",
"(",
"name",
")",
")",
"{",
"return",
"name",
";",
"}",
"else",
"{",
"return",
"qq",
".",
"azure",
".",
"util",
".",
"AZURE_PARAM_PRE... | Create Prefixed request headers which are appropriate for Azure.
If the request header is appropriate for Azure (e.g. Cache-Control) then it should be
passed along without a metadata prefix. For all other request header parameter names,
qq.azure.util.AZURE_PARAM_PREFIX should be prepended.
@param name Name of the Req... | [
"Create",
"Prefixed",
"request",
"headers",
"which",
"are",
"appropriate",
"for",
"Azure",
"."
] | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/azure/util.js#L39-L46 | train | |
FineUploader/fine-uploader | client/js/ui.handler.focusin.filenameinput.js | handleInputFocus | function handleInputFocus(target, event) {
if (spec.templating.isEditInput(target)) {
var fileId = spec.templating.getFileId(target),
status = spec.onGetUploadStatus(fileId);
if (status === qq.status.SUBMITTED) {
spec.log(qq.format("Detected valid filenam... | javascript | function handleInputFocus(target, event) {
if (spec.templating.isEditInput(target)) {
var fileId = spec.templating.getFileId(target),
status = spec.onGetUploadStatus(fileId);
if (status === qq.status.SUBMITTED) {
spec.log(qq.format("Detected valid filenam... | [
"function",
"handleInputFocus",
"(",
"target",
",",
"event",
")",
"{",
"if",
"(",
"spec",
".",
"templating",
".",
"isEditInput",
"(",
"target",
")",
")",
"{",
"var",
"fileId",
"=",
"spec",
".",
"templating",
".",
"getFileId",
"(",
"target",
")",
",",
"... | This will be called by the parent handler when a `focusin` event is received on the list element. | [
"This",
"will",
"be",
"called",
"by",
"the",
"parent",
"handler",
"when",
"a",
"focusin",
"event",
"is",
"received",
"on",
"the",
"list",
"element",
"."
] | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/ui.handler.focusin.filenameinput.js#L17-L27 | train |
FineUploader/fine-uploader | client/js/image-support/image.js | draw | function draw(fileOrBlob, container, options) {
var drawPreview = new qq.Promise(),
identifier = new qq.Identify(fileOrBlob, log),
maxSize = options.maxSize,
// jshint eqnull:true
orient = options.orient == null ? true : options.orient,
megapixErrorHan... | javascript | function draw(fileOrBlob, container, options) {
var drawPreview = new qq.Promise(),
identifier = new qq.Identify(fileOrBlob, log),
maxSize = options.maxSize,
// jshint eqnull:true
orient = options.orient == null ? true : options.orient,
megapixErrorHan... | [
"function",
"draw",
"(",
"fileOrBlob",
",",
"container",
",",
"options",
")",
"{",
"var",
"drawPreview",
"=",
"new",
"qq",
".",
"Promise",
"(",
")",
",",
"identifier",
"=",
"new",
"qq",
".",
"Identify",
"(",
"fileOrBlob",
",",
"log",
")",
",",
"maxSize... | Draw a preview iff the current UA can natively display it. Also rotate the image if necessary. | [
"Draw",
"a",
"preview",
"iff",
"the",
"current",
"UA",
"can",
"natively",
"display",
"it",
".",
"Also",
"rotate",
"the",
"image",
"if",
"necessary",
"."
] | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/image-support/image.js#L136-L196 | train |
FineUploader/fine-uploader | client/js/third-party/crypto-js/core.js | function (nBytes) {
var words = [];
for (var i = 0; i < nBytes; i += 4) {
words.push((Math.random() * 0x100000000) | 0);
}
return new WordArray.init(words, nBytes);
} | javascript | function (nBytes) {
var words = [];
for (var i = 0; i < nBytes; i += 4) {
words.push((Math.random() * 0x100000000) | 0);
}
return new WordArray.init(words, nBytes);
} | [
"function",
"(",
"nBytes",
")",
"{",
"var",
"words",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"nBytes",
";",
"i",
"+=",
"4",
")",
"{",
"words",
".",
"push",
"(",
"(",
"Math",
".",
"random",
"(",
")",
"*",
"0x1000... | Creates a word array filled with random bytes.
@param {number} nBytes The number of random bytes to generate.
@return {WordArray} The random word array.
@static
@example
var wordArray = CryptoJS.lib.WordArray.random(16); | [
"Creates",
"a",
"word",
"array",
"filled",
"with",
"random",
"bytes",
"."
] | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/third-party/crypto-js/core.js#L280-L287 | train | |
FineUploader/fine-uploader | client/js/third-party/crypto-js/core.js | function (data) {
// Convert string to WordArray, else assume WordArray already
if (typeof data == 'string') {
data = Utf8.parse(data);
}
// Append
this._data.concat(data);
this._nDataBytes += data.sigBytes;
} | javascript | function (data) {
// Convert string to WordArray, else assume WordArray already
if (typeof data == 'string') {
data = Utf8.parse(data);
}
// Append
this._data.concat(data);
this._nDataBytes += data.sigBytes;
} | [
"function",
"(",
"data",
")",
"{",
"// Convert string to WordArray, else assume WordArray already",
"if",
"(",
"typeof",
"data",
"==",
"'string'",
")",
"{",
"data",
"=",
"Utf8",
".",
"parse",
"(",
"data",
")",
";",
"}",
"// Append",
"this",
".",
"_data",
".",
... | Adds new data to this block algorithm's buffer.
@param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8.
@example
bufferedBlockAlgorithm._append('data');
bufferedBlockAlgorithm._append(wordArray); | [
"Adds",
"new",
"data",
"to",
"this",
"block",
"algorithm",
"s",
"buffer",
"."
] | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/third-party/crypto-js/core.js#L488-L497 | train | |
FineUploader/fine-uploader | client/js/third-party/crypto-js/core.js | function (hasher) {
return function (message, key) {
return new C_algo.HMAC.init(hasher, key).finalize(message);
};
} | javascript | function (hasher) {
return function (message, key) {
return new C_algo.HMAC.init(hasher, key).finalize(message);
};
} | [
"function",
"(",
"hasher",
")",
"{",
"return",
"function",
"(",
"message",
",",
"key",
")",
"{",
"return",
"new",
"C_algo",
".",
"HMAC",
".",
"init",
"(",
"hasher",
",",
"key",
")",
".",
"finalize",
"(",
"message",
")",
";",
"}",
";",
"}"
] | Creates a shortcut function to the HMAC's object interface.
@param {Hasher} hasher The hasher to use in this HMAC helper.
@return {Function} The shortcut function.
@static
@example
var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256); | [
"Creates",
"a",
"shortcut",
"function",
"to",
"the",
"HMAC",
"s",
"object",
"interface",
"."
] | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/third-party/crypto-js/core.js#L699-L703 | train | |
FineUploader/fine-uploader | client/js/s3/util.js | function(endpoint) {
var patterns = [
//bucket in domain
/^(?:https?:\/\/)?([a-z0-9.\-_]+)\.s3(?:-[a-z0-9\-]+)?\.amazonaws\.com/i,
//bucket in path
/^(?:https?:\/\/)?s3(?:-[a-z0-9\-]+)?\.amazonaws\.com\/([a-z0-9.\-_]+)/i,
... | javascript | function(endpoint) {
var patterns = [
//bucket in domain
/^(?:https?:\/\/)?([a-z0-9.\-_]+)\.s3(?:-[a-z0-9\-]+)?\.amazonaws\.com/i,
//bucket in path
/^(?:https?:\/\/)?s3(?:-[a-z0-9\-]+)?\.amazonaws\.com\/([a-z0-9.\-_]+)/i,
... | [
"function",
"(",
"endpoint",
")",
"{",
"var",
"patterns",
"=",
"[",
"//bucket in domain",
"/",
"^(?:https?:\\/\\/)?([a-z0-9.\\-_]+)\\.s3(?:-[a-z0-9\\-]+)?\\.amazonaws\\.com",
"/",
"i",
",",
"//bucket in path",
"/",
"^(?:https?:\\/\\/)?s3(?:-[a-z0-9\\-]+)?\\.amazonaws\\.com\\/([a-z0... | This allows for the region to be specified in the bucket's endpoint URL, or not.
Examples of some valid endpoints are:
http://foo.s3.amazonaws.com
https://foo.s3.amazonaws.com
http://foo.s3-ap-northeast-1.amazonaws.com
foo.s3.amazonaws.com
http://foo.bar.com
http://s3.amazonaws.com/foo.bar.com
...etc
@param endpoint ... | [
"This",
"allows",
"for",
"the",
"region",
"to",
"be",
"specified",
"in",
"the",
"bucket",
"s",
"endpoint",
"URL",
"or",
"not",
"."
] | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/s3/util.js#L69-L90 | train | |
FineUploader/fine-uploader | client/js/s3/util.js | function(name) {
if (qq.indexOf(qq.s3.util.UNPREFIXED_PARAM_NAMES, name) >= 0) {
return name;
}
return qq.s3.util.AWS_PARAM_PREFIX + name;
} | javascript | function(name) {
if (qq.indexOf(qq.s3.util.UNPREFIXED_PARAM_NAMES, name) >= 0) {
return name;
}
return qq.s3.util.AWS_PARAM_PREFIX + name;
} | [
"function",
"(",
"name",
")",
"{",
"if",
"(",
"qq",
".",
"indexOf",
"(",
"qq",
".",
"s3",
".",
"util",
".",
"UNPREFIXED_PARAM_NAMES",
",",
"name",
")",
">=",
"0",
")",
"{",
"return",
"name",
";",
"}",
"return",
"qq",
".",
"s3",
".",
"util",
".",
... | Create Prefixed request headers which are appropriate for S3.
If the request header is appropriate for S3 (e.g. Cache-Control) then pass
it along without a metadata prefix. For all other request header parameter names,
apply qq.s3.util.AWS_PARAM_PREFIX before the name.
See: http://docs.aws.amazon.com/AmazonS3/latest/A... | [
"Create",
"Prefixed",
"request",
"headers",
"which",
"are",
"appropriate",
"for",
"S3",
"."
] | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/s3/util.js#L99-L104 | train | |
FineUploader/fine-uploader | client/js/s3/util.js | function(policy, minSize, maxSize) {
var adjustedMinSize = minSize < 0 ? 0 : minSize,
// Adjust a maxSize of 0 to the largest possible integer, since we must specify a high and a low in the request
adjustedMaxSize = maxSize <= 0 ? 9007199254740992 : maxSize;
if (... | javascript | function(policy, minSize, maxSize) {
var adjustedMinSize = minSize < 0 ? 0 : minSize,
// Adjust a maxSize of 0 to the largest possible integer, since we must specify a high and a low in the request
adjustedMaxSize = maxSize <= 0 ? 9007199254740992 : maxSize;
if (... | [
"function",
"(",
"policy",
",",
"minSize",
",",
"maxSize",
")",
"{",
"var",
"adjustedMinSize",
"=",
"minSize",
"<",
"0",
"?",
"0",
":",
"minSize",
",",
"// Adjust a maxSize of 0 to the largest possible integer, since we must specify a high and a low in the request",
"adjust... | Add a condition to an existing S3 upload request policy document used to ensure AWS enforces any size
restrictions placed on files server-side. This is important to do, in case users mess with the client-side
checks already in place.
@param policy Policy document as an `Object`, with a `conditions` property already a... | [
"Add",
"a",
"condition",
"to",
"an",
"existing",
"S3",
"upload",
"request",
"policy",
"document",
"used",
"to",
"ensure",
"AWS",
"enforces",
"any",
"size",
"restrictions",
"placed",
"on",
"files",
"server",
"-",
"side",
".",
"This",
"is",
"important",
"to",
... | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/s3/util.js#L361-L369 | train | |
FineUploader/fine-uploader | client/js/s3/util.js | function(iframe) {
var doc = iframe.contentDocument || iframe.contentWindow.document,
queryString = doc.location.search,
match = /bucket=(.+)&key=(.+)&etag=(.+)/.exec(queryString);
if (match) {
return {
bucket: match[1],
... | javascript | function(iframe) {
var doc = iframe.contentDocument || iframe.contentWindow.document,
queryString = doc.location.search,
match = /bucket=(.+)&key=(.+)&etag=(.+)/.exec(queryString);
if (match) {
return {
bucket: match[1],
... | [
"function",
"(",
"iframe",
")",
"{",
"var",
"doc",
"=",
"iframe",
".",
"contentDocument",
"||",
"iframe",
".",
"contentWindow",
".",
"document",
",",
"queryString",
"=",
"doc",
".",
"location",
".",
"search",
",",
"match",
"=",
"/",
"bucket=(.+)&key=(.+)&eta... | Looks at a response from S3 contained in an iframe and parses the query string in an attempt to identify
the associated resource.
@param iframe Iframe containing response
@returns {{bucket: *, key: *, etag: *}} | [
"Looks",
"at",
"a",
"response",
"from",
"S3",
"contained",
"in",
"an",
"iframe",
"and",
"parses",
"the",
"query",
"string",
"in",
"an",
"attempt",
"to",
"identify",
"the",
"associated",
"resource",
"."
] | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/s3/util.js#L422-L434 | train | |
FineUploader/fine-uploader | client/js/ajax.requester.js | getCorsAjaxTransport | function getCorsAjaxTransport() {
var xhrOrXdr;
if (window.XMLHttpRequest || window.ActiveXObject) {
xhrOrXdr = qq.createXhrInstance();
if (xhrOrXdr.withCredentials === undefined) {
xhrOrXdr = new XDomainRequest();
// Workaround for XDR bug in IE... | javascript | function getCorsAjaxTransport() {
var xhrOrXdr;
if (window.XMLHttpRequest || window.ActiveXObject) {
xhrOrXdr = qq.createXhrInstance();
if (xhrOrXdr.withCredentials === undefined) {
xhrOrXdr = new XDomainRequest();
// Workaround for XDR bug in IE... | [
"function",
"getCorsAjaxTransport",
"(",
")",
"{",
"var",
"xhrOrXdr",
";",
"if",
"(",
"window",
".",
"XMLHttpRequest",
"||",
"window",
".",
"ActiveXObject",
")",
"{",
"xhrOrXdr",
"=",
"qq",
".",
"createXhrInstance",
"(",
")",
";",
"if",
"(",
"xhrOrXdr",
".... | Returns either a new `XMLHttpRequest` or `XDomainRequest` instance. | [
"Returns",
"either",
"a",
"new",
"XMLHttpRequest",
"or",
"XDomainRequest",
"instance",
"."
] | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/ajax.requester.js#L73-L90 | train |
FineUploader/fine-uploader | client/js/ajax.requester.js | dequeue | function dequeue(id) {
var i = qq.indexOf(queue, id),
max = options.maxConnections,
nextId;
delete requestData[id];
queue.splice(i, 1);
if (queue.length >= max && i < max) {
nextId = queue[max - 1];
sendRequest(nextId);
}
} | javascript | function dequeue(id) {
var i = qq.indexOf(queue, id),
max = options.maxConnections,
nextId;
delete requestData[id];
queue.splice(i, 1);
if (queue.length >= max && i < max) {
nextId = queue[max - 1];
sendRequest(nextId);
}
} | [
"function",
"dequeue",
"(",
"id",
")",
"{",
"var",
"i",
"=",
"qq",
".",
"indexOf",
"(",
"queue",
",",
"id",
")",
",",
"max",
"=",
"options",
".",
"maxConnections",
",",
"nextId",
";",
"delete",
"requestData",
"[",
"id",
"]",
";",
"queue",
".",
"spl... | Removes element from queue, sends next request | [
"Removes",
"element",
"from",
"queue",
"sends",
"next",
"request"
] | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/ajax.requester.js#L116-L128 | train |
FineUploader/fine-uploader | client/js/ajax.requester.js | function(optXhr) {
if (cacheBuster && qq.indexOf(["GET", "DELETE"], options.method) >= 0) {
params.qqtimestamp = new Date().getTime();
}
return prepareToSend(id, optXhr, path, params, additionalQueryParams, headers, payload);
... | javascript | function(optXhr) {
if (cacheBuster && qq.indexOf(["GET", "DELETE"], options.method) >= 0) {
params.qqtimestamp = new Date().getTime();
}
return prepareToSend(id, optXhr, path, params, additionalQueryParams, headers, payload);
... | [
"function",
"(",
"optXhr",
")",
"{",
"if",
"(",
"cacheBuster",
"&&",
"qq",
".",
"indexOf",
"(",
"[",
"\"GET\"",
",",
"\"DELETE\"",
"]",
",",
"options",
".",
"method",
")",
">=",
"0",
")",
"{",
"params",
".",
"qqtimestamp",
"=",
"new",
"Date",
"(",
... | Send the constructed request. | [
"Send",
"the",
"constructed",
"request",
"."
] | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/ajax.requester.js#L390-L396 | train | |
FineUploader/fine-uploader | client/js/s3/uploader.basic.js | function() {
var self = this,
additionalOptions = {
aclStore: this._aclStore,
getBucket: qq.bind(this._determineBucket, this),
getHost: qq.bind(this._determineHost, this),
getKeyName: qq.bind(this._determineKeyNa... | javascript | function() {
var self = this,
additionalOptions = {
aclStore: this._aclStore,
getBucket: qq.bind(this._determineBucket, this),
getHost: qq.bind(this._determineHost, this),
getKeyName: qq.bind(this._determineKeyNa... | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
",",
"additionalOptions",
"=",
"{",
"aclStore",
":",
"this",
".",
"_aclStore",
",",
"getBucket",
":",
"qq",
".",
"bind",
"(",
"this",
".",
"_determineBucket",
",",
"this",
")",
",",
"getHost",
":",... | Ensures the parent's upload handler creator passes any additional S3-specific options to the handler as well
as information required to instantiate the specific handler based on the current browser's capabilities.
@returns {qq.UploadHandlerController}
@private | [
"Ensures",
"the",
"parent",
"s",
"upload",
"handler",
"creator",
"passes",
"any",
"additional",
"S3",
"-",
"specific",
"options",
"to",
"the",
"handler",
"as",
"well",
"as",
"information",
"required",
"to",
"instantiate",
"the",
"specific",
"handler",
"based",
... | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/s3/uploader.basic.js#L197-L286 | train | |
FineUploader/fine-uploader | client/js/s3/uploader.basic.js | function(keynameFunc, id, successCallback, failureCallback) {
var self = this,
onSuccess = function(keyname) {
successCallback(keyname);
},
onFailure = function(reason) {
self.log(qq.format("Failed to retrieve key name f... | javascript | function(keynameFunc, id, successCallback, failureCallback) {
var self = this,
onSuccess = function(keyname) {
successCallback(keyname);
},
onFailure = function(reason) {
self.log(qq.format("Failed to retrieve key name f... | [
"function",
"(",
"keynameFunc",
",",
"id",
",",
"successCallback",
",",
"failureCallback",
")",
"{",
"var",
"self",
"=",
"this",
",",
"onSuccess",
"=",
"function",
"(",
"keyname",
")",
"{",
"successCallback",
"(",
"keyname",
")",
";",
"}",
",",
"onFailure"... | Called by the internal onUpload handler if the integrator has supplied a function to determine
the file's key name. The integrator's function may be promissory. We also need to fulfill
the promise contract associated with the caller as well.
@param keynameFunc Integrator-supplied function that must be executed to de... | [
"Called",
"by",
"the",
"internal",
"onUpload",
"handler",
"if",
"the",
"integrator",
"has",
"supplied",
"a",
"function",
"to",
"determine",
"the",
"file",
"s",
"key",
"name",
".",
"The",
"integrator",
"s",
"function",
"may",
"be",
"promissory",
".",
"We",
... | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/s3/uploader.basic.js#L384-L405 | train | |
FineUploader/fine-uploader | client/js/s3/uploader.basic.js | function(id, onSuccessCallback) {
var additionalMandatedParams = {
key: this.getKey(id),
bucket: this.getBucket(id)
};
return qq.FineUploaderBasic.prototype._onSubmitDelete.call(this, id, onSuccessCallback, additionalMandatedParams);
} | javascript | function(id, onSuccessCallback) {
var additionalMandatedParams = {
key: this.getKey(id),
bucket: this.getBucket(id)
};
return qq.FineUploaderBasic.prototype._onSubmitDelete.call(this, id, onSuccessCallback, additionalMandatedParams);
} | [
"function",
"(",
"id",
",",
"onSuccessCallback",
")",
"{",
"var",
"additionalMandatedParams",
"=",
"{",
"key",
":",
"this",
".",
"getKey",
"(",
"id",
")",
",",
"bucket",
":",
"this",
".",
"getBucket",
"(",
"id",
")",
"}",
";",
"return",
"qq",
".",
"F... | Hooks into the base internal `_onSubmitDelete` to add key and bucket params to the delete file request. | [
"Hooks",
"into",
"the",
"base",
"internal",
"_onSubmitDelete",
"to",
"add",
"key",
"and",
"bucket",
"params",
"to",
"the",
"delete",
"file",
"request",
"."
] | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/s3/uploader.basic.js#L426-L433 | train | |
FineUploader/fine-uploader | client/js/upload-handler/upload.handler.controller.js | function(id, chunkIdx, response, xhr) {
var chunkData = handler._getChunkData(id, chunkIdx);
handler._getFileState(id).attemptingResume = false;
delete handler._getFileState(id).temp.chunkProgress[chunkIdx];
handler._getFileState(id).loaded += chunkData.size;
... | javascript | function(id, chunkIdx, response, xhr) {
var chunkData = handler._getChunkData(id, chunkIdx);
handler._getFileState(id).attemptingResume = false;
delete handler._getFileState(id).temp.chunkProgress[chunkIdx];
handler._getFileState(id).loaded += chunkData.size;
... | [
"function",
"(",
"id",
",",
"chunkIdx",
",",
"response",
",",
"xhr",
")",
"{",
"var",
"chunkData",
"=",
"handler",
".",
"_getChunkData",
"(",
"id",
",",
"chunkIdx",
")",
";",
"handler",
".",
"_getFileState",
"(",
"id",
")",
".",
"attemptingResume",
"=",
... | Called when each chunk has uploaded successfully | [
"Called",
"when",
"each",
"chunk",
"has",
"uploaded",
"successfully"
] | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/upload-handler/upload.handler.controller.js#L46-L55 | train | |
FineUploader/fine-uploader | client/js/upload-handler/upload.handler.controller.js | function(id) {
var size = options.getSize(id),
name = options.getName(id);
log("All chunks have been uploaded for " + id + " - finalizing....");
handler.finalizeChunks(id).then(
function(response, xhr) {
log("Finalize successful fo... | javascript | function(id) {
var size = options.getSize(id),
name = options.getName(id);
log("All chunks have been uploaded for " + id + " - finalizing....");
handler.finalizeChunks(id).then(
function(response, xhr) {
log("Finalize successful fo... | [
"function",
"(",
"id",
")",
"{",
"var",
"size",
"=",
"options",
".",
"getSize",
"(",
"id",
")",
",",
"name",
"=",
"options",
".",
"getName",
"(",
"id",
")",
";",
"log",
"(",
"\"All chunks have been uploaded for \"",
"+",
"id",
"+",
"\" - finalizing....\"",... | Called when all chunks have been successfully uploaded and we want to ask the handler to perform any logic associated with closing out the file, such as combining the chunks. | [
"Called",
"when",
"all",
"chunks",
"have",
"been",
"successfully",
"uploaded",
"and",
"we",
"want",
"to",
"ask",
"the",
"handler",
"to",
"perform",
"any",
"logic",
"associated",
"with",
"closing",
"out",
"the",
"file",
"such",
"as",
"combining",
"the",
"chun... | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/upload-handler/upload.handler.controller.js#L59-L91 | train | |
FineUploader/fine-uploader | client/js/upload-handler/upload.handler.controller.js | function(errorMessage) {
var errorResponse = {};
if (errorMessage) {
errorResponse.error = errorMessage;
}
log(qq.format("Failed to generate blob for ID {}. Error message: {}.", id, errorMessage), "error");
... | javascript | function(errorMessage) {
var errorResponse = {};
if (errorMessage) {
errorResponse.error = errorMessage;
}
log(qq.format("Failed to generate blob for ID {}. Error message: {}.", id, errorMessage), "error");
... | [
"function",
"(",
"errorMessage",
")",
"{",
"var",
"errorResponse",
"=",
"{",
"}",
";",
"if",
"(",
"errorMessage",
")",
"{",
"errorResponse",
".",
"error",
"=",
"errorMessage",
";",
"}",
"log",
"(",
"qq",
".",
"format",
"(",
"\"Failed to generate blob for ID ... | Blob could not be generated. Fail the upload & attempt to prevent retries. Also bubble error message. | [
"Blob",
"could",
"not",
"be",
"generated",
".",
"Fail",
"the",
"upload",
"&",
"attempt",
"to",
"prevent",
"retries",
".",
"Also",
"bubble",
"error",
"message",
"."
] | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/upload-handler/upload.handler.controller.js#L519-L531 | train | |
FineUploader/fine-uploader | client/js/upload-handler/upload.handler.controller.js | function(originalResponse, successful) {
var response = originalResponse;
// The passed "response" param may not be a response at all.
// It could be a string, detailing the error, for example.
if (!qq.isObject(originalResponse)) {
response = {};
... | javascript | function(originalResponse, successful) {
var response = originalResponse;
// The passed "response" param may not be a response at all.
// It could be a string, detailing the error, for example.
if (!qq.isObject(originalResponse)) {
response = {};
... | [
"function",
"(",
"originalResponse",
",",
"successful",
")",
"{",
"var",
"response",
"=",
"originalResponse",
";",
"// The passed \"response\" param may not be a response at all.",
"// It could be a string, detailing the error, for example.",
"if",
"(",
"!",
"qq",
".",
"isObjec... | The response coming from handler implementations may be in various formats. Instead of hoping a promise nested 5 levels deep will always return an object as its first param, let's just normalize the response here. | [
"The",
"response",
"coming",
"from",
"handler",
"implementations",
"may",
"be",
"in",
"various",
"formats",
".",
"Instead",
"of",
"hoping",
"a",
"promise",
"nested",
"5",
"levels",
"deep",
"will",
"always",
"return",
"an",
"object",
"as",
"its",
"first",
"pa... | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/upload-handler/upload.handler.controller.js#L575-L591 | train | |
FineUploader/fine-uploader | client/js/upload-handler/upload.handler.controller.js | function() {
var waitingOrConnected = connectionManager.getWaitingOrConnected(),
i;
// ensure files are cancelled in reverse order which they were added
// to avoid a flash of time where a queued file begins to upload before it is canceled
if (waitingOrCo... | javascript | function() {
var waitingOrConnected = connectionManager.getWaitingOrConnected(),
i;
// ensure files are cancelled in reverse order which they were added
// to avoid a flash of time where a queued file begins to upload before it is canceled
if (waitingOrCo... | [
"function",
"(",
")",
"{",
"var",
"waitingOrConnected",
"=",
"connectionManager",
".",
"getWaitingOrConnected",
"(",
")",
",",
"i",
";",
"// ensure files are cancelled in reverse order which they were added",
"// to avoid a flash of time where a queued file begins to upload before it... | Cancels all queued or in-progress uploads | [
"Cancels",
"all",
"queued",
"or",
"in",
"-",
"progress",
"uploads"
] | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/upload-handler/upload.handler.controller.js#L703-L716 | train | |
FineUploader/fine-uploader | client/js/upload-handler/upload.handler.controller.js | function(id) {
if (controller.isResumable(id) && handler.pause && controller.isValid(id) && handler.pause(id)) {
connectionManager.free(id);
handler.moveInProgressToRemaining(id);
return true;
}
return false;
} | javascript | function(id) {
if (controller.isResumable(id) && handler.pause && controller.isValid(id) && handler.pause(id)) {
connectionManager.free(id);
handler.moveInProgressToRemaining(id);
return true;
}
return false;
} | [
"function",
"(",
"id",
")",
"{",
"if",
"(",
"controller",
".",
"isResumable",
"(",
"id",
")",
"&&",
"handler",
".",
"pause",
"&&",
"controller",
".",
"isValid",
"(",
"id",
")",
"&&",
"handler",
".",
"pause",
"(",
"id",
")",
")",
"{",
"connectionManag... | Attempts to pause the associated upload if the specific handler supports this and the file is "valid".
@param id ID of the upload/file to pause
@returns {boolean} true if the upload was paused | [
"Attempts",
"to",
"pause",
"the",
"associated",
"upload",
"if",
"the",
"specific",
"handler",
"supports",
"this",
"and",
"the",
"file",
"is",
"valid",
"."
] | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/upload-handler/upload.handler.controller.js#L797-L804 | train | |
FineUploader/fine-uploader | client/js/features.js | isChrome14OrHigher | function isChrome14OrHigher() {
return (qq.chrome() || qq.opera()) &&
navigator.userAgent.match(/Chrome\/[1][4-9]|Chrome\/[2-9][0-9]/) !== undefined;
} | javascript | function isChrome14OrHigher() {
return (qq.chrome() || qq.opera()) &&
navigator.userAgent.match(/Chrome\/[1][4-9]|Chrome\/[2-9][0-9]/) !== undefined;
} | [
"function",
"isChrome14OrHigher",
"(",
")",
"{",
"return",
"(",
"qq",
".",
"chrome",
"(",
")",
"||",
"qq",
".",
"opera",
"(",
")",
")",
"&&",
"navigator",
".",
"userAgent",
".",
"match",
"(",
"/",
"Chrome\\/[1][4-9]|Chrome\\/[2-9][0-9]",
"/",
")",
"!==",
... | only way to test for complete Clipboard API support at this time | [
"only",
"way",
"to",
"test",
"for",
"complete",
"Clipboard",
"API",
"support",
"at",
"this",
"time"
] | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/features.js#L42-L45 | train |
FineUploader/fine-uploader | client/js/features.js | isCrossOriginXhrSupported | function isCrossOriginXhrSupported() {
if (window.XMLHttpRequest) {
var xhr = qq.createXhrInstance();
//Commonly accepted test for XHR CORS support.
return xhr.withCredentials !== undefined;
}
return false;
} | javascript | function isCrossOriginXhrSupported() {
if (window.XMLHttpRequest) {
var xhr = qq.createXhrInstance();
//Commonly accepted test for XHR CORS support.
return xhr.withCredentials !== undefined;
}
return false;
} | [
"function",
"isCrossOriginXhrSupported",
"(",
")",
"{",
"if",
"(",
"window",
".",
"XMLHttpRequest",
")",
"{",
"var",
"xhr",
"=",
"qq",
".",
"createXhrInstance",
"(",
")",
";",
"//Commonly accepted test for XHR CORS support.",
"return",
"xhr",
".",
"withCredentials",... | Ensure we can send cross-origin `XMLHttpRequest`s | [
"Ensure",
"we",
"can",
"send",
"cross",
"-",
"origin",
"XMLHttpRequest",
"s"
] | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/features.js#L48-L57 | train |
FineUploader/fine-uploader | client/js/s3/request-signer.js | function(id, toBeSigned) {
var params = toBeSigned,
signatureConstructor = toBeSigned.signatureConstructor,
signatureEffort = new qq.Promise(),
queryParams;
if (options.signatureSpec.version === 4) {
queryParams = {v4: true};
... | javascript | function(id, toBeSigned) {
var params = toBeSigned,
signatureConstructor = toBeSigned.signatureConstructor,
signatureEffort = new qq.Promise(),
queryParams;
if (options.signatureSpec.version === 4) {
queryParams = {v4: true};
... | [
"function",
"(",
"id",
",",
"toBeSigned",
")",
"{",
"var",
"params",
"=",
"toBeSigned",
",",
"signatureConstructor",
"=",
"toBeSigned",
".",
"signatureConstructor",
",",
"signatureEffort",
"=",
"new",
"qq",
".",
"Promise",
"(",
")",
",",
"queryParams",
";",
... | On success, an object containing the parsed JSON response will be passed into the success handler if the
request succeeds. Otherwise an error message will be passed into the failure method.
@param id File ID.
@param toBeSigned an Object that holds the item(s) to be signed
@returns {qq.Promise} A promise that is fulfi... | [
"On",
"success",
"an",
"object",
"containing",
"the",
"parsed",
"JSON",
"response",
"will",
"be",
"passed",
"into",
"the",
"success",
"handler",
"if",
"the",
"request",
"succeeds",
".",
"Otherwise",
"an",
"error",
"message",
"will",
"be",
"passed",
"into",
"... | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/s3/request-signer.js#L489-L545 | train | |
FineUploader/fine-uploader | client/js/uploader.api.js | function(id) {
// If the edit filename feature is enabled, mark the filename element as "editable" and the associated edit icon
if (this._isEditFilenameEnabled()) {
this._templating.markFilenameEditable(id);
this._templating.showEditIcon(id);
// I... | javascript | function(id) {
// If the edit filename feature is enabled, mark the filename element as "editable" and the associated edit icon
if (this._isEditFilenameEnabled()) {
this._templating.markFilenameEditable(id);
this._templating.showEditIcon(id);
// I... | [
"function",
"(",
"id",
")",
"{",
"// If the edit filename feature is enabled, mark the filename element as \"editable\" and the associated edit icon",
"if",
"(",
"this",
".",
"_isEditFilenameEnabled",
"(",
")",
")",
"{",
"this",
".",
"_templating",
".",
"markFilenameEditable",
... | The file item has been added to the DOM. | [
"The",
"file",
"item",
"has",
"been",
"added",
"to",
"the",
"DOM",
"."
] | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/uploader.api.js#L310-L321 | train | |
FineUploader/fine-uploader | client/js/uploader.api.js | function(id, name, loaded, total) {
this._parent.prototype._onProgress.apply(this, arguments);
this._templating.updateProgress(id, loaded, total);
if (total === 0 || Math.round(loaded / total * 100) === 100) {
this._templating.hideCancel(id);
this._t... | javascript | function(id, name, loaded, total) {
this._parent.prototype._onProgress.apply(this, arguments);
this._templating.updateProgress(id, loaded, total);
if (total === 0 || Math.round(loaded / total * 100) === 100) {
this._templating.hideCancel(id);
this._t... | [
"function",
"(",
"id",
",",
"name",
",",
"loaded",
",",
"total",
")",
"{",
"this",
".",
"_parent",
".",
"prototype",
".",
"_onProgress",
".",
"apply",
"(",
"this",
",",
"arguments",
")",
";",
"this",
".",
"_templating",
".",
"updateProgress",
"(",
"id"... | Update the progress bar & percentage as the file is uploaded | [
"Update",
"the",
"progress",
"bar",
"&",
"percentage",
"as",
"the",
"file",
"is",
"uploaded"
] | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/uploader.api.js#L324-L342 | train | |
FineUploader/fine-uploader | client/js/s3/multipart.initiate.ajax.requester.js | handleInitiateRequestComplete | function handleInitiateRequestComplete(id, xhr, isError) {
var promise = pendingInitiateRequests[id],
domParser = new DOMParser(),
responseDoc = domParser.parseFromString(xhr.responseText, "application/xml"),
uploadIdElements, messageElements, uploadId, errorMessage, status;
... | javascript | function handleInitiateRequestComplete(id, xhr, isError) {
var promise = pendingInitiateRequests[id],
domParser = new DOMParser(),
responseDoc = domParser.parseFromString(xhr.responseText, "application/xml"),
uploadIdElements, messageElements, uploadId, errorMessage, status;
... | [
"function",
"handleInitiateRequestComplete",
"(",
"id",
",",
"xhr",
",",
"isError",
")",
"{",
"var",
"promise",
"=",
"pendingInitiateRequests",
"[",
"id",
"]",
",",
"domParser",
"=",
"new",
"DOMParser",
"(",
")",
",",
"responseDoc",
"=",
"domParser",
".",
"p... | Called by the base ajax requester when the response has been received. We definitively determine here if the
"Initiate MPU" request has been a success or not.
@param id ID associated with the file.
@param xhr `XMLHttpRequest` object containing the response, among other things.
@param isError A boolean indicating succ... | [
"Called",
"by",
"the",
"base",
"ajax",
"requester",
"when",
"the",
"response",
"has",
"been",
"received",
".",
"We",
"definitively",
"determine",
"here",
"if",
"the",
"Initiate",
"MPU",
"request",
"has",
"been",
"a",
"success",
"or",
"not",
"."
] | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/s3/multipart.initiate.ajax.requester.js#L99-L142 | train |
FineUploader/fine-uploader | client/js/upload-handler/form.upload.handler.js | expungeFile | function expungeFile(id) {
delete detachLoadEvents[id];
// If we are dealing with CORS, we might still be waiting for a response from a loaded iframe.
// In that case, terminate the timer waiting for a message from the loaded iframe
// and stop listening for any more messages coming fro... | javascript | function expungeFile(id) {
delete detachLoadEvents[id];
// If we are dealing with CORS, we might still be waiting for a response from a loaded iframe.
// In that case, terminate the timer waiting for a message from the loaded iframe
// and stop listening for any more messages coming fro... | [
"function",
"expungeFile",
"(",
"id",
")",
"{",
"delete",
"detachLoadEvents",
"[",
"id",
"]",
";",
"// If we are dealing with CORS, we might still be waiting for a response from a loaded iframe.",
"// In that case, terminate the timer waiting for a message from the loaded iframe",
"// an... | Remove any trace of the file from the handler.
@param id ID of the associated file | [
"Remove",
"any",
"trace",
"of",
"the",
"file",
"from",
"the",
"handler",
"."
] | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/upload-handler/form.upload.handler.js#L29-L50 | train |
FineUploader/fine-uploader | client/js/upload-handler/form.upload.handler.js | initIframeForUpload | function initIframeForUpload(name) {
var iframe = qq.toElement("<iframe src='javascript:false;' name='" + name + "' />");
iframe.setAttribute("id", name);
iframe.style.display = "none";
document.body.appendChild(iframe);
return iframe;
} | javascript | function initIframeForUpload(name) {
var iframe = qq.toElement("<iframe src='javascript:false;' name='" + name + "' />");
iframe.setAttribute("id", name);
iframe.style.display = "none";
document.body.appendChild(iframe);
return iframe;
} | [
"function",
"initIframeForUpload",
"(",
"name",
")",
"{",
"var",
"iframe",
"=",
"qq",
".",
"toElement",
"(",
"\"<iframe src='javascript:false;' name='\"",
"+",
"name",
"+",
"\"' />\"",
")",
";",
"iframe",
".",
"setAttribute",
"(",
"\"id\"",
",",
"name",
")",
"... | Generates an iframe to be used as a target for upload-related form submits. This also adds the iframe
to the current `document`. Note that the iframe is hidden from view.
@param name Name of the iframe.
@returns {HTMLIFrameElement} The created iframe | [
"Generates",
"an",
"iframe",
"to",
"be",
"used",
"as",
"a",
"target",
"for",
"upload",
"-",
"related",
"form",
"submits",
".",
"This",
"also",
"adds",
"the",
"iframe",
"to",
"the",
"current",
"document",
".",
"Note",
"that",
"the",
"iframe",
"is",
"hidde... | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/upload-handler/form.upload.handler.js#L67-L76 | train |
FineUploader/fine-uploader | client/js/upload-handler/form.upload.handler.js | function(id, fileInput) {
super_.add(id, {input: fileInput});
fileInput.setAttribute("name", inputName);
// remove file input from DOM
if (fileInput.parentNode) {
qq(fileInput).remove();
}
} | javascript | function(id, fileInput) {
super_.add(id, {input: fileInput});
fileInput.setAttribute("name", inputName);
// remove file input from DOM
if (fileInput.parentNode) {
qq(fileInput).remove();
}
} | [
"function",
"(",
"id",
",",
"fileInput",
")",
"{",
"super_",
".",
"add",
"(",
"id",
",",
"{",
"input",
":",
"fileInput",
"}",
")",
";",
"fileInput",
".",
"setAttribute",
"(",
"\"name\"",
",",
"inputName",
")",
";",
"// remove file input from DOM",
"if",
... | Adds File or Blob to the queue | [
"Adds",
"File",
"or",
"Blob",
"to",
"the",
"queue"
] | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/upload-handler/form.upload.handler.js#L143-L152 | train | |
FineUploader/fine-uploader | client/js/upload-handler/form.upload.handler.js | function(spec) {
var method = spec.method,
endpoint = spec.endpoint,
params = spec.params,
paramsInBody = spec.paramsInBody,
targetName = spec.targetName,
form = qq.toElement("<form method='" + method + "' enctype='multipart/for... | javascript | function(spec) {
var method = spec.method,
endpoint = spec.endpoint,
params = spec.params,
paramsInBody = spec.paramsInBody,
targetName = spec.targetName,
form = qq.toElement("<form method='" + method + "' enctype='multipart/for... | [
"function",
"(",
"spec",
")",
"{",
"var",
"method",
"=",
"spec",
".",
"method",
",",
"endpoint",
"=",
"spec",
".",
"endpoint",
",",
"params",
"=",
"spec",
".",
"params",
",",
"paramsInBody",
"=",
"spec",
".",
"paramsInBody",
",",
"targetName",
"=",
"sp... | Generates a form element and appends it to the `document`. When the form is submitted, a specific iframe is targeted.
The name of the iframe is passed in as a property of the spec parameter, and must be unique in the `document`. Note
that the form is hidden from view.
@param spec An object containing various propert... | [
"Generates",
"a",
"form",
"element",
"and",
"appends",
"it",
"to",
"the",
"document",
".",
"When",
"the",
"form",
"is",
"submitted",
"a",
"specific",
"iframe",
"is",
"targeted",
".",
"The",
"name",
"of",
"the",
"iframe",
"is",
"passed",
"in",
"as",
"a",
... | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/upload-handler/form.upload.handler.js#L261-L283 | train | |
FineUploader/fine-uploader | client/js/upload-handler/xhr.upload.handler.js | function(id, chunkIdx) {
var fileState = handler._getFileState(id);
if (fileState) {
delete fileState.temp.cachedChunks[chunkIdx];
}
} | javascript | function(id, chunkIdx) {
var fileState = handler._getFileState(id);
if (fileState) {
delete fileState.temp.cachedChunks[chunkIdx];
}
} | [
"function",
"(",
"id",
",",
"chunkIdx",
")",
"{",
"var",
"fileState",
"=",
"handler",
".",
"_getFileState",
"(",
"id",
")",
";",
"if",
"(",
"fileState",
")",
"{",
"delete",
"fileState",
".",
"temp",
".",
"cachedChunks",
"[",
"chunkIdx",
"]",
";",
"}",
... | Clear the cached chunk `Blob` after we are done with it, just in case the `Blob` bytes are stored in memory. | [
"Clear",
"the",
"cached",
"chunk",
"Blob",
"after",
"we",
"are",
"done",
"with",
"it",
"just",
"in",
"case",
"the",
"Blob",
"bytes",
"are",
"stored",
"in",
"memory",
"."
] | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/upload-handler/xhr.upload.handler.js#L90-L96 | train | |
FineUploader/fine-uploader | client/js/upload-handler/xhr.upload.handler.js | function(id, responseParser) {
var lastChunkIdx = handler._getTotalChunks(id) - 1,
xhr = handler._getXhr(id, lastChunkIdx);
if (responseParser) {
return new qq.Promise().success(responseParser(xhr), xhr);
}
return new qq.Promise().success... | javascript | function(id, responseParser) {
var lastChunkIdx = handler._getTotalChunks(id) - 1,
xhr = handler._getXhr(id, lastChunkIdx);
if (responseParser) {
return new qq.Promise().success(responseParser(xhr), xhr);
}
return new qq.Promise().success... | [
"function",
"(",
"id",
",",
"responseParser",
")",
"{",
"var",
"lastChunkIdx",
"=",
"handler",
".",
"_getTotalChunks",
"(",
"id",
")",
"-",
"1",
",",
"xhr",
"=",
"handler",
".",
"_getXhr",
"(",
"id",
",",
"lastChunkIdx",
")",
";",
"if",
"(",
"responseP... | Called when all chunks have been successfully uploaded. Expected promissory return type. This defines the default behavior if nothing further is required when all chunks have been uploaded. | [
"Called",
"when",
"all",
"chunks",
"have",
"been",
"successfully",
"uploaded",
".",
"Expected",
"promissory",
"return",
"type",
".",
"This",
"defines",
"the",
"default",
"behavior",
"if",
"nothing",
"further",
"is",
"required",
"when",
"all",
"chunks",
"have",
... | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/upload-handler/xhr.upload.handler.js#L111-L120 | train | |
FineUploader/fine-uploader | client/js/upload-handler/xhr.upload.handler.js | function(id) {
var localStorageId;
if (resumeEnabled && handler.isResumable(id)) {
localStorageId = handler._getLocalStorageId(id);
if (localStorageId && localStorage.getItem(localStorageId)) {
localStorage.removeItem(localStorageId);
... | javascript | function(id) {
var localStorageId;
if (resumeEnabled && handler.isResumable(id)) {
localStorageId = handler._getLocalStorageId(id);
if (localStorageId && localStorage.getItem(localStorageId)) {
localStorage.removeItem(localStorageId);
... | [
"function",
"(",
"id",
")",
"{",
"var",
"localStorageId",
";",
"if",
"(",
"resumeEnabled",
"&&",
"handler",
".",
"isResumable",
"(",
"id",
")",
")",
"{",
"localStorageId",
"=",
"handler",
".",
"_getLocalStorageId",
"(",
"id",
")",
";",
"if",
"(",
"localS... | Removes a chunked upload record from local storage, if possible. Returns true if the item was removed, false otherwise. | [
"Removes",
"a",
"chunked",
"upload",
"record",
"from",
"local",
"storage",
"if",
"possible",
".",
"Returns",
"true",
"if",
"the",
"item",
"was",
"removed",
"false",
"otherwise",
"."
] | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/upload-handler/xhr.upload.handler.js#L368-L381 | train | |
FineUploader/fine-uploader | client/js/upload-handler/xhr.upload.handler.js | function(id, optChunkIdx, xhr, optAjaxRequester) {
var xhrsId = optChunkIdx == null ? -1 : optChunkIdx,
tempState = handler._getFileState(id).temp;
tempState.xhrs = tempState.xhrs || {};
tempState.ajaxRequesters = tempState.ajaxRequesters || {};
tempStat... | javascript | function(id, optChunkIdx, xhr, optAjaxRequester) {
var xhrsId = optChunkIdx == null ? -1 : optChunkIdx,
tempState = handler._getFileState(id).temp;
tempState.xhrs = tempState.xhrs || {};
tempState.ajaxRequesters = tempState.ajaxRequesters || {};
tempStat... | [
"function",
"(",
"id",
",",
"optChunkIdx",
",",
"xhr",
",",
"optAjaxRequester",
")",
"{",
"var",
"xhrsId",
"=",
"optChunkIdx",
"==",
"null",
"?",
"-",
"1",
":",
"optChunkIdx",
",",
"tempState",
"=",
"handler",
".",
"_getFileState",
"(",
"id",
")",
".",
... | Registers an XHR transport instance created elsewhere.
@param id ID of the associated file
@param optChunkIdx The chunk index associated with this XHR, if applicable
@param xhr XMLHttpRequest object instance
@param optAjaxRequester `qq.AjaxRequester` associated with this request, if applicable.
@returns {XMLHttpReques... | [
"Registers",
"an",
"XHR",
"transport",
"instance",
"created",
"elsewhere",
"."
] | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/upload-handler/xhr.upload.handler.js#L507-L521 | train | |
FineUploader/fine-uploader | client/js/upload-handler/xhr.upload.handler.js | function() {
var expirationDays = resume.recordsExpireIn;
handler._iterateResumeRecords(function(key, uploadData) {
var expirationDate = new Date(uploadData.lastUpdated);
// transform updated date into expiration date
expirationDate.setDate(expir... | javascript | function() {
var expirationDays = resume.recordsExpireIn;
handler._iterateResumeRecords(function(key, uploadData) {
var expirationDate = new Date(uploadData.lastUpdated);
// transform updated date into expiration date
expirationDate.setDate(expir... | [
"function",
"(",
")",
"{",
"var",
"expirationDays",
"=",
"resume",
".",
"recordsExpireIn",
";",
"handler",
".",
"_iterateResumeRecords",
"(",
"function",
"(",
"key",
",",
"uploadData",
")",
"{",
"var",
"expirationDate",
"=",
"new",
"Date",
"(",
"uploadData",
... | Deletes any local storage records that are "expired". | [
"Deletes",
"any",
"local",
"storage",
"records",
"that",
"are",
"expired",
"."
] | 057cc83a7e7657d032a75cf4a6b3612c7b4191da | https://github.com/FineUploader/fine-uploader/blob/057cc83a7e7657d032a75cf4a6b3612c7b4191da/client/js/upload-handler/xhr.upload.handler.js#L524-L538 | train | |
elastic/apm-agent-nodejs | lib/instrumentation/express-utils.js | routePath | function routePath (route) {
if (!route) return ''
return route.path || (route.regexp && route.regexp.source) || ''
} | javascript | function routePath (route) {
if (!route) return ''
return route.path || (route.regexp && route.regexp.source) || ''
} | [
"function",
"routePath",
"(",
"route",
")",
"{",
"if",
"(",
"!",
"route",
")",
"return",
"''",
"return",
"route",
".",
"path",
"||",
"(",
"route",
".",
"regexp",
"&&",
"route",
".",
"regexp",
".",
"source",
")",
"||",
"''",
"}"
] | This works for both express AND restify | [
"This",
"works",
"for",
"both",
"express",
"AND",
"restify"
] | f23ca65801d7fee794e0d8f1f95275b7c0ad7417 | https://github.com/elastic/apm-agent-nodejs/blob/f23ca65801d7fee794e0d8f1f95275b7c0ad7417/lib/instrumentation/express-utils.js#L24-L27 | train |
elastic/apm-agent-nodejs | lib/instrumentation/express-utils.js | getPathFromRequest | function getPathFromRequest (req, useBase, usePathAsTransactionName) {
// Static serving route
if (req[symbols.staticFile]) {
return 'static file'
}
var path = getStackPath(req)
var route = routePath(req.route)
if (route) {
return path ? join([ path, route ]) : route
}
if (useBase) {
retu... | javascript | function getPathFromRequest (req, useBase, usePathAsTransactionName) {
// Static serving route
if (req[symbols.staticFile]) {
return 'static file'
}
var path = getStackPath(req)
var route = routePath(req.route)
if (route) {
return path ? join([ path, route ]) : route
}
if (useBase) {
retu... | [
"function",
"getPathFromRequest",
"(",
"req",
",",
"useBase",
",",
"usePathAsTransactionName",
")",
"{",
"// Static serving route",
"if",
"(",
"req",
"[",
"symbols",
".",
"staticFile",
"]",
")",
"{",
"return",
"'static file'",
"}",
"var",
"path",
"=",
"getStackP... | This function is also able to extract the path from a Restify request as it's storing the route name on req.route.path as well | [
"This",
"function",
"is",
"also",
"able",
"to",
"extract",
"the",
"path",
"from",
"a",
"Restify",
"request",
"as",
"it",
"s",
"storing",
"the",
"route",
"name",
"on",
"req",
".",
"route",
".",
"path",
"as",
"well"
] | f23ca65801d7fee794e0d8f1f95275b7c0ad7417 | https://github.com/elastic/apm-agent-nodejs/blob/f23ca65801d7fee794e0d8f1f95275b7c0ad7417/lib/instrumentation/express-utils.js#L37-L59 | train |
elastic/apm-agent-nodejs | lib/instrumentation/patch-async.js | activator | function activator (fn) {
var fallback = function () {
var args
var cbIdx = arguments.length - 1
if (typeof arguments[cbIdx] === 'function') {
args = Array(arguments.length)
for (var i = 0; i < arguments.length - 1; i++) {
args[i] = arguments[i]
}
args[cbI... | javascript | function activator (fn) {
var fallback = function () {
var args
var cbIdx = arguments.length - 1
if (typeof arguments[cbIdx] === 'function') {
args = Array(arguments.length)
for (var i = 0; i < arguments.length - 1; i++) {
args[i] = arguments[i]
}
args[cbI... | [
"function",
"activator",
"(",
"fn",
")",
"{",
"var",
"fallback",
"=",
"function",
"(",
")",
"{",
"var",
"args",
"var",
"cbIdx",
"=",
"arguments",
".",
"length",
"-",
"1",
"if",
"(",
"typeof",
"arguments",
"[",
"cbIdx",
"]",
"===",
"'function'",
")",
... | Shim activator for functions that have callback last | [
"Shim",
"activator",
"for",
"functions",
"that",
"have",
"callback",
"last"
] | f23ca65801d7fee794e0d8f1f95275b7c0ad7417 | https://github.com/elastic/apm-agent-nodejs/blob/f23ca65801d7fee794e0d8f1f95275b7c0ad7417/lib/instrumentation/patch-async.js#L420-L474 | train |
elastic/apm-agent-nodejs | lib/instrumentation/modules/ioredis.js | wrapInitPromise | function wrapInitPromise (original) {
return function wrappedInitPromise () {
var command = this
var cb = this.callback
if (typeof cb === 'function') {
this.callback = agent._instrumentation.bindFunction(function wrappedCallback () {
var span = command[spanSym]
if (spa... | javascript | function wrapInitPromise (original) {
return function wrappedInitPromise () {
var command = this
var cb = this.callback
if (typeof cb === 'function') {
this.callback = agent._instrumentation.bindFunction(function wrappedCallback () {
var span = command[spanSym]
if (spa... | [
"function",
"wrapInitPromise",
"(",
"original",
")",
"{",
"return",
"function",
"wrappedInitPromise",
"(",
")",
"{",
"var",
"command",
"=",
"this",
"var",
"cb",
"=",
"this",
".",
"callback",
"if",
"(",
"typeof",
"cb",
"===",
"'function'",
")",
"{",
"this",... | wrap initPromise to allow us to get notified when the callback to a command is called. If we don't do this we will still get notified because we register a callback with command.promise.finally the wrappedSendCommand, but the finally call will not get fired until the tick after the command.callback have fired, so if th... | [
"wrap",
"initPromise",
"to",
"allow",
"us",
"to",
"get",
"notified",
"when",
"the",
"callback",
"to",
"a",
"command",
"is",
"called",
".",
"If",
"we",
"don",
"t",
"do",
"this",
"we",
"will",
"still",
"get",
"notified",
"because",
"we",
"register",
"a",
... | f23ca65801d7fee794e0d8f1f95275b7c0ad7417 | https://github.com/elastic/apm-agent-nodejs/blob/f23ca65801d7fee794e0d8f1f95275b7c0ad7417/lib/instrumentation/modules/ioredis.js#L32-L47 | train |
elastic/apm-agent-nodejs | lib/instrumentation/modules/http2.js | wrapCreateServer | function wrapCreateServer (original) {
return function wrappedCreateServer (options, handler) {
var server = original.apply(this, arguments)
shimmer.wrap(server.constructor.prototype, 'emit', wrapEmit)
wrappedCreateServer[symbols.unwrap]()
return server
}
} | javascript | function wrapCreateServer (original) {
return function wrappedCreateServer (options, handler) {
var server = original.apply(this, arguments)
shimmer.wrap(server.constructor.prototype, 'emit', wrapEmit)
wrappedCreateServer[symbols.unwrap]()
return server
}
} | [
"function",
"wrapCreateServer",
"(",
"original",
")",
"{",
"return",
"function",
"wrappedCreateServer",
"(",
"options",
",",
"handler",
")",
"{",
"var",
"server",
"=",
"original",
".",
"apply",
"(",
"this",
",",
"arguments",
")",
"shimmer",
".",
"wrap",
"(",... | The `createServer` function will unpatch itself after patching the first server prototype it patches. | [
"The",
"createServer",
"function",
"will",
"unpatch",
"itself",
"after",
"patching",
"the",
"first",
"server",
"prototype",
"it",
"patches",
"."
] | f23ca65801d7fee794e0d8f1f95275b7c0ad7417 | https://github.com/elastic/apm-agent-nodejs/blob/f23ca65801d7fee794e0d8f1f95275b7c0ad7417/lib/instrumentation/modules/http2.js#L22-L29 | train |
elastic/apm-agent-nodejs | lib/parsers.js | getCulprit | function getCulprit (frames) {
if (frames.length === 0) return
var filename = frames[0].filename
var fnName = frames[0].function
for (var n = 0; n < frames.length; n++) {
if (!frames[n].library_frame) {
filename = frames[n].filename
fnName = frames[n].function
break
}
}
return fi... | javascript | function getCulprit (frames) {
if (frames.length === 0) return
var filename = frames[0].filename
var fnName = frames[0].function
for (var n = 0; n < frames.length; n++) {
if (!frames[n].library_frame) {
filename = frames[n].filename
fnName = frames[n].function
break
}
}
return fi... | [
"function",
"getCulprit",
"(",
"frames",
")",
"{",
"if",
"(",
"frames",
".",
"length",
"===",
"0",
")",
"return",
"var",
"filename",
"=",
"frames",
"[",
"0",
"]",
".",
"filename",
"var",
"fnName",
"=",
"frames",
"[",
"0",
"]",
".",
"function",
"for",... | Default `culprit` to the top of the stack or the highest non `library_frame` frame if such exists | [
"Default",
"culprit",
"to",
"the",
"top",
"of",
"the",
"stack",
"or",
"the",
"highest",
"non",
"library_frame",
"frame",
"if",
"such",
"exists"
] | f23ca65801d7fee794e0d8f1f95275b7c0ad7417 | https://github.com/elastic/apm-agent-nodejs/blob/f23ca65801d7fee794e0d8f1f95275b7c0ad7417/lib/parsers.js#L220-L234 | train |
GoogleChromeLabs/carlo | lib/find_chrome.js | linux | function linux(canary) {
let installations = [];
// Look into the directories where .desktop are saved on gnome based distro's
const desktopInstallationFolders = [
path.join(require('os').homedir(), '.local/share/applications/'),
'/usr/share/applications/',
];
desktopInstallationFolders.forEach(folde... | javascript | function linux(canary) {
let installations = [];
// Look into the directories where .desktop are saved on gnome based distro's
const desktopInstallationFolders = [
path.join(require('os').homedir(), '.local/share/applications/'),
'/usr/share/applications/',
];
desktopInstallationFolders.forEach(folde... | [
"function",
"linux",
"(",
"canary",
")",
"{",
"let",
"installations",
"=",
"[",
"]",
";",
"// Look into the directories where .desktop are saved on gnome based distro's",
"const",
"desktopInstallationFolders",
"=",
"[",
"path",
".",
"join",
"(",
"require",
"(",
"'os'",
... | Look for linux executables in 3 ways
1. Look into CHROME_PATH env variable
2. Look into the directories where .desktop are saved on gnome based distro's
3. Look for google-chrome-stable & google-chrome executables by using the which command | [
"Look",
"for",
"linux",
"executables",
"in",
"3",
"ways",
"1",
".",
"Look",
"into",
"CHROME_PATH",
"env",
"variable",
"2",
".",
"Look",
"into",
"the",
"directories",
"where",
".",
"desktop",
"are",
"saved",
"on",
"gnome",
"based",
"distro",
"s",
"3",
"."... | c79322776443a0564f110fd3e45b8d2042924d1d | https://github.com/GoogleChromeLabs/carlo/blob/c79322776443a0564f110fd3e45b8d2042924d1d/lib/find_chrome.js#L53-L98 | train |
Subsets and Splits
SQL Console for semeru/code-text-javascript
Retrieves 20,000 non-null code samples labeled as JavaScript, providing a basic overview of the dataset.