_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... | 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 + "({",
fo... | 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.lengt... | 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;
}
// cons... | 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... | 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'));
... | 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... | 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... | 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} ... | 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]... | 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
... | 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')) {
... | 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;
... | 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... | 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))
... | 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)
},
... | 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 ... | 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,
... | 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... | 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))... | 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 requireme... | 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... | 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
... | 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(getUserC... | 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'... | 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... | 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 + ' fai... | 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... | 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(... | 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... | 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, provideM... | 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 re... | 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(execution... | 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'))... | 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('l... | 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(
d... | 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,
//... | 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,
'--nocombin... | 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
}).t... | 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.ol... | 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;
... | 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._updateForS... | 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,
... | 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);
... | 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 === pos... | 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);... | 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 >... | 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;
... | 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);
... | javascript | {
"resource": ""
} | |
q25761 | train | function(opacity, scale, translate, compositeOperation) {
var options = opacity;
if (!$.isPlainObject(options)) {
options = {
opacity: opacity,
scale: scale,
translate: translate,
compositeOperation: compositeOperation
... | 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;
... | 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" );
$.cons... | 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 ) {
... | 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 );
... | 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 resul... | 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;
... | javascript | {
"resource": ""
} | |
q25771 | train | function() {
var docElement = document.documentElement || {},
body = document.body || {};
if ( typeof ( window.pageXOffset ) == "number" ) {
$.getPageScroll = function(){
return new $.Point(
window.pageXOffset,
... | 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 ( orig... | javascript | {
"resource": ""
} | |
q25773 | train | function() {
var docElement = document.documentElement || {},
body = document.body || {};
if ( typeof ( window.innerWidth ) == 'number' ) {
$.getWindowSize = function(){
return new $.Point(
window.innerWidth,
... | 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:
*/
... | 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 ... | 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 ) {
$.makeTransparen... | 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 ) {
eleme... | 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 = 'non... | 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 +... | 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( a... | 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 ] && oldC... | javascript | {
"resource": ""
} | |
q25782 | train | function( event ) {
event = $.getEvent( event );
if ( event.preventDefault ) {
$.cancelEvent = function( event ){
// W3C for preventing default
event.preventDefault();
};
} else {
$.cancelEvent =... | javascript | {
"resource": ""
} | |
q25783 | train | function( event ) {
event = $.getEvent( event );
if ( event.stopPropagation ) {
// W3C for stopping propagation
$.stopEvent = function( event ){
event.stopPropagation();
};
} else {
// IE for stoppin... | 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++... | 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 Activ... | 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... | 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" );
... | 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*/
/... | 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 ... | 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,... | 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({
... | 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.unbindSequenc... | 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,
... | 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: on... | 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;
... | javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.