_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3
values | text stringlengths 52 373k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q20500 | event | train | 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 | {
"resource": ""
} |
q20501 | disconnectBody | train | function disconnectBody() {
var key;
self.loggingOut = true;
offersPending = {};
acceptancePending = {};
self.disconnecting = true;
closedChannel = self.webSocket;
if( stillAliveTimer ) {
clearTimeout(stillAliveTimer);
stillAliveTimer = null... | javascript | {
"resource": ""
} |
q20502 | train | 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 | {
"resource": ""
} | |
q20503 | checkIceGatheringState | train | 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 | {
"resource": ""
} |
q20504 | validateVideoIds | train | 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 | {
"resource": ""
} |
q20505 | connect | train | 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 | {
"resource": ""
} |
q20506 | onAccessApproved | train | 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 | {
"resource": ""
} |
q20507 | portOnMessageHanlder | train | function portOnMessageHanlder(message) {
if(message === 'get-sourceId' && !pending) {
pending = true;
chrome.desktopCapture.chooseDesktopMedia(session, port.sender.tab, onAccessApproved);
}
} | javascript | {
"resource": ""
} |
q20508 | fillBar | train | 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 | {
"resource": ""
} |
q20509 | getMaxY | train | 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 | {
"resource": ""
} |
q20510 | drawLine | train | 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 | {
"resource": ""
} |
q20511 | train | 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 | {
"resource": ""
} | |
q20512 | hashUnique | train | 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 | {
"resource": ""
} |
q20513 | parseCharset | train | 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 | {
"resource": ""
} |
q20514 | toPrint | train | 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 | {
"resource": ""
} |
q20515 | endChoice | train | 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 | {
"resource": ""
} |
q20516 | structure | train | 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 | {
"resource": ""
} |
q20517 | train | 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 | {
"resource": ""
} | |
q20518 | AsyncInvokeLater | train | function AsyncInvokeLater(fn, receiver, arg) {
ASSERT(arguments.length === 3);
this._lateQueue.push(fn, receiver, arg);
this._queueTick();
} | javascript | {
"resource": ""
} |
q20519 | _drainQueueStep | train | 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 | {
"resource": ""
} |
q20520 | insert | train | 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 | {
"resource": ""
} |
q20521 | dummyP | train | function dummyP(n) {
return function lifted() {
var deferred = Promise.pending();
timers.setTimeout(nodeback, deferred, global.asyncTime || 100);
return deferred.promise;
}
} | javascript | {
"resource": ""
} |
q20522 | train | 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 | {
"resource": ""
} | |
q20523 | train | 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 | {
"resource": ""
} | |
q20524 | validateListFromOptions | train | 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 | {
"resource": ""
} |
q20525 | train | function(reason) {
log(qq.format("Failed to determine blob name for ID {} - {}", id, reason), "error");
promise.failure({error: reason});
} | javascript | {
"resource": ""
} | |
q20526 | handleNameUpdate | train | function handleNameUpdate(newFilenameInputEl, fileId) {
var newName = newFilenameInputEl.value,
origExtension;
if (newName !== undefined && qq.trimStr(newName).length > 0) {
origExtension = getOriginalExtension(fileId);
if (origExtension !== undefined) {
... | javascript | {
"resource": ""
} |
q20527 | registerInputBlurHandler | train | function registerInputBlurHandler(inputEl, fileId) {
inheritedInternalApi.getDisposeSupport().attach(inputEl, "blur", function() {
handleNameUpdate(inputEl, fileId);
});
} | javascript | {
"resource": ""
} |
q20528 | registerInputEnterKeyHandler | train | function registerInputEnterKeyHandler(inputEl, fileId) {
inheritedInternalApi.getDisposeSupport().attach(inputEl, "keyup", function(event) {
var code = event.keyCode || event.which;
if (code === 13) {
handleNameUpdate(inputEl, fileId);
}
});
} | javascript | {
"resource": ""
} |
q20529 | getFilesInDirectory | train | 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 | {
"resource": ""
} |
q20530 | addCallbacks | train | 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 | {
"resource": ""
} |
q20531 | maybeWrapInJquery | train | 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 | {
"resource": ""
} |
q20532 | train | function(id, loaded, total) {
updateTotalProgress(id, loaded, total);
perFileProgress[id] = {loaded: loaded, total: total};
} | javascript | {
"resource": ""
} | |
q20533 | examineEvent | train | 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 | {
"resource": ""
} |
q20534 | getDirEntryCount | train | 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 | {
"resource": ""
} |
q20535 | getIfd | train | function getIfd(app1Start, dirEntries) {
var offset = app1Start + 20,
bytes = dirEntries * 12;
return qq.readBlobToHex(fileOrBlob, offset, bytes);
} | javascript | {
"resource": ""
} |
q20536 | getTagValues | train | 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 | {
"resource": ""
} |
q20537 | handleCompleteRequestComplete | train | 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 | {
"resource": ""
} |
q20538 | train | 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 | {
"resource": ""
} | |
q20539 | train | 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 | {
"resource": ""
} | |
q20540 | train | 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 | {
"resource": ""
} | |
q20541 | train | 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 | {
"resource": ""
} | |
q20542 | train | function(awsResponseXml) {
var parser = new DOMParser(),
parsedDoc = parser.parseFromString(awsResponseXml, "application/xml"),
errorEls = parsedDoc.getElementsByTagName("Error"),
errorDetails = {},
codeE... | javascript | {
"resource": ""
} | |
q20543 | train | 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 | {
"resource": ""
} | |
q20544 | train | function(fileId, imgOrCanvas, maxSize, fromServer, customResizeFunction) {
var promiseToReturn = new qq.Promise(),
fileOrUrl, options;
if (this._imageGenerator) {
fileOrUrl = this._thumbnailUrls[fileId];
options = {
customResiz... | javascript | {
"resource": ""
} | |
q20545 | train | function(id) {
var uploadDataEntry = this.getUploads({id: id}),
parentId = null;
if (uploadDataEntry) {
if (uploadDataEntry.parentId !== undefined) {
parentId = uploadDataEntry.parentId;
}
}
return pare... | javascript | {
"resource": ""
} | |
q20546 | train | 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 | {
"resource": ""
} | |
q20547 | train | 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 | {
"resource": ""
} | |
q20548 | train | 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 | {
"resource": ""
} | |
q20549 | train | function(spec) {
var button = this._createUploadButton({
accept: spec.validation.acceptFiles,
allowedExtensions: spec.validation.allowedExtensions,
element: spec.element,
folders: spec.folders,
multiple: spec.multiple,
... | javascript | {
"resource": ""
} | |
q20550 | train | 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 | {
"resource": ""
} | |
q20551 | train | function(fileWrapper, validationDescriptor) {
var self = this,
file = (function() {
if (fileWrapper.file instanceof qq.BlobProxy) {
return fileWrapper.file.referenceBlob;
}
return fileWrapper.file;
... | javascript | {
"resource": ""
} | |
q20552 | train | 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 | {
"resource": ""
} | |
q20553 | train | function(originalImage, scaledImageDataUri, log) {
"use strict";
var reader = new FileReader(),
insertionEffort = new qq.Promise(),
originalImageDataUri = "";
reader.onload = function() {
originalImageDataUri = reader.result;
insertionEffort.succ... | javascript | {
"resource": ""
} | |
q20554 | maybeUploadOnSubmit | train | 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 | {
"resource": ""
} |
q20555 | train | 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 | {
"resource": ""
} | |
q20556 | train | function(name) {
if (qq.azure.util._paramNameMatchesAzureParameter(name)) {
return name;
}
else {
return qq.azure.util.AZURE_PARAM_PREFIX + name;
}
} | javascript | {
"resource": ""
} | |
q20557 | handleInputFocus | train | 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 | {
"resource": ""
} |
q20558 | draw | train | 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 | {
"resource": ""
} |
q20559 | train | 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 | {
"resource": ""
} | |
q20560 | train | 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 | {
"resource": ""
} | |
q20561 | train | function (hasher) {
return function (message, key) {
return new C_algo.HMAC.init(hasher, key).finalize(message);
};
} | javascript | {
"resource": ""
} | |
q20562 | train | 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 | {
"resource": ""
} | |
q20563 | train | function(name) {
if (qq.indexOf(qq.s3.util.UNPREFIXED_PARAM_NAMES, name) >= 0) {
return name;
}
return qq.s3.util.AWS_PARAM_PREFIX + name;
} | javascript | {
"resource": ""
} | |
q20564 | train | 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 | {
"resource": ""
} | |
q20565 | train | 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 | {
"resource": ""
} | |
q20566 | getCorsAjaxTransport | train | 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 | {
"resource": ""
} |
q20567 | dequeue | train | 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 | {
"resource": ""
} |
q20568 | train | 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 | {
"resource": ""
} | |
q20569 | train | 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 | {
"resource": ""
} | |
q20570 | train | 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 | {
"resource": ""
} | |
q20571 | train | function(id, onSuccessCallback) {
var additionalMandatedParams = {
key: this.getKey(id),
bucket: this.getBucket(id)
};
return qq.FineUploaderBasic.prototype._onSubmitDelete.call(this, id, onSuccessCallback, additionalMandatedParams);
} | javascript | {
"resource": ""
} | |
q20572 | train | 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 | {
"resource": ""
} | |
q20573 | train | 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 | {
"resource": ""
} | |
q20574 | train | function(errorMessage) {
var errorResponse = {};
if (errorMessage) {
errorResponse.error = errorMessage;
}
log(qq.format("Failed to generate blob for ID {}. Error message: {}.", id, errorMessage), "error");
... | javascript | {
"resource": ""
} | |
q20575 | train | 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 | {
"resource": ""
} | |
q20576 | train | 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 | {
"resource": ""
} | |
q20577 | train | 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 | {
"resource": ""
} | |
q20578 | isChrome14OrHigher | train | function isChrome14OrHigher() {
return (qq.chrome() || qq.opera()) &&
navigator.userAgent.match(/Chrome\/[1][4-9]|Chrome\/[2-9][0-9]/) !== undefined;
} | javascript | {
"resource": ""
} |
q20579 | isCrossOriginXhrSupported | train | function isCrossOriginXhrSupported() {
if (window.XMLHttpRequest) {
var xhr = qq.createXhrInstance();
//Commonly accepted test for XHR CORS support.
return xhr.withCredentials !== undefined;
}
return false;
} | javascript | {
"resource": ""
} |
q20580 | train | function(id, toBeSigned) {
var params = toBeSigned,
signatureConstructor = toBeSigned.signatureConstructor,
signatureEffort = new qq.Promise(),
queryParams;
if (options.signatureSpec.version === 4) {
queryParams = {v4: true};
... | javascript | {
"resource": ""
} | |
q20581 | train | 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 | {
"resource": ""
} | |
q20582 | train | 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 | {
"resource": ""
} | |
q20583 | handleInitiateRequestComplete | train | 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 | {
"resource": ""
} |
q20584 | expungeFile | train | 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 | {
"resource": ""
} |
q20585 | initIframeForUpload | train | 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 | {
"resource": ""
} |
q20586 | train | function(id, fileInput) {
super_.add(id, {input: fileInput});
fileInput.setAttribute("name", inputName);
// remove file input from DOM
if (fileInput.parentNode) {
qq(fileInput).remove();
}
} | javascript | {
"resource": ""
} | |
q20587 | train | 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 | {
"resource": ""
} | |
q20588 | train | function(id, chunkIdx) {
var fileState = handler._getFileState(id);
if (fileState) {
delete fileState.temp.cachedChunks[chunkIdx];
}
} | javascript | {
"resource": ""
} | |
q20589 | train | 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 | {
"resource": ""
} | |
q20590 | train | function(id) {
var localStorageId;
if (resumeEnabled && handler.isResumable(id)) {
localStorageId = handler._getLocalStorageId(id);
if (localStorageId && localStorage.getItem(localStorageId)) {
localStorage.removeItem(localStorageId);
... | javascript | {
"resource": ""
} | |
q20591 | train | 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 | {
"resource": ""
} | |
q20592 | train | 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 | {
"resource": ""
} | |
q20593 | routePath | train | function routePath (route) {
if (!route) return ''
return route.path || (route.regexp && route.regexp.source) || ''
} | javascript | {
"resource": ""
} |
q20594 | getPathFromRequest | train | 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 | {
"resource": ""
} |
q20595 | activator | train | 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 | {
"resource": ""
} |
q20596 | wrapInitPromise | train | 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 | {
"resource": ""
} |
q20597 | wrapCreateServer | train | 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 | {
"resource": ""
} |
q20598 | getCulprit | train | 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 | {
"resource": ""
} |
q20599 | linux | train | 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 | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.