repo
stringlengths
5
67
path
stringlengths
4
116
func_name
stringlengths
0
58
original_string
stringlengths
52
373k
language
stringclasses
1 value
code
stringlengths
52
373k
code_tokens
list
docstring
stringlengths
4
11.8k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
86
226
partition
stringclasses
1 value
greggman/twgl.js
src/textures.js
setSamplerParameters
function setSamplerParameters(gl, sampler, options) { setTextureSamplerParameters(gl, sampler, gl.samplerParameteri, options); }
javascript
function setSamplerParameters(gl, sampler, options) { setTextureSamplerParameters(gl, sampler, gl.samplerParameteri, options); }
[ "function", "setSamplerParameters", "(", "gl", ",", "sampler", ",", "options", ")", "{", "setTextureSamplerParameters", "(", "gl", ",", "sampler", ",", "gl", ".", "samplerParameteri", ",", "options", ")", ";", "}" ]
Sets the sampler parameters of a sampler. @param {WebGLRenderingContext} gl the WebGLRenderingContext @param {WebGLSampler} sampler the WebGLSampler to set parameters for @param {module:twgl.TextureOptions} options A TextureOptions object with whatever parameters you want set. @memberOf module:twgl/textures
[ "Sets", "the", "sampler", "parameters", "of", "a", "sampler", "." ]
ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd
https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/textures.js#L712-L714
train
greggman/twgl.js
src/textures.js
createSampler
function createSampler(gl, options) { const sampler = gl.createSampler(); setSamplerParameters(gl, sampler, options); return sampler; }
javascript
function createSampler(gl, options) { const sampler = gl.createSampler(); setSamplerParameters(gl, sampler, options); return sampler; }
[ "function", "createSampler", "(", "gl", ",", "options", ")", "{", "const", "sampler", "=", "gl", ".", "createSampler", "(", ")", ";", "setSamplerParameters", "(", "gl", ",", "sampler", ",", "options", ")", ";", "return", "sampler", ";", "}" ]
Creates a new sampler object and sets parameters. Example: const sampler = twgl.createSampler(gl, { minMag: gl.NEAREST, // sets both TEXTURE_MIN_FILTER and TEXTURE_MAG_FILTER wrap: gl.CLAMP_TO_NEAREST, // sets both TEXTURE_WRAP_S and TEXTURE_WRAP_T and TEXTURE_WRAP_R }); @param {WebGLRenderingContext} gl th...
[ "Creates", "a", "new", "sampler", "object", "and", "sets", "parameters", "." ]
ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd
https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/textures.js#L731-L735
train
greggman/twgl.js
src/textures.js
createSamplers
function createSamplers(gl, samplerOptions) { const samplers = {}; Object.keys(samplerOptions).forEach(function(name) { samplers[name] = createSampler(gl, samplerOptions[name]); }); return samplers; }
javascript
function createSamplers(gl, samplerOptions) { const samplers = {}; Object.keys(samplerOptions).forEach(function(name) { samplers[name] = createSampler(gl, samplerOptions[name]); }); return samplers; }
[ "function", "createSamplers", "(", "gl", ",", "samplerOptions", ")", "{", "const", "samplers", "=", "{", "}", ";", "Object", ".", "keys", "(", "samplerOptions", ")", ".", "forEach", "(", "function", "(", "name", ")", "{", "samplers", "[", "name", "]", ...
Creates a multiple sampler objects and sets parameters on each. Example: const samplers = twgl.createSamplers(gl, { nearest: { minMag: gl.NEAREST, }, nearestClampS: { minMag: gl.NEAREST, wrapS: gl.CLAMP_TO_NEAREST, }, linear: { minMag: gl.LINEAR, }, nearestClamp: { minMag: gl.NEAREST, wrap: gl.CLAMP_TO_EDGE, }, linea...
[ "Creates", "a", "multiple", "sampler", "objects", "and", "sets", "parameters", "on", "each", "." ]
ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd
https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/textures.js#L771-L777
train
greggman/twgl.js
src/textures.js
make1Pixel
function make1Pixel(color) { color = color || defaults.textureColor; if (isArrayBuffer(color)) { return color; } return new Uint8Array([color[0] * 255, color[1] * 255, color[2] * 255, color[3] * 255]); }
javascript
function make1Pixel(color) { color = color || defaults.textureColor; if (isArrayBuffer(color)) { return color; } return new Uint8Array([color[0] * 255, color[1] * 255, color[2] * 255, color[3] * 255]); }
[ "function", "make1Pixel", "(", "color", ")", "{", "color", "=", "color", "||", "defaults", ".", "textureColor", ";", "if", "(", "isArrayBuffer", "(", "color", ")", ")", "{", "return", "color", ";", "}", "return", "new", "Uint8Array", "(", "[", "color", ...
Makes a 1x1 pixel If no color is passed in uses the default color which can be set by calling `setDefaultTextureColor`. @param {(number[]|ArrayBufferView)} [color] The color using 0-1 values @return {Uint8Array} Unit8Array with color. @private
[ "Makes", "a", "1x1", "pixel", "If", "no", "color", "is", "passed", "in", "uses", "the", "default", "color", "which", "can", "be", "set", "by", "calling", "setDefaultTextureColor", "." ]
ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd
https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/textures.js#L786-L792
train
greggman/twgl.js
src/textures.js
getCubeFaceOrder
function getCubeFaceOrder(gl, options) { options = options || {}; return options.cubeFaceOrder || [ gl.TEXTURE_CUBE_MAP_POSITIVE_X, gl.TEXTURE_CUBE_MAP_NEGATIVE_X, gl.TEXTURE_CUBE_MAP_POSITIVE_Y, gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, gl.TEXTURE_CUBE_MAP_POSITIVE_Z, gl.TEXTURE_CUBE_MAP_...
javascript
function getCubeFaceOrder(gl, options) { options = options || {}; return options.cubeFaceOrder || [ gl.TEXTURE_CUBE_MAP_POSITIVE_X, gl.TEXTURE_CUBE_MAP_NEGATIVE_X, gl.TEXTURE_CUBE_MAP_POSITIVE_Y, gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, gl.TEXTURE_CUBE_MAP_POSITIVE_Z, gl.TEXTURE_CUBE_MAP_...
[ "function", "getCubeFaceOrder", "(", "gl", ",", "options", ")", "{", "options", "=", "options", "||", "{", "}", ";", "return", "options", ".", "cubeFaceOrder", "||", "[", "gl", ".", "TEXTURE_CUBE_MAP_POSITIVE_X", ",", "gl", ".", "TEXTURE_CUBE_MAP_NEGATIVE_X", ...
Gets an array of cubemap face enums @param {WebGLRenderingContext} gl the WebGLRenderingContext @param {module:twgl.TextureOptions} options A TextureOptions object with whatever parameters you want set. This is often the same options you passed in when you created the texture. @return {number[]} cubemap face enums @pri...
[ "Gets", "an", "array", "of", "cubemap", "face", "enums" ]
ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd
https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/textures.js#L839-L849
train
greggman/twgl.js
src/textures.js
urlIsSameOrigin
function urlIsSameOrigin(url) { if (typeof document !== 'undefined') { // for IE really const a = document.createElement('a'); a.href = url; return a.hostname === location.hostname && a.port === location.port && a.protocol === location.protocol; } else { const localOrig...
javascript
function urlIsSameOrigin(url) { if (typeof document !== 'undefined') { // for IE really const a = document.createElement('a'); a.href = url; return a.hostname === location.hostname && a.port === location.port && a.protocol === location.protocol; } else { const localOrig...
[ "function", "urlIsSameOrigin", "(", "url", ")", "{", "if", "(", "typeof", "document", "!==", "'undefined'", ")", "{", "// for IE really", "const", "a", "=", "document", ".", "createElement", "(", "'a'", ")", ";", "a", ".", "href", "=", "url", ";", "retur...
Checks whether the url's origin is the same so that we can set the `crossOrigin` @param {string} url url to image @returns {boolean} true if the window's origin is the same as image's url @private
[ "Checks", "whether", "the", "url", "s", "origin", "is", "the", "same", "so", "that", "we", "can", "set", "the", "crossOrigin" ]
ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd
https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/textures.js#L1018-L1031
train
greggman/twgl.js
src/textures.js
loadImage
function loadImage(url, crossOrigin, callback) { callback = callback || noop; let img; crossOrigin = crossOrigin !== undefined ? crossOrigin : defaults.crossOrigin; crossOrigin = setToAnonymousIfUndefinedAndURLIsNotSameOrigin(url, crossOrigin); if (typeof Image !== 'undefined') { img = new Image(); if...
javascript
function loadImage(url, crossOrigin, callback) { callback = callback || noop; let img; crossOrigin = crossOrigin !== undefined ? crossOrigin : defaults.crossOrigin; crossOrigin = setToAnonymousIfUndefinedAndURLIsNotSameOrigin(url, crossOrigin); if (typeof Image !== 'undefined') { img = new Image(); if...
[ "function", "loadImage", "(", "url", ",", "crossOrigin", ",", "callback", ")", "{", "callback", "=", "callback", "||", "noop", ";", "let", "img", ";", "crossOrigin", "=", "crossOrigin", "!==", "undefined", "?", "crossOrigin", ":", "defaults", ".", "crossOrig...
Loads an image @param {string} url url to image @param {string} crossOrigin @param {function(err, img)} [callback] a callback that's passed an error and the image. The error will be non-null if there was an error @return {HTMLImageElement} the image being loaded. @private
[ "Loads", "an", "image" ]
ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd
https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/textures.js#L1048-L1116
train
greggman/twgl.js
src/textures.js
isTexImageSource
function isTexImageSource(obj) { return (typeof ImageBitmap !== 'undefined' && obj instanceof ImageBitmap) || (typeof ImageData !== 'undefined' && obj instanceof ImageData) || (typeof HTMLElement !== 'undefined' && obj instanceof HTMLElement); }
javascript
function isTexImageSource(obj) { return (typeof ImageBitmap !== 'undefined' && obj instanceof ImageBitmap) || (typeof ImageData !== 'undefined' && obj instanceof ImageData) || (typeof HTMLElement !== 'undefined' && obj instanceof HTMLElement); }
[ "function", "isTexImageSource", "(", "obj", ")", "{", "return", "(", "typeof", "ImageBitmap", "!==", "'undefined'", "&&", "obj", "instanceof", "ImageBitmap", ")", "||", "(", "typeof", "ImageData", "!==", "'undefined'", "&&", "obj", "instanceof", "ImageData", ")"...
check if object is a TexImageSource @param {Object} obj Object to test @return {boolean} true if object is a TexImageSource @private
[ "check", "if", "object", "is", "a", "TexImageSource" ]
ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd
https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/textures.js#L1125-L1129
train
greggman/twgl.js
src/textures.js
loadAndUseImage
function loadAndUseImage(obj, crossOrigin, callback) { if (isTexImageSource(obj)) { setTimeout(function() { callback(null, obj); }); return obj; } return loadImage(obj, crossOrigin, callback); }
javascript
function loadAndUseImage(obj, crossOrigin, callback) { if (isTexImageSource(obj)) { setTimeout(function() { callback(null, obj); }); return obj; } return loadImage(obj, crossOrigin, callback); }
[ "function", "loadAndUseImage", "(", "obj", ",", "crossOrigin", ",", "callback", ")", "{", "if", "(", "isTexImageSource", "(", "obj", ")", ")", "{", "setTimeout", "(", "function", "(", ")", "{", "callback", "(", "null", ",", "obj", ")", ";", "}", ")", ...
if obj is an TexImageSource then just uses it otherwise if obj is a string then load it first. @param {string|TexImageSource} obj @param {string} crossOrigin @param {function(err, img)} [callback] a callback that's passed an error and the image. The error will be non-null if there was an error @private
[ "if", "obj", "is", "an", "TexImageSource", "then", "just", "uses", "it", "otherwise", "if", "obj", "is", "a", "string", "then", "load", "it", "first", "." ]
ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd
https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/textures.js#L1142-L1151
train
greggman/twgl.js
src/textures.js
loadTextureFromUrl
function loadTextureFromUrl(gl, tex, options, callback) { callback = callback || noop; options = options || defaults.textureOptions; setTextureTo1PixelColor(gl, tex, options); // Because it's async we need to copy the options. options = Object.assign({}, options); const img = loadAndUseImage(options.src, op...
javascript
function loadTextureFromUrl(gl, tex, options, callback) { callback = callback || noop; options = options || defaults.textureOptions; setTextureTo1PixelColor(gl, tex, options); // Because it's async we need to copy the options. options = Object.assign({}, options); const img = loadAndUseImage(options.src, op...
[ "function", "loadTextureFromUrl", "(", "gl", ",", "tex", ",", "options", ",", "callback", ")", "{", "callback", "=", "callback", "||", "noop", ";", "options", "=", "options", "||", "defaults", ".", "textureOptions", ";", "setTextureTo1PixelColor", "(", "gl", ...
A callback for when an image finished downloading and been uploaded into a texture @callback ThreeDReadyCallback @param {*} err If truthy there was an error. @param {WebGLTexture} tex the texture. @param {HTMLImageElement[]} imgs the images for each slice. @memberOf module:twgl Loads a texture from an image from a Ur...
[ "A", "callback", "for", "when", "an", "image", "finished", "downloading", "and", "been", "uploaded", "into", "a", "texture" ]
ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd
https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/textures.js#L1244-L1259
train
greggman/twgl.js
src/textures.js
setEmptyTexture
function setEmptyTexture(gl, tex, options) { const target = options.target || gl.TEXTURE_2D; gl.bindTexture(target, tex); const level = options.level || 0; const internalFormat = options.internalFormat || options.format || gl.RGBA; const formatType = getFormatAndTypeForInternalFormat(internalFormat); const ...
javascript
function setEmptyTexture(gl, tex, options) { const target = options.target || gl.TEXTURE_2D; gl.bindTexture(target, tex); const level = options.level || 0; const internalFormat = options.internalFormat || options.format || gl.RGBA; const formatType = getFormatAndTypeForInternalFormat(internalFormat); const ...
[ "function", "setEmptyTexture", "(", "gl", ",", "tex", ",", "options", ")", "{", "const", "target", "=", "options", ".", "target", "||", "gl", ".", "TEXTURE_2D", ";", "gl", ".", "bindTexture", "(", "target", ",", "tex", ")", ";", "const", "level", "=", ...
Sets a texture with no contents of a certain size. In other words calls `gl.texImage2D` with `null`. You must set `options.width` and `options.height`. @param {WebGLRenderingContext} gl the WebGLRenderingContext @param {WebGLTexture} tex the WebGLTexture to set parameters for @param {module:twgl.TextureOptions} options...
[ "Sets", "a", "texture", "with", "no", "contents", "of", "a", "certain", "size", ".", "In", "other", "words", "calls", "gl", ".", "texImage2D", "with", "null", ".", "You", "must", "set", "options", ".", "width", "and", "options", ".", "height", "." ]
ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd
https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/textures.js#L1530-L1549
train
greggman/twgl.js
src/textures.js
createTexture
function createTexture(gl, options, callback) { callback = callback || noop; options = options || defaults.textureOptions; const tex = gl.createTexture(); const target = options.target || gl.TEXTURE_2D; let width = options.width || 1; let height = options.height || 1; const internalFormat = options.inte...
javascript
function createTexture(gl, options, callback) { callback = callback || noop; options = options || defaults.textureOptions; const tex = gl.createTexture(); const target = options.target || gl.TEXTURE_2D; let width = options.width || 1; let height = options.height || 1; const internalFormat = options.inte...
[ "function", "createTexture", "(", "gl", ",", "options", ",", "callback", ")", "{", "callback", "=", "callback", "||", "noop", ";", "options", "=", "options", "||", "defaults", ".", "textureOptions", ";", "const", "tex", "=", "gl", ".", "createTexture", "("...
Creates a texture based on the options passed in. @param {WebGLRenderingContext} gl the WebGLRenderingContext @param {module:twgl.TextureOptions} [options] A TextureOptions object with whatever parameters you want set. @param {module:twgl.TextureReadyCallback} [callback] A callback called when an image has been downloa...
[ "Creates", "a", "texture", "based", "on", "the", "options", "passed", "in", "." ]
ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd
https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/textures.js#L1559-L1614
train
greggman/twgl.js
src/textures.js
resizeTexture
function resizeTexture(gl, tex, options, width, height) { width = width || options.width; height = height || options.height; const target = options.target || gl.TEXTURE_2D; gl.bindTexture(target, tex); const level = options.level || 0; const internalFormat = options.internalFormat || options.format || gl.RG...
javascript
function resizeTexture(gl, tex, options, width, height) { width = width || options.width; height = height || options.height; const target = options.target || gl.TEXTURE_2D; gl.bindTexture(target, tex); const level = options.level || 0; const internalFormat = options.internalFormat || options.format || gl.RG...
[ "function", "resizeTexture", "(", "gl", ",", "tex", ",", "options", ",", "width", ",", "height", ")", "{", "width", "=", "width", "||", "options", ".", "width", ";", "height", "=", "height", "||", "options", ".", "height", ";", "const", "target", "=", ...
Resizes a texture based on the options passed in. Note: This is not a generic resize anything function. It's mostly used by {@link module:twgl.resizeFramebufferInfo} It will use `options.src` if it exists to try to determine a `type` otherwise it will assume `gl.UNSIGNED_BYTE`. No data is provided for the texture. Tex...
[ "Resizes", "a", "texture", "based", "on", "the", "options", "passed", "in", "." ]
ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd
https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/textures.js#L1632-L1657
train
greggman/twgl.js
src/textures.js
createTextures
function createTextures(gl, textureOptions, callback) { callback = callback || noop; let numDownloading = 0; const errors = []; const textures = {}; const images = {}; function callCallbackIfReady() { if (numDownloading === 0) { setTimeout(function() { callback(errors.length ? errors : un...
javascript
function createTextures(gl, textureOptions, callback) { callback = callback || noop; let numDownloading = 0; const errors = []; const textures = {}; const images = {}; function callCallbackIfReady() { if (numDownloading === 0) { setTimeout(function() { callback(errors.length ? errors : un...
[ "function", "createTextures", "(", "gl", ",", "textureOptions", ",", "callback", ")", "{", "callback", "=", "callback", "||", "noop", ";", "let", "numDownloading", "=", "0", ";", "const", "errors", "=", "[", "]", ";", "const", "textures", "=", "{", "}", ...
Creates a bunch of textures based on the passed in options. Example: const textures = twgl.createTextures(gl, { // a power of 2 image hftIcon: { src: "images/hft-icon-16.png", mag: gl.NEAREST }, // a non-power of 2 image clover: { src: "images/clover.jpg" }, // From a canvas fromCanvas: { src: ctx.canvas }, // A cube...
[ "Creates", "a", "bunch", "of", "textures", "based", "on", "the", "passed", "in", "options", "." ]
ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd
https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/textures.js#L1747-L1786
train
greggman/twgl.js
src/framebuffers.js
resizeFramebufferInfo
function resizeFramebufferInfo(gl, framebufferInfo, attachments, width, height) { width = width || gl.drawingBufferWidth; height = height || gl.drawingBufferHeight; framebufferInfo.width = width; framebufferInfo.height = height; attachments = attachments || defaultAttachments; attachments.forEach(function...
javascript
function resizeFramebufferInfo(gl, framebufferInfo, attachments, width, height) { width = width || gl.drawingBufferWidth; height = height || gl.drawingBufferHeight; framebufferInfo.width = width; framebufferInfo.height = height; attachments = attachments || defaultAttachments; attachments.forEach(function...
[ "function", "resizeFramebufferInfo", "(", "gl", ",", "framebufferInfo", ",", "attachments", ",", "width", ",", "height", ")", "{", "width", "=", "width", "||", "gl", ".", "drawingBufferWidth", ";", "height", "=", "height", "||", "gl", ".", "drawingBufferHeight...
Resizes the attachments of a framebuffer. You need to pass in the same `attachments` as you passed in {@link module:twgl.createFramebufferInfo} because TWGL has no idea the format/type of each attachment. The simplest usage // create an RGBA/UNSIGNED_BYTE texture and DEPTH_STENCIL renderbuffer const fbi = twgl.creat...
[ "Resizes", "the", "attachments", "of", "a", "framebuffer", "." ]
ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd
https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/framebuffers.js#L274-L292
train
greggman/twgl.js
src/framebuffers.js
bindFramebufferInfo
function bindFramebufferInfo(gl, framebufferInfo, target) { target = target || gl.FRAMEBUFFER; if (framebufferInfo) { gl.bindFramebuffer(target, framebufferInfo.framebuffer); gl.viewport(0, 0, framebufferInfo.width, framebufferInfo.height); } else { gl.bindFramebuffer(target, null); gl.viewport(0,...
javascript
function bindFramebufferInfo(gl, framebufferInfo, target) { target = target || gl.FRAMEBUFFER; if (framebufferInfo) { gl.bindFramebuffer(target, framebufferInfo.framebuffer); gl.viewport(0, 0, framebufferInfo.width, framebufferInfo.height); } else { gl.bindFramebuffer(target, null); gl.viewport(0,...
[ "function", "bindFramebufferInfo", "(", "gl", ",", "framebufferInfo", ",", "target", ")", "{", "target", "=", "target", "||", "gl", ".", "FRAMEBUFFER", ";", "if", "(", "framebufferInfo", ")", "{", "gl", ".", "bindFramebuffer", "(", "target", ",", "framebuffe...
Binds a framebuffer This function pretty much soley exists because I spent hours trying to figure out why something I wrote wasn't working only to realize I forget to set the viewport dimensions. My hope is this function will fix that. It is effectively the same as gl.bindFramebuffer(gl.FRAMEBUFFER, someFramebufferI...
[ "Binds", "a", "framebuffer" ]
ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd
https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/framebuffers.js#L314-L323
train
greggman/twgl.js
src/v3.js
create
function create(x, y, z) { const dst = new VecType(3); if (x) { dst[0] = x; } if (y) { dst[1] = y; } if (z) { dst[2] = z; } return dst; }
javascript
function create(x, y, z) { const dst = new VecType(3); if (x) { dst[0] = x; } if (y) { dst[1] = y; } if (z) { dst[2] = z; } return dst; }
[ "function", "create", "(", "x", ",", "y", ",", "z", ")", "{", "const", "dst", "=", "new", "VecType", "(", "3", ")", ";", "if", "(", "x", ")", "{", "dst", "[", "0", "]", "=", "x", ";", "}", "if", "(", "y", ")", "{", "dst", "[", "1", "]",...
Creates a vec3; may be called with x, y, z to set initial values. @return {module:twgl/v3.Vec3} the created vector @memberOf module:twgl/v3
[ "Creates", "a", "vec3", ";", "may", "be", "called", "with", "x", "y", "z", "to", "set", "initial", "values", "." ]
ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd
https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/v3.js#L74-L86
train
greggman/twgl.js
src/v3.js
add
function add(a, b, dst) { dst = dst || new VecType(3); dst[0] = a[0] + b[0]; dst[1] = a[1] + b[1]; dst[2] = a[2] + b[2]; return dst; }
javascript
function add(a, b, dst) { dst = dst || new VecType(3); dst[0] = a[0] + b[0]; dst[1] = a[1] + b[1]; dst[2] = a[2] + b[2]; return dst; }
[ "function", "add", "(", "a", ",", "b", ",", "dst", ")", "{", "dst", "=", "dst", "||", "new", "VecType", "(", "3", ")", ";", "dst", "[", "0", "]", "=", "a", "[", "0", "]", "+", "b", "[", "0", "]", ";", "dst", "[", "1", "]", "=", "a", "...
Adds two vectors; assumes a and b have the same dimension. @param {module:twgl/v3.Vec3} a Operand vector. @param {module:twgl/v3.Vec3} b Operand vector. @param {module:twgl/v3.Vec3} [dst] vector to hold result. If not new one is created.. @return {module:twgl/v3.Vec3} the created vector @memberOf module:twgl/v3
[ "Adds", "two", "vectors", ";", "assumes", "a", "and", "b", "have", "the", "same", "dimension", "." ]
ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd
https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/v3.js#L96-L104
train
greggman/twgl.js
src/v3.js
subtract
function subtract(a, b, dst) { dst = dst || new VecType(3); dst[0] = a[0] - b[0]; dst[1] = a[1] - b[1]; dst[2] = a[2] - b[2]; return dst; }
javascript
function subtract(a, b, dst) { dst = dst || new VecType(3); dst[0] = a[0] - b[0]; dst[1] = a[1] - b[1]; dst[2] = a[2] - b[2]; return dst; }
[ "function", "subtract", "(", "a", ",", "b", ",", "dst", ")", "{", "dst", "=", "dst", "||", "new", "VecType", "(", "3", ")", ";", "dst", "[", "0", "]", "=", "a", "[", "0", "]", "-", "b", "[", "0", "]", ";", "dst", "[", "1", "]", "=", "a"...
Subtracts two vectors. @param {module:twgl/v3.Vec3} a Operand vector. @param {module:twgl/v3.Vec3} b Operand vector. @param {module:twgl/v3.Vec3} [dst] vector to hold result. If not new one is created.. @return {module:twgl/v3.Vec3} the created vector @memberOf module:twgl/v3
[ "Subtracts", "two", "vectors", "." ]
ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd
https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/v3.js#L114-L122
train
greggman/twgl.js
src/v3.js
mulScalar
function mulScalar(v, k, dst) { dst = dst || new VecType(3); dst[0] = v[0] * k; dst[1] = v[1] * k; dst[2] = v[2] * k; return dst; }
javascript
function mulScalar(v, k, dst) { dst = dst || new VecType(3); dst[0] = v[0] * k; dst[1] = v[1] * k; dst[2] = v[2] * k; return dst; }
[ "function", "mulScalar", "(", "v", ",", "k", ",", "dst", ")", "{", "dst", "=", "dst", "||", "new", "VecType", "(", "3", ")", ";", "dst", "[", "0", "]", "=", "v", "[", "0", "]", "*", "k", ";", "dst", "[", "1", "]", "=", "v", "[", "1", "]...
Mutiplies a vector by a scalar. @param {module:twgl/v3.Vec3} v The vector. @param {number} k The scalar. @param {module:twgl/v3.Vec3} [dst] vector to hold result. If not new one is created.. @return {module:twgl/v3.Vec3} dst. @memberOf module:twgl/v3
[ "Mutiplies", "a", "vector", "by", "a", "scalar", "." ]
ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd
https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/v3.js#L214-L222
train
greggman/twgl.js
src/v3.js
divScalar
function divScalar(v, k, dst) { dst = dst || new VecType(3); dst[0] = v[0] / k; dst[1] = v[1] / k; dst[2] = v[2] / k; return dst; }
javascript
function divScalar(v, k, dst) { dst = dst || new VecType(3); dst[0] = v[0] / k; dst[1] = v[1] / k; dst[2] = v[2] / k; return dst; }
[ "function", "divScalar", "(", "v", ",", "k", ",", "dst", ")", "{", "dst", "=", "dst", "||", "new", "VecType", "(", "3", ")", ";", "dst", "[", "0", "]", "=", "v", "[", "0", "]", "/", "k", ";", "dst", "[", "1", "]", "=", "v", "[", "1", "]...
Divides a vector by a scalar. @param {module:twgl/v3.Vec3} v The vector. @param {number} k The scalar. @param {module:twgl/v3.Vec3} [dst] vector to hold result. If not new one is created.. @return {module:twgl/v3.Vec3} dst. @memberOf module:twgl/v3
[ "Divides", "a", "vector", "by", "a", "scalar", "." ]
ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd
https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/v3.js#L232-L240
train
greggman/twgl.js
src/v3.js
cross
function cross(a, b, dst) { dst = dst || new VecType(3); const t1 = a[2] * b[0] - a[0] * b[2]; const t2 = a[0] * b[1] - a[1] * b[0]; dst[0] = a[1] * b[2] - a[2] * b[1]; dst[1] = t1; dst[2] = t2; return dst; }
javascript
function cross(a, b, dst) { dst = dst || new VecType(3); const t1 = a[2] * b[0] - a[0] * b[2]; const t2 = a[0] * b[1] - a[1] * b[0]; dst[0] = a[1] * b[2] - a[2] * b[1]; dst[1] = t1; dst[2] = t2; return dst; }
[ "function", "cross", "(", "a", ",", "b", ",", "dst", ")", "{", "dst", "=", "dst", "||", "new", "VecType", "(", "3", ")", ";", "const", "t1", "=", "a", "[", "2", "]", "*", "b", "[", "0", "]", "-", "a", "[", "0", "]", "*", "b", "[", "2", ...
Computes the cross product of two vectors; assumes both vectors have three entries. @param {module:twgl/v3.Vec3} a Operand vector. @param {module:twgl/v3.Vec3} b Operand vector. @param {module:twgl/v3.Vec3} [dst] vector to hold result. If not new one is created.. @return {module:twgl/v3.Vec3} The vector a cross b. @mem...
[ "Computes", "the", "cross", "product", "of", "two", "vectors", ";", "assumes", "both", "vectors", "have", "three", "entries", "." ]
ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd
https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/v3.js#L251-L261
train
greggman/twgl.js
src/v3.js
normalize
function normalize(a, dst) { dst = dst || new VecType(3); const lenSq = a[0] * a[0] + a[1] * a[1] + a[2] * a[2]; const len = Math.sqrt(lenSq); if (len > 0.00001) { dst[0] = a[0] / len; dst[1] = a[1] / len; dst[2] = a[2] / len; } else { dst[0] = 0; dst[1] = 0; dst[2] = 0; } return...
javascript
function normalize(a, dst) { dst = dst || new VecType(3); const lenSq = a[0] * a[0] + a[1] * a[1] + a[2] * a[2]; const len = Math.sqrt(lenSq); if (len > 0.00001) { dst[0] = a[0] / len; dst[1] = a[1] / len; dst[2] = a[2] / len; } else { dst[0] = 0; dst[1] = 0; dst[2] = 0; } return...
[ "function", "normalize", "(", "a", ",", "dst", ")", "{", "dst", "=", "dst", "||", "new", "VecType", "(", "3", ")", ";", "const", "lenSq", "=", "a", "[", "0", "]", "*", "a", "[", "0", "]", "+", "a", "[", "1", "]", "*", "a", "[", "1", "]", ...
Divides a vector by its Euclidean length and returns the quotient. @param {module:twgl/v3.Vec3} a The vector. @param {module:twgl/v3.Vec3} [dst] vector to hold result. If not new one is created.. @return {module:twgl/v3.Vec3} The normalized vector. @memberOf module:twgl/v3
[ "Divides", "a", "vector", "by", "its", "Euclidean", "length", "and", "returns", "the", "quotient", "." ]
ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd
https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/v3.js#L330-L346
train
greggman/twgl.js
src/v3.js
negate
function negate(v, dst) { dst = dst || new VecType(3); dst[0] = -v[0]; dst[1] = -v[1]; dst[2] = -v[2]; return dst; }
javascript
function negate(v, dst) { dst = dst || new VecType(3); dst[0] = -v[0]; dst[1] = -v[1]; dst[2] = -v[2]; return dst; }
[ "function", "negate", "(", "v", ",", "dst", ")", "{", "dst", "=", "dst", "||", "new", "VecType", "(", "3", ")", ";", "dst", "[", "0", "]", "=", "-", "v", "[", "0", "]", ";", "dst", "[", "1", "]", "=", "-", "v", "[", "1", "]", ";", "dst"...
Negates a vector. @param {module:twgl/v3.Vec3} v The vector. @param {module:twgl/v3.Vec3} [dst] vector to hold result. If not new one is created.. @return {module:twgl/v3.Vec3} -v. @memberOf module:twgl/v3
[ "Negates", "a", "vector", "." ]
ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd
https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/v3.js#L355-L363
train
greggman/twgl.js
src/v3.js
copy
function copy(v, dst) { dst = dst || new VecType(3); dst[0] = v[0]; dst[1] = v[1]; dst[2] = v[2]; return dst; }
javascript
function copy(v, dst) { dst = dst || new VecType(3); dst[0] = v[0]; dst[1] = v[1]; dst[2] = v[2]; return dst; }
[ "function", "copy", "(", "v", ",", "dst", ")", "{", "dst", "=", "dst", "||", "new", "VecType", "(", "3", ")", ";", "dst", "[", "0", "]", "=", "v", "[", "0", "]", ";", "dst", "[", "1", "]", "=", "v", "[", "1", "]", ";", "dst", "[", "2", ...
Copies a vector. @param {module:twgl/v3.Vec3} v The vector. @param {module:twgl/v3.Vec3} [dst] vector to hold result. If not new one is created.. @return {module:twgl/v3.Vec3} A copy of v. @memberOf module:twgl/v3
[ "Copies", "a", "vector", "." ]
ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd
https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/v3.js#L372-L380
train
greggman/twgl.js
src/primitives.js
deindexVertices
function deindexVertices(vertices) { const indices = vertices.indices; const newVertices = {}; const numElements = indices.length; function expandToUnindexed(channel) { const srcBuffer = vertices[channel]; const numComponents = srcBuffer.numComponents; const dstBuffer = createAugmentedTypedArray(nu...
javascript
function deindexVertices(vertices) { const indices = vertices.indices; const newVertices = {}; const numElements = indices.length; function expandToUnindexed(channel) { const srcBuffer = vertices[channel]; const numComponents = srcBuffer.numComponents; const dstBuffer = createAugmentedTypedArray(nu...
[ "function", "deindexVertices", "(", "vertices", ")", "{", "const", "indices", "=", "vertices", ".", "indices", ";", "const", "newVertices", "=", "{", "}", ";", "const", "numElements", "=", "indices", ".", "length", ";", "function", "expandToUnindexed", "(", ...
Given indexed vertices creates a new set of vertices unindexed by expanding the indexed vertices. @param {Object.<string, TypedArray>} vertices The indexed vertices to deindex @return {Object.<string, TypedArray>} The deindexed vertices @memberOf module:twgl/primitives
[ "Given", "indexed", "vertices", "creates", "a", "new", "set", "of", "vertices", "unindexed", "by", "expanding", "the", "indexed", "vertices", "." ]
ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd
https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/primitives.js#L139-L161
train
greggman/twgl.js
src/primitives.js
flattenNormals
function flattenNormals(vertices) { if (vertices.indices) { throw "can't flatten normals of indexed vertices. deindex them first"; } const normals = vertices.normal; const numNormals = normals.length; for (let ii = 0; ii < numNormals; ii += 9) { // pull out the 3 normals for this triangle const n...
javascript
function flattenNormals(vertices) { if (vertices.indices) { throw "can't flatten normals of indexed vertices. deindex them first"; } const normals = vertices.normal; const numNormals = normals.length; for (let ii = 0; ii < numNormals; ii += 9) { // pull out the 3 normals for this triangle const n...
[ "function", "flattenNormals", "(", "vertices", ")", "{", "if", "(", "vertices", ".", "indices", ")", "{", "throw", "\"can't flatten normals of indexed vertices. deindex them first\"", ";", "}", "const", "normals", "=", "vertices", ".", "normal", ";", "const", "numNo...
flattens the normals of deindexed vertices in place. @param {Object.<string, TypedArray>} vertices The deindexed vertices who's normals to flatten @return {Object.<string, TypedArray>} The flattened vertices (same as was passed in) @memberOf module:twgl/primitives
[ "flattens", "the", "normals", "of", "deindexed", "vertices", "in", "place", "." ]
ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd
https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/primitives.js#L169-L217
train
greggman/twgl.js
src/primitives.js
reorientNormals
function reorientNormals(array, matrix) { applyFuncToV3Array(array, m4.inverse(matrix), transformNormal); return array; }
javascript
function reorientNormals(array, matrix) { applyFuncToV3Array(array, m4.inverse(matrix), transformNormal); return array; }
[ "function", "reorientNormals", "(", "array", ",", "matrix", ")", "{", "applyFuncToV3Array", "(", "array", ",", "m4", ".", "inverse", "(", "matrix", ")", ",", "transformNormal", ")", ";", "return", "array", ";", "}" ]
Reorients normals by the inverse-transpose of the given matrix.. @param {(number[]|TypedArray)} array The array. Assumes value floats per element. @param {module:twgl/m4.Mat4} matrix A matrix to multiply by. @return {(number[]|TypedArray)} the same array that was passed in @memberOf module:twgl/primitives
[ "Reorients", "normals", "by", "the", "inverse", "-", "transpose", "of", "the", "given", "matrix", ".." ]
ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd
https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/primitives.js#L263-L266
train
greggman/twgl.js
src/primitives.js
createXYQuadVertices
function createXYQuadVertices(size, xOffset, yOffset) { size = size || 2; xOffset = xOffset || 0; yOffset = yOffset || 0; size *= 0.5; return { position: { numComponents: 2, data: [ xOffset + -1 * size, yOffset + -1 * size, xOffset + 1 * size, yOffset + -1 * size, xOff...
javascript
function createXYQuadVertices(size, xOffset, yOffset) { size = size || 2; xOffset = xOffset || 0; yOffset = yOffset || 0; size *= 0.5; return { position: { numComponents: 2, data: [ xOffset + -1 * size, yOffset + -1 * size, xOffset + 1 * size, yOffset + -1 * size, xOff...
[ "function", "createXYQuadVertices", "(", "size", ",", "xOffset", ",", "yOffset", ")", "{", "size", "=", "size", "||", "2", ";", "xOffset", "=", "xOffset", "||", "0", ";", "yOffset", "=", "yOffset", "||", "0", ";", "size", "*=", "0.5", ";", "return", ...
Creates XY quad Buffers The default with no parameters will return a 2x2 quad with values from -1 to +1. If you want a unit quad with that goes from 0 to 1 you'd call it with twgl.primitives.createXYQuadBufferInfo(gl, 1, 0.5, 0.5); If you want a unit quad centered above 0,0 you'd call it with twgl.primitives.create...
[ "Creates", "XY", "quad", "Buffers" ]
ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd
https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/primitives.js#L369-L398
train
greggman/twgl.js
src/primitives.js
createPlaneVertices
function createPlaneVertices( width, depth, subdivisionsWidth, subdivisionsDepth, matrix) { width = width || 1; depth = depth || 1; subdivisionsWidth = subdivisionsWidth || 1; subdivisionsDepth = subdivisionsDepth || 1; matrix = matrix || m4.identity(); const numVertices = (subdivisions...
javascript
function createPlaneVertices( width, depth, subdivisionsWidth, subdivisionsDepth, matrix) { width = width || 1; depth = depth || 1; subdivisionsWidth = subdivisionsWidth || 1; subdivisionsDepth = subdivisionsDepth || 1; matrix = matrix || m4.identity(); const numVertices = (subdivisions...
[ "function", "createPlaneVertices", "(", "width", ",", "depth", ",", "subdivisionsWidth", ",", "subdivisionsDepth", ",", "matrix", ")", "{", "width", "=", "width", "||", "1", ";", "depth", "=", "depth", "||", "1", ";", "subdivisionsWidth", "=", "subdivisionsWid...
Creates XZ plane buffers. The created plane has position, normal, and texcoord data @param {WebGLRenderingContext} gl The WebGLRenderingContext. @param {number} [width] Width of the plane. Default = 1 @param {number} [depth] Depth of the plane. Default = 1 @param {number} [subdivisionsWidth] Number of steps across th...
[ "Creates", "XZ", "plane", "buffers", "." ]
ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd
https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/primitives.js#L445-L502
train
greggman/twgl.js
src/primitives.js
createSphereVertices
function createSphereVertices( radius, subdivisionsAxis, subdivisionsHeight, opt_startLatitudeInRadians, opt_endLatitudeInRadians, opt_startLongitudeInRadians, opt_endLongitudeInRadians) { if (subdivisionsAxis <= 0 || subdivisionsHeight <= 0) { throw Error('subdivisionAxis and subdivis...
javascript
function createSphereVertices( radius, subdivisionsAxis, subdivisionsHeight, opt_startLatitudeInRadians, opt_endLatitudeInRadians, opt_startLongitudeInRadians, opt_endLongitudeInRadians) { if (subdivisionsAxis <= 0 || subdivisionsHeight <= 0) { throw Error('subdivisionAxis and subdivis...
[ "function", "createSphereVertices", "(", "radius", ",", "subdivisionsAxis", ",", "subdivisionsHeight", ",", "opt_startLatitudeInRadians", ",", "opt_endLatitudeInRadians", ",", "opt_startLongitudeInRadians", ",", "opt_endLongitudeInRadians", ")", "{", "if", "(", "subdivisionsA...
Creates sphere buffers. The created sphere has position, normal, and texcoord data @param {WebGLRenderingContext} gl The WebGLRenderingContext. @param {number} radius radius of the sphere. @param {number} subdivisionsAxis number of steps around the sphere. @param {number} subdivisionsHeight number of vertically on th...
[ "Creates", "sphere", "buffers", "." ]
ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd
https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/primitives.js#L567-L640
train
greggman/twgl.js
src/primitives.js
createCubeVertices
function createCubeVertices(size) { size = size || 1; const k = size / 2; const cornerVertices = [ [-k, -k, -k], [+k, -k, -k], [-k, +k, -k], [+k, +k, -k], [-k, -k, +k], [+k, -k, +k], [-k, +k, +k], [+k, +k, +k], ]; const faceNormals = [ [+1, +0, +0], [-1, +0, +0], ...
javascript
function createCubeVertices(size) { size = size || 1; const k = size / 2; const cornerVertices = [ [-k, -k, -k], [+k, -k, -k], [-k, +k, -k], [+k, +k, -k], [-k, -k, +k], [+k, -k, +k], [-k, +k, +k], [+k, +k, +k], ]; const faceNormals = [ [+1, +0, +0], [-1, +0, +0], ...
[ "function", "createCubeVertices", "(", "size", ")", "{", "size", "=", "size", "||", "1", ";", "const", "k", "=", "size", "/", "2", ";", "const", "cornerVertices", "=", "[", "[", "-", "k", ",", "-", "k", ",", "-", "k", "]", ",", "[", "+", "k", ...
Creates the buffers and indices for a cube. The cube is created around the origin. (-size / 2, size / 2). @param {WebGLRenderingContext} gl The WebGLRenderingContext. @param {number} [size] width, height and depth of the cube. @return {Object.<string, WebGLBuffer>} The created buffers. @memberOf module:twgl/primitive...
[ "Creates", "the", "buffers", "and", "indices", "for", "a", "cube", "." ]
ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd
https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/primitives.js#L689-L752
train
greggman/twgl.js
src/primitives.js
expandRLEData
function expandRLEData(rleData, padding) { padding = padding || []; const data = []; for (let ii = 0; ii < rleData.length; ii += 4) { const runLength = rleData[ii]; const element = rleData.slice(ii + 1, ii + 4); element.push.apply(element, padding); for (let jj = 0; jj < runLength; ++jj) { d...
javascript
function expandRLEData(rleData, padding) { padding = padding || []; const data = []; for (let ii = 0; ii < rleData.length; ii += 4) { const runLength = rleData[ii]; const element = rleData.slice(ii + 1, ii + 4); element.push.apply(element, padding); for (let jj = 0; jj < runLength; ++jj) { d...
[ "function", "expandRLEData", "(", "rleData", ",", "padding", ")", "{", "padding", "=", "padding", "||", "[", "]", ";", "const", "data", "=", "[", "]", ";", "for", "(", "let", "ii", "=", "0", ";", "ii", "<", "rleData", ".", "length", ";", "ii", "+...
Expands RLE data @param {number[]} rleData data in format of run-length, x, y, z, run-length, x, y, z @param {number[]} [padding] value to add each entry with. @return {number[]} the expanded rleData @private
[ "Expands", "RLE", "data" ]
ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd
https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/primitives.js#L913-L925
train
greggman/twgl.js
src/primitives.js
createCylinderVertices
function createCylinderVertices( radius, height, radialSubdivisions, verticalSubdivisions, topCap, bottomCap) { return createTruncatedConeVertices( radius, radius, height, radialSubdivisions, verticalSubdivisions, topCap, bottomCap); }
javascript
function createCylinderVertices( radius, height, radialSubdivisions, verticalSubdivisions, topCap, bottomCap) { return createTruncatedConeVertices( radius, radius, height, radialSubdivisions, verticalSubdivisions, topCap, bottomCap); }
[ "function", "createCylinderVertices", "(", "radius", ",", "height", ",", "radialSubdivisions", ",", "verticalSubdivisions", ",", "topCap", ",", "bottomCap", ")", "{", "return", "createTruncatedConeVertices", "(", "radius", ",", "radius", ",", "height", ",", "radialS...
Creates cylinder buffers. The cylinder will be created around the origin along the y-axis. @param {WebGLRenderingContext} gl The WebGLRenderingContext. @param {number} radius Radius of cylinder. @param {number} height Height of cylinder. @param {number} radialSubdivisions The number of subdivisions around the cylinder...
[ "Creates", "cylinder", "buffers", ".", "The", "cylinder", "will", "be", "created", "around", "the", "origin", "along", "the", "y", "-", "axis", "." ]
ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd
https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/primitives.js#L1507-L1522
train
greggman/twgl.js
src/primitives.js
createTorusVertices
function createTorusVertices( radius, thickness, radialSubdivisions, bodySubdivisions, startAngle, endAngle) { if (radialSubdivisions < 3) { throw Error('radialSubdivisions must be 3 or greater'); } if (bodySubdivisions < 3) { throw Error('verticalSubdivisions must be 3 or greater...
javascript
function createTorusVertices( radius, thickness, radialSubdivisions, bodySubdivisions, startAngle, endAngle) { if (radialSubdivisions < 3) { throw Error('radialSubdivisions must be 3 or greater'); } if (bodySubdivisions < 3) { throw Error('verticalSubdivisions must be 3 or greater...
[ "function", "createTorusVertices", "(", "radius", ",", "thickness", ",", "radialSubdivisions", ",", "bodySubdivisions", ",", "startAngle", ",", "endAngle", ")", "{", "if", "(", "radialSubdivisions", "<", "3", ")", "{", "throw", "Error", "(", "'radialSubdivisions m...
Creates buffers for a torus @param {WebGLRenderingContext} gl The WebGLRenderingContext. @param {number} radius radius of center of torus circle. @param {number} thickness radius of torus ring. @param {number} radialSubdivisions The number of subdivisions around the torus. @param {number} bodySubdivisions The number o...
[ "Creates", "buffers", "for", "a", "torus" ]
ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd
https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/primitives.js#L1566-L1634
train
greggman/twgl.js
src/primitives.js
createDiscVertices
function createDiscVertices( radius, divisions, stacks, innerRadius, stackPower) { if (divisions < 3) { throw Error('divisions must be at least 3'); } stacks = stacks ? stacks : 1; stackPower = stackPower ? stackPower : 1; innerRadius = innerRadius ? innerRadius : 0; // Note: We do...
javascript
function createDiscVertices( radius, divisions, stacks, innerRadius, stackPower) { if (divisions < 3) { throw Error('divisions must be at least 3'); } stacks = stacks ? stacks : 1; stackPower = stackPower ? stackPower : 1; innerRadius = innerRadius ? innerRadius : 0; // Note: We do...
[ "function", "createDiscVertices", "(", "radius", ",", "divisions", ",", "stacks", ",", "innerRadius", ",", "stackPower", ")", "{", "if", "(", "divisions", "<", "3", ")", "{", "throw", "Error", "(", "'divisions must be at least 3'", ")", ";", "}", "stacks", "...
Creates disc buffers. The disc will be in the xz plane, centered at the origin. When creating, at least 3 divisions, or pie pieces, need to be specified, otherwise the triangles making up the disc will be degenerate. You can also specify the number of radial pieces `stacks`. A value of 1 for stacks will give you a simp...
[ "Creates", "disc", "buffers", ".", "The", "disc", "will", "be", "in", "the", "xz", "plane", "centered", "at", "the", "origin", ".", "When", "creating", "at", "least", "3", "divisions", "or", "pie", "pieces", "need", "to", "be", "specified", "otherwise", ...
ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd
https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/primitives.js#L1718-L1781
train
greggman/twgl.js
src/primitives.js
createBufferFunc
function createBufferFunc(fn) { return function(gl) { const arrays = fn.apply(this, Array.prototype.slice.call(arguments, 1)); return attributes.createBuffersFromArrays(gl, arrays); }; }
javascript
function createBufferFunc(fn) { return function(gl) { const arrays = fn.apply(this, Array.prototype.slice.call(arguments, 1)); return attributes.createBuffersFromArrays(gl, arrays); }; }
[ "function", "createBufferFunc", "(", "fn", ")", "{", "return", "function", "(", "gl", ")", "{", "const", "arrays", "=", "fn", ".", "apply", "(", "this", ",", "Array", ".", "prototype", ".", "slice", ".", "call", "(", "arguments", ",", "1", ")", ")", ...
creates a function that calls fn to create vertices and then creates a buffers for them @private
[ "creates", "a", "function", "that", "calls", "fn", "to", "create", "vertices", "and", "then", "creates", "a", "buffers", "for", "them" ]
ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd
https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/primitives.js#L1851-L1856
train
greggman/twgl.js
src/primitives.js
createBufferInfoFunc
function createBufferInfoFunc(fn) { return function(gl) { const arrays = fn.apply(null, Array.prototype.slice.call(arguments, 1)); return attributes.createBufferInfoFromArrays(gl, arrays); }; }
javascript
function createBufferInfoFunc(fn) { return function(gl) { const arrays = fn.apply(null, Array.prototype.slice.call(arguments, 1)); return attributes.createBufferInfoFromArrays(gl, arrays); }; }
[ "function", "createBufferInfoFunc", "(", "fn", ")", "{", "return", "function", "(", "gl", ")", "{", "const", "arrays", "=", "fn", ".", "apply", "(", "null", ",", "Array", ".", "prototype", ".", "slice", ".", "call", "(", "arguments", ",", "1", ")", "...
creates a function that calls fn to create vertices and then creates a bufferInfo object for them @private
[ "creates", "a", "function", "that", "calls", "fn", "to", "create", "vertices", "and", "then", "creates", "a", "bufferInfo", "object", "for", "them" ]
ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd
https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/primitives.js#L1863-L1868
train
greggman/twgl.js
src/primitives.js
copyElements
function copyElements(src, dst, dstNdx, offset) { offset = offset || 0; const length = src.length; for (let ii = 0; ii < length; ++ii) { dst[dstNdx + ii] = src[ii] + offset; } }
javascript
function copyElements(src, dst, dstNdx, offset) { offset = offset || 0; const length = src.length; for (let ii = 0; ii < length; ++ii) { dst[dstNdx + ii] = src[ii] + offset; } }
[ "function", "copyElements", "(", "src", ",", "dst", ",", "dstNdx", ",", "offset", ")", "{", "offset", "=", "offset", "||", "0", ";", "const", "length", "=", "src", ".", "length", ";", "for", "(", "let", "ii", "=", "0", ";", "ii", "<", "length", "...
Copy elements from one array to another @param {Array|TypedArray} src source array @param {Array|TypedArray} dst dest array @param {number} dstNdx index in dest to copy src @param {number} [offset] offset to add to copied values @private
[ "Copy", "elements", "from", "one", "array", "to", "another" ]
ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd
https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/primitives.js#L1891-L1897
train
greggman/twgl.js
src/primitives.js
createArrayOfSameType
function createArrayOfSameType(srcArray, length) { const arraySrc = getArray(srcArray); const newArray = new arraySrc.constructor(length); let newArraySpec = newArray; // If it appears to have been augmented make new one augemented if (arraySrc.numComponents && arraySrc.numElements) { augmentTypedArray(ne...
javascript
function createArrayOfSameType(srcArray, length) { const arraySrc = getArray(srcArray); const newArray = new arraySrc.constructor(length); let newArraySpec = newArray; // If it appears to have been augmented make new one augemented if (arraySrc.numComponents && arraySrc.numElements) { augmentTypedArray(ne...
[ "function", "createArrayOfSameType", "(", "srcArray", ",", "length", ")", "{", "const", "arraySrc", "=", "getArray", "(", "srcArray", ")", ";", "const", "newArray", "=", "new", "arraySrc", ".", "constructor", "(", "length", ")", ";", "let", "newArraySpec", "...
Creates an array of the same time @param {(number[]|ArrayBufferView|module:twgl.FullArraySpec)} srcArray array who's type to copy @param {number} length size of new array @return {(number[]|ArrayBufferView|module:twgl.FullArraySpec)} array with same type as srcArray @private
[ "Creates", "an", "array", "of", "the", "same", "time" ]
ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd
https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/primitives.js#L1907-L1923
train
greggman/twgl.js
src/primitives.js
concatVertices
function concatVertices(arrayOfArrays) { const names = {}; let baseName; // get names of all arrays. // and numElements for each set of vertices for (let ii = 0; ii < arrayOfArrays.length; ++ii) { const arrays = arrayOfArrays[ii]; Object.keys(arrays).forEach(function(name) { // eslint-disable-line ...
javascript
function concatVertices(arrayOfArrays) { const names = {}; let baseName; // get names of all arrays. // and numElements for each set of vertices for (let ii = 0; ii < arrayOfArrays.length; ++ii) { const arrays = arrayOfArrays[ii]; Object.keys(arrays).forEach(function(name) { // eslint-disable-line ...
[ "function", "concatVertices", "(", "arrayOfArrays", ")", "{", "const", "names", "=", "{", "}", ";", "let", "baseName", ";", "// get names of all arrays.", "// and numElements for each set of vertices", "for", "(", "let", "ii", "=", "0", ";", "ii", "<", "arrayOfArr...
Concatinates sets of vertices Assumes the vertices match in composition. For example if one set of vertices has positions, normals, and indices all sets of vertices must have positions, normals, and indices and of the same type. Example: const cubeVertices = twgl.primtiives.createCubeVertices(2); const sphereVertice...
[ "Concatinates", "sets", "of", "vertices" ]
ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd
https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/primitives.js#L1950-L2019
train
greggman/twgl.js
src/primitives.js
getLengthOfCombinedArrays
function getLengthOfCombinedArrays(name) { let length = 0; let arraySpec; for (let ii = 0; ii < arrayOfArrays.length; ++ii) { const arrays = arrayOfArrays[ii]; const arrayInfo = arrays[name]; const array = getArray(arrayInfo); length += array.length; if (!arraySpec || arrayInfo...
javascript
function getLengthOfCombinedArrays(name) { let length = 0; let arraySpec; for (let ii = 0; ii < arrayOfArrays.length; ++ii) { const arrays = arrayOfArrays[ii]; const arrayInfo = arrays[name]; const array = getArray(arrayInfo); length += array.length; if (!arraySpec || arrayInfo...
[ "function", "getLengthOfCombinedArrays", "(", "name", ")", "{", "let", "length", "=", "0", ";", "let", "arraySpec", ";", "for", "(", "let", "ii", "=", "0", ";", "ii", "<", "arrayOfArrays", ".", "length", ";", "++", "ii", ")", "{", "const", "arrays", ...
compute length of combined array and return one for reference
[ "compute", "length", "of", "combined", "array", "and", "return", "one", "for", "reference" ]
ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd
https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/primitives.js#L1974-L1990
train
greggman/twgl.js
src/primitives.js
duplicateVertices
function duplicateVertices(arrays) { const newArrays = {}; Object.keys(arrays).forEach(function(name) { const arraySpec = arrays[name]; const srcArray = getArray(arraySpec); const newArraySpec = createArrayOfSameType(arraySpec, srcArray.length); copyElements(srcArray, getArray(newArraySpec), 0); ...
javascript
function duplicateVertices(arrays) { const newArrays = {}; Object.keys(arrays).forEach(function(name) { const arraySpec = arrays[name]; const srcArray = getArray(arraySpec); const newArraySpec = createArrayOfSameType(arraySpec, srcArray.length); copyElements(srcArray, getArray(newArraySpec), 0); ...
[ "function", "duplicateVertices", "(", "arrays", ")", "{", "const", "newArrays", "=", "{", "}", ";", "Object", ".", "keys", "(", "arrays", ")", ".", "forEach", "(", "function", "(", "name", ")", "{", "const", "arraySpec", "=", "arrays", "[", "name", "]"...
Creates a duplicate set of vertices This is useful for calling reorientVertices when you also want to keep the original available @param {module:twgl.Arrays} arrays of vertices @return {module:twgl.Arrays} The dupilicated vertices. @memberOf module:twgl/primitives
[ "Creates", "a", "duplicate", "set", "of", "vertices" ]
ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd
https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/primitives.js#L2031-L2041
train
isomorphic-git/isomorphic-git
src/models/PGP.js
printKey
function printKey () { let keyid = printKeyid(this.primaryKey.getKeyId()) let userid = printUser(this.getPrimaryUser().user) return keyid + ' ' + userid }
javascript
function printKey () { let keyid = printKeyid(this.primaryKey.getKeyId()) let userid = printUser(this.getPrimaryUser().user) return keyid + ' ' + userid }
[ "function", "printKey", "(", ")", "{", "let", "keyid", "=", "printKeyid", "(", "this", ".", "primaryKey", ".", "getKeyId", "(", ")", ")", "let", "userid", "=", "printUser", "(", "this", ".", "getPrimaryUser", "(", ")", ".", "user", ")", "return", "keyi...
Print a key
[ "Print", "a", "key" ]
fc29aba74ea55c798abb0274e0a032c6af90cb58
https://github.com/isomorphic-git/isomorphic-git/blob/fc29aba74ea55c798abb0274e0a032c6af90cb58/src/models/PGP.js#L10-L14
train
isomorphic-git/isomorphic-git
src/models/GitPackIndex.js
otherVarIntDecode
function otherVarIntDecode (reader, startWith) { let result = startWith let shift = 4 let byte = null do { byte = reader.readUInt8() result |= (byte & 0b01111111) << shift shift += 7 } while (byte & 0b10000000) return result }
javascript
function otherVarIntDecode (reader, startWith) { let result = startWith let shift = 4 let byte = null do { byte = reader.readUInt8() result |= (byte & 0b01111111) << shift shift += 7 } while (byte & 0b10000000) return result }
[ "function", "otherVarIntDecode", "(", "reader", ",", "startWith", ")", "{", "let", "result", "=", "startWith", "let", "shift", "=", "4", "let", "byte", "=", "null", "do", "{", "byte", "=", "reader", ".", "readUInt8", "(", ")", "result", "|=", "(", "byt...
I'm pretty much copying this one from the git C source code, because it makes no sense.
[ "I", "m", "pretty", "much", "copying", "this", "one", "from", "the", "git", "C", "source", "code", "because", "it", "makes", "no", "sense", "." ]
fc29aba74ea55c798abb0274e0a032c6af90cb58
https://github.com/isomorphic-git/isomorphic-git/blob/fc29aba74ea55c798abb0274e0a032c6af90cb58/src/models/GitPackIndex.js#L35-L45
train
isomorphic-git/isomorphic-git
src/models/GitIndex.js
parseCacheEntryFlags
function parseCacheEntryFlags (bits) { return { assumeValid: Boolean(bits & 0b1000000000000000), extended: Boolean(bits & 0b0100000000000000), stage: (bits & 0b0011000000000000) >> 12, nameLength: bits & 0b0000111111111111 } }
javascript
function parseCacheEntryFlags (bits) { return { assumeValid: Boolean(bits & 0b1000000000000000), extended: Boolean(bits & 0b0100000000000000), stage: (bits & 0b0011000000000000) >> 12, nameLength: bits & 0b0000111111111111 } }
[ "function", "parseCacheEntryFlags", "(", "bits", ")", "{", "return", "{", "assumeValid", ":", "Boolean", "(", "bits", "&", "0b1000000000000000", ")", ",", "extended", ":", "Boolean", "(", "bits", "&", "0b0100000000000000", ")", ",", "stage", ":", "(", "bits"...
Extract 1-bit assume-valid, 1-bit extended flag, 2-bit merge state flag, 12-bit path length flag
[ "Extract", "1", "-", "bit", "assume", "-", "valid", "1", "-", "bit", "extended", "flag", "2", "-", "bit", "merge", "state", "flag", "12", "-", "bit", "path", "length", "flag" ]
fc29aba74ea55c798abb0274e0a032c6af90cb58
https://github.com/isomorphic-git/isomorphic-git/blob/fc29aba74ea55c798abb0274e0a032c6af90cb58/src/models/GitIndex.js#L9-L16
train
jsonresume/resume-cli
lib/init.js
fillInit
function fillInit() { console.log('\nThis utility will generate a resume.json file in your current working directory.'); console.log('Fill out your name and email to get started, or leave the fields blank.'); console.log('All fields are optional.\n'); console.log('Press ^C at any time to quit.'); r...
javascript
function fillInit() { console.log('\nThis utility will generate a resume.json file in your current working directory.'); console.log('Fill out your name and email to get started, or leave the fields blank.'); console.log('All fields are optional.\n'); console.log('Press ^C at any time to quit.'); r...
[ "function", "fillInit", "(", ")", "{", "console", ".", "log", "(", "'\\nThis utility will generate a resume.json file in your current working directory.'", ")", ";", "console", ".", "log", "(", "'Fill out your name and email to get started, or leave the fields blank.'", ")", ";",...
slowly replace colors with chalk
[ "slowly", "replace", "colors", "with", "chalk" ]
229aa718f054ed4166275d8c1352d11319ffcab2
https://github.com/jsonresume/resume-cli/blob/229aa718f054ed4166275d8c1352d11319ffcab2/lib/init.js#L6-L46
train
zadvorsky/three.bas
dist/bas.module.js
ToonAnimationMaterial
function ToonAnimationMaterial(parameters) { if (!parameters.defines) { parameters.defines = {}; } parameters.defines['TOON'] = ''; PhongAnimationMaterial.call(this, parameters); }
javascript
function ToonAnimationMaterial(parameters) { if (!parameters.defines) { parameters.defines = {}; } parameters.defines['TOON'] = ''; PhongAnimationMaterial.call(this, parameters); }
[ "function", "ToonAnimationMaterial", "(", "parameters", ")", "{", "if", "(", "!", "parameters", ".", "defines", ")", "{", "parameters", ".", "defines", "=", "{", "}", ";", "}", "parameters", ".", "defines", "[", "'TOON'", "]", "=", "''", ";", "PhongAnima...
Extends THREE.MeshToonMaterial with custom shader chunks. MeshToonMaterial is mostly the same as MeshPhongMaterial. The only difference is a TOON define, and support for a gradientMap uniform. @param {Object} parameters Object containing material properties and custom shader chunks. @constructor
[ "Extends", "THREE", ".", "MeshToonMaterial", "with", "custom", "shader", "chunks", ".", "MeshToonMaterial", "is", "mostly", "the", "same", "as", "MeshPhongMaterial", ".", "The", "only", "difference", "is", "a", "TOON", "define", "and", "support", "for", "a", "...
e29194aae319c6b3dbd6e4a72ad6c9fa0fe67f44
https://github.com/zadvorsky/three.bas/blob/e29194aae319c6b3dbd6e4a72ad6c9fa0fe67f44/dist/bas.module.js#L363-L370
train
zadvorsky/three.bas
dist/bas.module.js
MultiPrefabBufferGeometry
function MultiPrefabBufferGeometry(prefabs, repeatCount) { BufferGeometry.call(this); if (Array.isArray(prefabs)) { this.prefabGeometries = prefabs; } else { this.prefabGeometries = [prefabs]; } this.prefabGeometriesCount = this.prefabGeometries.length; /** * Number of prefabs. * @type {Num...
javascript
function MultiPrefabBufferGeometry(prefabs, repeatCount) { BufferGeometry.call(this); if (Array.isArray(prefabs)) { this.prefabGeometries = prefabs; } else { this.prefabGeometries = [prefabs]; } this.prefabGeometriesCount = this.prefabGeometries.length; /** * Number of prefabs. * @type {Num...
[ "function", "MultiPrefabBufferGeometry", "(", "prefabs", ",", "repeatCount", ")", "{", "BufferGeometry", ".", "call", "(", "this", ")", ";", "if", "(", "Array", ".", "isArray", "(", "prefabs", ")", ")", "{", "this", ".", "prefabGeometries", "=", "prefabs", ...
A BufferGeometry where a 'prefab' geometry array is repeated a number of times. @param {Array} prefabs An array with Geometry instances to repeat. @param {Number} repeatCount The number of times to repeat the array of Geometries. @constructor
[ "A", "BufferGeometry", "where", "a", "prefab", "geometry", "array", "is", "repeated", "a", "number", "of", "times", "." ]
e29194aae319c6b3dbd6e4a72ad6c9fa0fe67f44
https://github.com/zadvorsky/three.bas/blob/e29194aae319c6b3dbd6e4a72ad6c9fa0fe67f44/dist/bas.module.js#L657-L696
train
zadvorsky/three.bas
dist/bas.module.js
InstancedPrefabBufferGeometry
function InstancedPrefabBufferGeometry(prefab, count) { if (prefab.isGeometry === true) { console.error('InstancedPrefabBufferGeometry prefab must be a BufferGeometry.'); } InstancedBufferGeometry.call(this); this.prefabGeometry = prefab; this.copy(prefab); this.maxInstancedCount = count; this.pref...
javascript
function InstancedPrefabBufferGeometry(prefab, count) { if (prefab.isGeometry === true) { console.error('InstancedPrefabBufferGeometry prefab must be a BufferGeometry.'); } InstancedBufferGeometry.call(this); this.prefabGeometry = prefab; this.copy(prefab); this.maxInstancedCount = count; this.pref...
[ "function", "InstancedPrefabBufferGeometry", "(", "prefab", ",", "count", ")", "{", "if", "(", "prefab", ".", "isGeometry", "===", "true", ")", "{", "console", ".", "error", "(", "'InstancedPrefabBufferGeometry prefab must be a BufferGeometry.'", ")", ";", "}", "Ins...
A wrapper around THREE.InstancedBufferGeometry, which is more memory efficient than PrefabBufferGeometry, but requires the ANGLE_instanced_arrays extension. @param {BufferGeometry} prefab The Geometry instance to repeat. @param {Number} count The number of times to repeat the geometry. @constructor
[ "A", "wrapper", "around", "THREE", ".", "InstancedBufferGeometry", "which", "is", "more", "memory", "efficient", "than", "PrefabBufferGeometry", "but", "requires", "the", "ANGLE_instanced_arrays", "extension", "." ]
e29194aae319c6b3dbd6e4a72ad6c9fa0fe67f44
https://github.com/zadvorsky/three.bas/blob/e29194aae319c6b3dbd6e4a72ad6c9fa0fe67f44/dist/bas.module.js#L907-L919
train
zadvorsky/three.bas
dist/bas.module.js
separateFaces
function separateFaces(geometry) { var vertices = []; for (var i = 0, il = geometry.faces.length; i < il; i++) { var n = vertices.length; var face = geometry.faces[i]; var a = face.a; var b = face.b; var c = face.c; var va = geometry.vertices[a]; var vb = geometry.ve...
javascript
function separateFaces(geometry) { var vertices = []; for (var i = 0, il = geometry.faces.length; i < il; i++) { var n = vertices.length; var face = geometry.faces[i]; var a = face.a; var b = face.b; var c = face.c; var va = geometry.vertices[a]; var vb = geometry.ve...
[ "function", "separateFaces", "(", "geometry", ")", "{", "var", "vertices", "=", "[", "]", ";", "for", "(", "var", "i", "=", "0", ",", "il", "=", "geometry", ".", "faces", ".", "length", ";", "i", "<", "il", ";", "i", "++", ")", "{", "var", "n",...
Duplicates vertices so each face becomes separate. Same as THREE.ExplodeModifier. @param {THREE.Geometry} geometry Geometry instance to modify.
[ "Duplicates", "vertices", "so", "each", "face", "becomes", "separate", ".", "Same", "as", "THREE", ".", "ExplodeModifier", "." ]
e29194aae319c6b3dbd6e4a72ad6c9fa0fe67f44
https://github.com/zadvorsky/three.bas/blob/e29194aae319c6b3dbd6e4a72ad6c9fa0fe67f44/dist/bas.module.js#L979-L1004
train
zadvorsky/three.bas
dist/bas.module.js
createDepthAnimationMaterial
function createDepthAnimationMaterial(sourceMaterial) { return new DepthAnimationMaterial({ uniforms: sourceMaterial.uniforms, defines: sourceMaterial.defines, vertexFunctions: sourceMaterial.vertexFunctions, vertexParameters: sourceMaterial.vertexParameters, vertexInit: sourceMaterial...
javascript
function createDepthAnimationMaterial(sourceMaterial) { return new DepthAnimationMaterial({ uniforms: sourceMaterial.uniforms, defines: sourceMaterial.defines, vertexFunctions: sourceMaterial.vertexFunctions, vertexParameters: sourceMaterial.vertexParameters, vertexInit: sourceMaterial...
[ "function", "createDepthAnimationMaterial", "(", "sourceMaterial", ")", "{", "return", "new", "DepthAnimationMaterial", "(", "{", "uniforms", ":", "sourceMaterial", ".", "uniforms", ",", "defines", ":", "sourceMaterial", ".", "defines", ",", "vertexFunctions", ":", ...
Create a THREE.BAS.DepthAnimationMaterial for shadows from a THREE.SpotLight or THREE.DirectionalLight by copying relevant shader chunks. Uniform values must be manually synced between the source material and the depth material. @see {@link http://three-bas-examples.surge.sh/examples/shadows/} @param {THREE.BAS.BaseA...
[ "Create", "a", "THREE", ".", "BAS", ".", "DepthAnimationMaterial", "for", "shadows", "from", "a", "THREE", ".", "SpotLight", "or", "THREE", ".", "DirectionalLight", "by", "copying", "relevant", "shader", "chunks", ".", "Uniform", "values", "must", "be", "manua...
e29194aae319c6b3dbd6e4a72ad6c9fa0fe67f44
https://github.com/zadvorsky/three.bas/blob/e29194aae319c6b3dbd6e4a72ad6c9fa0fe67f44/dist/bas.module.js#L1071-L1080
train
zadvorsky/three.bas
dist/bas.module.js
createDistanceAnimationMaterial
function createDistanceAnimationMaterial(sourceMaterial) { return new DistanceAnimationMaterial({ uniforms: sourceMaterial.uniforms, defines: sourceMaterial.defines, vertexFunctions: sourceMaterial.vertexFunctions, vertexParameters: sourceMaterial.vertexParameters, vertexInit: sourceMa...
javascript
function createDistanceAnimationMaterial(sourceMaterial) { return new DistanceAnimationMaterial({ uniforms: sourceMaterial.uniforms, defines: sourceMaterial.defines, vertexFunctions: sourceMaterial.vertexFunctions, vertexParameters: sourceMaterial.vertexParameters, vertexInit: sourceMa...
[ "function", "createDistanceAnimationMaterial", "(", "sourceMaterial", ")", "{", "return", "new", "DistanceAnimationMaterial", "(", "{", "uniforms", ":", "sourceMaterial", ".", "uniforms", ",", "defines", ":", "sourceMaterial", ".", "defines", ",", "vertexFunctions", "...
Create a THREE.BAS.DistanceAnimationMaterial for shadows from a THREE.PointLight by copying relevant shader chunks. Uniform values must be manually synced between the source material and the distance material. @see {@link http://three-bas-examples.surge.sh/examples/shadows/} @param {THREE.BAS.BaseAnimationMaterial} s...
[ "Create", "a", "THREE", ".", "BAS", ".", "DistanceAnimationMaterial", "for", "shadows", "from", "a", "THREE", ".", "PointLight", "by", "copying", "relevant", "shader", "chunks", ".", "Uniform", "values", "must", "be", "manually", "synced", "between", "the", "s...
e29194aae319c6b3dbd6e4a72ad6c9fa0fe67f44
https://github.com/zadvorsky/three.bas/blob/e29194aae319c6b3dbd6e4a72ad6c9fa0fe67f44/dist/bas.module.js#L1091-L1100
train
zadvorsky/three.bas
dist/bas.module.js
ModelBufferGeometry
function ModelBufferGeometry(model, options) { BufferGeometry.call(this); /** * A reference to the geometry used to create this instance. * @type {THREE.Geometry} */ this.modelGeometry = model; /** * Number of faces of the model. * @type {Number} */ this.faceCount = this.modelGeometry.face...
javascript
function ModelBufferGeometry(model, options) { BufferGeometry.call(this); /** * A reference to the geometry used to create this instance. * @type {THREE.Geometry} */ this.modelGeometry = model; /** * Number of faces of the model. * @type {Number} */ this.faceCount = this.modelGeometry.face...
[ "function", "ModelBufferGeometry", "(", "model", ",", "options", ")", "{", "BufferGeometry", ".", "call", "(", "this", ")", ";", "/**\n * A reference to the geometry used to create this instance.\n * @type {THREE.Geometry}\n */", "this", ".", "modelGeometry", "=", "mode...
A THREE.BufferGeometry for animating individual faces of a THREE.Geometry. @param {THREE.Geometry} model The THREE.Geometry to base this geometry on. @param {Object=} options @param {Boolean=} options.computeCentroids If true, a centroids will be computed for each face and stored in THREE.BAS.ModelBufferGeometry.centr...
[ "A", "THREE", ".", "BufferGeometry", "for", "animating", "individual", "faces", "of", "a", "THREE", ".", "Geometry", "." ]
e29194aae319c6b3dbd6e4a72ad6c9fa0fe67f44
https://github.com/zadvorsky/three.bas/blob/e29194aae319c6b3dbd6e4a72ad6c9fa0fe67f44/dist/bas.module.js#L1112-L1138
train
zadvorsky/three.bas
examples/audio_visual/main.js
function (start, end) { var total = 0; start = start || 0; end = end || this.binCount; for (var i = start; i < end; i++) { total += this.frequencyByteData[i]; } return total / (end - start); }
javascript
function (start, end) { var total = 0; start = start || 0; end = end || this.binCount; for (var i = start; i < end; i++) { total += this.frequencyByteData[i]; } return total / (end - start); }
[ "function", "(", "start", ",", "end", ")", "{", "var", "total", "=", "0", ";", "start", "=", "start", "||", "0", ";", "end", "=", "end", "||", "this", ".", "binCount", ";", "for", "(", "var", "i", "=", "start", ";", "i", "<", "end", ";", "i",...
not save if out of bounds
[ "not", "save", "if", "out", "of", "bounds" ]
e29194aae319c6b3dbd6e4a72ad6c9fa0fe67f44
https://github.com/zadvorsky/three.bas/blob/e29194aae319c6b3dbd6e4a72ad6c9fa0fe67f44/examples/audio_visual/main.js#L331-L342
train
zadvorsky/three.bas
examples/points_animation/main.js
getRandomPointOnSphere
function getRandomPointOnSphere(r) { var u = THREE.Math.randFloat(0, 1); var v = THREE.Math.randFloat(0, 1); var theta = 2 * Math.PI * u; var phi = Math.acos(2 * v - 1); var x = r * Math.sin(theta) * Math.sin(phi); var y = r * Math.cos(theta) * Math.sin(phi); var z = r * Math.cos(phi); return { x, ...
javascript
function getRandomPointOnSphere(r) { var u = THREE.Math.randFloat(0, 1); var v = THREE.Math.randFloat(0, 1); var theta = 2 * Math.PI * u; var phi = Math.acos(2 * v - 1); var x = r * Math.sin(theta) * Math.sin(phi); var y = r * Math.cos(theta) * Math.sin(phi); var z = r * Math.cos(phi); return { x, ...
[ "function", "getRandomPointOnSphere", "(", "r", ")", "{", "var", "u", "=", "THREE", ".", "Math", ".", "randFloat", "(", "0", ",", "1", ")", ";", "var", "v", "=", "THREE", ".", "Math", ".", "randFloat", "(", "0", ",", "1", ")", ";", "var", "theta"...
Get a random point on a sphere @param {Float} r Shpere radius @returns {Object} return the point's position
[ "Get", "a", "random", "point", "on", "a", "sphere" ]
e29194aae319c6b3dbd6e4a72ad6c9fa0fe67f44
https://github.com/zadvorsky/three.bas/blob/e29194aae319c6b3dbd6e4a72ad6c9fa0fe67f44/examples/points_animation/main.js#L58-L71
train
zadvorsky/three.bas
examples/points_animation/main.js
getPointsOnPicture
function getPointsOnPicture(selector) { var img = document.querySelector(selector); var width = img.width; var height = img.height; var canvas = document.createElement('canvas'); document.body.appendChild(canvas); canvas.width = width; canvas.height = height; var ctx = canvas.getContext('2d'); ctx.dr...
javascript
function getPointsOnPicture(selector) { var img = document.querySelector(selector); var width = img.width; var height = img.height; var canvas = document.createElement('canvas'); document.body.appendChild(canvas); canvas.width = width; canvas.height = height; var ctx = canvas.getContext('2d'); ctx.dr...
[ "function", "getPointsOnPicture", "(", "selector", ")", "{", "var", "img", "=", "document", ".", "querySelector", "(", "selector", ")", ";", "var", "width", "=", "img", ".", "width", ";", "var", "height", "=", "img", ".", "height", ";", "var", "canvas", ...
Translate a picture to a set of points @param {String} selector The DOM selector of image @returns {Array} return the set of points
[ "Translate", "a", "picture", "to", "a", "set", "of", "points" ]
e29194aae319c6b3dbd6e4a72ad6c9fa0fe67f44
https://github.com/zadvorsky/three.bas/blob/e29194aae319c6b3dbd6e4a72ad6c9fa0fe67f44/examples/points_animation/main.js#L79-L117
train
zadvorsky/three.bas
dist/bas.js
BasicAnimationMaterial
function BasicAnimationMaterial(parameters) { this.varyingParameters = []; this.vertexParameters = []; this.vertexFunctions = []; this.vertexInit = []; this.vertexNormal = []; this.vertexPosition = []; this.vertexColor = []; this.vertexPostMorph = []; this.vertexPostSkinning = []; this.fragmentFun...
javascript
function BasicAnimationMaterial(parameters) { this.varyingParameters = []; this.vertexParameters = []; this.vertexFunctions = []; this.vertexInit = []; this.vertexNormal = []; this.vertexPosition = []; this.vertexColor = []; this.vertexPostMorph = []; this.vertexPostSkinning = []; this.fragmentFun...
[ "function", "BasicAnimationMaterial", "(", "parameters", ")", "{", "this", ".", "varyingParameters", "=", "[", "]", ";", "this", ".", "vertexParameters", "=", "[", "]", ";", "this", ".", "vertexFunctions", "=", "[", "]", ";", "this", ".", "vertexInit", "="...
Extends THREE.MeshBasicMaterial with custom shader chunks. @see http://three-bas-examples.surge.sh/examples/materials_basic/ @param {Object} parameters Object containing material properties and custom shader chunks. @constructor
[ "Extends", "THREE", ".", "MeshBasicMaterial", "with", "custom", "shader", "chunks", "." ]
e29194aae319c6b3dbd6e4a72ad6c9fa0fe67f44
https://github.com/zadvorsky/three.bas/blob/e29194aae319c6b3dbd6e4a72ad6c9fa0fe67f44/dist/bas.js#L192-L215
train
zadvorsky/three.bas
dist/bas.js
PointsAnimationMaterial
function PointsAnimationMaterial(parameters) { this.varyingParameters = []; this.vertexFunctions = []; this.vertexParameters = []; this.vertexInit = []; this.vertexPosition = []; this.vertexColor = []; this.fragmentFunctions = []; this.fragmentParameters = []; this.fragmentInit = []; this.fragment...
javascript
function PointsAnimationMaterial(parameters) { this.varyingParameters = []; this.vertexFunctions = []; this.vertexParameters = []; this.vertexInit = []; this.vertexPosition = []; this.vertexColor = []; this.fragmentFunctions = []; this.fragmentParameters = []; this.fragmentInit = []; this.fragment...
[ "function", "PointsAnimationMaterial", "(", "parameters", ")", "{", "this", ".", "varyingParameters", "=", "[", "]", ";", "this", ".", "vertexFunctions", "=", "[", "]", ";", "this", ".", "vertexParameters", "=", "[", "]", ";", "this", ".", "vertexInit", "=...
Extends THREE.PointsMaterial with custom shader chunks. @param {Object} parameters Object containing material properties and custom shader chunks. @constructor
[ "Extends", "THREE", ".", "PointsMaterial", "with", "custom", "shader", "chunks", "." ]
e29194aae319c6b3dbd6e4a72ad6c9fa0fe67f44
https://github.com/zadvorsky/three.bas/blob/e29194aae319c6b3dbd6e4a72ad6c9fa0fe67f44/dist/bas.js#L384-L405
train
zadvorsky/three.bas
dist/bas.js
PrefabBufferGeometry
function PrefabBufferGeometry(prefab, count) { three.BufferGeometry.call(this); /** * A reference to the prefab geometry used to create this instance. * @type {Geometry|BufferGeometry} */ this.prefabGeometry = prefab; this.isPrefabBufferGeometry = prefab.isBufferGeometry; /** * Number of prefabs...
javascript
function PrefabBufferGeometry(prefab, count) { three.BufferGeometry.call(this); /** * A reference to the prefab geometry used to create this instance. * @type {Geometry|BufferGeometry} */ this.prefabGeometry = prefab; this.isPrefabBufferGeometry = prefab.isBufferGeometry; /** * Number of prefabs...
[ "function", "PrefabBufferGeometry", "(", "prefab", ",", "count", ")", "{", "three", ".", "BufferGeometry", ".", "call", "(", "this", ")", ";", "/**\n * A reference to the prefab geometry used to create this instance.\n * @type {Geometry|BufferGeometry}\n */", "this", ".",...
A BufferGeometry where a 'prefab' geometry is repeated a number of times. @param {Geometry|BufferGeometry} prefab The Geometry instance to repeat. @param {Number} count The number of times to repeat the geometry. @constructor
[ "A", "BufferGeometry", "where", "a", "prefab", "geometry", "is", "repeated", "a", "number", "of", "times", "." ]
e29194aae319c6b3dbd6e4a72ad6c9fa0fe67f44
https://github.com/zadvorsky/three.bas/blob/e29194aae319c6b3dbd6e4a72ad6c9fa0fe67f44/dist/bas.js#L474-L502
train
OpenVidu/openvidu
openvidu-browser/src/OpenViduInternal/KurentoUtils/kurento-jsonrpc/index.js
RpcNotification
function RpcNotification(method, params) { if(defineProperty_IE8) { this.method = method this.params = params } else { Object.defineProperty(this, 'method', {value: method, enumerable: true}); Object.defineProperty(this, 'params', {value: params, enumerable: true}); } }
javascript
function RpcNotification(method, params) { if(defineProperty_IE8) { this.method = method this.params = params } else { Object.defineProperty(this, 'method', {value: method, enumerable: true}); Object.defineProperty(this, 'params', {value: params, enumerable: true}); } }
[ "function", "RpcNotification", "(", "method", ",", "params", ")", "{", "if", "(", "defineProperty_IE8", ")", "{", "this", ".", "method", "=", "method", "this", ".", "params", "=", "params", "}", "else", "{", "Object", ".", "defineProperty", "(", "this", ...
Representation of a RPC notification @class @constructor @param {String} method -method of the notification @param params - parameters of the notification
[ "Representation", "of", "a", "RPC", "notification" ]
89db47dd37949ceab29e5228371a8fcab04d8d55
https://github.com/OpenVidu/openvidu/blob/89db47dd37949ceab29e5228371a8fcab04d8d55/openvidu-browser/src/OpenViduInternal/KurentoUtils/kurento-jsonrpc/index.js#L132-L144
train
OpenVidu/openvidu
openvidu-browser/src/OpenViduInternal/KurentoUtils/kurento-jsonrpc/index.js
storeResponse
function storeResponse(message, id, dest) { var response = { message: message, /** Timeout to auto-clean old responses */ timeout: setTimeout(function() { responses.remove(id, dest); }, response_timeout) }; responses.set(response, id, dest); }
javascript
function storeResponse(message, id, dest) { var response = { message: message, /** Timeout to auto-clean old responses */ timeout: setTimeout(function() { responses.remove(id, dest); }, response_timeout) }; responses.set(response, id, dest); }
[ "function", "storeResponse", "(", "message", ",", "id", ",", "dest", ")", "{", "var", "response", "=", "{", "message", ":", "message", ",", "/** Timeout to auto-clean old responses */", "timeout", ":", "setTimeout", "(", "function", "(", ")", "{", "responses", ...
Store the response to prevent to process duplicate request later
[ "Store", "the", "response", "to", "prevent", "to", "process", "duplicate", "request", "later" ]
89db47dd37949ceab29e5228371a8fcab04d8d55
https://github.com/OpenVidu/openvidu/blob/89db47dd37949ceab29e5228371a8fcab04d8d55/openvidu-browser/src/OpenViduInternal/KurentoUtils/kurento-jsonrpc/index.js#L289-L303
train
OpenVidu/openvidu
openvidu-browser/src/OpenViduInternal/KurentoUtils/kurento-jsonrpc/index.js
storeProcessedResponse
function storeProcessedResponse(ack, from) { var timeout = setTimeout(function() { processedResponses.remove(ack, from); }, duplicates_timeout); processedResponses.set(timeout, ack, from); }
javascript
function storeProcessedResponse(ack, from) { var timeout = setTimeout(function() { processedResponses.remove(ack, from); }, duplicates_timeout); processedResponses.set(timeout, ack, from); }
[ "function", "storeProcessedResponse", "(", "ack", ",", "from", ")", "{", "var", "timeout", "=", "setTimeout", "(", "function", "(", ")", "{", "processedResponses", ".", "remove", "(", "ack", ",", "from", ")", ";", "}", ",", "duplicates_timeout", ")", ";", ...
Store the response to ignore duplicated messages later
[ "Store", "the", "response", "to", "ignore", "duplicated", "messages", "later" ]
89db47dd37949ceab29e5228371a8fcab04d8d55
https://github.com/OpenVidu/openvidu/blob/89db47dd37949ceab29e5228371a8fcab04d8d55/openvidu-browser/src/OpenViduInternal/KurentoUtils/kurento-jsonrpc/index.js#L308-L317
train
midwayjs/midway
packages/midway-init/boilerplate/midway-ts-ant-design-pro-boilerplate/boilerplate/client/src/models/menu.js
formatter
function formatter(data, parentAuthority, parentName) { if (!data) { return undefined; } return data .map(item => { if (!item.name || !item.path) { return null; } let locale = 'menu'; if (parentName && parentName !== '/') { locale = `${parentName}.${item.name}`; ...
javascript
function formatter(data, parentAuthority, parentName) { if (!data) { return undefined; } return data .map(item => { if (!item.name || !item.path) { return null; } let locale = 'menu'; if (parentName && parentName !== '/') { locale = `${parentName}.${item.name}`; ...
[ "function", "formatter", "(", "data", ",", "parentAuthority", ",", "parentName", ")", "{", "if", "(", "!", "data", ")", "{", "return", "undefined", ";", "}", "return", "data", ".", "map", "(", "item", "=>", "{", "if", "(", "!", "item", ".", "name", ...
Conversion router to menu.
[ "Conversion", "router", "to", "menu", "." ]
e7aeb80dedc31d25d8ac0fbe5a789062a7da5eb8
https://github.com/midwayjs/midway/blob/e7aeb80dedc31d25d8ac0fbe5a789062a7da5eb8/packages/midway-init/boilerplate/midway-ts-ant-design-pro-boilerplate/boilerplate/client/src/models/menu.js#L5-L34
train
geotiffjs/geotiff.js
src/compression/lzw.js
getByte
function getByte(array, position, length) { const d = position % 8; const a = Math.floor(position / 8); const de = 8 - d; const ef = (position + length) - ((a + 1) * 8); let fg = (8 * (a + 2)) - (position + length); const dg = ((a + 2) * 8) - position; fg = Math.max(0, fg); if (a >= array.length) { ...
javascript
function getByte(array, position, length) { const d = position % 8; const a = Math.floor(position / 8); const de = 8 - d; const ef = (position + length) - ((a + 1) * 8); let fg = (8 * (a + 2)) - (position + length); const dg = ((a + 2) * 8) - position; fg = Math.max(0, fg); if (a >= array.length) { ...
[ "function", "getByte", "(", "array", ",", "position", ",", "length", ")", "{", "const", "d", "=", "position", "%", "8", ";", "const", "a", "=", "Math", ".", "floor", "(", "position", "/", "8", ")", ";", "const", "de", "=", "8", "-", "d", ";", "...
end of information
[ "end", "of", "information" ]
b2ac9467b943836664f10730676adcd3cef5a544
https://github.com/geotiffjs/geotiff.js/blob/b2ac9467b943836664f10730676adcd3cef5a544/src/compression/lzw.js#L8-L34
train
easysoft/zui
dist/js/zui.js
function(element, options) { var that = this; that.name = NAME; that.$ = $(element); options = that.options = $.extend({}, Pager.DEFAULTS, this.$.data(), options); var lang = options.lang || $.zui.clientLang(); that.lang = $.isPlainObject(lang) ? ($.extend(true, {}, ...
javascript
function(element, options) { var that = this; that.name = NAME; that.$ = $(element); options = that.options = $.extend({}, Pager.DEFAULTS, this.$.data(), options); var lang = options.lang || $.zui.clientLang(); that.lang = $.isPlainObject(lang) ? ($.extend(true, {}, ...
[ "function", "(", "element", ",", "options", ")", "{", "var", "that", "=", "this", ";", "that", ".", "name", "=", "NAME", ";", "that", ".", "$", "=", "$", "(", "element", ")", ";", "options", "=", "that", ".", "options", "=", "$", ".", "extend", ...
The pager model class
[ "The", "pager", "model", "class" ]
a5af01d76e9481d618d6abd3e873a8ee7e49c59f
https://github.com/easysoft/zui/blob/a5af01d76e9481d618d6abd3e873a8ee7e49c59f/dist/js/zui.js#L434-L465
train
easysoft/zui
dist/js/zui.js
function () { var ie = this.isIE() || this.isIE10() || false; if (ie) { for (var i = 10; i > 5; i--) { if (this.isIE(i)) { ie = i; break; } } } this.ie = ie; this.cssHelper(); }
javascript
function () { var ie = this.isIE() || this.isIE10() || false; if (ie) { for (var i = 10; i > 5; i--) { if (this.isIE(i)) { ie = i; break; } } } this.ie = ie; this.cssHelper(); }
[ "function", "(", ")", "{", "var", "ie", "=", "this", ".", "isIE", "(", ")", "||", "this", ".", "isIE10", "(", ")", "||", "false", ";", "if", "(", "ie", ")", "{", "for", "(", "var", "i", "=", "10", ";", "i", ">", "5", ";", "i", "--", ")", ...
The browser modal class
[ "The", "browser", "modal", "class" ]
a5af01d76e9481d618d6abd3e873a8ee7e49c59f
https://github.com/easysoft/zui/blob/a5af01d76e9481d618d6abd3e873a8ee7e49c59f/dist/js/zui.js#L1207-L1221
train
easysoft/zui
dist/js/zui.js
function() { // Since window has its own native 'resize' event, return false so that // jQuery will bind the event using DOM methods. Since only 'window' // objects have a .setTimeout method, this should be a sufficient test. // Unless, of course, we're throttling the 're...
javascript
function() { // Since window has its own native 'resize' event, return false so that // jQuery will bind the event using DOM methods. Since only 'window' // objects have a .setTimeout method, this should be a sufficient test. // Unless, of course, we're throttling the 're...
[ "function", "(", ")", "{", "// Since window has its own native 'resize' event, return false so that", "// jQuery will bind the event using DOM methods. Since only 'window'", "// objects have a .setTimeout method, this should be a sufficient test.", "// Unless, of course, we're throttling the 'resize' ...
Called only when the first 'resize' event callback is bound per element.
[ "Called", "only", "when", "the", "first", "resize", "event", "callback", "is", "bound", "per", "element", "." ]
a5af01d76e9481d618d6abd3e873a8ee7e49c59f
https://github.com/easysoft/zui/blob/a5af01d76e9481d618d6abd3e873a8ee7e49c59f/dist/js/zui.js#L1757-L1781
train
easysoft/zui
dist/js/zui.js
function() { // Since window has its own native 'resize' event, return false so that // jQuery will unbind the event using DOM methods. Since only 'window' // objects have a .setTimeout method, this should be a sufficient test. // Unless, of course, we're throttling the '...
javascript
function() { // Since window has its own native 'resize' event, return false so that // jQuery will unbind the event using DOM methods. Since only 'window' // objects have a .setTimeout method, this should be a sufficient test. // Unless, of course, we're throttling the '...
[ "function", "(", ")", "{", "// Since window has its own native 'resize' event, return false so that", "// jQuery will unbind the event using DOM methods. Since only 'window'", "// objects have a .setTimeout method, this should be a sufficient test.", "// Unless, of course, we're throttling the 'resize...
Called only when the last 'resize' event callback is unbound per element.
[ "Called", "only", "when", "the", "last", "resize", "event", "callback", "is", "unbound", "per", "element", "." ]
a5af01d76e9481d618d6abd3e873a8ee7e49c59f
https://github.com/easysoft/zui/blob/a5af01d76e9481d618d6abd3e873a8ee7e49c59f/dist/js/zui.js#L1784-L1805
train
easysoft/zui
dist/js/zui.js
new_handler
function new_handler(e, w, h) { var elem = $(this), data = $.data(this, str_data) || {}; // If called from the polling loop, w and h will be passed in as // arguments. If called manually, via .trigger( 'resize' ) or .resize(), // those...
javascript
function new_handler(e, w, h) { var elem = $(this), data = $.data(this, str_data) || {}; // If called from the polling loop, w and h will be passed in as // arguments. If called manually, via .trigger( 'resize' ) or .resize(), // those...
[ "function", "new_handler", "(", "e", ",", "w", ",", "h", ")", "{", "var", "elem", "=", "$", "(", "this", ")", ",", "data", "=", "$", ".", "data", "(", "this", ",", "str_data", ")", "||", "{", "}", ";", "// If called from the polling loop, w and h will ...
The new_handler function is executed every time the event is triggered. This is used to update the internal element data store with the width and height when the event is triggered manually, to avoid double-firing of the event callback. See the "Double firing issue in jQuery 1.3.2" comments above for more information.
[ "The", "new_handler", "function", "is", "executed", "every", "time", "the", "event", "is", "triggered", ".", "This", "is", "used", "to", "update", "the", "internal", "element", "data", "store", "with", "the", "width", "and", "height", "when", "the", "event",...
a5af01d76e9481d618d6abd3e873a8ee7e49c59f
https://github.com/easysoft/zui/blob/a5af01d76e9481d618d6abd3e873a8ee7e49c59f/dist/js/zui.js#L1825-L1836
train
easysoft/zui
dist/js/zui.js
function(modal, callback, redirect) { var originModal = modal; if($.isFunction(modal)) { var oldModal = redirect; redirect = callback; callback = modal; modal = oldModal; } modal = getModal(modal); if(modal && modal.length) { ...
javascript
function(modal, callback, redirect) { var originModal = modal; if($.isFunction(modal)) { var oldModal = redirect; redirect = callback; callback = modal; modal = oldModal; } modal = getModal(modal); if(modal && modal.length) { ...
[ "function", "(", "modal", ",", "callback", ",", "redirect", ")", "{", "var", "originModal", "=", "modal", ";", "if", "(", "$", ".", "isFunction", "(", "modal", ")", ")", "{", "var", "oldModal", "=", "redirect", ";", "redirect", "=", "callback", ";", ...
callback, redirect, modal
[ "callback", "redirect", "modal" ]
a5af01d76e9481d618d6abd3e873a8ee7e49c59f
https://github.com/easysoft/zui/blob/a5af01d76e9481d618d6abd3e873a8ee7e49c59f/dist/js/zui.js#L3779-L3798
train
easysoft/zui
dist/js/zui.js
function(element, options) { var that = this; that.name = NAME; that.$ = $(element); options = that.options = $.extend({trigger: 'contextmenu'}, ContextMenu.DEFAULTS, this.$.data(), options); var trigger = options.trigger; that.id = $.zui.uuid(); var eventHandl...
javascript
function(element, options) { var that = this; that.name = NAME; that.$ = $(element); options = that.options = $.extend({trigger: 'contextmenu'}, ContextMenu.DEFAULTS, this.$.data(), options); var trigger = options.trigger; that.id = $.zui.uuid(); var eventHandl...
[ "function", "(", "element", ",", "options", ")", "{", "var", "that", "=", "this", ";", "that", ".", "name", "=", "NAME", ";", "that", ".", "$", "=", "$", "(", "element", ")", ";", "options", "=", "that", ".", "options", "=", "$", ".", "extend", ...
The contextmenu model class
[ "The", "contextmenu", "model", "class" ]
a5af01d76e9481d618d6abd3e873a8ee7e49c59f
https://github.com/easysoft/zui/blob/a5af01d76e9481d618d6abd3e873a8ee7e49c59f/dist/js/zui.js#L4781-L4814
train
easysoft/zui
assets/live.js
function () { if (document.body) { // make sure all resources are loaded on first activation if (!loaded) Live.loadresources(); Live.checkForChanges(); } setTimeout(Live.heartbeat, interval); }
javascript
function () { if (document.body) { // make sure all resources are loaded on first activation if (!loaded) Live.loadresources(); Live.checkForChanges(); } setTimeout(Live.heartbeat, interval); }
[ "function", "(", ")", "{", "if", "(", "document", ".", "body", ")", "{", "// make sure all resources are loaded on first activation\r", "if", "(", "!", "loaded", ")", "Live", ".", "loadresources", "(", ")", ";", "Live", ".", "checkForChanges", "(", ")", ";", ...
performs a cycle per interval
[ "performs", "a", "cycle", "per", "interval" ]
a5af01d76e9481d618d6abd3e873a8ee7e49c59f
https://github.com/easysoft/zui/blob/a5af01d76e9481d618d6abd3e873a8ee7e49c59f/assets/live.js#L37-L44
train
easysoft/zui
assets/live.js
function () { // helper method to assert if a given url is local function isLocal(url) { var loc = document.location, reg = new RegExp("^\\.|^\/(?!\/)|^[\\w]((?!://).)*$|" + loc.protocol + "//" + loc.host); return url.match(reg); } // gather all resources ...
javascript
function () { // helper method to assert if a given url is local function isLocal(url) { var loc = document.location, reg = new RegExp("^\\.|^\/(?!\/)|^[\\w]((?!://).)*$|" + loc.protocol + "//" + loc.host); return url.match(reg); } // gather all resources ...
[ "function", "(", ")", "{", "// helper method to assert if a given url is local\r", "function", "isLocal", "(", "url", ")", "{", "var", "loc", "=", "document", ".", "location", ",", "reg", "=", "new", "RegExp", "(", "\"^\\\\.|^\\/(?!\\/)|^[\\\\w]((?!://).)*$|\"", "+", ...
loads all local css and js resources upon first activation
[ "loads", "all", "local", "css", "and", "js", "resources", "upon", "first", "activation" ]
a5af01d76e9481d618d6abd3e873a8ee7e49c59f
https://github.com/easysoft/zui/blob/a5af01d76e9481d618d6abd3e873a8ee7e49c59f/assets/live.js#L47-L104
train
easysoft/zui
assets/live.js
isLocal
function isLocal(url) { var loc = document.location, reg = new RegExp("^\\.|^\/(?!\/)|^[\\w]((?!://).)*$|" + loc.protocol + "//" + loc.host); return url.match(reg); }
javascript
function isLocal(url) { var loc = document.location, reg = new RegExp("^\\.|^\/(?!\/)|^[\\w]((?!://).)*$|" + loc.protocol + "//" + loc.host); return url.match(reg); }
[ "function", "isLocal", "(", "url", ")", "{", "var", "loc", "=", "document", ".", "location", ",", "reg", "=", "new", "RegExp", "(", "\"^\\\\.|^\\/(?!\\/)|^[\\\\w]((?!://).)*$|\"", "+", "loc", ".", "protocol", "+", "\"//\"", "+", "loc", ".", "host", ")", ";...
helper method to assert if a given url is local
[ "helper", "method", "to", "assert", "if", "a", "given", "url", "is", "local" ]
a5af01d76e9481d618d6abd3e873a8ee7e49c59f
https://github.com/easysoft/zui/blob/a5af01d76e9481d618d6abd3e873a8ee7e49c59f/assets/live.js#L50-L54
train
easysoft/zui
assets/live.js
function () { for (var url in resources) { if (pendingRequests[url]) continue; Live.getHead(url, function (url, newInfo) { var oldInfo = resources[url], hasChanged = false; resources[url] = newInfo; for (var header in oldInfo) { ...
javascript
function () { for (var url in resources) { if (pendingRequests[url]) continue; Live.getHead(url, function (url, newInfo) { var oldInfo = resources[url], hasChanged = false; resources[url] = newInfo; for (var header in oldInfo) { ...
[ "function", "(", ")", "{", "for", "(", "var", "url", "in", "resources", ")", "{", "if", "(", "pendingRequests", "[", "url", "]", ")", "continue", ";", "Live", ".", "getHead", "(", "url", ",", "function", "(", "url", ",", "newInfo", ")", "{", "var",...
check all tracking resources for changes
[ "check", "all", "tracking", "resources", "for", "changes" ]
a5af01d76e9481d618d6abd3e873a8ee7e49c59f
https://github.com/easysoft/zui/blob/a5af01d76e9481d618d6abd3e873a8ee7e49c59f/assets/live.js#L107-L137
train
easysoft/zui
assets/live.js
function (url, type) { switch (type.toLowerCase()) { // css files can be reloaded dynamically by replacing the link element case "text/css": var link = currentLinkElements[url], html = document.body.parentNode, head = link....
javascript
function (url, type) { switch (type.toLowerCase()) { // css files can be reloaded dynamically by replacing the link element case "text/css": var link = currentLinkElements[url], html = document.body.parentNode, head = link....
[ "function", "(", "url", ",", "type", ")", "{", "switch", "(", "type", ".", "toLowerCase", "(", ")", ")", "{", "// css files can be reloaded dynamically by replacing the link element \r", "case", "\"text/css\"", ":", "var", "link", "=", "cur...
act upon a changed url of certain content type
[ "act", "upon", "a", "changed", "url", "of", "certain", "content", "type" ]
a5af01d76e9481d618d6abd3e873a8ee7e49c59f
https://github.com/easysoft/zui/blob/a5af01d76e9481d618d6abd3e873a8ee7e49c59f/assets/live.js#L140-L173
train
easysoft/zui
assets/live.js
function () { var pending = 0; for (var url in oldLinkElements) { // if this sheet has any cssRules, delete the old link try { var link = currentLinkElements[url], oldLink = oldLinkElements[url], html = document.body.parentNode, she...
javascript
function () { var pending = 0; for (var url in oldLinkElements) { // if this sheet has any cssRules, delete the old link try { var link = currentLinkElements[url], oldLink = oldLinkElements[url], html = document.body.parentNode, she...
[ "function", "(", ")", "{", "var", "pending", "=", "0", ";", "for", "(", "var", "url", "in", "oldLinkElements", ")", "{", "// if this sheet has any cssRules, delete the old link\r", "try", "{", "var", "link", "=", "currentLinkElements", "[", "url", "]", ",", "o...
removes the old stylesheet rules only once the new one has finished loading
[ "removes", "the", "old", "stylesheet", "rules", "only", "once", "the", "new", "one", "has", "finished", "loading" ]
a5af01d76e9481d618d6abd3e873a8ee7e49c59f
https://github.com/easysoft/zui/blob/a5af01d76e9481d618d6abd3e873a8ee7e49c59f/assets/live.js#L176-L198
train
easysoft/zui
assets/live.js
function (url, callback) { pendingRequests[url] = true; var xhr = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XmlHttp"); xhr.open("HEAD", url, true); xhr.onreadystatechange = function () { delete pendingRequests[url]; if (xhr.readyState == 4 ...
javascript
function (url, callback) { pendingRequests[url] = true; var xhr = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XmlHttp"); xhr.open("HEAD", url, true); xhr.onreadystatechange = function () { delete pendingRequests[url]; if (xhr.readyState == 4 ...
[ "function", "(", "url", ",", "callback", ")", "{", "pendingRequests", "[", "url", "]", "=", "true", ";", "var", "xhr", "=", "window", ".", "XMLHttpRequest", "?", "new", "XMLHttpRequest", "(", ")", ":", "new", "ActiveXObject", "(", "\"Microsoft.XmlHttp\"", ...
performs a HEAD request and passes the header info to the given callback
[ "performs", "a", "HEAD", "request", "and", "passes", "the", "header", "info", "to", "the", "given", "callback" ]
a5af01d76e9481d618d6abd3e873a8ee7e49c59f
https://github.com/easysoft/zui/blob/a5af01d76e9481d618d6abd3e873a8ee7e49c59f/assets/live.js#L201-L221
train
easysoft/zui
dist/lib/markdoc/zui.markdoc.js
function(element, options) { var that = this; that.name = NAME; that.$ = $(element); that.options = $.extend({}, MarkDoc.DEFAULTS, this.$.data(), options); that.$.data('originContent', that.$.text()); that.render(); }
javascript
function(element, options) { var that = this; that.name = NAME; that.$ = $(element); that.options = $.extend({}, MarkDoc.DEFAULTS, this.$.data(), options); that.$.data('originContent', that.$.text()); that.render(); }
[ "function", "(", "element", ",", "options", ")", "{", "var", "that", "=", "this", ";", "that", ".", "name", "=", "NAME", ";", "that", ".", "$", "=", "$", "(", "element", ")", ";", "that", ".", "options", "=", "$", ".", "extend", "(", "{", "}", ...
model name The markdoc model class
[ "model", "name", "The", "markdoc", "model", "class" ]
a5af01d76e9481d618d6abd3e873a8ee7e49c59f
https://github.com/easysoft/zui/blob/a5af01d76e9481d618d6abd3e873a8ee7e49c59f/dist/lib/markdoc/zui.markdoc.js#L1311-L1319
train
easysoft/zui
dist/lib/chart/zui.chart.js
function(easeDecimal) { var animDecimal = (easeDecimal) ? easeDecimal : 1; this.clear(); // ZUI change begin var labelPositionMap; // ZUI change end helpers.each(this.segments, function(segment, index) { segment.transition({ ...
javascript
function(easeDecimal) { var animDecimal = (easeDecimal) ? easeDecimal : 1; this.clear(); // ZUI change begin var labelPositionMap; // ZUI change end helpers.each(this.segments, function(segment, index) { segment.transition({ ...
[ "function", "(", "easeDecimal", ")", "{", "var", "animDecimal", "=", "(", "easeDecimal", ")", "?", "easeDecimal", ":", "1", ";", "this", ".", "clear", "(", ")", ";", "// ZUI change begin", "var", "labelPositionMap", ";", "// ZUI change end", "helpers", ".", ...
ZUI change end
[ "ZUI", "change", "end" ]
a5af01d76e9481d618d6abd3e873a8ee7e49c59f
https://github.com/easysoft/zui/blob/a5af01d76e9481d618d6abd3e873a8ee7e49c59f/dist/lib/chart/zui.chart.js#L2822-L2872
train
easysoft/zui
assets/plupload/plupload.dev.js
normalizeCaps
function normalizeCaps(settings) { var features = settings.required_features, caps = {}; function resolve(feature, value, strict) { // Feature notation is deprecated, use caps (this thing here is required for backward compatibility) var map = { chunks: 'slice_blob', jpgresize: 'send_binary_string', pngr...
javascript
function normalizeCaps(settings) { var features = settings.required_features, caps = {}; function resolve(feature, value, strict) { // Feature notation is deprecated, use caps (this thing here is required for backward compatibility) var map = { chunks: 'slice_blob', jpgresize: 'send_binary_string', pngr...
[ "function", "normalizeCaps", "(", "settings", ")", "{", "var", "features", "=", "settings", ".", "required_features", ",", "caps", "=", "{", "}", ";", "function", "resolve", "(", "feature", ",", "value", ",", "strict", ")", "{", "// Feature notation is depreca...
convert plupload features to caps acceptable by mOxie
[ "convert", "plupload", "features", "to", "caps", "acceptable", "by", "mOxie" ]
a5af01d76e9481d618d6abd3e873a8ee7e49c59f
https://github.com/easysoft/zui/blob/a5af01d76e9481d618d6abd3e873a8ee7e49c59f/assets/plupload/plupload.dev.js#L46-L100
train
easysoft/zui
assets/plupload/plupload.dev.js
function(str) { var xmlEncodeChars = {'<' : 'lt', '>' : 'gt', '&' : 'amp', '"' : 'quot', '\'' : '#39'}, xmlEncodeRegExp = /[<>&\"\']/g; return str ? ('' + str).replace(xmlEncodeRegExp, function(chr) { return xmlEncodeChars[chr] ? '&' + xmlEncodeChars[chr] + ';' : chr; }) : str; }
javascript
function(str) { var xmlEncodeChars = {'<' : 'lt', '>' : 'gt', '&' : 'amp', '"' : 'quot', '\'' : '#39'}, xmlEncodeRegExp = /[<>&\"\']/g; return str ? ('' + str).replace(xmlEncodeRegExp, function(chr) { return xmlEncodeChars[chr] ? '&' + xmlEncodeChars[chr] + ';' : chr; }) : str; }
[ "function", "(", "str", ")", "{", "var", "xmlEncodeChars", "=", "{", "'<'", ":", "'lt'", ",", "'>'", ":", "'gt'", ",", "'&'", ":", "'amp'", ",", "'\"'", ":", "'quot'", ",", "'\\''", ":", "'#39'", "}", ",", "xmlEncodeRegExp", "=", "/", "[<>&\\\"\\']",...
Encodes the specified string. @method xmlEncode @static @param {String} s String to encode. @return {String} Encoded string.
[ "Encodes", "the", "specified", "string", "." ]
a5af01d76e9481d618d6abd3e873a8ee7e49c59f
https://github.com/easysoft/zui/blob/a5af01d76e9481d618d6abd3e873a8ee7e49c59f/assets/plupload/plupload.dev.js#L404-L410
train
easysoft/zui
assets/plupload/plupload.dev.js
function(url, items) { var query = ''; plupload.each(items, function(value, name) { query += (query ? '&' : '') + encodeURIComponent(name) + '=' + encodeURIComponent(value); }); if (query) { url += (url.indexOf('?') > 0 ? '&' : '?') + query; } return url; }
javascript
function(url, items) { var query = ''; plupload.each(items, function(value, name) { query += (query ? '&' : '') + encodeURIComponent(name) + '=' + encodeURIComponent(value); }); if (query) { url += (url.indexOf('?') > 0 ? '&' : '?') + query; } return url; }
[ "function", "(", "url", ",", "items", ")", "{", "var", "query", "=", "''", ";", "plupload", ".", "each", "(", "items", ",", "function", "(", "value", ",", "name", ")", "{", "query", "+=", "(", "query", "?", "'&'", ":", "''", ")", "+", "encodeURIC...
Builds a full url out of a base URL and an object with items to append as query string items. @method buildUrl @static @param {String} url Base URL to append query string items to. @param {Object} items Name/value object to serialize as a querystring. @return {String} String with url + serialized query string items.
[ "Builds", "a", "full", "url", "out", "of", "a", "base", "URL", "and", "an", "object", "with", "items", "to", "append", "as", "query", "string", "items", "." ]
a5af01d76e9481d618d6abd3e873a8ee7e49c59f
https://github.com/easysoft/zui/blob/a5af01d76e9481d618d6abd3e873a8ee7e49c59f/assets/plupload/plupload.dev.js#L604-L616
train
easysoft/zui
assets/plupload/plupload.dev.js
function(size) { if (size === undef || /\D/.test(size)) { return plupload.translate('N/A'); } function round(num, precision) { return Math.round(num * Math.pow(10, precision)) / Math.pow(10, precision); } var boundary = Math.pow(1024, 4); // TB if (size > boundary) { return round(size / bound...
javascript
function(size) { if (size === undef || /\D/.test(size)) { return plupload.translate('N/A'); } function round(num, precision) { return Math.round(num * Math.pow(10, precision)) / Math.pow(10, precision); } var boundary = Math.pow(1024, 4); // TB if (size > boundary) { return round(size / bound...
[ "function", "(", "size", ")", "{", "if", "(", "size", "===", "undef", "||", "/", "\\D", "/", ".", "test", "(", "size", ")", ")", "{", "return", "plupload", ".", "translate", "(", "'N/A'", ")", ";", "}", "function", "round", "(", "num", ",", "prec...
Formats the specified number as a size string for example 1024 becomes 1 KB. @method formatSize @static @param {Number} size Size to format as string. @return {String} Formatted size string.
[ "Formats", "the", "specified", "number", "as", "a", "size", "string", "for", "example", "1024", "becomes", "1", "KB", "." ]
a5af01d76e9481d618d6abd3e873a8ee7e49c59f
https://github.com/easysoft/zui/blob/a5af01d76e9481d618d6abd3e873a8ee7e49c59f/assets/plupload/plupload.dev.js#L626-L659
train
easysoft/zui
assets/plupload/plupload.dev.js
onBeforeUpload
function onBeforeUpload(up, file) { // Generate unique target filenames if (up.settings.unique_names) { var matches = file.name.match(/\.([^.]+)$/), ext = "part"; if (matches) { ext = matches[1]; } file.target_name = file.id + '.' + ext; } }
javascript
function onBeforeUpload(up, file) { // Generate unique target filenames if (up.settings.unique_names) { var matches = file.name.match(/\.([^.]+)$/), ext = "part"; if (matches) { ext = matches[1]; } file.target_name = file.id + '.' + ext; } }
[ "function", "onBeforeUpload", "(", "up", ",", "file", ")", "{", "// Generate unique target filenames", "if", "(", "up", ".", "settings", ".", "unique_names", ")", "{", "var", "matches", "=", "file", ".", "name", ".", "match", "(", "/", "\\.([^.]+)$", "/", ...
Internal event handlers
[ "Internal", "event", "handlers" ]
a5af01d76e9481d618d6abd3e873a8ee7e49c59f
https://github.com/easysoft/zui/blob/a5af01d76e9481d618d6abd3e873a8ee7e49c59f/assets/plupload/plupload.dev.js#L1436-L1445
train
easysoft/zui
assets/plupload/plupload.dev.js
function(id) { var i; for (i = files.length - 1; i >= 0; i--) { if (files[i].id === id) { return files[i]; } } }
javascript
function(id) { var i; for (i = files.length - 1; i >= 0; i--) { if (files[i].id === id) { return files[i]; } } }
[ "function", "(", "id", ")", "{", "var", "i", ";", "for", "(", "i", "=", "files", ".", "length", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "if", "(", "files", "[", "i", "]", ".", "id", "===", "id", ")", "{", "return", "files...
Returns the specified file object by id. @method getFile @param {String} id File id to look for. @return {plupload.File} File object or undefined if it wasn't found;
[ "Returns", "the", "specified", "file", "object", "by", "id", "." ]
a5af01d76e9481d618d6abd3e873a8ee7e49c59f
https://github.com/easysoft/zui/blob/a5af01d76e9481d618d6abd3e873a8ee7e49c59f/assets/plupload/plupload.dev.js#L2005-L2012
train
easysoft/zui
assets/plupload/plupload.dev.js
function(file) { var id = typeof(file) === 'string' ? file : file.id; for (var i = files.length - 1; i >= 0; i--) { if (files[i].id === id) { return this.splice(i, 1)[0]; } } }
javascript
function(file) { var id = typeof(file) === 'string' ? file : file.id; for (var i = files.length - 1; i >= 0; i--) { if (files[i].id === id) { return this.splice(i, 1)[0]; } } }
[ "function", "(", "file", ")", "{", "var", "id", "=", "typeof", "(", "file", ")", "===", "'string'", "?", "file", ":", "file", ".", "id", ";", "for", "(", "var", "i", "=", "files", ".", "length", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ...
Removes a specific file. @method removeFile @param {plupload.File|String} file File to remove from queue.
[ "Removes", "a", "specific", "file", "." ]
a5af01d76e9481d618d6abd3e873a8ee7e49c59f
https://github.com/easysoft/zui/blob/a5af01d76e9481d618d6abd3e873a8ee7e49c59f/assets/plupload/plupload.dev.js#L2126-L2134
train
easysoft/zui
assets/plupload/plupload.dev.js
function(start, length) { // Splice and trigger events var removed = files.splice(start === undef ? 0 : start, length === undef ? files.length : length); // if upload is in progress we need to stop it and restart after files are removed var restartRequired = false; if (this.state == plupload.STARTED) { ...
javascript
function(start, length) { // Splice and trigger events var removed = files.splice(start === undef ? 0 : start, length === undef ? files.length : length); // if upload is in progress we need to stop it and restart after files are removed var restartRequired = false; if (this.state == plupload.STARTED) { ...
[ "function", "(", "start", ",", "length", ")", "{", "// Splice and trigger events", "var", "removed", "=", "files", ".", "splice", "(", "start", "===", "undef", "?", "0", ":", "start", ",", "length", "===", "undef", "?", "files", ".", "length", ":", "leng...
Removes part of the queue and returns the files removed. This will also trigger the FilesRemoved and QueueChanged events. @method splice @param {Number} [start=0] Start index to remove from. @param {Number} [length] Number of files to remove (defaults to number of files in the queue). @return {Array} Array of files th...
[ "Removes", "part", "of", "the", "queue", "and", "returns", "the", "files", "removed", ".", "This", "will", "also", "trigger", "the", "FilesRemoved", "and", "QueueChanged", "events", "." ]
a5af01d76e9481d618d6abd3e873a8ee7e49c59f
https://github.com/easysoft/zui/blob/a5af01d76e9481d618d6abd3e873a8ee7e49c59f/assets/plupload/plupload.dev.js#L2145-L2176
train
easysoft/zui
assets/plupload/plupload.dev.js
function(type) { var list, args, result; type = type.toLowerCase(); list = this.hasEventListener(type); if (list) { // sort event list by priority list.sort(function(a, b) { return b.priority - a.priority; }); // first argument should be current plupload.Uploader instance args = [].slice...
javascript
function(type) { var list, args, result; type = type.toLowerCase(); list = this.hasEventListener(type); if (list) { // sort event list by priority list.sort(function(a, b) { return b.priority - a.priority; }); // first argument should be current plupload.Uploader instance args = [].slice...
[ "function", "(", "type", ")", "{", "var", "list", ",", "args", ",", "result", ";", "type", "=", "type", ".", "toLowerCase", "(", ")", ";", "list", "=", "this", ".", "hasEventListener", "(", "type", ")", ";", "if", "(", "list", ")", "{", "// sort ev...
Dispatches the specified event name and its arguments to all listeners. @method trigger @param {String} name Event name to fire. @param {Object..} Multiple arguments to pass along to the listener functions. override the parent method to match Plupload-like event logic
[ "Dispatches", "the", "specified", "event", "name", "and", "its", "arguments", "to", "all", "listeners", "." ]
a5af01d76e9481d618d6abd3e873a8ee7e49c59f
https://github.com/easysoft/zui/blob/a5af01d76e9481d618d6abd3e873a8ee7e49c59f/assets/plupload/plupload.dev.js#L2187-L2211
train
easysoft/zui
assets/plupload/plupload.dev.js
function() { var file = this.getSource().getSource(); return plupload.inArray(plupload.typeOf(file), ['blob', 'file']) !== -1 ? file : null; }
javascript
function() { var file = this.getSource().getSource(); return plupload.inArray(plupload.typeOf(file), ['blob', 'file']) !== -1 ? file : null; }
[ "function", "(", ")", "{", "var", "file", "=", "this", ".", "getSource", "(", ")", ".", "getSource", "(", ")", ";", "return", "plupload", ".", "inArray", "(", "plupload", ".", "typeOf", "(", "file", ")", ",", "[", "'blob'", ",", "'file'", "]", ")",...
Returns native window.File object, when it's available. @method getNative @return {window.File} or null, if plupload.File is of different origin
[ "Returns", "native", "window", ".", "File", "object", "when", "it", "s", "available", "." ]
a5af01d76e9481d618d6abd3e873a8ee7e49c59f
https://github.com/easysoft/zui/blob/a5af01d76e9481d618d6abd3e873a8ee7e49c59f/assets/plupload/plupload.dev.js#L2379-L2382
train
easysoft/zui
dist/lib/selectable/zui.selectable.js
function(element, options) { this.name = name; this.$ = $(element); this.id = $.zui.uuid(); this.selectOrder = 1; this.selections = {}; this.getOptions(options); this._init(); }
javascript
function(element, options) { this.name = name; this.$ = $(element); this.id = $.zui.uuid(); this.selectOrder = 1; this.selections = {}; this.getOptions(options); this._init(); }
[ "function", "(", "element", ",", "options", ")", "{", "this", ".", "name", "=", "name", ";", "this", ".", "$", "=", "$", "(", "element", ")", ";", "this", ".", "id", "=", "$", ".", "zui", ".", "uuid", "(", ")", ";", "this", ".", "selectOrder", ...
module name The selectable modal class
[ "module", "name", "The", "selectable", "modal", "class" ]
a5af01d76e9481d618d6abd3e873a8ee7e49c59f
https://github.com/easysoft/zui/blob/a5af01d76e9481d618d6abd3e873a8ee7e49c59f/dist/lib/selectable/zui.selectable.js#L22-L31
train
popeindustries/lit-html-server
src/template.js
getTagState
function getTagState(string) { for (let i = string.length - 1; i >= 0; i--) { const char = string[i]; if (char === '>') { return 0; } else if (char === '<') { return 1; } } return -1; }
javascript
function getTagState(string) { for (let i = string.length - 1; i >= 0; i--) { const char = string[i]; if (char === '>') { return 0; } else if (char === '<') { return 1; } } return -1; }
[ "function", "getTagState", "(", "string", ")", "{", "for", "(", "let", "i", "=", "string", ".", "length", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "const", "char", "=", "string", "[", "i", "]", ";", "if", "(", "char", "===", "...
Determine if 'string' terminates with an opened or closed tag. Iterating through all characters has at worst a time complexity of O(n), and is better than the alternative (using "indexOf/lastIndexOf") which is potentially O(2n). @param { string } string @returns { number } - returns "-1" if no tag, "0" if closed tag,...
[ "Determine", "if", "string", "terminates", "with", "an", "opened", "or", "closed", "tag", "." ]
ad5cd24db5bd1352b7af6fc0543947a7711056d4
https://github.com/popeindustries/lit-html-server/blob/ad5cd24db5bd1352b7af6fc0543947a7711056d4/src/template.js#L123-L135
train
popeindustries/lit-html-server
src/directives/unsafe-html.js
unsafeHTMLDirective
function unsafeHTMLDirective(value) { return function(part) { if (!isNodePart(part)) { throw Error('The `unsafeHTML` directive can only be used in text nodes'); } part.setValue(`${unsafePrefixString}${value}`); }; }
javascript
function unsafeHTMLDirective(value) { return function(part) { if (!isNodePart(part)) { throw Error('The `unsafeHTML` directive can only be used in text nodes'); } part.setValue(`${unsafePrefixString}${value}`); }; }
[ "function", "unsafeHTMLDirective", "(", "value", ")", "{", "return", "function", "(", "part", ")", "{", "if", "(", "!", "isNodePart", "(", "part", ")", ")", "{", "throw", "Error", "(", "'The `unsafeHTML` directive can only be used in text nodes'", ")", ";", "}",...
Render "value" without HTML escaping @param { string } value @returns { (part: NodePart) => void }
[ "Render", "value", "without", "HTML", "escaping" ]
ad5cd24db5bd1352b7af6fc0543947a7711056d4
https://github.com/popeindustries/lit-html-server/blob/ad5cd24db5bd1352b7af6fc0543947a7711056d4/src/directives/unsafe-html.js#L11-L18
train
popeindustries/lit-html-server
src/template-result.js
reduce
function reduce(buffer, chunks, chunk, deep = false) { if (Buffer.isBuffer(chunk)) { return Buffer.concat([buffer, chunk], buffer.length + chunk.length); } else if (isTemplateResult(chunk)) { if (deep) { return reduce(buffer, chunks, chunk.read(deep), deep); } else { chunks.push(buffer, chun...
javascript
function reduce(buffer, chunks, chunk, deep = false) { if (Buffer.isBuffer(chunk)) { return Buffer.concat([buffer, chunk], buffer.length + chunk.length); } else if (isTemplateResult(chunk)) { if (deep) { return reduce(buffer, chunks, chunk.read(deep), deep); } else { chunks.push(buffer, chun...
[ "function", "reduce", "(", "buffer", ",", "chunks", ",", "chunk", ",", "deep", "=", "false", ")", "{", "if", "(", "Buffer", ".", "isBuffer", "(", "chunk", ")", ")", "{", "return", "Buffer", ".", "concat", "(", "[", "buffer", ",", "chunk", "]", ",",...
Commit "chunk" to string "buffer". Returns new "buffer" value. @param { Buffer } buffer @param { Array<any> } chunks @param { any } chunk @param { boolean } [deep] @returns { Buffer }
[ "Commit", "chunk", "to", "string", "buffer", ".", "Returns", "new", "buffer", "value", "." ]
ad5cd24db5bd1352b7af6fc0543947a7711056d4
https://github.com/popeindustries/lit-html-server/blob/ad5cd24db5bd1352b7af6fc0543947a7711056d4/src/template-result.js#L167-L183
train
popeindustries/lit-html-server
src/directives/repeat.js
repeatDirective
function repeatDirective(items, keyFnOrTemplate, template) { if (template === undefined) { template = keyFnOrTemplate; } return function(part) { part.setValue(items.map((item, index) => template(item, index))); }; }
javascript
function repeatDirective(items, keyFnOrTemplate, template) { if (template === undefined) { template = keyFnOrTemplate; } return function(part) { part.setValue(items.map((item, index) => template(item, index))); }; }
[ "function", "repeatDirective", "(", "items", ",", "keyFnOrTemplate", ",", "template", ")", "{", "if", "(", "template", "===", "undefined", ")", "{", "template", "=", "keyFnOrTemplate", ";", "}", "return", "function", "(", "part", ")", "{", "part", ".", "se...
Loop through 'items' and call 'template'. No concept of efficient re-ordering possible in server context, so this is a simple no-op map operation. @param { Array<any> } items @param { function } keyFnOrTemplate @param { (item: any, index: number) => TemplateResult } [template] @returns { (part: Part) => void }
[ "Loop", "through", "items", "and", "call", "template", ".", "No", "concept", "of", "efficient", "re", "-", "ordering", "possible", "in", "server", "context", "so", "this", "is", "a", "simple", "no", "-", "op", "map", "operation", "." ]
ad5cd24db5bd1352b7af6fc0543947a7711056d4
https://github.com/popeindustries/lit-html-server/blob/ad5cd24db5bd1352b7af6fc0543947a7711056d4/src/directives/repeat.js#L15-L23
train
popeindustries/lit-html-server
src/default-template-result-processor.js
getTemplateResultChunk
function getTemplateResultChunk(result, stack) { let chunk = result.readChunk(); // Skip empty strings if (Buffer.isBuffer(chunk) && chunk.length === 0) { chunk = result.readChunk(); } // Finished reading, dispose if (chunk === null) { stack.shift(); } else if (isTemplateResult(chunk)) { // ...
javascript
function getTemplateResultChunk(result, stack) { let chunk = result.readChunk(); // Skip empty strings if (Buffer.isBuffer(chunk) && chunk.length === 0) { chunk = result.readChunk(); } // Finished reading, dispose if (chunk === null) { stack.shift(); } else if (isTemplateResult(chunk)) { // ...
[ "function", "getTemplateResultChunk", "(", "result", ",", "stack", ")", "{", "let", "chunk", "=", "result", ".", "readChunk", "(", ")", ";", "// Skip empty strings", "if", "(", "Buffer", ".", "isBuffer", "(", "chunk", ")", "&&", "chunk", ".", "length", "==...
Retrieve next chunk from "result". Adds nested TemplateResults to the stack if necessary. @param { TemplateResult } result @param { Array<any> } stack
[ "Retrieve", "next", "chunk", "from", "result", ".", "Adds", "nested", "TemplateResults", "to", "the", "stack", "if", "necessary", "." ]
ad5cd24db5bd1352b7af6fc0543947a7711056d4
https://github.com/popeindustries/lit-html-server/blob/ad5cd24db5bd1352b7af6fc0543947a7711056d4/src/default-template-result-processor.js#L164-L182
train
popeindustries/lit-html-server
src/directives/class-map.js
classMapDirective
function classMapDirective(classInfo) { return function(part) { if (!isAttributePart(part) || part.name !== 'class') { throw Error('The `classMap` directive can only be used in the `class` attribute'); } let value = ''; for (const key in classInfo) { if (classInfo[key]) { value +...
javascript
function classMapDirective(classInfo) { return function(part) { if (!isAttributePart(part) || part.name !== 'class') { throw Error('The `classMap` directive can only be used in the `class` attribute'); } let value = ''; for (const key in classInfo) { if (classInfo[key]) { value +...
[ "function", "classMapDirective", "(", "classInfo", ")", "{", "return", "function", "(", "part", ")", "{", "if", "(", "!", "isAttributePart", "(", "part", ")", "||", "part", ".", "name", "!==", "'class'", ")", "{", "throw", "Error", "(", "'The `classMap` di...
Applies CSS classes, where'classInfo' keys are added as class names if values are truthy. Only applies to 'class' attribute. @param { object } classInfo @returns { (part: AttributePart) => void }
[ "Applies", "CSS", "classes", "where", "classInfo", "keys", "are", "added", "as", "class", "names", "if", "values", "are", "truthy", ".", "Only", "applies", "to", "class", "attribute", "." ]
ad5cd24db5bd1352b7af6fc0543947a7711056d4
https://github.com/popeindustries/lit-html-server/blob/ad5cd24db5bd1352b7af6fc0543947a7711056d4/src/directives/class-map.js#L12-L28
train
popeindustries/lit-html-server
src/directives/if-defined.js
ifDefinedDirective
function ifDefinedDirective(value) { return function(part) { if (value === undefined && isAttributePart(part)) { return part.setValue(nothingString); } part.setValue(value); }; }
javascript
function ifDefinedDirective(value) { return function(part) { if (value === undefined && isAttributePart(part)) { return part.setValue(nothingString); } part.setValue(value); }; }
[ "function", "ifDefinedDirective", "(", "value", ")", "{", "return", "function", "(", "part", ")", "{", "if", "(", "value", "===", "undefined", "&&", "isAttributePart", "(", "part", ")", ")", "{", "return", "part", ".", "setValue", "(", "nothingString", ")"...
Sets the attribute if 'value' is defined, removes the attribute if undefined. @param { any } value @returns { (part: AttributePart) => void }
[ "Sets", "the", "attribute", "if", "value", "is", "defined", "removes", "the", "attribute", "if", "undefined", "." ]
ad5cd24db5bd1352b7af6fc0543947a7711056d4
https://github.com/popeindustries/lit-html-server/blob/ad5cd24db5bd1352b7af6fc0543947a7711056d4/src/directives/if-defined.js#L12-L19
train
popeindustries/lit-html-server
src/parts.js
resolveAttributeValue
function resolveAttributeValue(value, part) { if (isDirective(value)) { value = resolveDirectiveValue(value, part); } if (value === nothingString) { return value; } if (isTemplateResult(value)) { value = value.read(); } if (isPrimitive(value)) { const string = typeof value !== 'string' ...
javascript
function resolveAttributeValue(value, part) { if (isDirective(value)) { value = resolveDirectiveValue(value, part); } if (value === nothingString) { return value; } if (isTemplateResult(value)) { value = value.read(); } if (isPrimitive(value)) { const string = typeof value !== 'string' ...
[ "function", "resolveAttributeValue", "(", "value", ",", "part", ")", "{", "if", "(", "isDirective", "(", "value", ")", ")", "{", "value", "=", "resolveDirectiveValue", "(", "value", ",", "part", ")", ";", "}", "if", "(", "value", "===", "nothingString", ...
Resolve "value" to string if possible @param { any } value @param { AttributePart } part @returns { any }
[ "Resolve", "value", "to", "string", "if", "possible" ]
ad5cd24db5bd1352b7af6fc0543947a7711056d4
https://github.com/popeindustries/lit-html-server/blob/ad5cd24db5bd1352b7af6fc0543947a7711056d4/src/parts.js#L249-L290
train