_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3 values | text stringlengths 52 373k | language stringclasses 1 value | meta_information dict |
|---|---|---|---|---|---|
q25700 | train | function(){
var plugin = $(this.element).data("ui-" + this.options.pluginName) || $(this.element).data(this.options.pluginName),
opts = this.options,
actualOpts = plugin.options,
availOptList = opts.optionList,
$opts = $(this.options.optionTarget).empty(),
$ul = $("<ul>").appendTo($opts),
$li = null;
$.each(availOptList, function(i, o){
if( typeof o.value === "boolean"){
$li = $("<li>").append(
$("<input>", {
id: o.name,
name: o.name,
type: "checkbox",
checked: !!actualOpts[o.name] //o.value
})
).append(
$("<label>", {"for": o.name, text: " " + o.hint})
);
}else if( typeof o.value === "number" || typeof o.value === "string"){
$li = $("<li>").append(
$("<label>", {"for": o.name, text: " " + o.name})
).append(
$("<input>", {
id: o.name,
name: o.name,
type: "text",
value: actualOpts[o.name] //o.value
})
);
}else if( $.isArray(o.value) ){
$li = $("<li>")
.append(
$("<label>", {"for": o.name, text: " " + o.name})
).append(
$("<select>", {
id: o.name,
name: o.name,
size: 1
})
);
var $sel = $li.find("select");
$.each(o.value, function(){
$sel.append($("<option>", {
value: this.value,
text: this.name,
selected: (actualOpts[o.name] == this.value) //this.selected
}));
});
}
$ul.append($li);
});
} | javascript | {
"resource": ""
} | |
q25701 | train | function(){
var plugin = $(this.element).data("ui-" + this.options.pluginName) || $(this.element).data(this.options.pluginName),
opts = this.options,
actualOpts = plugin.options,
availOptList = opts.optionList,
lines = [],
header = opts.header || '$("#selector").' + opts.pluginName + "({",
footer = "});",
i;
// Make a filtered copy of the option list (so we get the last ',' right)
if(this.options.hideDefaults){
availOptList = [];
for(i=0; i<this.options.optionList.length; i++){
var o = this.options.optionList[i],
n = o.name,
defVal = o.value;
if($.isArray(defVal)){
defVal = $.map(defVal, function(e){ return e.selected ? e.value : null;})[0];
}
if( actualOpts[n] !== defVal /*&& actualOpts[n] !== undefined*/){
availOptList.push(o);
}
}
}
//
lines.push(header);
for(i=0; i<availOptList.length; i++){
var o = availOptList[i],
actualVal = actualOpts[o.name],
line = " " + o.name + ": ";
if(typeof actualVal === "string"){
line += '"' + actualVal + '"';
}else if($.isPlainObject(actualVal)){
line += JSON.stringify(actualVal);
}else{
line += "" + actualVal;
}
if( i < (availOptList.length - 1) ){
line += ",";
}
if( opts.showComments ){
line += " // " + o.hint;
}
lines.push(line);
}
lines.push(footer);
$(opts.sourceTarget).addClass("ui-configurator-source").text(lines.join("\n"));
this._trigger("render");
} | javascript | {
"resource": ""
} | |
q25702 | updateControls | train | function updateControls() {
var query = $.trim($("input[name=query]").val());
$("#btnPin").attr("disabled", !taxonTree.getActiveNode());
$("#btnUnpin")
.attr("disabled", !taxonTree.isFilterActive())
.toggleClass("btn-success", taxonTree.isFilterActive());
$("#btnResetSearch").attr("disabled", query.length === 0);
$("#btnSearch").attr("disabled", query.length < 2);
} | javascript | {
"resource": ""
} |
q25703 | _delay | train | function _delay(tag, ms, callback) {
/*jshint -W040:true */
var self = this;
tag = "" + (tag || "default");
if (timerMap[tag] != null) {
clearTimeout(timerMap[tag]);
delete timerMap[tag];
// console.log("Cancel timer '" + tag + "'");
}
if (ms == null || callback == null) {
return;
}
// console.log("Start timer '" + tag + "'");
timerMap[tag] = setTimeout(function() {
// console.log("Execute timer '" + tag + "'");
callback.call(self);
}, +ms);
} | javascript | {
"resource": ""
} |
q25704 | moveModuleUp | train | function moveModuleUp(source, target, module) {
const targetZip = new JSZip();
return fse
.readFileAsync(source)
.then(buffer => JSZip.loadAsync(buffer))
.then(sourceZip => sourceZip.filter(file => file.startsWith(module + '/')))
.map(srcZipObj =>
zipFile(
targetZip,
srcZipObj.name.replace(module + '/', ''),
srcZipObj.async('nodebuffer')
)
)
.then(() => writeZip(targetZip, target));
} | javascript | {
"resource": ""
} |
q25705 | cleanup | train | function cleanup() {
const artifacts = ['.requirements'];
if (this.options.zip) {
if (this.serverless.service.package.individually) {
this.targetFuncs.forEach(f => {
artifacts.push(path.join(f.module, '.requirements.zip'));
artifacts.push(path.join(f.module, 'unzip_requirements.py'));
});
} else {
artifacts.push('.requirements.zip');
artifacts.push('unzip_requirements.py');
}
}
return BbPromise.all(
artifacts.map(artifact =>
fse.removeAsync(path.join(this.servicePath, artifact))
)
);
} | javascript | {
"resource": ""
} |
q25706 | cleanupCache | train | function cleanupCache() {
const cacheLocation = getUserCachePath(this.options);
if (fse.existsSync(cacheLocation)) {
if (this.serverless) {
this.serverless.cli.log(`Removing static caches at: ${cacheLocation}`);
}
// Only remove cache folders that we added, just incase someone accidentally puts a weird
// static cache location so we don't remove a bunch of personal stuff
const promises = [];
glob
.sync([path.join(cacheLocation, '*slspyc/')], { mark: true, dot: false })
.forEach(file => {
promises.push(fse.removeAsync(file));
});
return BbPromise.all(promises);
} else {
if (this.serverless) {
this.serverless.cli.log(`No static cache found`);
}
return BbPromise.resolve();
}
} | javascript | {
"resource": ""
} |
q25707 | dockerCommand | train | function dockerCommand(options) {
const cmd = 'docker';
const ps = spawnSync(cmd, options, { encoding: 'utf-8' });
if (ps.error) {
if (ps.error.code === 'ENOENT') {
throw new Error('docker not found! Please install it.');
}
throw new Error(ps.error);
} else if (ps.status !== 0) {
throw new Error(ps.stderr);
}
return ps;
} | javascript | {
"resource": ""
} |
q25708 | tryBindPath | train | function tryBindPath(serverless, bindPath, testFile) {
const options = [
'run',
'--rm',
'-v',
`${bindPath}:/test`,
'alpine',
'ls',
`/test/${testFile}`
];
try {
const ps = dockerCommand(options);
if (process.env.SLS_DEBUG) {
serverless.cli.log(`Trying bindPath ${bindPath} (${options})`);
serverless.cli.log(ps.stdout.trim());
}
return ps.stdout.trim() === `/test/${testFile}`;
} catch (err) {
return false;
}
} | javascript | {
"resource": ""
} |
q25709 | getBindPath | train | function getBindPath(serverless, servicePath) {
// Determine bind path
if (process.platform !== 'win32' && !isWsl) {
return servicePath;
}
// test docker is available
dockerCommand(['version']);
// find good bind path for Windows
let bindPaths = [];
let baseBindPath = servicePath.replace(/\\([^\s])/g, '/$1');
let drive;
let path;
bindPaths.push(baseBindPath);
if (baseBindPath.startsWith('/mnt/')) {
// cygwin "/mnt/C/users/..."
baseBindPath = baseBindPath.replace(/^\/mnt\//, '/');
}
if (baseBindPath[1] == ':') {
// normal windows "c:/users/..."
drive = baseBindPath[0];
path = baseBindPath.substring(3);
} else if (baseBindPath[0] == '/' && baseBindPath[2] == '/') {
// gitbash "/c/users/..."
drive = baseBindPath[1];
path = baseBindPath.substring(3);
} else {
throw new Error(`Unknown path format ${baseBindPath.substr(10)}...`);
}
bindPaths.push(`/${drive.toLowerCase()}/${path}`); // Docker Toolbox (seems like Docker for Windows can support this too)
bindPaths.push(`${drive.toLowerCase()}:/${path}`); // Docker for Windows
// other options just in case
bindPaths.push(`/${drive.toUpperCase()}/${path}`);
bindPaths.push(`/mnt/${drive.toLowerCase()}/${path}`);
bindPaths.push(`/mnt/${drive.toUpperCase()}/${path}`);
bindPaths.push(`${drive.toUpperCase()}:/${path}`);
const testFile = findTestFile(servicePath);
for (let i = 0; i < bindPaths.length; i++) {
const bindPath = bindPaths[i];
if (tryBindPath(serverless, bindPath, testFile)) {
return bindPath;
}
}
throw new Error('Unable to find good bind path format');
} | javascript | {
"resource": ""
} |
q25710 | getDockerUid | train | function getDockerUid(bindPath) {
const options = [
'run',
'--rm',
'-v',
`${bindPath}:/test`,
'alpine',
'stat',
'-c',
'%u',
'/bin/sh'
];
const ps = dockerCommand(options);
return ps.stdout.trim();
} | javascript | {
"resource": ""
} |
q25711 | zipRequirements | train | function zipRequirements() {
const rootZip = new JSZip();
const src = path.join('.serverless', 'requirements');
const runtimepath = 'python';
return addTree(rootZip.folder(runtimepath), src).then(() =>
writeZip(rootZip, path.join('.serverless', 'pythonRequirements.zip'))
);
} | javascript | {
"resource": ""
} |
q25712 | createLayers | train | function createLayers() {
if (!this.serverless.service.layers) {
this.serverless.service.layers = {};
}
this.serverless.service.layers['pythonRequirements'] = Object.assign(
{
artifact: path.join('.serverless', 'pythonRequirements.zip'),
name: `${
this.serverless.service.service
}-${this.serverless.providers.aws.getStage()}-python-requirements`,
description:
'Python requirements generated by serverless-python-requirements.',
compatibleRuntimes: [this.serverless.service.provider.runtime]
},
this.options.layer
);
return BbPromise.resolve();
} | javascript | {
"resource": ""
} |
q25713 | layerRequirements | train | function layerRequirements() {
if (!this.options.layer) {
return BbPromise.resolve();
}
this.serverless.cli.log('Packaging Python Requirements Lambda Layer...');
return BbPromise.bind(this)
.then(zipRequirements)
.then(createLayers);
} | javascript | {
"resource": ""
} |
q25714 | addVendorHelper | train | function addVendorHelper() {
if (this.options.zip) {
if (this.serverless.service.package.individually) {
return BbPromise.resolve(this.targetFuncs)
.map(f => {
if (!get(f, 'package.include')) {
set(f, ['package', 'include'], []);
}
if (!get(f, 'module')) {
set(f, ['module'], '.');
}
f.package.include.push('unzip_requirements.py');
return f;
})
.then(functions => uniqBy(functions, func => func.module))
.map(f => {
this.serverless.cli.log(
`Adding Python requirements helper to ${f.module}...`
);
return fse.copyAsync(
path.resolve(__dirname, '../unzip_requirements.py'),
path.join(this.servicePath, f.module, 'unzip_requirements.py')
);
});
} else {
this.serverless.cli.log('Adding Python requirements helper...');
if (!get(this.serverless.service, 'package.include')) {
set(this.serverless.service, ['package', 'include'], []);
}
this.serverless.service.package.include.push('unzip_requirements.py');
return fse.copyAsync(
path.resolve(__dirname, '../unzip_requirements.py'),
path.join(this.servicePath, 'unzip_requirements.py')
);
}
}
} | javascript | {
"resource": ""
} |
q25715 | removeVendorHelper | train | function removeVendorHelper() {
if (this.options.zip && this.options.cleanupZipHelper) {
if (this.serverless.service.package.individually) {
return BbPromise.resolve(this.targetFuncs)
.map(f => {
if (!get(f, 'module')) {
set(f, ['module'], '.');
}
return f;
})
.then(funcs => uniqBy(funcs, f => f.module))
.map(f => {
this.serverless.cli.log(
`Removing Python requirements helper from ${f.module}...`
);
return fse.removeAsync(
path.join(this.servicePath, f.module, 'unzip_requirements.py')
);
});
} else {
this.serverless.cli.log('Removing Python requirements helper...');
return fse.removeAsync(
path.join(this.servicePath, 'unzip_requirements.py')
);
}
}
} | javascript | {
"resource": ""
} |
q25716 | addTree | train | function addTree(zip, src) {
const srcN = path.normalize(src);
return fse
.readdirAsync(srcN)
.map(name => {
const srcPath = path.join(srcN, name);
return fse.statAsync(srcPath).then(stat => {
if (stat.isDirectory()) {
return addTree(zip.folder(name), srcPath);
} else {
const opts = { date: stat.mtime, unixPermissions: stat.mode };
return fse
.readFileAsync(srcPath)
.then(data => zip.file(name, data, opts));
}
});
})
.then(() => zip); // Original zip for chaining.
} | javascript | {
"resource": ""
} |
q25717 | writeZip | train | function writeZip(zip, targetPath) {
const opts = {
platform: process.platform == 'win32' ? 'DOS' : 'UNIX',
compression: 'DEFLATE',
compressionOptions: {
level: 9
}
};
return new BbPromise(resolve =>
zip
.generateNodeStream(opts)
.pipe(fse.createWriteStream(targetPath))
.on('finish', resolve)
).then(() => null);
} | javascript | {
"resource": ""
} |
q25718 | zipFile | train | function zipFile(zip, zipPath, bufferPromise, fileOpts) {
return bufferPromise
.then(buffer =>
zip.file(
zipPath,
buffer,
Object.assign(
{},
{
// necessary to get the same hash when zipping the same content
date: new Date(0)
},
fileOpts
)
)
)
.then(() => zip);
} | javascript | {
"resource": ""
} |
q25719 | mergeCommands | train | function mergeCommands(commands) {
const cmds = filterCommands(commands);
if (cmds.length === 0) {
throw new Error('Expected at least one non-empty command');
} else if (cmds.length === 1) {
return cmds[0];
} else {
// Quote the arguments in each command and join them all using &&.
const script = cmds.map(quote).join(' && ');
return ['/bin/sh', '-c', script];
}
} | javascript | {
"resource": ""
} |
q25720 | generateRequirementsFile | train | function generateRequirementsFile(
requirementsPath,
targetFile,
serverless,
servicePath,
options
) {
if (
options.usePoetry &&
fse.existsSync(path.join(servicePath, 'pyproject.toml'))
) {
filterRequirementsFile(
path.join(servicePath, '.serverless/requirements.txt'),
targetFile,
options
);
serverless.cli.log(
`Parsed requirements.txt from pyproject.toml in ${targetFile}...`
);
} else if (
options.usePipenv &&
fse.existsSync(path.join(servicePath, 'Pipfile'))
) {
filterRequirementsFile(
path.join(servicePath, '.serverless/requirements.txt'),
targetFile,
options
);
serverless.cli.log(
`Parsed requirements.txt from Pipfile in ${targetFile}...`
);
} else {
filterRequirementsFile(requirementsPath, targetFile, options);
serverless.cli.log(
`Generated requirements from ${requirementsPath} in ${targetFile}...`
);
}
} | javascript | {
"resource": ""
} |
q25721 | copyVendors | train | function copyVendors(vendorFolder, targetFolder, serverless) {
// Create target folder if it does not exist
fse.ensureDirSync(targetFolder);
serverless.cli.log(
`Copying vendor libraries from ${vendorFolder} to ${targetFolder}...`
);
fse.readdirSync(vendorFolder).map(file => {
let source = path.join(vendorFolder, file);
let dest = path.join(targetFolder, file);
if (fse.existsSync(dest)) {
rimraf.sync(dest);
}
fse.copySync(source, dest);
});
} | javascript | {
"resource": ""
} |
q25722 | requirementsFileExists | train | function requirementsFileExists(servicePath, options, fileName) {
if (
options.usePoetry &&
fse.existsSync(path.join(servicePath, 'pyproject.toml'))
) {
return true;
}
if (options.usePipenv && fse.existsSync(path.join(servicePath, 'Pipfile'))) {
return true;
}
if (fse.existsSync(fileName)) {
return true;
}
return false;
} | javascript | {
"resource": ""
} |
q25723 | installRequirementsIfNeeded | train | function installRequirementsIfNeeded(
servicePath,
modulePath,
options,
funcOptions,
serverless
) {
// Our source requirements, under our service path, and our module path (if specified)
const fileName = path.join(servicePath, modulePath, options.fileName);
// Skip requirements generation, if requirements file doesn't exist
if (!requirementsFileExists(servicePath, options, fileName)) {
return false;
}
let requirementsTxtDirectory;
// Copy our requirements to another path in .serverless (incase of individually packaged)
if (modulePath && modulePath !== '.') {
requirementsTxtDirectory = path.join(
servicePath,
'.serverless',
modulePath
);
} else {
requirementsTxtDirectory = path.join(servicePath, '.serverless');
}
fse.ensureDirSync(requirementsTxtDirectory);
const slsReqsTxt = path.join(requirementsTxtDirectory, 'requirements.txt');
generateRequirementsFile(
fileName,
slsReqsTxt,
serverless,
servicePath,
options
);
// If no requirements file or an empty requirements file, then do nothing
if (!fse.existsSync(slsReqsTxt) || fse.statSync(slsReqsTxt).size == 0) {
serverless.cli.log(
`Skipping empty output requirements.txt file from ${slsReqsTxt}`
);
return false;
}
// Then generate our MD5 Sum of this requirements file to determine where it should "go" to and/or pull cache from
const reqChecksum = sha256Path(slsReqsTxt);
// Then figure out where this cache should be, if we're caching, if we're in a module, etc
const workingReqsFolder = getRequirementsWorkingPath(
reqChecksum,
requirementsTxtDirectory,
options
);
// Check if our static cache is present and is valid
if (fse.existsSync(workingReqsFolder)) {
if (
fse.existsSync(path.join(workingReqsFolder, '.completed_requirements')) &&
workingReqsFolder.endsWith('_slspyc')
) {
serverless.cli.log(
`Using static cache of requirements found at ${workingReqsFolder} ...`
);
// We'll "touch" the folder, as to bring it to the start of the FIFO cache
fse.utimesSync(workingReqsFolder, new Date(), new Date());
return workingReqsFolder;
}
// Remove our old folder if it didn't complete properly, but _just incase_ only remove it if named properly...
if (
workingReqsFolder.endsWith('_slspyc') ||
workingReqsFolder.endsWith('.requirements')
) {
rimraf.sync(workingReqsFolder);
}
}
// Ensuring the working reqs folder exists
fse.ensureDirSync(workingReqsFolder);
// Copy our requirements.txt into our working folder...
fse.copySync(slsReqsTxt, path.join(workingReqsFolder, 'requirements.txt'));
// Then install our requirements from this folder
installRequirements(workingReqsFolder, serverless, options);
// Copy vendor libraries to requirements folder
if (options.vendor) {
copyVendors(options.vendor, workingReqsFolder, serverless);
}
if (funcOptions.vendor) {
copyVendors(funcOptions.vendor, workingReqsFolder, serverless);
}
// Then touch our ".completed_requirements" file so we know we can use this for static cache
if (options.useStaticCache) {
fse.closeSync(
fse.openSync(path.join(workingReqsFolder, '.completed_requirements'), 'w')
);
}
return workingReqsFolder;
} | javascript | {
"resource": ""
} |
q25724 | installAllRequirements | train | function installAllRequirements() {
// fse.ensureDirSync(path.join(this.servicePath, '.serverless'));
// First, check and delete cache versions, if enabled
checkForAndDeleteMaxCacheVersions(this.options, this.serverless);
// Then if we're going to package functions individually...
if (this.serverless.service.package.individually) {
let doneModules = [];
this.targetFuncs
.filter(func =>
(func.runtime || this.serverless.service.provider.runtime).match(
/^python.*/
)
)
.map(f => {
if (!get(f, 'module')) {
set(f, ['module'], '.');
}
// If we didn't already process a module (functions can re-use modules)
if (!doneModules.includes(f.module)) {
const reqsInstalledAt = installRequirementsIfNeeded(
this.servicePath,
f.module,
this.options,
f,
this.serverless
);
// Add modulePath into .serverless for each module so it's easier for injecting and for users to see where reqs are
let modulePath = path.join(
this.servicePath,
'.serverless',
`${f.module}`,
'requirements'
);
// Only do if we didn't already do it
if (
reqsInstalledAt &&
!fse.existsSync(modulePath) &&
reqsInstalledAt != modulePath
) {
if (this.options.useStaticCache) {
// Windows can't symlink so we have to copy on Windows,
// it's not as fast, but at least it works
if (process.platform == 'win32') {
fse.copySync(reqsInstalledAt, modulePath);
} else {
fse.symlink(reqsInstalledAt, modulePath);
}
} else {
fse.rename(reqsInstalledAt, modulePath);
}
}
doneModules.push(f.module);
}
});
} else {
const reqsInstalledAt = installRequirementsIfNeeded(
this.servicePath,
'',
this.options,
{},
this.serverless
);
// Add symlinks into .serverless for so it's easier for injecting and for users to see where reqs are
let symlinkPath = path.join(
this.servicePath,
'.serverless',
`requirements`
);
// Only do if we didn't already do it
if (
reqsInstalledAt &&
!fse.existsSync(symlinkPath) &&
reqsInstalledAt != symlinkPath
) {
// Windows can't symlink so we have to use junction on Windows
if (process.platform == 'win32') {
fse.symlink(reqsInstalledAt, symlinkPath, 'junction');
} else {
fse.symlink(reqsInstalledAt, symlinkPath);
}
}
}
} | javascript | {
"resource": ""
} |
q25725 | checkForAndDeleteMaxCacheVersions | train | function checkForAndDeleteMaxCacheVersions(options, serverless) {
// If we're using the static cache, and we have static cache max versions enabled
if (
options.useStaticCache &&
options.staticCacheMaxVersions &&
parseInt(options.staticCacheMaxVersions) > 0
) {
// Get the list of our cache files
const files = glob.sync(
[path.join(getUserCachePath(options), '*_slspyc/')],
{ mark: true }
);
// Check if we have too many
if (files.length >= options.staticCacheMaxVersions) {
// Sort by modified time
files.sort(function(a, b) {
return (
fse.statSync(a).mtime.getTime() - fse.statSync(b).mtime.getTime()
);
});
// Remove the older files...
var items = 0;
for (
var i = 0;
i < files.length - options.staticCacheMaxVersions + 1;
i++
) {
rimraf.sync(files[i]);
items++;
}
// Log the number of cache files flushed
serverless.cli.log(
`Removed ${items} items from cache because of staticCacheMaxVersions`
);
}
}
} | javascript | {
"resource": ""
} |
q25726 | getRequirementsWorkingPath | train | function getRequirementsWorkingPath(
subfolder,
requirementsTxtDirectory,
options
) {
// If we want to use the static cache
if (options && options.useStaticCache) {
if (subfolder) {
subfolder = subfolder + '_slspyc';
}
// If we have max number of cache items...
return path.join(getUserCachePath(options), subfolder);
}
// If we don't want to use the static cache, then fallback to the way things used to work
return path.join(requirementsTxtDirectory, 'requirements');
} | javascript | {
"resource": ""
} |
q25727 | getUserCachePath | train | function getUserCachePath(options) {
// If we've manually set the static cache location
if (options && options.cacheLocation) {
return path.resolve(options.cacheLocation);
}
// Otherwise, find/use the python-ey appdirs cache location
const dirs = new Appdir({
appName: 'serverless-python-requirements',
appAuthor: 'UnitedIncome'
});
return dirs.userCache();
} | javascript | {
"resource": ""
} |
q25728 | isPoetryProject | train | function isPoetryProject(servicePath) {
const pyprojectPath = path.join(servicePath, 'pyproject.toml');
if (!fse.existsSync(pyprojectPath)) {
return false;
}
const pyprojectToml = fs.readFileSync(pyprojectPath);
const pyproject = tomlParse(pyprojectToml);
const buildSystemReqs =
(pyproject['build-system'] && pyproject['build-system']['requires']) || [];
for (var i = 0; i < buildSystemReqs.length; i++) {
if (buildSystemReqs[i].startsWith('poetry')) {
return true;
}
}
return false;
} | javascript | {
"resource": ""
} |
q25729 | train | function(browser) {
return runner.runJsUnitTests(options.filter, browser).then(
function(results) {
var failedCount = results.reduce(function(prev, item) {
return prev + (item['pass'] ? 0 : 1);
}, 0);
log(results.length + ' tests, ' + failedCount + ' failure(s).');
log('[ ' + chalk.cyan(browser) + ' ] JSUnit tests: ',
failedCount > 0 ? chalk.red('FAILED') : chalk.green('PASSED'));
if (failedCount > 0) {
throw new Error();
}
}, finalize);
} | javascript | {
"resource": ""
} | |
q25730 | calculateCartesianProduct | train | function calculateCartesianProduct(keyRangeSets) {
goog.asserts.assert(
keyRangeSets.length > 1,
'Should only be called for cross-column indices.');
var keyRangeSetsAsArrays = keyRangeSets.map(
function(keyRangeSet) {
return keyRangeSet.getValues();
});
var it = goog.iter.product.apply(null, keyRangeSetsAsArrays);
var combinations = [];
goog.iter.forEach(it, function(value) {
combinations.push(value);
});
return combinations;
} | javascript | {
"resource": ""
} |
q25731 | scanDeps | train | function scanDeps() {
var provideMap = new ProvideMap_();
var requireMap = new RequireMap_();
scanFiles(relativeGlob('lib'), provideMap, requireMap);
var closureRequire = new RequireMap_();
var closureProvide = new ProvideMap_();
var closurePath = config.CLOSURE_LIBRARY_PATH + '/closure/goog';
scanFiles(relativeGlob(closurePath), closureProvide, closureRequire);
var closureDeps =
extractClosureDependencies(requireMap, closureRequire, closureProvide);
var edges = requireMap.getTopoSortEntry(provideMap, closureProvide);
var edgesClosure = closureRequire.getTopoSortEntry(
closureProvide, closureProvide, closureDeps);
var topoSorter = new Toposort();
edges.forEach(function(entry) {
topoSorter.add(entry.name, entry.depends);
});
var topoSorterClosure = new Toposort();
edgesClosure.forEach(function(entry) {
topoSorterClosure.add(entry.name, entry.depends);
});
var files = [pathMod.resolve(
pathMod.join(config.CLOSURE_LIBRARY_PATH, 'closure/goog/base.js'))];
files = files.concat(topoSorterClosure.sort().reverse());
files = files.concat(topoSorter.sort().reverse());
return files;
} | javascript | {
"resource": ""
} |
q25732 | genAddDependency | train | function genAddDependency(basePath, provideMap, requireMap) {
var provide = provideMap.getAllProvides();
var require = requireMap.getAllRequires();
var set = new Set();
provide.forEach(function(value, key) {
set.add(key);
});
require.forEach(function(value, key) {
set.add(key);
});
var results = [];
set.forEach(function(key) {
var relativeServePath = pathMod.join(
'../../', pathMod.relative(basePath, key));
if (osMod.platform().indexOf('win') != -1) {
// For the case of Windows relativeServePath contains backslashes. Need to
// escape the backward slash, otherwise it will not appear in the deps.js
// file correctly. An alternative would be to convert backslashes to
// forward slashes which works just as fine in the context of a browser.
relativeServePath = relativeServePath.replace(/\\/g, '\\\\');
}
var line = 'goog.addDependency("' + relativeServePath + '", ';
var isModule = false;
if (provide.has(key)) {
var value = /** @type {!Array<string>} */ (provide.get(key));
line += JSON.stringify(value) + ', ';
isModule = provideMap.isModule(key);
} else {
line += '[], ';
}
if (require.has(key)) {
line += JSON.stringify(require.get(key));
} else {
line += '[]';
}
line += isModule ? ', true);' : ');';
results.push(line);
});
return results;
} | javascript | {
"resource": ""
} |
q25733 | genDeps | train | function genDeps(basePath, targets) {
var provideMap = new ProvideMap_();
var requireMap = new RequireMap_();
var files = [];
targets.forEach(function(target) {
files = files.concat(relativeGlob(target));
});
scanFiles(files, provideMap, requireMap);
var results = genAddDependency(basePath, provideMap, requireMap);
return results.join('\n');
} | javascript | {
"resource": ""
} |
q25734 | genModuleDeps | train | function genModuleDeps(scriptPath) {
var provideMap = new ProvideMap_();
var requireMap = new RequireMap_();
scanFiles([scriptPath], provideMap, requireMap);
var dumpValues = function(map) {
var results = [];
map.forEach(function(value, key) {
results = results.concat(value);
});
return results;
};
var relativePath = pathMod.join('../..', scriptPath);
if (osMod.platform().indexOf('win') != -1) {
relativePath = relativePath.replace(/\\/g, '\\\\');
}
var provide = provideMap.getAllProvides();
var require = requireMap.getAllRequires();
return 'goog.addDependency("' + relativePath + '", ' +
JSON.stringify(dumpValues(provide)) + ', ' +
JSON.stringify(dumpValues(require)) + ', true);';
} | javascript | {
"resource": ""
} |
q25735 | train | function(table) {
return table.getEffectiveName() ==
joinStep.predicate.rightColumn.getTable().getEffectiveName() ?
joinStep.predicate.rightColumn : joinStep.predicate.leftColumn;
} | javascript | {
"resource": ""
} | |
q25736 | train | function(executionStep) {
// In order to use and index for implementing a join, the entire relation
// must be fed to the JoinStep, otherwise the index can't be used.
if (!(executionStep instanceof lf.proc.TableAccessFullStep)) {
return null;
}
var candidateColumn = getColumnForTable(executionStep.table);
return goog.isNull(candidateColumn.getIndex()) ? null : candidateColumn;
} | javascript | {
"resource": ""
} | |
q25737 | addSampleData | train | function addSampleData() {
return Promise.all([
insertPersonData('actor.json', db.getSchema().table('Actor')),
insertPersonData('director.json', db.getSchema().table('Director')),
insertData('movie.json', db.getSchema().table('Movie')),
insertData('movieactor.json', db.getSchema().table('MovieActor')),
insertData('moviedirector.json', db.getSchema().table('MovieDirector')),
insertData('moviegenre.json', db.getSchema().table('MovieGenre'))
]).then(function(queries) {
var tx = db.createTransaction();
return tx.exec(queries);
});
} | javascript | {
"resource": ""
} |
q25738 | train | function(original, clone) {
if (goog.isNull(original)) {
return;
}
var cloneFull = original.getChildCount() == clone.getChildCount();
if (cloneFull) {
var cloneIndex = copyParentStack.indexOf(clone);
if (cloneIndex != -1) {
copyParentStack.splice(cloneIndex, 1);
}
}
} | javascript | {
"resource": ""
} | |
q25739 | train | function(coverage) {
return coverage[0] ?
(coverage[1] ? lf.index.Favor.TIE : lf.index.Favor.LHS) :
lf.index.Favor.RHS;
} | javascript | {
"resource": ""
} | |
q25740 | selectAllMovies | train | function selectAllMovies() {
var movie = db.getSchema().table('Movie');
db.select(movie.id, movie.title, movie.year).
from(movie).exec().then(
function(results) {
var elapsed = Date.now() - startTime;
$('#load_time').text(elapsed.toString() + 'ms');
$('#master').bootstrapTable('load', results).
on('click-row.bs.table', function(e, row, $element) {
startTime = Date.now();
generateDetails(row.id);
});
});
} | javascript | {
"resource": ""
} |
q25741 | generateDetails | train | function generateDetails(id) {
var m = db.getSchema().table('Movie');
var ma = db.getSchema().table('MovieActor');
var md = db.getSchema().table('MovieDirector');
var a = db.getSchema().table('Actor');
var d = db.getSchema().table('Director');
var details = {};
var promises = [];
promises.push(
db.select().
from(m).
where(m.id.eq(id)).
exec().
then(function(rows) {
details['title'] = rows[0]['title'];
details['year'] = rows[0]['year'];
details['rating'] = rows[0]['rating'];
details['company'] = rows[0]['company'];
}));
promises.push(
db.select().
from(ma).
innerJoin(a, a.id.eq(ma.actorId)).
where(ma.movieId.eq(id)).
orderBy(a.lastName).
exec().then(function(rows) {
details['actors'] = rows.map(function(row) {
return row['Actor']['lastName'] + ', ' +
row['Actor']['firstName'];
}).join('<br/>');
}));
promises.push(
db.select().
from(md, d).
where(lf.op.and(md.movieId.eq(id), d.id.eq(md.directorId))).
orderBy(d.lastName).
exec().then(function(rows) {
details['directors'] = rows.map(function(row) {
return row['Director']['lastName'] + ', ' +
row['Director']['firstName'];
}).join('<br/>');
}));
Promise.all(promises).then(function() {
displayDetails(details);
});
} | javascript | {
"resource": ""
} |
q25742 | bootstrap | train | function bootstrap(lovefieldBinary) {
// Setting "window" to be Node's global context.
global.window = global;
// Setting "self" to be Node's global context. This must be placed after
// global.window.
global.self = global;
// Setting "document" to a dummy object, even though it is not actually used,
// because it results in a runtime error when using lovefield.min.js.
global.document = {};
vmMod.runInThisContext(fsMod.readFileSync(lovefieldBinary), lovefieldBinary);
} | javascript | {
"resource": ""
} |
q25743 | runSpac | train | function runSpac(schemaFilePath, namespace, outputDir) {
var spacPath = pathMod.resolve(pathMod.join(__dirname, '../spac/spac.js'));
var spac = childProcess.fork(
spacPath,
[
'--schema=' + schemaFilePath,
'--namespace=' + namespace,
'--outputdir=' + outputDir,
'--nocombine=true'
]);
return new Promise(function(resolve, reject) {
spac.on('close', function(code) {
if (code == 0) {
resolve();
} else {
var error = new Error(
'ERROR: unable to generate code from ' + schemaFilePath + '\r\n');
log(error);
reject(error);
}
});
});
} | javascript | {
"resource": ""
} |
q25744 | train | function(col, defaultValue) {
var lhs = ' ' + prefix + '.' + col.getName() + ' = ';
body.push(lhs + (col.isNullable() ? 'null' : defaultValue) + ';');
} | javascript | {
"resource": ""
} | |
q25745 | babelReactResolver$$1 | train | function babelReactResolver$$1(component, props, children) {
return isReactComponent(component) ? React.createElement(component, props, children) : React.createElement(VueContainer, Object.assign({ component: component }, props), children);
} | javascript | {
"resource": ""
} |
q25746 | exposeTemplates | train | function exposeTemplates(req, res, next) {
// Uses the `ExpressHandlebars` instance to get the get the **precompiled**
// templates which will be shared with the client-side of the app.
hbs.getTemplates('shared/templates/', {
cache : app.enabled('view cache'),
precompiled: true
}).then(function (templates) {
// RegExp to remove the ".handlebars" extension from the template names.
var extRegex = new RegExp(hbs.extname + '$');
// Creates an array of templates which are exposed via
// `res.locals.templates`.
templates = Object.keys(templates).map(function (name) {
return {
name : name.replace(extRegex, ''),
template: templates[name]
};
});
// Exposes the templates during view rendering.
if (templates.length) {
res.locals.templates = templates;
}
setImmediate(next);
})
.catch(next);
} | javascript | {
"resource": ""
} |
q25747 | train | function( opacity ) {
if ( this.element[ $.SIGNAL ] && $.Browser.vendor == $.BROWSERS.IE ) {
$.setElementOpacity( this.element, opacity, true );
} else {
$.setElementOpacity( this.wrapper, opacity, true );
}
} | javascript | {
"resource": ""
} | |
q25748 | train | function( viewport ) {
var viewerSize,
newWidth,
newHeight,
bounds,
topleft,
bottomright;
viewerSize = $.getElementSize( this.viewer.element );
if ( this._resizeWithViewer && viewerSize.x && viewerSize.y && !viewerSize.equals( this.oldViewerSize ) ) {
this.oldViewerSize = viewerSize;
if ( this.maintainSizeRatio || !this.elementArea) {
newWidth = viewerSize.x * this.sizeRatio;
newHeight = viewerSize.y * this.sizeRatio;
} else {
newWidth = Math.sqrt(this.elementArea * (viewerSize.x / viewerSize.y));
newHeight = this.elementArea / newWidth;
}
this.element.style.width = Math.round( newWidth ) + 'px';
this.element.style.height = Math.round( newHeight ) + 'px';
if (!this.elementArea) {
this.elementArea = newWidth * newHeight;
}
this.updateSize();
}
if (viewport && this.viewport) {
bounds = viewport.getBoundsNoRotate(true);
topleft = this.viewport.pixelFromPointNoRotate(bounds.getTopLeft(), false);
bottomright = this.viewport.pixelFromPointNoRotate(bounds.getBottomRight(), false)
.minus( this.totalBorderWidths );
//update style for navigator-box
var style = this.displayRegion.style;
style.display = this.world.getItemCount() ? 'block' : 'none';
style.top = Math.round( topleft.y ) + 'px';
style.left = Math.round( topleft.x ) + 'px';
var width = Math.abs( topleft.x - bottomright.x );
var height = Math.abs( topleft.y - bottomright.y );
// make sure width and height are non-negative so IE doesn't throw
style.width = Math.round( Math.max( width, 0 ) ) + 'px';
style.height = Math.round( Math.max( height, 0 ) ) + 'px';
}
} | javascript | {
"resource": ""
} | |
q25749 | train | function(options) {
var _this = this;
var original = options.originalTiledImage;
delete options.original;
var optionsClone = $.extend({}, options, {
success: function(event) {
var myItem = event.item;
myItem._originalForNavigator = original;
_this._matchBounds(myItem, original, true);
function matchBounds() {
_this._matchBounds(myItem, original);
}
function matchOpacity() {
_this._matchOpacity(myItem, original);
}
function matchCompositeOperation() {
_this._matchCompositeOperation(myItem, original);
}
original.addHandler('bounds-change', matchBounds);
original.addHandler('clip-change', matchBounds);
original.addHandler('opacity-change', matchOpacity);
original.addHandler('composite-operation-change', matchCompositeOperation);
}
});
return $.Viewer.prototype.addTiledImage.apply(this, [optionsClone]);
} | javascript | {
"resource": ""
} | |
q25750 | train | function() {
var xUpdated = this._xSpring.update();
var yUpdated = this._ySpring.update();
var scaleUpdated = this._scaleSpring.update();
var degreesUpdated = this._degreesSpring.update();
if (xUpdated || yUpdated || scaleUpdated || degreesUpdated) {
this._updateForScale();
this._needsDraw = true;
return true;
}
return false;
} | javascript | {
"resource": ""
} | |
q25751 | train | function(current) {
return current ?
new $.Rect(
this._xSpring.current.value,
this._ySpring.current.value,
this._worldWidthCurrent,
this._worldHeightCurrent) :
new $.Rect(
this._xSpring.target.value,
this._ySpring.target.value,
this._worldWidthTarget,
this._worldHeightTarget);
} | javascript | {
"resource": ""
} | |
q25752 | train | function(current) {
var bounds = this.getBoundsNoRotate(current);
if (this._clip) {
var worldWidth = current ?
this._worldWidthCurrent : this._worldWidthTarget;
var ratio = worldWidth / this.source.dimensions.x;
var clip = this._clip.times(ratio);
bounds = new $.Rect(
bounds.x + clip.x,
bounds.y + clip.y,
clip.width,
clip.height);
}
return bounds.rotate(this.getRotation(current), this._getRotationPoint(current));
} | javascript | {
"resource": ""
} | |
q25753 | train | function( pixel ) {
var viewerCoordinates = pixel.minus(
OpenSeadragon.getElementPosition( this.viewer.element ));
return this.viewerElementToImageCoordinates( viewerCoordinates );
} | javascript | {
"resource": ""
} | |
q25754 | train | function( pixel ) {
var viewerCoordinates = this.imageToViewerElementCoordinates( pixel );
return viewerCoordinates.plus(
OpenSeadragon.getElementPosition( this.viewer.element ));
} | javascript | {
"resource": ""
} | |
q25755 | train | function(position, immediately) {
var sameTarget = (this._xSpring.target.value === position.x &&
this._ySpring.target.value === position.y);
if (immediately) {
if (sameTarget && this._xSpring.current.value === position.x &&
this._ySpring.current.value === position.y) {
return;
}
this._xSpring.resetTo(position.x);
this._ySpring.resetTo(position.y);
this._needsDraw = true;
} else {
if (sameTarget) {
return;
}
this._xSpring.springTo(position.x);
this._ySpring.springTo(position.y);
this._needsDraw = true;
}
if (!sameTarget) {
this._raiseBoundsChange();
}
} | javascript | {
"resource": ""
} | |
q25756 | train | function(degrees, immediately) {
if (this._degreesSpring.target.value === degrees &&
this._degreesSpring.isAtTargetValue()) {
return;
}
if (immediately) {
this._degreesSpring.resetTo(degrees);
} else {
this._degreesSpring.springTo(degrees);
}
this._needsDraw = true;
this._raiseBoundsChange();
} | javascript | {
"resource": ""
} | |
q25757 | train | function( opacity ) {
$.console.error("drawer.setOpacity is deprecated. Use tiledImage.setOpacity instead.");
var world = this.viewer.world;
for (var i = 0; i < world.getItemCount(); i++) {
world.getItemAt( i ).setOpacity( opacity );
}
return this;
} | javascript | {
"resource": ""
} | |
q25758 | train | function() {
$.console.error("drawer.getOpacity is deprecated. Use tiledImage.getOpacity instead.");
var world = this.viewer.world;
var maxOpacity = 0;
for (var i = 0; i < world.getItemCount(); i++) {
var opacity = world.getItemAt( i ).getOpacity();
if ( opacity > maxOpacity ) {
maxOpacity = opacity;
}
}
return maxOpacity;
} | javascript | {
"resource": ""
} | |
q25759 | train | function() {
this.canvas.innerHTML = "";
if ( this.useCanvas ) {
var viewportSize = this._calculateCanvasSize();
if( this.canvas.width != viewportSize.x ||
this.canvas.height != viewportSize.y ) {
this.canvas.width = viewportSize.x;
this.canvas.height = viewportSize.y;
this._updateImageSmoothingEnabled(this.context);
if ( this.sketchCanvas !== null ) {
var sketchCanvasSize = this._calculateSketchCanvasSize();
this.sketchCanvas.width = sketchCanvasSize.x;
this.sketchCanvas.height = sketchCanvasSize.y;
this._updateImageSmoothingEnabled(this.sketchContext);
}
}
this._clear();
}
} | javascript | {
"resource": ""
} | |
q25760 | train | function(tile, drawingHandler, useSketch, scale, translate) {
$.console.assert(tile, '[Drawer.drawTile] tile is required');
$.console.assert(drawingHandler, '[Drawer.drawTile] drawingHandler is required');
if (this.useCanvas) {
var context = this._getContext(useSketch);
scale = scale || 1;
tile.drawCanvas(context, drawingHandler, scale, translate);
} else {
tile.drawHTML( this.canvas );
}
} | javascript | {
"resource": ""
} | |
q25761 | train | function(opacity, scale, translate, compositeOperation) {
var options = opacity;
if (!$.isPlainObject(options)) {
options = {
opacity: opacity,
scale: scale,
translate: translate,
compositeOperation: compositeOperation
};
}
if (!this.useCanvas || !this.sketchCanvas) {
return;
}
opacity = options.opacity;
compositeOperation = options.compositeOperation;
var bounds = options.bounds;
this.context.save();
this.context.globalAlpha = opacity;
if (compositeOperation) {
this.context.globalCompositeOperation = compositeOperation;
}
if (bounds) {
// Internet Explorer, Microsoft Edge, and Safari have problems
// when you call context.drawImage with negative x or y
// or x + width or y + height greater than the canvas width or height respectively.
if (bounds.x < 0) {
bounds.width += bounds.x;
bounds.x = 0;
}
if (bounds.x + bounds.width > this.canvas.width) {
bounds.width = this.canvas.width - bounds.x;
}
if (bounds.y < 0) {
bounds.height += bounds.y;
bounds.y = 0;
}
if (bounds.y + bounds.height > this.canvas.height) {
bounds.height = this.canvas.height - bounds.y;
}
this.context.drawImage(
this.sketchCanvas,
bounds.x,
bounds.y,
bounds.width,
bounds.height,
bounds.x,
bounds.y,
bounds.width,
bounds.height
);
} else {
scale = options.scale || 1;
translate = options.translate;
var position = translate instanceof $.Point ?
translate : new $.Point(0, 0);
var widthExt = 0;
var heightExt = 0;
if (translate) {
var widthDiff = this.sketchCanvas.width - this.canvas.width;
var heightDiff = this.sketchCanvas.height - this.canvas.height;
widthExt = Math.round(widthDiff / 2);
heightExt = Math.round(heightDiff / 2);
}
this.context.drawImage(
this.sketchCanvas,
position.x - widthExt * scale,
position.y - heightExt * scale,
(this.canvas.width + 2 * widthExt) * scale,
(this.canvas.height + 2 * heightExt) * scale,
-widthExt,
-heightExt,
this.canvas.width + 2 * widthExt,
this.canvas.height + 2 * heightExt
);
}
this.context.restore();
} | javascript | {
"resource": ""
} | |
q25762 | train | function(sketch) {
var canvas = this._getContext(sketch).canvas;
return new $.Point(canvas.width, canvas.height);
} | javascript | {
"resource": ""
} | |
q25763 | processResponse | train | function processResponse( xhr ){
var responseText = xhr.responseText,
status = xhr.status,
statusText,
data;
if ( !xhr ) {
throw new Error( $.getString( "Errors.Security" ) );
} else if ( xhr.status !== 200 && xhr.status !== 0 ) {
status = xhr.status;
statusText = ( status == 404 ) ?
"Not Found" :
xhr.statusText;
throw new Error( $.getString( "Errors.Status", status, statusText ) );
}
if( responseText.match(/\s*<.*/) ){
try{
data = ( xhr.responseXML && xhr.responseXML.documentElement ) ?
xhr.responseXML :
$.parseXml( responseText );
} catch (e){
data = xhr.responseText;
}
}else if( responseText.match(/\s*[\{\[].*/) ){
try{
data = $.parseJSON(responseText);
} catch(e){
data = responseText;
}
}else{
data = responseText;
}
return data;
} | javascript | {
"resource": ""
} |
q25764 | train | function( options ) {
$.console.assert( options, "[TileCache.cacheTile] options is required" );
$.console.assert( options.tile, "[TileCache.cacheTile] options.tile is required" );
$.console.assert( options.tile.cacheKey, "[TileCache.cacheTile] options.tile.cacheKey is required" );
$.console.assert( options.tiledImage, "[TileCache.cacheTile] options.tiledImage is required" );
var cutoff = options.cutoff || 0;
var insertionIndex = this._tilesLoaded.length;
var imageRecord = this._imagesLoaded[options.tile.cacheKey];
if (!imageRecord) {
$.console.assert( options.image, "[TileCache.cacheTile] options.image is required to create an ImageRecord" );
imageRecord = this._imagesLoaded[options.tile.cacheKey] = new ImageRecord({
image: options.image
});
this._imagesLoadedCount++;
}
imageRecord.addTile(options.tile);
options.tile.cacheImageRecord = imageRecord;
// Note that just because we're unloading a tile doesn't necessarily mean
// we're unloading an image. With repeated calls it should sort itself out, though.
if ( this._imagesLoadedCount > this._maxImageCacheCount ) {
var worstTile = null;
var worstTileIndex = -1;
var worstTileRecord = null;
var prevTile, worstTime, worstLevel, prevTime, prevLevel, prevTileRecord;
for ( var i = this._tilesLoaded.length - 1; i >= 0; i-- ) {
prevTileRecord = this._tilesLoaded[ i ];
prevTile = prevTileRecord.tile;
if ( prevTile.level <= cutoff || prevTile.beingDrawn ) {
continue;
} else if ( !worstTile ) {
worstTile = prevTile;
worstTileIndex = i;
worstTileRecord = prevTileRecord;
continue;
}
prevTime = prevTile.lastTouchTime;
worstTime = worstTile.lastTouchTime;
prevLevel = prevTile.level;
worstLevel = worstTile.level;
if ( prevTime < worstTime ||
( prevTime == worstTime && prevLevel > worstLevel ) ) {
worstTile = prevTile;
worstTileIndex = i;
worstTileRecord = prevTileRecord;
}
}
if ( worstTile && worstTileIndex >= 0 ) {
this._unloadTile(worstTileRecord);
insertionIndex = worstTileIndex;
}
}
this._tilesLoaded[ insertionIndex ] = new TileRecord({
tile: options.tile,
tiledImage: options.tiledImage
});
} | javascript | {
"resource": ""
} | |
q25765 | train | function( tiledImage ) {
$.console.assert(tiledImage, '[TileCache.clearTilesFor] tiledImage is required');
var tileRecord;
for ( var i = 0; i < this._tilesLoaded.length; ++i ) {
tileRecord = this._tilesLoaded[ i ];
if ( tileRecord.tiledImage === tiledImage ) {
this._unloadTile(tileRecord);
this._tilesLoaded.splice( i, 1 );
i--;
}
}
} | javascript | {
"resource": ""
} | |
q25766 | train | function( object, method ) {
return function(){
var args = arguments;
if ( args === undefined ){
args = [];
}
return method.apply( object, args );
};
} | javascript | {
"resource": ""
} | |
q25767 | train | function( element ) {
var result = new $.Point(),
isFixed,
offsetParent;
element = $.getElement( element );
isFixed = $.getElementStyle( element ).position == "fixed";
offsetParent = getOffsetParent( element, isFixed );
while ( offsetParent ) {
result.x += element.offsetLeft;
result.y += element.offsetTop;
if ( isFixed ) {
result = result.plus( $.getPageScroll() );
}
element = offsetParent;
isFixed = $.getElementStyle( element ).position == "fixed";
offsetParent = getOffsetParent( element, isFixed );
}
return result;
} | javascript | {
"resource": ""
} | |
q25768 | train | function(property) {
var memo = {};
$.getCssPropertyWithVendorPrefix = function(property) {
if (memo[property] !== undefined) {
return memo[property];
}
var style = document.createElement('div').style;
var result = null;
if (style[property] !== undefined) {
result = property;
} else {
var prefixes = ['Webkit', 'Moz', 'MS', 'O',
'webkit', 'moz', 'ms', 'o'];
var suffix = $.capitalizeFirstLetter(property);
for (var i = 0; i < prefixes.length; i++) {
var prop = prefixes[i] + suffix;
if (style[prop] !== undefined) {
result = prop;
break;
}
}
}
memo[property] = result;
return result;
};
return $.getCssPropertyWithVendorPrefix(property);
} | javascript | {
"resource": ""
} | |
q25769 | train | function( event ) {
if( event ){
$.getEvent = function( event ) {
return event;
};
} else {
$.getEvent = function() {
return window.event;
};
}
return $.getEvent( event );
} | javascript | {
"resource": ""
} | |
q25770 | train | function( event ) {
if ( typeof ( event.pageX ) == "number" ) {
$.getMousePosition = function( event ){
var result = new $.Point();
event = $.getEvent( event );
result.x = event.pageX;
result.y = event.pageY;
return result;
};
} else if ( typeof ( event.clientX ) == "number" ) {
$.getMousePosition = function( event ){
var result = new $.Point();
event = $.getEvent( event );
result.x =
event.clientX +
document.body.scrollLeft +
document.documentElement.scrollLeft;
result.y =
event.clientY +
document.body.scrollTop +
document.documentElement.scrollTop;
return result;
};
} else {
throw new Error(
"Unknown event mouse position, no known technique."
);
}
return $.getMousePosition( event );
} | javascript | {
"resource": ""
} | |
q25771 | train | function() {
var docElement = document.documentElement || {},
body = document.body || {};
if ( typeof ( window.pageXOffset ) == "number" ) {
$.getPageScroll = function(){
return new $.Point(
window.pageXOffset,
window.pageYOffset
);
};
} else if ( body.scrollLeft || body.scrollTop ) {
$.getPageScroll = function(){
return new $.Point(
document.body.scrollLeft,
document.body.scrollTop
);
};
} else if ( docElement.scrollLeft || docElement.scrollTop ) {
$.getPageScroll = function(){
return new $.Point(
document.documentElement.scrollLeft,
document.documentElement.scrollTop
);
};
} else {
// We can't reassign the function yet, as there was no scroll.
return new $.Point(0, 0);
}
return $.getPageScroll();
} | javascript | {
"resource": ""
} | |
q25772 | train | function( scroll ) {
if ( typeof ( window.scrollTo ) !== "undefined" ) {
$.setPageScroll = function( scroll ) {
window.scrollTo( scroll.x, scroll.y );
};
} else {
var originalScroll = $.getPageScroll();
if ( originalScroll.x === scroll.x &&
originalScroll.y === scroll.y ) {
// We are already correctly positioned and there
// is no way to detect the correct method.
return;
}
document.body.scrollLeft = scroll.x;
document.body.scrollTop = scroll.y;
var currentScroll = $.getPageScroll();
if ( currentScroll.x !== originalScroll.x &&
currentScroll.y !== originalScroll.y ) {
$.setPageScroll = function( scroll ) {
document.body.scrollLeft = scroll.x;
document.body.scrollTop = scroll.y;
};
return;
}
document.documentElement.scrollLeft = scroll.x;
document.documentElement.scrollTop = scroll.y;
currentScroll = $.getPageScroll();
if ( currentScroll.x !== originalScroll.x &&
currentScroll.y !== originalScroll.y ) {
$.setPageScroll = function( scroll ) {
document.documentElement.scrollLeft = scroll.x;
document.documentElement.scrollTop = scroll.y;
};
return;
}
// We can't find anything working, so we do nothing.
$.setPageScroll = function( scroll ) {
};
}
return $.setPageScroll( scroll );
} | javascript | {
"resource": ""
} | |
q25773 | train | function() {
var docElement = document.documentElement || {},
body = document.body || {};
if ( typeof ( window.innerWidth ) == 'number' ) {
$.getWindowSize = function(){
return new $.Point(
window.innerWidth,
window.innerHeight
);
};
} else if ( docElement.clientWidth || docElement.clientHeight ) {
$.getWindowSize = function(){
return new $.Point(
document.documentElement.clientWidth,
document.documentElement.clientHeight
);
};
} else if ( body.clientWidth || body.clientHeight ) {
$.getWindowSize = function(){
return new $.Point(
document.body.clientWidth,
document.body.clientHeight
);
};
} else {
throw new Error("Unknown window size, no known technique.");
}
return $.getWindowSize();
} | javascript | {
"resource": ""
} | |
q25774 | train | function( element ) {
// Convert a possible ID to an actual HTMLElement
element = $.getElement( element );
/*
CSS tables require you to have a display:table/row/cell hierarchy so we need to create
three nested wrapper divs:
*/
var wrappers = [
$.makeNeutralElement( 'div' ),
$.makeNeutralElement( 'div' ),
$.makeNeutralElement( 'div' )
];
// It feels like we should be able to pass style dicts to makeNeutralElement:
$.extend(wrappers[0].style, {
display: "table",
height: "100%",
width: "100%"
});
$.extend(wrappers[1].style, {
display: "table-row"
});
$.extend(wrappers[2].style, {
display: "table-cell",
verticalAlign: "middle",
textAlign: "center"
});
wrappers[0].appendChild(wrappers[1]);
wrappers[1].appendChild(wrappers[2]);
wrappers[2].appendChild(element);
return wrappers[0];
} | javascript | {
"resource": ""
} | |
q25775 | train | function( tagName ) {
var element = document.createElement( tagName ),
style = element.style;
style.background = "transparent none";
style.border = "none";
style.margin = "0px";
style.padding = "0px";
style.position = "static";
return element;
} | javascript | {
"resource": ""
} | |
q25776 | train | function( src ) {
$.makeTransparentImage = function( src ){
var img = $.makeNeutralElement( "img" );
img.src = src;
return img;
};
if ( $.Browser.vendor == $.BROWSERS.IE && $.Browser.version < 7 ) {
$.makeTransparentImage = function( src ){
var img = $.makeNeutralElement( "img" ),
element = null;
element = $.makeNeutralElement("span");
element.style.display = "inline-block";
img.onload = function() {
element.style.width = element.style.width || img.width + "px";
element.style.height = element.style.height || img.height + "px";
img.onload = null;
img = null; // to prevent memory leaks in IE
};
img.src = src;
element.style.filter =
"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" +
src +
"', sizingMethod='scale')";
return element;
};
}
return $.makeTransparentImage( src );
} | javascript | {
"resource": ""
} | |
q25777 | train | function( element, opacity, usesAlpha ) {
var ieOpacity,
ieFilter;
element = $.getElement( element );
if ( usesAlpha && !$.Browser.alpha ) {
opacity = Math.round( opacity );
}
if ( $.Browser.opacity ) {
element.style.opacity = opacity < 1 ? opacity : "";
} else {
if ( opacity < 1 ) {
ieOpacity = Math.round( 100 * opacity );
ieFilter = "alpha(opacity=" + ieOpacity + ")";
element.style.filter = ieFilter;
} else {
element.style.filter = "";
}
}
} | javascript | {
"resource": ""
} | |
q25778 | train | function( element ) {
element = $.getElement( element );
if ( typeof element.style.touchAction !== 'undefined' ) {
element.style.touchAction = 'none';
} else if ( typeof element.style.msTouchAction !== 'undefined' ) {
element.style.msTouchAction = 'none';
}
} | javascript | {
"resource": ""
} | |
q25779 | train | function( element, className ) {
element = $.getElement( element );
if (!element.className) {
element.className = className;
} else if ( ( ' ' + element.className + ' ' ).
indexOf( ' ' + className + ' ' ) === -1 ) {
element.className += ' ' + className;
}
} | javascript | {
"resource": ""
} | |
q25780 | train | function( array, searchElement, fromIndex ) {
if ( Array.prototype.indexOf ) {
this.indexOf = function( array, searchElement, fromIndex ) {
return array.indexOf( searchElement, fromIndex );
};
} else {
this.indexOf = function( array, searchElement, fromIndex ) {
var i,
pivot = ( fromIndex ) ? fromIndex : 0,
length;
if ( !array ) {
throw new TypeError( );
}
length = array.length;
if ( length === 0 || pivot >= length ) {
return -1;
}
if ( pivot < 0 ) {
pivot = length - Math.abs( pivot );
}
for ( i = pivot; i < length; i++ ) {
if ( array[i] === searchElement ) {
return i;
}
}
return -1;
};
}
return this.indexOf( array, searchElement, fromIndex );
} | javascript | {
"resource": ""
} | |
q25781 | train | function( element, className ) {
var oldClasses,
newClasses = [],
i;
element = $.getElement( element );
oldClasses = element.className.split( /\s+/ );
for ( i = 0; i < oldClasses.length; i++ ) {
if ( oldClasses[ i ] && oldClasses[ i ] !== className ) {
newClasses.push( oldClasses[ i ] );
}
}
element.className = newClasses.join(' ');
} | javascript | {
"resource": ""
} | |
q25782 | train | function( event ) {
event = $.getEvent( event );
if ( event.preventDefault ) {
$.cancelEvent = function( event ){
// W3C for preventing default
event.preventDefault();
};
} else {
$.cancelEvent = function( event ){
event = $.getEvent( event );
// legacy for preventing default
event.cancel = true;
// IE for preventing default
event.returnValue = false;
};
}
$.cancelEvent( event );
} | javascript | {
"resource": ""
} | |
q25783 | train | function( event ) {
event = $.getEvent( event );
if ( event.stopPropagation ) {
// W3C for stopping propagation
$.stopEvent = function( event ){
event.stopPropagation();
};
} else {
// IE for stopping propagation
$.stopEvent = function( event ){
event = $.getEvent( event );
event.cancelBubble = true;
};
}
$.stopEvent( event );
} | javascript | {
"resource": ""
} | |
q25784 | train | function( object, method ) {
//TODO: This pattern is painful to use and debug. It's much cleaner
// to use pinning plus anonymous functions. Get rid of this
// pattern!
var initialArgs = [],
i;
for ( i = 2; i < arguments.length; i++ ) {
initialArgs.push( arguments[ i ] );
}
return function() {
var args = initialArgs.concat( [] ),
i;
for ( i = 0; i < arguments.length; i++ ) {
args.push( arguments[ i ] );
}
return method.apply( object, args );
};
} | javascript | {
"resource": ""
} | |
q25785 | train | function( url ) {
var match = url.match(/^([a-z]+:)\/\//i);
if ( match === null ) {
// Relative URL, retrive the protocol from window.location
return window.location.protocol;
}
return match[1].toLowerCase();
} | javascript | {
"resource": ""
} | |
q25786 | train | function( local ) {
// IE11 does not support window.ActiveXObject so we just try to
// create one to see if it is supported.
// See: http://msdn.microsoft.com/en-us/library/ie/dn423948%28v=vs.85%29.aspx
var supportActiveX;
try {
/* global ActiveXObject:true */
supportActiveX = !!new ActiveXObject( "Microsoft.XMLHTTP" );
} catch( e ) {
supportActiveX = false;
}
if ( supportActiveX ) {
if ( window.XMLHttpRequest ) {
$.createAjaxRequest = function( local ) {
if ( local ) {
return new ActiveXObject( "Microsoft.XMLHTTP" );
}
return new XMLHttpRequest();
};
} else {
$.createAjaxRequest = function() {
return new ActiveXObject( "Microsoft.XMLHTTP" );
};
}
} else if ( window.XMLHttpRequest ) {
$.createAjaxRequest = function() {
return new XMLHttpRequest();
};
} else {
throw new Error( "Browser doesn't support XMLHttpRequest." );
}
return $.createAjaxRequest( local );
} | javascript | {
"resource": ""
} | |
q25787 | train | function( options ){
var script,
url = options.url,
head = document.head ||
document.getElementsByTagName( "head" )[ 0 ] ||
document.documentElement,
jsonpCallback = options.callbackName || 'openseadragon' + $.now(),
previous = window[ jsonpCallback ],
replace = "$1" + jsonpCallback + "$2",
callbackParam = options.param || 'callback',
callback = options.callback;
url = url.replace( /(\=)\?(&|$)|\?\?/i, replace );
// Add callback manually
url += (/\?/.test( url ) ? "&" : "?") + callbackParam + "=" + jsonpCallback;
// Install callback
window[ jsonpCallback ] = function( response ) {
if ( !previous ){
try{
delete window[ jsonpCallback ];
}catch(e){
//swallow
}
} else {
window[ jsonpCallback ] = previous;
}
if( callback && $.isFunction( callback ) ){
callback( response );
}
};
script = document.createElement( "script" );
//TODO: having an issue with async info requests
if( undefined !== options.async || false !== options.async ){
script.async = "async";
}
if ( options.scriptCharset ) {
script.charset = options.scriptCharset;
}
script.src = url;
// Attach handlers for all browsers
script.onload = script.onreadystatechange = function( _, isAbort ) {
if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {
// Handle memory leak in IE
script.onload = script.onreadystatechange = null;
// Remove the script
if ( head && script.parentNode ) {
head.removeChild( script );
}
// Dereference the script
script = undefined;
}
};
// Use insertBefore instead of appendChild to circumvent an IE6 bug.
// This arises when a base node is used (#2709 and #4378).
head.insertBefore( script, head.firstChild );
} | javascript | {
"resource": ""
} | |
q25788 | train | function( string ) {
if ( window.DOMParser ) {
$.parseXml = function( string ) {
var xmlDoc = null,
parser;
parser = new DOMParser();
xmlDoc = parser.parseFromString( string, "text/xml" );
return xmlDoc;
};
} else if ( window.ActiveXObject ) {
$.parseXml = function( string ) {
var xmlDoc = null;
xmlDoc = new ActiveXObject( "Microsoft.XMLDOM" );
xmlDoc.async = false;
xmlDoc.loadXML( string );
return xmlDoc;
};
} else {
throw new Error( "Browser doesn't support XML DOM." );
}
return $.parseXml( string );
} | javascript | {
"resource": ""
} | |
q25789 | train | function(string) {
if (window.JSON && window.JSON.parse) {
$.parseJSON = window.JSON.parse;
} else {
// Should only be used by IE8 in non standards mode
$.parseJSON = function(string) {
/*jshint evil:true*/
//eslint-disable-next-line no-eval
return eval('(' + string + ')');
};
}
return $.parseJSON(string);
} | javascript | {
"resource": ""
} | |
q25790 | train | function(other) {
return (other instanceof $.Rect) &&
this.x === other.x &&
this.y === other.y &&
this.width === other.width &&
this.height === other.height &&
this.degrees === other.degrees;
} | javascript | {
"resource": ""
} | |
q25791 | train | function(rect) {
var thisBoundingBox = this.getBoundingBox();
var otherBoundingBox = rect.getBoundingBox();
var left = Math.min(thisBoundingBox.x, otherBoundingBox.x);
var top = Math.min(thisBoundingBox.y, otherBoundingBox.y);
var right = Math.max(
thisBoundingBox.x + thisBoundingBox.width,
otherBoundingBox.x + otherBoundingBox.width);
var bottom = Math.max(
thisBoundingBox.y + thisBoundingBox.height,
otherBoundingBox.y + otherBoundingBox.height);
return new $.Rect(
left,
top,
right - left,
bottom - top);
} | javascript | {
"resource": ""
} | |
q25792 | train | function(degrees, pivot) {
degrees = $.positiveModulo(degrees, 360);
if (degrees === 0) {
return this.clone();
}
pivot = pivot || this.getCenter();
var newTopLeft = this.getTopLeft().rotate(degrees, pivot);
var newTopRight = this.getTopRight().rotate(degrees, pivot);
var diff = newTopRight.minus(newTopLeft);
// Handle floating point error
diff = diff.apply(function(x) {
var EPSILON = 1e-15;
return Math.abs(x) < EPSILON ? 0 : x;
});
var radians = Math.atan(diff.y / diff.x);
if (diff.x < 0) {
radians += Math.PI;
} else if (diff.y < 0) {
radians += 2 * Math.PI;
}
return new $.Rect(
newTopLeft.x,
newTopLeft.y,
this.width,
this.height,
radians / Math.PI * 180);
} | javascript | {
"resource": ""
} | |
q25793 | train | function() {
return "[" +
(Math.round(this.x * 100) / 100) + ", " +
(Math.round(this.y * 100) / 100) + ", " +
(Math.round(this.width * 100) / 100) + "x" +
(Math.round(this.height * 100) / 100) + ", " +
(Math.round(this.degrees * 100) / 100) + "deg" +
"]";
} | javascript | {
"resource": ""
} | |
q25794 | filterFiles | train | function filterFiles( files ){
var filtered = [],
file,
i;
for( i = 0; i < files.length; i++ ){
file = files[ i ];
if( file.height &&
file.width &&
file.url ){
//This is sufficient to serve as a level
filtered.push({
url: file.url,
width: Number( file.width ),
height: Number( file.height )
});
}
else {
$.console.error( 'Unsupported image format: %s', file.url ? file.url : '<no URL>' );
}
}
return filtered.sort(function(a, b) {
return a.height - b.height;
});
} | javascript | {
"resource": ""
} |
q25795 | train | function( ) {
if ( !THIS[ this.hash ] ) {
//this viewer has already been destroyed: returning immediately
return;
}
this.close();
this.clearOverlays();
this.overlaysContainer.innerHTML = "";
//TODO: implement this...
//this.unbindSequenceControls()
//this.unbindStandardControls()
if (this.referenceStrip) {
this.referenceStrip.destroy();
this.referenceStrip = null;
}
if ( this._updateRequestId !== null ) {
$.cancelAnimationFrame( this._updateRequestId );
this._updateRequestId = null;
}
if ( this.drawer ) {
this.drawer.destroy();
}
this.removeAllHandlers();
// Go through top element (passed to us) and remove all children
// Use removeChild to make sure it handles SVG or any non-html
// also it performs better - http://jsperf.com/innerhtml-vs-removechild/15
if (this.element){
while (this.element.firstChild) {
this.element.removeChild(this.element.firstChild);
}
}
// destroy the mouse trackers
if (this.innerTracker){
this.innerTracker.destroy();
}
if (this.outerTracker){
this.outerTracker.destroy();
}
THIS[ this.hash ] = null;
delete THIS[ this.hash ];
// clear all our references to dom objects
this.canvas = null;
this.container = null;
// clear our reference to the main element - they will need to pass it in again, creating a new viewer
this.element = null;
} | javascript | {
"resource": ""
} | |
q25796 | train | function(debugMode){
for (var i = 0; i < this.world.getItemCount(); i++) {
this.world.getItemAt(i).debugMode = debugMode;
}
this.debugMode = debugMode;
this.forceRedraw();
} | javascript | {
"resource": ""
} | |
q25797 | train | function( fullScreen ) {
var _this = this;
if ( !$.supportsFullScreen ) {
return this.setFullPage( fullScreen );
}
if ( $.isFullScreen() === fullScreen ) {
return this;
}
var fullScreeEventArgs = {
fullScreen: fullScreen,
preventDefaultAction: false
};
/**
* Raised when the viewer is about to change to/from full-screen mode (see {@link OpenSeadragon.Viewer#setFullScreen}).
* Note: the pre-full-screen event is not raised when the user is exiting
* full-screen mode by pressing the Esc key. In that case, consider using
* the full-screen, pre-full-page or full-page events.
*
* @event pre-full-screen
* @memberof OpenSeadragon.Viewer
* @type {object}
* @property {OpenSeadragon.Viewer} eventSource - A reference to the Viewer which raised the event.
* @property {Boolean} fullScreen - True if entering full-screen mode, false if exiting full-screen mode.
* @property {Boolean} preventDefaultAction - Set to true to prevent full-screen mode change. Default: false.
* @property {?Object} userData - Arbitrary subscriber-defined object.
*/
this.raiseEvent( 'pre-full-screen', fullScreeEventArgs );
if ( fullScreeEventArgs.preventDefaultAction ) {
return this;
}
if ( fullScreen ) {
this.setFullPage( true );
// If the full page mode is not actually entered, we need to prevent
// the full screen mode.
if ( !this.isFullPage() ) {
return this;
}
this.fullPageStyleWidth = this.element.style.width;
this.fullPageStyleHeight = this.element.style.height;
this.element.style.width = '100%';
this.element.style.height = '100%';
var onFullScreenChange = function() {
var isFullScreen = $.isFullScreen();
if ( !isFullScreen ) {
$.removeEvent( document, $.fullScreenEventName, onFullScreenChange );
$.removeEvent( document, $.fullScreenErrorEventName, onFullScreenChange );
_this.setFullPage( false );
if ( _this.isFullPage() ) {
_this.element.style.width = _this.fullPageStyleWidth;
_this.element.style.height = _this.fullPageStyleHeight;
}
}
if ( _this.navigator && _this.viewport ) {
//09/08/2018 - Fabroh : Fix issue #1504 : Ensure to get the navigator updated on fullscreen out with custom location with a timeout
setTimeout(function(){
_this.navigator.update( _this.viewport );
});
}
/**
* Raised when the viewer has changed to/from full-screen mode (see {@link OpenSeadragon.Viewer#setFullScreen}).
*
* @event full-screen
* @memberof OpenSeadragon.Viewer
* @type {object}
* @property {OpenSeadragon.Viewer} eventSource - A reference to the Viewer which raised the event.
* @property {Boolean} fullScreen - True if changed to full-screen mode, false if exited full-screen mode.
* @property {?Object} userData - Arbitrary subscriber-defined object.
*/
_this.raiseEvent( 'full-screen', { fullScreen: isFullScreen } );
};
$.addEvent( document, $.fullScreenEventName, onFullScreenChange );
$.addEvent( document, $.fullScreenErrorEventName, onFullScreenChange );
$.requestFullScreen( document.body );
} else {
$.exitFullScreen();
}
return this;
} | javascript | {
"resource": ""
} | |
q25798 | train | function( element, location, placement, onDraw ) {
var options;
if( $.isPlainObject( element ) ){
options = element;
} else {
options = {
element: element,
location: location,
placement: placement,
onDraw: onDraw
};
}
element = $.getElement( options.element );
if ( getOverlayIndex( this.currentOverlays, element ) >= 0 ) {
// they're trying to add a duplicate overlay
return this;
}
var overlay = getOverlayObject( this, options);
this.currentOverlays.push(overlay);
overlay.drawHTML( this.overlaysContainer, this.viewport );
/**
* Raised when an overlay is added to the viewer (see {@link OpenSeadragon.Viewer#addOverlay}).
*
* @event add-overlay
* @memberof OpenSeadragon.Viewer
* @type {object}
* @property {OpenSeadragon.Viewer} eventSource - A reference to the Viewer which raised the event.
* @property {Element} element - The overlay element.
* @property {OpenSeadragon.Point|OpenSeadragon.Rect} location
* @property {OpenSeadragon.Placement} placement
* @property {?Object} userData - Arbitrary subscriber-defined object.
*/
this.raiseEvent( 'add-overlay', {
element: element,
location: options.location,
placement: options.placement
});
return this;
} | javascript | {
"resource": ""
} | |
q25799 | train | function( element, location, placement ) {
var i;
element = $.getElement( element );
i = getOverlayIndex( this.currentOverlays, element );
if ( i >= 0 ) {
this.currentOverlays[ i ].update( location, placement );
THIS[ this.hash ].forceRedraw = true;
/**
* Raised when an overlay's location or placement changes
* (see {@link OpenSeadragon.Viewer#updateOverlay}).
*
* @event update-overlay
* @memberof OpenSeadragon.Viewer
* @type {object}
* @property {OpenSeadragon.Viewer} eventSource - A reference to the
* Viewer which raised the event.
* @property {Element} element
* @property {OpenSeadragon.Point|OpenSeadragon.Rect} location
* @property {OpenSeadragon.Placement} placement
* @property {?Object} userData - Arbitrary subscriber-defined object.
*/
this.raiseEvent( 'update-overlay', {
element: element,
location: location,
placement: placement
});
}
return this;
} | javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.