id int32 0 58k | 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
6,900 | pissang/claygl | dist/claygl.es.js | function () {
if (this.image.px) {
return isPowerOfTwo$1(this.image.px.width)
&& isPowerOfTwo$1(this.image.px.height);
}
else {
return isPowerOfTwo$1(this.width)
&& isPowerOfTwo$1(this.height);
}
} | javascript | function () {
if (this.image.px) {
return isPowerOfTwo$1(this.image.px.width)
&& isPowerOfTwo$1(this.image.px.height);
}
else {
return isPowerOfTwo$1(this.width)
&& isPowerOfTwo$1(this.height);
}
} | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"image",
".",
"px",
")",
"{",
"return",
"isPowerOfTwo$1",
"(",
"this",
".",
"image",
".",
"px",
".",
"width",
")",
"&&",
"isPowerOfTwo$1",
"(",
"this",
".",
"image",
".",
"px",
".",
"height",
")",
... | Overwrite the isPowerOfTwo method | [
"Overwrite",
"the",
"isPowerOfTwo",
"method"
] | b157bb50cf8c725fa20f90ebb55481352777f0a7 | https://github.com/pissang/claygl/blob/b157bb50cf8c725fa20f90ebb55481352777f0a7/dist/claygl.es.js#L19498-L19507 | |
6,901 | pissang/claygl | dist/claygl.es.js | function (clip, mapRule) {
// Clip have been exists in
for (var i = 0; i < this._clips.length; i++) {
if (this._clips[i].clip === clip) {
return;
}
}
// Map the joint index in skeleton to joint pose index in clip
var maps = [];
for ... | javascript | function (clip, mapRule) {
// Clip have been exists in
for (var i = 0; i < this._clips.length; i++) {
if (this._clips[i].clip === clip) {
return;
}
}
// Map the joint index in skeleton to joint pose index in clip
var maps = [];
for ... | [
"function",
"(",
"clip",
",",
"mapRule",
")",
"{",
"// Clip have been exists in",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"_clips",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"this",
".",
"_clips",
"[",
"i",
"]",
".... | Add a skinning clip and create a map between clip and skeleton
@param {clay.animation.SkinningClip} clip
@param {Object} [mapRule] Map between joint name in skeleton and joint name in clip | [
"Add",
"a",
"skinning",
"clip",
"and",
"create",
"a",
"map",
"between",
"clip",
"and",
"skeleton"
] | b157bb50cf8c725fa20f90ebb55481352777f0a7 | https://github.com/pissang/claygl/blob/b157bb50cf8c725fa20f90ebb55481352777f0a7/dist/claygl.es.js#L20438-L20472 | |
6,902 | pissang/claygl | dist/claygl.es.js | function (geometry) {
var attributes = geometry.attributes;
var positionAttr = attributes.position;
var jointAttr = attributes.joint;
var weightAttr = attributes.weight;
var jointsBoundingBoxes = [];
for (var i = 0; i < this.joints.length; i++) {
jointsBoundi... | javascript | function (geometry) {
var attributes = geometry.attributes;
var positionAttr = attributes.position;
var jointAttr = attributes.joint;
var weightAttr = attributes.weight;
var jointsBoundingBoxes = [];
for (var i = 0; i < this.joints.length; i++) {
jointsBoundi... | [
"function",
"(",
"geometry",
")",
"{",
"var",
"attributes",
"=",
"geometry",
".",
"attributes",
";",
"var",
"positionAttr",
"=",
"attributes",
".",
"position",
";",
"var",
"jointAttr",
"=",
"attributes",
".",
"joint",
";",
"var",
"weightAttr",
"=",
"attribut... | Update boundingBox of each joint bound to geometry.
ASSUME skeleton and geometry joints are matched.
@param {clay.Geometry} geometry | [
"Update",
"boundingBox",
"of",
"each",
"joint",
"bound",
"to",
"geometry",
".",
"ASSUME",
"skeleton",
"and",
"geometry",
"joints",
"are",
"matched",
"."
] | b157bb50cf8c725fa20f90ebb55481352777f0a7 | https://github.com/pissang/claygl/blob/b157bb50cf8c725fa20f90ebb55481352777f0a7/dist/claygl.es.js#L20545-L20589 | |
6,903 | pissang/claygl | dist/claygl.es.js | function () {
this._setPose();
var jointsBoundingBoxes = this._jointsBoundingBoxes;
for (var i = 0; i < this.joints.length; i++) {
var joint = this.joints[i];
mat4.multiply(
this._skinMatricesSubArrays[i],
joint.node.worldTransform.array... | javascript | function () {
this._setPose();
var jointsBoundingBoxes = this._jointsBoundingBoxes;
for (var i = 0; i < this.joints.length; i++) {
var joint = this.joints[i];
mat4.multiply(
this._skinMatricesSubArrays[i],
joint.node.worldTransform.array... | [
"function",
"(",
")",
"{",
"this",
".",
"_setPose",
"(",
")",
";",
"var",
"jointsBoundingBoxes",
"=",
"this",
".",
"_jointsBoundingBoxes",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"joints",
".",
"length",
";",
"i",
"++",
"... | Update skinning matrices | [
"Update",
"skinning",
"matrices"
] | b157bb50cf8c725fa20f90ebb55481352777f0a7 | https://github.com/pissang/claygl/blob/b157bb50cf8c725fa20f90ebb55481352777f0a7/dist/claygl.es.js#L20607-L20636 | |
6,904 | pissang/claygl | dist/claygl.es.js | function (buffer) {
var header = new Uint32Array(buffer, 0, 4);
if (header[0] !== 0x46546C67) {
this.trigger('error', 'Invalid glTF binary format: Invalid header');
return;
}
if (header[0] < 2) {
this.trigger('error', 'Only glTF2.0 is supported.');
... | javascript | function (buffer) {
var header = new Uint32Array(buffer, 0, 4);
if (header[0] !== 0x46546C67) {
this.trigger('error', 'Invalid glTF binary format: Invalid header');
return;
}
if (header[0] < 2) {
this.trigger('error', 'Only glTF2.0 is supported.');
... | [
"function",
"(",
"buffer",
")",
"{",
"var",
"header",
"=",
"new",
"Uint32Array",
"(",
"buffer",
",",
"0",
",",
"4",
")",
";",
"if",
"(",
"header",
"[",
"0",
"]",
"!==",
"0x46546C67",
")",
"{",
"this",
".",
"trigger",
"(",
"'error'",
",",
"'Invalid ... | Parse glTF binary
@param {ArrayBuffer} buffer
@return {clay.loader.GLTF.Result} | [
"Parse",
"glTF",
"binary"
] | b157bb50cf8c725fa20f90ebb55481352777f0a7 | https://github.com/pissang/claygl/blob/b157bb50cf8c725fa20f90ebb55481352777f0a7/dist/claygl.es.js#L21046-L21094 | |
6,905 | pissang/claygl | dist/claygl.es.js | function (path) {
if (path && path.match(/^data:(.*?)base64,/)) {
return path;
}
var rootPath = this.bufferRootPath;
if (rootPath == null) {
rootPath = this.rootPath;
}
return util$1.relative2absolute(path, rootPath);
} | javascript | function (path) {
if (path && path.match(/^data:(.*?)base64,/)) {
return path;
}
var rootPath = this.bufferRootPath;
if (rootPath == null) {
rootPath = this.rootPath;
}
return util$1.relative2absolute(path, rootPath);
} | [
"function",
"(",
"path",
")",
"{",
"if",
"(",
"path",
"&&",
"path",
".",
"match",
"(",
"/",
"^data:(.*?)base64,",
"/",
")",
")",
"{",
"return",
"path",
";",
"}",
"var",
"rootPath",
"=",
"this",
".",
"bufferRootPath",
";",
"if",
"(",
"rootPath",
"==",... | Binary file path resolver. User can override it
@param {string} path | [
"Binary",
"file",
"path",
"resolver",
".",
"User",
"can",
"override",
"it"
] | b157bb50cf8c725fa20f90ebb55481352777f0a7 | https://github.com/pissang/claygl/blob/b157bb50cf8c725fa20f90ebb55481352777f0a7/dist/claygl.es.js#L21220-L21230 | |
6,906 | pissang/claygl | dist/claygl.es.js | function (path) {
if (path && path.match(/^data:(.*?)base64,/)) {
return path;
}
var rootPath = this.textureRootPath;
if (rootPath == null) {
rootPath = this.rootPath;
}
return util$1.relative2absolute(path, rootPath);
} | javascript | function (path) {
if (path && path.match(/^data:(.*?)base64,/)) {
return path;
}
var rootPath = this.textureRootPath;
if (rootPath == null) {
rootPath = this.rootPath;
}
return util$1.relative2absolute(path, rootPath);
} | [
"function",
"(",
"path",
")",
"{",
"if",
"(",
"path",
"&&",
"path",
".",
"match",
"(",
"/",
"^data:(.*?)base64,",
"/",
")",
")",
"{",
"return",
"path",
";",
"}",
"var",
"rootPath",
"=",
"this",
".",
"textureRootPath",
";",
"if",
"(",
"rootPath",
"=="... | Texture file path resolver. User can override it
@param {string} path | [
"Texture",
"file",
"path",
"resolver",
".",
"User",
"can",
"override",
"it"
] | b157bb50cf8c725fa20f90ebb55481352777f0a7 | https://github.com/pissang/claygl/blob/b157bb50cf8c725fa20f90ebb55481352777f0a7/dist/claygl.es.js#L21236-L21246 | |
6,907 | pissang/claygl | dist/claygl.es.js | function (renderer) {
if (renderer.__currentFrameBuffer) {
// Already bound
if (renderer.__currentFrameBuffer === this) {
return;
}
console.warn('Renderer already bound with another framebuffer. Unbind it first');
}
renderer.__cur... | javascript | function (renderer) {
if (renderer.__currentFrameBuffer) {
// Already bound
if (renderer.__currentFrameBuffer === this) {
return;
}
console.warn('Renderer already bound with another framebuffer. Unbind it first');
}
renderer.__cur... | [
"function",
"(",
"renderer",
")",
"{",
"if",
"(",
"renderer",
".",
"__currentFrameBuffer",
")",
"{",
"// Already bound",
"if",
"(",
"renderer",
".",
"__currentFrameBuffer",
"===",
"this",
")",
"{",
"return",
";",
"}",
"console",
".",
"warn",
"(",
"'Renderer ... | Bind the framebuffer to given renderer before rendering
@param {clay.Renderer} renderer | [
"Bind",
"the",
"framebuffer",
"to",
"given",
"renderer",
"before",
"rendering"
] | b157bb50cf8c725fa20f90ebb55481352777f0a7 | https://github.com/pissang/claygl/blob/b157bb50cf8c725fa20f90ebb55481352777f0a7/dist/claygl.es.js#L22362-L22440 | |
6,908 | pissang/claygl | dist/claygl.es.js | function (renderer) {
// Remove status record on renderer
renderer.__currentFrameBuffer = null;
var _gl = renderer.gl;
_gl.bindFramebuffer(GL_FRAMEBUFFER, null);
this._boundRenderer = null;
this._cache.use(renderer.__uid__);
var viewport = this._cache.get('view... | javascript | function (renderer) {
// Remove status record on renderer
renderer.__currentFrameBuffer = null;
var _gl = renderer.gl;
_gl.bindFramebuffer(GL_FRAMEBUFFER, null);
this._boundRenderer = null;
this._cache.use(renderer.__uid__);
var viewport = this._cache.get('view... | [
"function",
"(",
"renderer",
")",
"{",
"// Remove status record on renderer",
"renderer",
".",
"__currentFrameBuffer",
"=",
"null",
";",
"var",
"_gl",
"=",
"renderer",
".",
"gl",
";",
"_gl",
".",
"bindFramebuffer",
"(",
"GL_FRAMEBUFFER",
",",
"null",
")",
";",
... | Unbind the frame buffer after rendering
@param {clay.Renderer} renderer | [
"Unbind",
"the",
"frame",
"buffer",
"after",
"rendering"
] | b157bb50cf8c725fa20f90ebb55481352777f0a7 | https://github.com/pissang/claygl/blob/b157bb50cf8c725fa20f90ebb55481352777f0a7/dist/claygl.es.js#L22446-L22463 | |
6,909 | pissang/claygl | dist/claygl.es.js | function (renderer) {
var _gl = renderer.gl;
for (var attachment in this._textures) {
var obj = this._textures[attachment];
if (obj) {
var texture = obj.texture;
// FIXME some texture format can't generate mipmap
if (!texture.NPOT &... | javascript | function (renderer) {
var _gl = renderer.gl;
for (var attachment in this._textures) {
var obj = this._textures[attachment];
if (obj) {
var texture = obj.texture;
// FIXME some texture format can't generate mipmap
if (!texture.NPOT &... | [
"function",
"(",
"renderer",
")",
"{",
"var",
"_gl",
"=",
"renderer",
".",
"gl",
";",
"for",
"(",
"var",
"attachment",
"in",
"this",
".",
"_textures",
")",
"{",
"var",
"obj",
"=",
"this",
".",
"_textures",
"[",
"attachment",
"]",
";",
"if",
"(",
"o... | Because the data of texture is changed over time, Here update the mipmaps of texture each time after rendered; | [
"Because",
"the",
"data",
"of",
"texture",
"is",
"changed",
"over",
"time",
"Here",
"update",
"the",
"mipmaps",
"of",
"texture",
"each",
"time",
"after",
"rendered",
";"
] | b157bb50cf8c725fa20f90ebb55481352777f0a7 | https://github.com/pissang/claygl/blob/b157bb50cf8c725fa20f90ebb55481352777f0a7/dist/claygl.es.js#L22467-L22483 | |
6,910 | pissang/claygl | dist/claygl.es.js | function (attachment, target) {
// TODO depth extension check ?
this._textures[attachment] = null;
if (this._boundRenderer) {
var cache = this._cache;
cache.use(this._boundRenderer.__uid__);
this._doDetach(this._boundRenderer.gl, attachment, target);
}... | javascript | function (attachment, target) {
// TODO depth extension check ?
this._textures[attachment] = null;
if (this._boundRenderer) {
var cache = this._cache;
cache.use(this._boundRenderer.__uid__);
this._doDetach(this._boundRenderer.gl, attachment, target);
}... | [
"function",
"(",
"attachment",
",",
"target",
")",
"{",
"// TODO depth extension check ?",
"this",
".",
"_textures",
"[",
"attachment",
"]",
"=",
"null",
";",
"if",
"(",
"this",
".",
"_boundRenderer",
")",
"{",
"var",
"cache",
"=",
"this",
".",
"_cache",
"... | Detach a texture
@param {number} [attachment=gl.COLOR_ATTACHMENT0]
@param {number} [target=gl.TEXTURE_2D] | [
"Detach",
"a",
"texture"
] | b157bb50cf8c725fa20f90ebb55481352777f0a7 | https://github.com/pissang/claygl/blob/b157bb50cf8c725fa20f90ebb55481352777f0a7/dist/claygl.es.js#L22641-L22649 | |
6,911 | pissang/claygl | dist/claygl.es.js | function (scene) {
if (this.scene) {
this.detachScene();
}
scene.skybox = this;
this.scene = scene;
scene.on('beforerender', this._beforeRenderScene, this);
} | javascript | function (scene) {
if (this.scene) {
this.detachScene();
}
scene.skybox = this;
this.scene = scene;
scene.on('beforerender', this._beforeRenderScene, this);
} | [
"function",
"(",
"scene",
")",
"{",
"if",
"(",
"this",
".",
"scene",
")",
"{",
"this",
".",
"detachScene",
"(",
")",
";",
"}",
"scene",
".",
"skybox",
"=",
"this",
";",
"this",
".",
"scene",
"=",
"scene",
";",
"scene",
".",
"on",
"(",
"'beforeren... | Attach the skybox to the scene
@param {clay.Scene} scene | [
"Attach",
"the",
"skybox",
"to",
"the",
"scene"
] | b157bb50cf8c725fa20f90ebb55481352777f0a7 | https://github.com/pissang/claygl/blob/b157bb50cf8c725fa20f90ebb55481352777f0a7/dist/claygl.es.js#L22939-L22947 | |
6,912 | pissang/claygl | dist/claygl.es.js | function (envMap) {
if (envMap.textureType === 'texture2D') {
this.material.define('EQUIRECTANGULAR');
// LINEAR filter can remove the artifacts in pole
envMap.minFilter = Texture.LINEAR;
}
else {
this.material.undefine('EQUIRECTANGULAR');
... | javascript | function (envMap) {
if (envMap.textureType === 'texture2D') {
this.material.define('EQUIRECTANGULAR');
// LINEAR filter can remove the artifacts in pole
envMap.minFilter = Texture.LINEAR;
}
else {
this.material.undefine('EQUIRECTANGULAR');
... | [
"function",
"(",
"envMap",
")",
"{",
"if",
"(",
"envMap",
".",
"textureType",
"===",
"'texture2D'",
")",
"{",
"this",
".",
"material",
".",
"define",
"(",
"'EQUIRECTANGULAR'",
")",
";",
"// LINEAR filter can remove the artifacts in pole",
"envMap",
".",
"minFilter... | Set environment map
@param {clay.TextureCube} envMap | [
"Set",
"environment",
"map"
] | b157bb50cf8c725fa20f90ebb55481352777f0a7 | https://github.com/pissang/claygl/blob/b157bb50cf8c725fa20f90ebb55481352777f0a7/dist/claygl.es.js#L22971-L22981 | |
6,913 | pissang/claygl | dist/claygl.es.js | function (renderer, path, cubeMap, option, onsuccess, onerror) {
var self = this;
if (typeof(option) === 'function') {
onsuccess = option;
onerror = onsuccess;
option = {};
}
else {
option = option || {};
}
textureUtil.loa... | javascript | function (renderer, path, cubeMap, option, onsuccess, onerror) {
var self = this;
if (typeof(option) === 'function') {
onsuccess = option;
onerror = onsuccess;
option = {};
}
else {
option = option || {};
}
textureUtil.loa... | [
"function",
"(",
"renderer",
",",
"path",
",",
"cubeMap",
",",
"option",
",",
"onsuccess",
",",
"onerror",
")",
"{",
"var",
"self",
"=",
"this",
";",
"if",
"(",
"typeof",
"(",
"option",
")",
"===",
"'function'",
")",
"{",
"onsuccess",
"=",
"option",
... | Load a panorama texture and render it to a cube map
@param {clay.Renderer} renderer
@param {string} path
@param {clay.TextureCube} cubeMap
@param {object} [option]
@param {boolean} [option.encodeRGBM]
@param {number} [option.exposure]
@param {Function} [onsuccess]
@param {Function} [onerror] | [
"Load",
"a",
"panorama",
"texture",
"and",
"render",
"it",
"to",
"a",
"cube",
"map"
] | b157bb50cf8c725fa20f90ebb55481352777f0a7 | https://github.com/pissang/claygl/blob/b157bb50cf8c725fa20f90ebb55481352777f0a7/dist/claygl.es.js#L23522-L23541 | |
6,914 | pissang/claygl | dist/claygl.es.js | function (renderer, panoramaMap, cubeMap, option) {
var environmentMapPass = new EnvironmentMapPass();
var skydome = new Skybox$1({
scene: new Scene()
});
skydome.setEnvironmentMap(panoramaMap);
option = option || {};
if (option.encodeRGBM) {
skyd... | javascript | function (renderer, panoramaMap, cubeMap, option) {
var environmentMapPass = new EnvironmentMapPass();
var skydome = new Skybox$1({
scene: new Scene()
});
skydome.setEnvironmentMap(panoramaMap);
option = option || {};
if (option.encodeRGBM) {
skyd... | [
"function",
"(",
"renderer",
",",
"panoramaMap",
",",
"cubeMap",
",",
"option",
")",
"{",
"var",
"environmentMapPass",
"=",
"new",
"EnvironmentMapPass",
"(",
")",
";",
"var",
"skydome",
"=",
"new",
"Skybox$1",
"(",
"{",
"scene",
":",
"new",
"Scene",
"(",
... | Render a panorama texture to a cube map
@param {clay.Renderer} renderer
@param {clay.Texture2D} panoramaMap
@param {clay.TextureCube} cubeMap
@param {Object} option
@param {boolean} [option.encodeRGBM] | [
"Render",
"a",
"panorama",
"texture",
"to",
"a",
"cube",
"map"
] | b157bb50cf8c725fa20f90ebb55481352777f0a7 | https://github.com/pissang/claygl/blob/b157bb50cf8c725fa20f90ebb55481352777f0a7/dist/claygl.es.js#L23551-L23571 | |
6,915 | pissang/claygl | dist/claygl.es.js | function (size, unitSize, color1, color2) {
size = size || 512;
unitSize = unitSize || 64;
color1 = color1 || 'black';
color2 = color2 || 'white';
var repeat = Math.ceil(size / unitSize);
var canvas = document.createElement('canvas');
canvas.width = size;
... | javascript | function (size, unitSize, color1, color2) {
size = size || 512;
unitSize = unitSize || 64;
color1 = color1 || 'black';
color2 = color2 || 'white';
var repeat = Math.ceil(size / unitSize);
var canvas = document.createElement('canvas');
canvas.width = size;
... | [
"function",
"(",
"size",
",",
"unitSize",
",",
"color1",
",",
"color2",
")",
"{",
"size",
"=",
"size",
"||",
"512",
";",
"unitSize",
"=",
"unitSize",
"||",
"64",
";",
"color1",
"=",
"color1",
"||",
"'black'",
";",
"color2",
"=",
"color2",
"||",
"'whi... | Create a chessboard texture
@param {number} [size]
@param {number} [unitSize]
@param {string} [color1]
@param {string} [color2]
@return {clay.Texture2D} | [
"Create",
"a",
"chessboard",
"texture"
] | b157bb50cf8c725fa20f90ebb55481352777f0a7 | https://github.com/pissang/claygl/blob/b157bb50cf8c725fa20f90ebb55481352777f0a7/dist/claygl.es.js#L23688-L23719 | |
6,916 | pissang/claygl | dist/claygl.es.js | function (color) {
var canvas = document.createElement('canvas');
canvas.width = 1;
canvas.height = 1;
var ctx = canvas.getContext('2d');
ctx.fillStyle = color;
ctx.fillRect(0, 0, 1, 1);
var texture = new Texture2D({
image: canvas
});
... | javascript | function (color) {
var canvas = document.createElement('canvas');
canvas.width = 1;
canvas.height = 1;
var ctx = canvas.getContext('2d');
ctx.fillStyle = color;
ctx.fillRect(0, 0, 1, 1);
var texture = new Texture2D({
image: canvas
});
... | [
"function",
"(",
"color",
")",
"{",
"var",
"canvas",
"=",
"document",
".",
"createElement",
"(",
"'canvas'",
")",
";",
"canvas",
".",
"width",
"=",
"1",
";",
"canvas",
".",
"height",
"=",
"1",
";",
"var",
"ctx",
"=",
"canvas",
".",
"getContext",
"(",... | Create a blank pure color 1x1 texture
@param {string} color
@return {clay.Texture2D} | [
"Create",
"a",
"blank",
"pure",
"color",
"1x1",
"texture"
] | b157bb50cf8c725fa20f90ebb55481352777f0a7 | https://github.com/pissang/claygl/blob/b157bb50cf8c725fa20f90ebb55481352777f0a7/dist/claygl.es.js#L23726-L23739 | |
6,917 | pissang/claygl | dist/claygl.es.js | function (renderer, size) {
if (!renderer.getGLExtension('EXT_shader_texture_lod')) {
console.warn('Device not support textureCubeLodEXT');
return;
}
if (!this._brdfLookup) {
this._normalDistribution = cubemapUtil.generateNormalDistribution();
this... | javascript | function (renderer, size) {
if (!renderer.getGLExtension('EXT_shader_texture_lod')) {
console.warn('Device not support textureCubeLodEXT');
return;
}
if (!this._brdfLookup) {
this._normalDistribution = cubemapUtil.generateNormalDistribution();
this... | [
"function",
"(",
"renderer",
",",
"size",
")",
"{",
"if",
"(",
"!",
"renderer",
".",
"getGLExtension",
"(",
"'EXT_shader_texture_lod'",
")",
")",
"{",
"console",
".",
"warn",
"(",
"'Device not support textureCubeLodEXT'",
")",
";",
"return",
";",
"}",
"if",
... | Do prefitering the cubemap
@param {clay.Renderer} renderer
@param {number} [size=32] | [
"Do",
"prefitering",
"the",
"cubemap"
] | b157bb50cf8c725fa20f90ebb55481352777f0a7 | https://github.com/pissang/claygl/blob/b157bb50cf8c725fa20f90ebb55481352777f0a7/dist/claygl.es.js#L24048-L24073 | |
6,918 | pissang/claygl | dist/claygl.es.js | function (renderer, scene, sceneCamera, notUpdateScene) {
if (!sceneCamera) {
sceneCamera = scene.getMainCamera();
}
this.trigger('beforerender', this, renderer, scene, sceneCamera);
this._renderShadowPass(renderer, scene, sceneCamera, notUpdateScene);
this.trigger('a... | javascript | function (renderer, scene, sceneCamera, notUpdateScene) {
if (!sceneCamera) {
sceneCamera = scene.getMainCamera();
}
this.trigger('beforerender', this, renderer, scene, sceneCamera);
this._renderShadowPass(renderer, scene, sceneCamera, notUpdateScene);
this.trigger('a... | [
"function",
"(",
"renderer",
",",
"scene",
",",
"sceneCamera",
",",
"notUpdateScene",
")",
"{",
"if",
"(",
"!",
"sceneCamera",
")",
"{",
"sceneCamera",
"=",
"scene",
".",
"getMainCamera",
"(",
")",
";",
"}",
"this",
".",
"trigger",
"(",
"'beforerender'",
... | Render scene to shadow textures
@param {clay.Renderer} renderer
@param {clay.Scene} scene
@param {clay.Camera} sceneCamera
@param {boolean} [notUpdateScene=false]
@memberOf clay.prePass.ShadowMap.prototype | [
"Render",
"scene",
"to",
"shadow",
"textures"
] | b157bb50cf8c725fa20f90ebb55481352777f0a7 | https://github.com/pissang/claygl/blob/b157bb50cf8c725fa20f90ebb55481352777f0a7/dist/claygl.es.js#L24395-L24402 | |
6,919 | pissang/claygl | dist/claygl.es.js | function (renderer, size) {
renderer.saveClear();
var viewport = renderer.viewport;
var x = 0, y = 0;
var width = size || viewport.width / 4;
var height = width;
if (this.softShadow === ShadowMapPass.VSM) {
this._outputDepthPass.material.define('fragment', 'US... | javascript | function (renderer, size) {
renderer.saveClear();
var viewport = renderer.viewport;
var x = 0, y = 0;
var width = size || viewport.width / 4;
var height = width;
if (this.softShadow === ShadowMapPass.VSM) {
this._outputDepthPass.material.define('fragment', 'US... | [
"function",
"(",
"renderer",
",",
"size",
")",
"{",
"renderer",
".",
"saveClear",
"(",
")",
";",
"var",
"viewport",
"=",
"renderer",
".",
"viewport",
";",
"var",
"x",
"=",
"0",
",",
"y",
"=",
"0",
";",
"var",
"width",
"=",
"size",
"||",
"viewport",... | Debug rendering of shadow textures
@param {clay.Renderer} renderer
@param {number} size
@memberOf clay.prePass.ShadowMap.prototype | [
"Debug",
"rendering",
"of",
"shadow",
"textures"
] | b157bb50cf8c725fa20f90ebb55481352777f0a7 | https://github.com/pissang/claygl/blob/b157bb50cf8c725fa20f90ebb55481352777f0a7/dist/claygl.es.js#L24410-L24431 | |
6,920 | pissang/claygl | dist/claygl.es.js | function (x, y, forcePickAll) {
var out = this.pickAll(x, y, [], forcePickAll);
return out[0] || null;
} | javascript | function (x, y, forcePickAll) {
var out = this.pickAll(x, y, [], forcePickAll);
return out[0] || null;
} | [
"function",
"(",
"x",
",",
"y",
",",
"forcePickAll",
")",
"{",
"var",
"out",
"=",
"this",
".",
"pickAll",
"(",
"x",
",",
"y",
",",
"[",
"]",
",",
"forcePickAll",
")",
";",
"return",
"out",
"[",
"0",
"]",
"||",
"null",
";",
"}"
] | Pick the nearest intersection object in the scene
@param {number} x Mouse position x
@param {number} y Mouse position y
@param {boolean} [forcePickAll=false] ignore ignorePicking
@return {clay.picking.RayPicking~Intersection} | [
"Pick",
"the",
"nearest",
"intersection",
"object",
"in",
"the",
"scene"
] | b157bb50cf8c725fa20f90ebb55481352777f0a7 | https://github.com/pissang/claygl/blob/b157bb50cf8c725fa20f90ebb55481352777f0a7/dist/claygl.es.js#L25182-L25185 | |
6,921 | pissang/claygl | dist/claygl.es.js | function (x, y, output, forcePickAll) {
this.renderer.screenToNDC(x, y, this._ndc);
this.camera.castRay(this._ndc, this._ray);
output = output || [];
this._intersectNode(this.scene, output, forcePickAll || false);
output.sort(this._intersectionCompareFunc);
return out... | javascript | function (x, y, output, forcePickAll) {
this.renderer.screenToNDC(x, y, this._ndc);
this.camera.castRay(this._ndc, this._ray);
output = output || [];
this._intersectNode(this.scene, output, forcePickAll || false);
output.sort(this._intersectionCompareFunc);
return out... | [
"function",
"(",
"x",
",",
"y",
",",
"output",
",",
"forcePickAll",
")",
"{",
"this",
".",
"renderer",
".",
"screenToNDC",
"(",
"x",
",",
"y",
",",
"this",
".",
"_ndc",
")",
";",
"this",
".",
"camera",
".",
"castRay",
"(",
"this",
".",
"_ndc",
",... | Pick all intersection objects, wich will be sorted from near to far
@param {number} x Mouse position x
@param {number} y Mouse position y
@param {Array} [output]
@param {boolean} [forcePickAll=false] ignore ignorePicking
@return {Array.<clay.picking.RayPicking~Intersection>} | [
"Pick",
"all",
"intersection",
"objects",
"wich",
"will",
"be",
"sorted",
"from",
"near",
"to",
"far"
] | b157bb50cf8c725fa20f90ebb55481352777f0a7 | https://github.com/pissang/claygl/blob/b157bb50cf8c725fa20f90ebb55481352777f0a7/dist/claygl.es.js#L25195-L25206 | |
6,922 | pissang/claygl | dist/claygl.es.js | function () {
for (var i = 0; i < this.nodes.length; i++) {
this.nodes[i].clear();
}
// Traverse all the nodes and build the graph
for (var i = 0; i < this.nodes.length; i++) {
var node = this.nodes[i];
if (!node.inputs) {
continue;
... | javascript | function () {
for (var i = 0; i < this.nodes.length; i++) {
this.nodes[i].clear();
}
// Traverse all the nodes and build the graph
for (var i = 0; i < this.nodes.length; i++) {
var node = this.nodes[i];
if (!node.inputs) {
continue;
... | [
"function",
"(",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"nodes",
".",
"length",
";",
"i",
"++",
")",
"{",
"this",
".",
"nodes",
"[",
"i",
"]",
".",
"clear",
"(",
")",
";",
"}",
"// Traverse all the nodes and build... | Update links of graph | [
"Update",
"links",
"of",
"graph"
] | b157bb50cf8c725fa20f90ebb55481352777f0a7 | https://github.com/pissang/claygl/blob/b157bb50cf8c725fa20f90ebb55481352777f0a7/dist/claygl.es.js#L27548-L27583 | |
6,923 | pissang/claygl | dist/claygl.es.js | function (width, height) {
if (this._gBufferTex1.width === width
&& this._gBufferTex1.height === height
) {
return;
}
this._gBufferTex1.width = width;
this._gBufferTex1.height = height;
this._gBufferTex2.width = width;
this._gBufferTex2.he... | javascript | function (width, height) {
if (this._gBufferTex1.width === width
&& this._gBufferTex1.height === height
) {
return;
}
this._gBufferTex1.width = width;
this._gBufferTex1.height = height;
this._gBufferTex2.width = width;
this._gBufferTex2.he... | [
"function",
"(",
"width",
",",
"height",
")",
"{",
"if",
"(",
"this",
".",
"_gBufferTex1",
".",
"width",
"===",
"width",
"&&",
"this",
".",
"_gBufferTex1",
".",
"height",
"===",
"height",
")",
"{",
"return",
";",
"}",
"this",
".",
"_gBufferTex1",
".",
... | Set G Buffer size.
@param {number} width
@param {number} height | [
"Set",
"G",
"Buffer",
"size",
"."
] | b157bb50cf8c725fa20f90ebb55481352777f0a7 | https://github.com/pissang/claygl/blob/b157bb50cf8c725fa20f90ebb55481352777f0a7/dist/claygl.es.js#L28704-L28721 | |
6,924 | pissang/claygl | dist/claygl.es.js | function() {
var cone = new Cone$1({
topRadius: this.radius,
bottomRadius: this.radius,
capSegments: this.capSegments,
heightSegments: this.heightSegments,
height: this.height
});
this.attributes.position.value = cone.attributes.positi... | javascript | function() {
var cone = new Cone$1({
topRadius: this.radius,
bottomRadius: this.radius,
capSegments: this.capSegments,
heightSegments: this.heightSegments,
height: this.height
});
this.attributes.position.value = cone.attributes.positi... | [
"function",
"(",
")",
"{",
"var",
"cone",
"=",
"new",
"Cone$1",
"(",
"{",
"topRadius",
":",
"this",
".",
"radius",
",",
"bottomRadius",
":",
"this",
".",
"radius",
",",
"capSegments",
":",
"this",
".",
"capSegments",
",",
"heightSegments",
":",
"this",
... | Build cylinder geometry | [
"Build",
"cylinder",
"geometry"
] | b157bb50cf8c725fa20f90ebb55481352777f0a7 | https://github.com/pissang/claygl/blob/b157bb50cf8c725fa20f90ebb55481352777f0a7/dist/claygl.es.js#L29252-L29267 | |
6,925 | pissang/claygl | dist/claygl.es.js | function (light) {
var volumeMesh;
if (light.volumeMesh) {
volumeMesh = light.volumeMesh;
}
else {
switch (light.type) {
// Only local light (point and spot) needs volume mesh.
// Directional and ambient light renders in full quad
... | javascript | function (light) {
var volumeMesh;
if (light.volumeMesh) {
volumeMesh = light.volumeMesh;
}
else {
switch (light.type) {
// Only local light (point and spot) needs volume mesh.
// Directional and ambient light renders in full quad
... | [
"function",
"(",
"light",
")",
"{",
"var",
"volumeMesh",
";",
"if",
"(",
"light",
".",
"volumeMesh",
")",
"{",
"volumeMesh",
"=",
"light",
".",
"volumeMesh",
";",
"}",
"else",
"{",
"switch",
"(",
"light",
".",
"type",
")",
"{",
"// Only local light (poin... | Update light volume mesh Light volume mesh is rendered in light accumulate pass instead of full quad. It will reduce pixels significantly when local light is relatively small. And we can use custom volume mesh to shape the light. See "Deferred Shading Optimizations" in GDC2011 | [
"Update",
"light",
"volume",
"mesh",
"Light",
"volume",
"mesh",
"is",
"rendered",
"in",
"light",
"accumulate",
"pass",
"instead",
"of",
"full",
"quad",
".",
"It",
"will",
"reduce",
"pixels",
"significantly",
"when",
"local",
"light",
"is",
"relatively",
"small... | b157bb50cf8c725fa20f90ebb55481352777f0a7 | https://github.com/pissang/claygl/blob/b157bb50cf8c725fa20f90ebb55481352777f0a7/dist/claygl.es.js#L29771-L29829 | |
6,926 | pissang/claygl | dist/claygl.es.js | function(out) {
var amount = Math.min(this._particlePool.length, this.amount);
var particle;
for (var i = 0; i < amount; i++) {
particle = this._particlePool.pop();
// Initialize particle status
if (this.position) {
this.position.get(particle.... | javascript | function(out) {
var amount = Math.min(this._particlePool.length, this.amount);
var particle;
for (var i = 0; i < amount; i++) {
particle = this._particlePool.pop();
// Initialize particle status
if (this.position) {
this.position.get(particle.... | [
"function",
"(",
"out",
")",
"{",
"var",
"amount",
"=",
"Math",
".",
"min",
"(",
"this",
".",
"_particlePool",
".",
"length",
",",
"this",
".",
"amount",
")",
";",
"var",
"particle",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"amount",... | Emitter number of particles and push them to a given particle list. Emmit number is defined by amount property
@param {Array.<clay.particle.Particle>} out | [
"Emitter",
"number",
"of",
"particles",
"and",
"push",
"them",
"to",
"a",
"given",
"particle",
"list",
".",
"Emmit",
"number",
"is",
"defined",
"by",
"amount",
"property"
] | b157bb50cf8c725fa20f90ebb55481352777f0a7 | https://github.com/pissang/claygl/blob/b157bb50cf8c725fa20f90ebb55481352777f0a7/dist/claygl.es.js#L32704-L32736 | |
6,927 | pissang/claygl | dist/claygl.es.js | function() {
// Put all the particles back
for (var i = 0; i < this._particles.length; i++) {
var p = this._particles[i];
p.emitter.kill(p);
}
this._particles.length = 0;
this._elapsedTime = 0;
this._emitting = true;
} | javascript | function() {
// Put all the particles back
for (var i = 0; i < this._particles.length; i++) {
var p = this._particles[i];
p.emitter.kill(p);
}
this._particles.length = 0;
this._elapsedTime = 0;
this._emitting = true;
} | [
"function",
"(",
")",
"{",
"// Put all the particles back",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"_particles",
".",
"length",
";",
"i",
"++",
")",
"{",
"var",
"p",
"=",
"this",
".",
"_particles",
"[",
"i",
"]",
";",
"p",
... | Reset the particle system. | [
"Reset",
"the",
"particle",
"system",
"."
] | b157bb50cf8c725fa20f90ebb55481352777f0a7 | https://github.com/pissang/claygl/blob/b157bb50cf8c725fa20f90ebb55481352777f0a7/dist/claygl.es.js#L32948-L32957 | |
6,928 | pissang/claygl | dist/claygl.es.js | function(ratio) {
this._texture.width = this.width * ratio;
this._texture.height = this.height * ratio;
this.downSampleRatio = ratio;
} | javascript | function(ratio) {
this._texture.width = this.width * ratio;
this._texture.height = this.height * ratio;
this.downSampleRatio = ratio;
} | [
"function",
"(",
"ratio",
")",
"{",
"this",
".",
"_texture",
".",
"width",
"=",
"this",
".",
"width",
"*",
"ratio",
";",
"this",
".",
"_texture",
".",
"height",
"=",
"this",
".",
"height",
"*",
"ratio",
";",
"this",
".",
"downSampleRatio",
"=",
"rati... | Set picking presision
@param {number} ratio | [
"Set",
"picking",
"presision"
] | b157bb50cf8c725fa20f90ebb55481352777f0a7 | https://github.com/pissang/claygl/blob/b157bb50cf8c725fa20f90ebb55481352777f0a7/dist/claygl.es.js#L33165-L33169 | |
6,929 | pissang/claygl | dist/claygl.es.js | function(scene, camera) {
var renderer = this.renderer;
if (renderer.getWidth() !== this.width || renderer.getHeight() !== this.height) {
this.resize(renderer.width, renderer.height);
}
this._frameBuffer.attach(this._texture);
this._frameBuffer.bind(renderer);
... | javascript | function(scene, camera) {
var renderer = this.renderer;
if (renderer.getWidth() !== this.width || renderer.getHeight() !== this.height) {
this.resize(renderer.width, renderer.height);
}
this._frameBuffer.attach(this._texture);
this._frameBuffer.bind(renderer);
... | [
"function",
"(",
"scene",
",",
"camera",
")",
"{",
"var",
"renderer",
"=",
"this",
".",
"renderer",
";",
"if",
"(",
"renderer",
".",
"getWidth",
"(",
")",
"!==",
"this",
".",
"width",
"||",
"renderer",
".",
"getHeight",
"(",
")",
"!==",
"this",
".",
... | Update the picking framebuffer
@param {number} ratio | [
"Update",
"the",
"picking",
"framebuffer"
] | b157bb50cf8c725fa20f90ebb55481352777f0a7 | https://github.com/pissang/claygl/blob/b157bb50cf8c725fa20f90ebb55481352777f0a7/dist/claygl.es.js#L33181-L33194 | |
6,930 | pissang/claygl | dist/claygl.es.js | function(x, y) {
var renderer = this.renderer;
var ratio = this.downSampleRatio;
x = Math.ceil(ratio * x);
y = Math.ceil(ratio * (this.height - y));
this._frameBuffer.bind(renderer);
var pixel = new Uint8Array(4);
var _gl = renderer.gl;
// TODO out of bo... | javascript | function(x, y) {
var renderer = this.renderer;
var ratio = this.downSampleRatio;
x = Math.ceil(ratio * x);
y = Math.ceil(ratio * (this.height - y));
this._frameBuffer.bind(renderer);
var pixel = new Uint8Array(4);
var _gl = renderer.gl;
// TODO out of bo... | [
"function",
"(",
"x",
",",
"y",
")",
"{",
"var",
"renderer",
"=",
"this",
".",
"renderer",
";",
"var",
"ratio",
"=",
"this",
".",
"downSampleRatio",
";",
"x",
"=",
"Math",
".",
"ceil",
"(",
"ratio",
"*",
"x",
")",
";",
"y",
"=",
"Math",
".",
"c... | Pick the object
@param {number} x Mouse position x
@param {number} y Mouse position y
@return {clay.Node} | [
"Pick",
"the",
"object"
] | b157bb50cf8c725fa20f90ebb55481352777f0a7 | https://github.com/pissang/claygl/blob/b157bb50cf8c725fa20f90ebb55481352777f0a7/dist/claygl.es.js#L33231-L33253 | |
6,931 | pissang/claygl | dist/claygl.es.js | function (frameTime) {
var target = this.target;
var position = this.target.position;
var xAxis = target.localTransform.x.normalize();
var zAxis = target.localTransform.z.normalize();
if (this.verticalMoveLock) {
zAxis.y = 0;
zAxis.normalize();
}... | javascript | function (frameTime) {
var target = this.target;
var position = this.target.position;
var xAxis = target.localTransform.x.normalize();
var zAxis = target.localTransform.z.normalize();
if (this.verticalMoveLock) {
zAxis.y = 0;
zAxis.normalize();
}... | [
"function",
"(",
"frameTime",
")",
"{",
"var",
"target",
"=",
"this",
".",
"target",
";",
"var",
"position",
"=",
"this",
".",
"target",
".",
"position",
";",
"var",
"xAxis",
"=",
"target",
".",
"localTransform",
".",
"x",
".",
"normalize",
"(",
")",
... | Control update. Should be invoked every frame
@param {number} frameTime Frame time | [
"Control",
"update",
".",
"Should",
"be",
"invoked",
"every",
"frame"
] | b157bb50cf8c725fa20f90ebb55481352777f0a7 | https://github.com/pissang/claygl/blob/b157bb50cf8c725fa20f90ebb55481352777f0a7/dist/claygl.es.js#L33421-L33454 | |
6,932 | pissang/claygl | dist/claygl.es.js | function() {
/**
* When user begins to interact with connected gamepad:
*
* @see https://w3c.github.io/gamepad/#dom-gamepadevent
*/
vendor.addEventListener(window, 'gamepadconnected', this._checkGamepadCompatibility);
if (this.timeline) {
this.ti... | javascript | function() {
/**
* When user begins to interact with connected gamepad:
*
* @see https://w3c.github.io/gamepad/#dom-gamepadevent
*/
vendor.addEventListener(window, 'gamepadconnected', this._checkGamepadCompatibility);
if (this.timeline) {
this.ti... | [
"function",
"(",
")",
"{",
"/**\n * When user begins to interact with connected gamepad:\n *\n * @see https://w3c.github.io/gamepad/#dom-gamepadevent\n */",
"vendor",
".",
"addEventListener",
"(",
"window",
",",
"'gamepadconnected'",
",",
"this",
".",
"_... | Init. control. | [
"Init",
".",
"control",
"."
] | b157bb50cf8c725fa20f90ebb55481352777f0a7 | https://github.com/pissang/claygl/blob/b157bb50cf8c725fa20f90ebb55481352777f0a7/dist/claygl.es.js#L33639-L33654 | |
6,933 | pissang/claygl | dist/claygl.es.js | function() {
vendor.removeEventListener(window, 'gamepadconnected', this._checkGamepadCompatibility);
if (this.timeline) {
this.timeline.off('frame', this.update);
}
vendor.removeEventListener(window, 'gamepaddisconnected', this._disconnectGamepad);
} | javascript | function() {
vendor.removeEventListener(window, 'gamepadconnected', this._checkGamepadCompatibility);
if (this.timeline) {
this.timeline.off('frame', this.update);
}
vendor.removeEventListener(window, 'gamepaddisconnected', this._disconnectGamepad);
} | [
"function",
"(",
")",
"{",
"vendor",
".",
"removeEventListener",
"(",
"window",
",",
"'gamepadconnected'",
",",
"this",
".",
"_checkGamepadCompatibility",
")",
";",
"if",
"(",
"this",
".",
"timeline",
")",
"{",
"this",
".",
"timeline",
".",
"off",
"(",
"'f... | Dispose control. | [
"Dispose",
"control",
"."
] | b157bb50cf8c725fa20f90ebb55481352777f0a7 | https://github.com/pissang/claygl/blob/b157bb50cf8c725fa20f90ebb55481352777f0a7/dist/claygl.es.js#L33659-L33669 | |
6,934 | pissang/claygl | dist/claygl.es.js | function (frameTime) {
if (!this._standardGamepadAvailable) {
return;
}
this._scanPressedGamepadButtons();
this._scanInclinedGamepadAxes();
// Update target depending on user input.
var target = this.target;
var position = this.target.position;
... | javascript | function (frameTime) {
if (!this._standardGamepadAvailable) {
return;
}
this._scanPressedGamepadButtons();
this._scanInclinedGamepadAxes();
// Update target depending on user input.
var target = this.target;
var position = this.target.position;
... | [
"function",
"(",
"frameTime",
")",
"{",
"if",
"(",
"!",
"this",
".",
"_standardGamepadAvailable",
")",
"{",
"return",
";",
"}",
"this",
".",
"_scanPressedGamepadButtons",
"(",
")",
";",
"this",
".",
"_scanInclinedGamepadAxes",
"(",
")",
";",
"// Update target ... | Control's update. Should be invoked every frame.
@param {number} frameTime Frame time. | [
"Control",
"s",
"update",
".",
"Should",
"be",
"invoked",
"every",
"frame",
"."
] | b157bb50cf8c725fa20f90ebb55481352777f0a7 | https://github.com/pissang/claygl/blob/b157bb50cf8c725fa20f90ebb55481352777f0a7/dist/claygl.es.js#L33676-L33728 | |
6,935 | pissang/claygl | dist/claygl.es.js | function () {
var dom = this.domElement;
vendor.addEventListener(dom, 'touchstart', this._mouseDownHandler);
vendor.addEventListener(dom, 'mousedown', this._mouseDownHandler);
vendor.addEventListener(dom, 'wheel', this._mouseWheelHandler);
if (this.timeline) {
this... | javascript | function () {
var dom = this.domElement;
vendor.addEventListener(dom, 'touchstart', this._mouseDownHandler);
vendor.addEventListener(dom, 'mousedown', this._mouseDownHandler);
vendor.addEventListener(dom, 'wheel', this._mouseWheelHandler);
if (this.timeline) {
this... | [
"function",
"(",
")",
"{",
"var",
"dom",
"=",
"this",
".",
"domElement",
";",
"vendor",
".",
"addEventListener",
"(",
"dom",
",",
"'touchstart'",
",",
"this",
".",
"_mouseDownHandler",
")",
";",
"vendor",
".",
"addEventListener",
"(",
"dom",
",",
"'mousedo... | Initialize.
Mouse event binding | [
"Initialize",
".",
"Mouse",
"event",
"binding"
] | b157bb50cf8c725fa20f90ebb55481352777f0a7 | https://github.com/pissang/claygl/blob/b157bb50cf8c725fa20f90ebb55481352777f0a7/dist/claygl.es.js#L34260-L34274 | |
6,936 | pissang/claygl | dist/claygl.es.js | function () {
var dom = this.domElement;
vendor.removeEventListener(dom, 'touchstart', this._mouseDownHandler);
vendor.removeEventListener(dom, 'touchmove', this._mouseMoveHandler);
vendor.removeEventListener(dom, 'touchend', this._mouseUpHandler);
vendor.removeEventListener(do... | javascript | function () {
var dom = this.domElement;
vendor.removeEventListener(dom, 'touchstart', this._mouseDownHandler);
vendor.removeEventListener(dom, 'touchmove', this._mouseMoveHandler);
vendor.removeEventListener(dom, 'touchend', this._mouseUpHandler);
vendor.removeEventListener(do... | [
"function",
"(",
")",
"{",
"var",
"dom",
"=",
"this",
".",
"domElement",
";",
"vendor",
".",
"removeEventListener",
"(",
"dom",
",",
"'touchstart'",
",",
"this",
".",
"_mouseDownHandler",
")",
";",
"vendor",
".",
"removeEventListener",
"(",
"dom",
",",
"'t... | Dispose.
Mouse event unbinding | [
"Dispose",
".",
"Mouse",
"event",
"unbinding"
] | b157bb50cf8c725fa20f90ebb55481352777f0a7 | https://github.com/pissang/claygl/blob/b157bb50cf8c725fa20f90ebb55481352777f0a7/dist/claygl.es.js#L34280-L34297 | |
6,937 | pissang/claygl | dist/claygl.es.js | function (alpha) {
alpha = Math.max(Math.min(this.maxAlpha, alpha), this.minAlpha);
this._theta = alpha / 180 * Math.PI;
this._needsUpdate = true;
} | javascript | function (alpha) {
alpha = Math.max(Math.min(this.maxAlpha, alpha), this.minAlpha);
this._theta = alpha / 180 * Math.PI;
this._needsUpdate = true;
} | [
"function",
"(",
"alpha",
")",
"{",
"alpha",
"=",
"Math",
".",
"max",
"(",
"Math",
".",
"min",
"(",
"this",
".",
"maxAlpha",
",",
"alpha",
")",
",",
"this",
".",
"minAlpha",
")",
";",
"this",
".",
"_theta",
"=",
"alpha",
"/",
"180",
"*",
"Math",
... | Set alpha rotation angle
@param {number} alpha | [
"Set",
"alpha",
"rotation",
"angle"
] | b157bb50cf8c725fa20f90ebb55481352777f0a7 | https://github.com/pissang/claygl/blob/b157bb50cf8c725fa20f90ebb55481352777f0a7/dist/claygl.es.js#L34365-L34370 | |
6,938 | pissang/claygl | dist/claygl.es.js | function (beta) {
beta = Math.max(Math.min(this.maxBeta, beta), this.minBeta);
this._phi = -beta / 180 * Math.PI;
this._needsUpdate = true;
} | javascript | function (beta) {
beta = Math.max(Math.min(this.maxBeta, beta), this.minBeta);
this._phi = -beta / 180 * Math.PI;
this._needsUpdate = true;
} | [
"function",
"(",
"beta",
")",
"{",
"beta",
"=",
"Math",
".",
"max",
"(",
"Math",
".",
"min",
"(",
"this",
".",
"maxBeta",
",",
"beta",
")",
",",
"this",
".",
"minBeta",
")",
";",
"this",
".",
"_phi",
"=",
"-",
"beta",
"/",
"180",
"*",
"Math",
... | Set beta rotation angle
@param {number} beta | [
"Set",
"beta",
"rotation",
"angle"
] | b157bb50cf8c725fa20f90ebb55481352777f0a7 | https://github.com/pissang/claygl/blob/b157bb50cf8c725fa20f90ebb55481352777f0a7/dist/claygl.es.js#L34376-L34381 | |
6,939 | pissang/claygl | dist/claygl.es.js | function () {
for (var i = 0; i < this._animators.length; i++) {
this._animators[i].stop();
}
this._animators.length = 0;
} | javascript | function () {
for (var i = 0; i < this._animators.length; i++) {
this._animators[i].stop();
}
this._animators.length = 0;
} | [
"function",
"(",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"_animators",
".",
"length",
";",
"i",
"++",
")",
"{",
"this",
".",
"_animators",
"[",
"i",
"]",
".",
"stop",
"(",
")",
";",
"}",
"this",
".",
"_animator... | Stop all animations | [
"Stop",
"all",
"animations"
] | b157bb50cf8c725fa20f90ebb55481352777f0a7 | https://github.com/pissang/claygl/blob/b157bb50cf8c725fa20f90ebb55481352777f0a7/dist/claygl.es.js#L34500-L34505 | |
6,940 | pissang/claygl | dist/claygl.es.js | function (deltaTime) {
deltaTime = deltaTime || 16;
if (this._rotating) {
var radian = (this.autoRotateDirection === 'cw' ? 1 : -1)
* this.autoRotateSpeed / 180 * Math.PI;
this._phi -= radian * deltaTime / 1000;
this._needsUpdate = true;
}
... | javascript | function (deltaTime) {
deltaTime = deltaTime || 16;
if (this._rotating) {
var radian = (this.autoRotateDirection === 'cw' ? 1 : -1)
* this.autoRotateSpeed / 180 * Math.PI;
this._phi -= radian * deltaTime / 1000;
this._needsUpdate = true;
}
... | [
"function",
"(",
"deltaTime",
")",
"{",
"deltaTime",
"=",
"deltaTime",
"||",
"16",
";",
"if",
"(",
"this",
".",
"_rotating",
")",
"{",
"var",
"radian",
"=",
"(",
"this",
".",
"autoRotateDirection",
"===",
"'cw'",
"?",
"1",
":",
"-",
"1",
")",
"*",
... | Call update each frame
@param {number} deltaTime Frame time | [
"Call",
"update",
"each",
"frame"
] | b157bb50cf8c725fa20f90ebb55481352777f0a7 | https://github.com/pissang/claygl/blob/b157bb50cf8c725fa20f90ebb55481352777f0a7/dist/claygl.es.js#L34514-L34549 | |
6,941 | pissang/claygl | dist/claygl.es.js | function (geometry, shallow) {
if (!geometry) {
return null;
}
var data = {
metadata : util$1.extend({}, META)
};
//transferable buffers
var buffers = [];
//dynamic
data.dynamic = geometry.dynamic;
//bounding box
i... | javascript | function (geometry, shallow) {
if (!geometry) {
return null;
}
var data = {
metadata : util$1.extend({}, META)
};
//transferable buffers
var buffers = [];
//dynamic
data.dynamic = geometry.dynamic;
//bounding box
i... | [
"function",
"(",
"geometry",
",",
"shallow",
")",
"{",
"if",
"(",
"!",
"geometry",
")",
"{",
"return",
"null",
";",
"}",
"var",
"data",
"=",
"{",
"metadata",
":",
"util$1",
".",
"extend",
"(",
"{",
"}",
",",
"META",
")",
"}",
";",
"//transferable b... | Convert geometry to a object containing transferable data
@param {Geometry} geometry geometry
@param {Boolean} shallow whether shallow copy
@returns {Object} { data : data, buffers : buffers }, buffers is the transferable list | [
"Convert",
"geometry",
"to",
"a",
"object",
"containing",
"transferable",
"data"
] | b157bb50cf8c725fa20f90ebb55481352777f0a7 | https://github.com/pissang/claygl/blob/b157bb50cf8c725fa20f90ebb55481352777f0a7/dist/claygl.es.js#L35242-L35286 | |
6,942 | pissang/claygl | dist/claygl.es.js | function (object) {
if (!object) {
return null;
}
if (object.data && object.buffers) {
return transferableUtil.toGeometry(object.data);
}
if (!object.metadata || object.metadata.generator !== META.generator) {
throw new Error('[util.transferabl... | javascript | function (object) {
if (!object) {
return null;
}
if (object.data && object.buffers) {
return transferableUtil.toGeometry(object.data);
}
if (!object.metadata || object.metadata.generator !== META.generator) {
throw new Error('[util.transferabl... | [
"function",
"(",
"object",
")",
"{",
"if",
"(",
"!",
"object",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"object",
".",
"data",
"&&",
"object",
".",
"buffers",
")",
"{",
"return",
"transferableUtil",
".",
"toGeometry",
"(",
"object",
".",
"dat... | Reproduce a geometry from object generated by toObject
@param {Object} object object generated by toObject
@returns {Geometry} geometry | [
"Reproduce",
"a",
"geometry",
"from",
"object",
"generated",
"by",
"toObject"
] | b157bb50cf8c725fa20f90ebb55481352777f0a7 | https://github.com/pissang/claygl/blob/b157bb50cf8c725fa20f90ebb55481352777f0a7/dist/claygl.es.js#L35293-L35328 | |
6,943 | webslides/WebSlides | src/js/utils/custom-event.js | canIuseNativeCustom | function canIuseNativeCustom() {
try {
const p = new NativeCustomEvent('t', {
detail: {
a: 'b'
}
});
return 't' === p.type && 'b' === p.detail.a;
} catch (e) { }
/* istanbul ignore next: hard to reproduce on test environment */
return false;
} | javascript | function canIuseNativeCustom() {
try {
const p = new NativeCustomEvent('t', {
detail: {
a: 'b'
}
});
return 't' === p.type && 'b' === p.detail.a;
} catch (e) { }
/* istanbul ignore next: hard to reproduce on test environment */
return false;
} | [
"function",
"canIuseNativeCustom",
"(",
")",
"{",
"try",
"{",
"const",
"p",
"=",
"new",
"NativeCustomEvent",
"(",
"'t'",
",",
"{",
"detail",
":",
"{",
"a",
":",
"'b'",
"}",
"}",
")",
";",
"return",
"'t'",
"===",
"p",
".",
"type",
"&&",
"'b'",
"==="... | Check for the usage of native support for CustomEvents which is lacking
completely on IE.
@return {boolean} Whether it can be used or not. | [
"Check",
"for",
"the",
"usage",
"of",
"native",
"support",
"for",
"CustomEvents",
"which",
"is",
"lacking",
"completely",
"on",
"IE",
"."
] | fb5208218f15eb341d0aab64d86ba67a221aced3 | https://github.com/webslides/WebSlides/blob/fb5208218f15eb341d0aab64d86ba67a221aced3/src/js/utils/custom-event.js#L8-L20 |
6,944 | webslides/WebSlides | src/js/utils/custom-event.js | CustomEvent | function CustomEvent(type, params) {
const e = document.createEvent('CustomEvent');
if (params) {
e.initCustomEvent(type, params.bubbles, params.cancelable, params.detail);
} else {
e.initCustomEvent(type, false, false, undefined);
}
return e;
} | javascript | function CustomEvent(type, params) {
const e = document.createEvent('CustomEvent');
if (params) {
e.initCustomEvent(type, params.bubbles, params.cancelable, params.detail);
} else {
e.initCustomEvent(type, false, false, undefined);
}
return e;
} | [
"function",
"CustomEvent",
"(",
"type",
",",
"params",
")",
"{",
"const",
"e",
"=",
"document",
".",
"createEvent",
"(",
"'CustomEvent'",
")",
";",
"if",
"(",
"params",
")",
"{",
"e",
".",
"initCustomEvent",
"(",
"type",
",",
"params",
".",
"bubbles",
... | Lousy polyfill for the Custom Event constructor for IE.
@param {!string} type The type of the event.
@param {?Object} params Additional information for the event.
@return {Event}
@constructor
/* istanbul ignore next: hard to reproduce on test environment | [
"Lousy",
"polyfill",
"for",
"the",
"Custom",
"Event",
"constructor",
"for",
"IE",
"."
] | fb5208218f15eb341d0aab64d86ba67a221aced3 | https://github.com/webslides/WebSlides/blob/fb5208218f15eb341d0aab64d86ba67a221aced3/src/js/utils/custom-event.js#L30-L40 |
6,945 | libp2p/js-libp2p | src/util/index.js | emitFirst | function emitFirst (emitter, events, handler) {
handler = once(handler)
events.forEach((e) => {
emitter.once(e, (...args) => {
events.forEach((ev) => {
emitter.removeListener(ev, handler)
})
handler.apply(emitter, args)
})
})
} | javascript | function emitFirst (emitter, events, handler) {
handler = once(handler)
events.forEach((e) => {
emitter.once(e, (...args) => {
events.forEach((ev) => {
emitter.removeListener(ev, handler)
})
handler.apply(emitter, args)
})
})
} | [
"function",
"emitFirst",
"(",
"emitter",
",",
"events",
",",
"handler",
")",
"{",
"handler",
"=",
"once",
"(",
"handler",
")",
"events",
".",
"forEach",
"(",
"(",
"e",
")",
"=>",
"{",
"emitter",
".",
"once",
"(",
"e",
",",
"(",
"...",
"args",
")",
... | Registers `handler` to each event in `events`. The `handler`
will only be called for the first event fired, at which point
the `handler` will be removed as a listener.
Ensures `handler` is only called once.
@example
// will call `callback` when `start` or `error` is emitted by `this`
emitFirst(this, ['error', 'start'... | [
"Registers",
"handler",
"to",
"each",
"event",
"in",
"events",
".",
"The",
"handler",
"will",
"only",
"be",
"called",
"for",
"the",
"first",
"event",
"fired",
"at",
"which",
"point",
"the",
"handler",
"will",
"be",
"removed",
"as",
"a",
"listener",
"."
] | 28c054c21e7ba2796450d2ab2a0bef6542ec3583 | https://github.com/libp2p/js-libp2p/blob/28c054c21e7ba2796450d2ab2a0bef6542ec3583/src/util/index.js#L21-L31 |
6,946 | vue-styleguidist/vue-styleguidist | packages/vue-styleguidist/loaders/utils/getSections.js | getSections | function getSections(sections, config, parentDepth) {
return sections.map(section => processSection(section, config, parentDepth))
} | javascript | function getSections(sections, config, parentDepth) {
return sections.map(section => processSection(section, config, parentDepth))
} | [
"function",
"getSections",
"(",
"sections",
",",
"config",
",",
"parentDepth",
")",
"{",
"return",
"sections",
".",
"map",
"(",
"section",
"=>",
"processSection",
"(",
"section",
",",
"config",
",",
"parentDepth",
")",
")",
"}"
] | Return object for one level of sections.
@param {Array} sections
@param {object} config
@param {number} parentDepth
@returns {Array} | [
"Return",
"object",
"for",
"one",
"level",
"of",
"sections",
"."
] | a039dc0e112a1d59122d84f5a7ce6b328a63c61b | https://github.com/vue-styleguidist/vue-styleguidist/blob/a039dc0e112a1d59122d84f5a7ce6b328a63c61b/packages/vue-styleguidist/loaders/utils/getSections.js#L21-L23 |
6,947 | vue-styleguidist/vue-styleguidist | packages/vue-styleguidist/loaders/utils/getSections.js | processSection | function processSection(section, config, parentDepth) {
const contentRelativePath = section.content
// Try to load section content file
let content
if (contentRelativePath) {
const contentAbsolutePath = path.resolve(config.configDir, contentRelativePath)
if (!fs.existsSync(contentAbsolutePath)) {
throw new ... | javascript | function processSection(section, config, parentDepth) {
const contentRelativePath = section.content
// Try to load section content file
let content
if (contentRelativePath) {
const contentAbsolutePath = path.resolve(config.configDir, contentRelativePath)
if (!fs.existsSync(contentAbsolutePath)) {
throw new ... | [
"function",
"processSection",
"(",
"section",
",",
"config",
",",
"parentDepth",
")",
"{",
"const",
"contentRelativePath",
"=",
"section",
".",
"content",
"// Try to load section content file",
"let",
"content",
"if",
"(",
"contentRelativePath",
")",
"{",
"const",
"... | Return an object for a given section with all components and subsections.
@param {object} section
@param {object} config
@param {number} parentDepth
@returns {object} | [
"Return",
"an",
"object",
"for",
"a",
"given",
"section",
"with",
"all",
"components",
"and",
"subsections",
"."
] | a039dc0e112a1d59122d84f5a7ce6b328a63c61b | https://github.com/vue-styleguidist/vue-styleguidist/blob/a039dc0e112a1d59122d84f5a7ce6b328a63c61b/packages/vue-styleguidist/loaders/utils/getSections.js#L41-L76 |
6,948 | vue-styleguidist/vue-styleguidist | packages/vue-styleguidist/loaders/utils/processComponent.js | getComponentMetadataPath | function getComponentMetadataPath(filepath) {
const extname = path.extname(filepath)
return filepath.substring(0, filepath.length - extname.length) + '.json'
} | javascript | function getComponentMetadataPath(filepath) {
const extname = path.extname(filepath)
return filepath.substring(0, filepath.length - extname.length) + '.json'
} | [
"function",
"getComponentMetadataPath",
"(",
"filepath",
")",
"{",
"const",
"extname",
"=",
"path",
".",
"extname",
"(",
"filepath",
")",
"return",
"filepath",
".",
"substring",
"(",
"0",
",",
"filepath",
".",
"length",
"-",
"extname",
".",
"length",
")",
... | References the filepath of the metadata file.
@param {string} filepath
@returns {object} | [
"References",
"the",
"filepath",
"of",
"the",
"metadata",
"file",
"."
] | a039dc0e112a1d59122d84f5a7ce6b328a63c61b | https://github.com/vue-styleguidist/vue-styleguidist/blob/a039dc0e112a1d59122d84f5a7ce6b328a63c61b/packages/vue-styleguidist/loaders/utils/processComponent.js#L15-L18 |
6,949 | vue-styleguidist/vue-styleguidist | packages/vue-styleguidist/scripts/config.js | findConfigFile | function findConfigFile() {
let configDir
try {
configDir = findup.sync(process.cwd(), CONFIG_FILENAME)
} catch (exception) {
return false
}
return path.join(configDir, CONFIG_FILENAME)
} | javascript | function findConfigFile() {
let configDir
try {
configDir = findup.sync(process.cwd(), CONFIG_FILENAME)
} catch (exception) {
return false
}
return path.join(configDir, CONFIG_FILENAME)
} | [
"function",
"findConfigFile",
"(",
")",
"{",
"let",
"configDir",
"try",
"{",
"configDir",
"=",
"findup",
".",
"sync",
"(",
"process",
".",
"cwd",
"(",
")",
",",
"CONFIG_FILENAME",
")",
"}",
"catch",
"(",
"exception",
")",
"{",
"return",
"false",
"}",
"... | Try to find config file up the file tree.
@return {string|boolean} Config absolute file path. | [
"Try",
"to",
"find",
"config",
"file",
"up",
"the",
"file",
"tree",
"."
] | a039dc0e112a1d59122d84f5a7ce6b328a63c61b | https://github.com/vue-styleguidist/vue-styleguidist/blob/a039dc0e112a1d59122d84f5a7ce6b328a63c61b/packages/vue-styleguidist/scripts/config.js#L62-L71 |
6,950 | Microsoft/Recognizers-Text | JavaScript/samples/simple-console/index.js | runRecognition | function runRecognition() {
var stdin = process.openStdin();
// Read the text to recognize
write('Enter the text to recognize: ');
stdin.addListener('data', function (e) {
var input = e.toString().trim();
if (input) {
// Exit
if (input.toLowerCase() === 'exit') ... | javascript | function runRecognition() {
var stdin = process.openStdin();
// Read the text to recognize
write('Enter the text to recognize: ');
stdin.addListener('data', function (e) {
var input = e.toString().trim();
if (input) {
// Exit
if (input.toLowerCase() === 'exit') ... | [
"function",
"runRecognition",
"(",
")",
"{",
"var",
"stdin",
"=",
"process",
".",
"openStdin",
"(",
")",
";",
"// Read the text to recognize",
"write",
"(",
"'Enter the text to recognize: '",
")",
";",
"stdin",
".",
"addListener",
"(",
"'data'",
",",
"function",
... | Read from Console and recognize | [
"Read",
"from",
"Console",
"and",
"recognize"
] | 08414d1585eaa29a61455aaea95bf29a8d629b23 | https://github.com/Microsoft/Recognizers-Text/blob/08414d1585eaa29a61455aaea95bf29a8d629b23/JavaScript/samples/simple-console/index.js#L11-L44 |
6,951 | jfhbrook/node-ecstatic | lib/ecstatic.js | shouldCompressGzip | function shouldCompressGzip(req) {
const headers = req.headers;
return headers && headers['accept-encoding'] &&
headers['accept-encoding']
.split(',')
.some(el => ['*', 'compress', 'gzip', 'deflate'].indexOf(el.trim()) !== -1)
;
} | javascript | function shouldCompressGzip(req) {
const headers = req.headers;
return headers && headers['accept-encoding'] &&
headers['accept-encoding']
.split(',')
.some(el => ['*', 'compress', 'gzip', 'deflate'].indexOf(el.trim()) !== -1)
;
} | [
"function",
"shouldCompressGzip",
"(",
"req",
")",
"{",
"const",
"headers",
"=",
"req",
".",
"headers",
";",
"return",
"headers",
"&&",
"headers",
"[",
"'accept-encoding'",
"]",
"&&",
"headers",
"[",
"'accept-encoding'",
"]",
".",
"split",
"(",
"','",
")",
... | Check to see if we should try to compress a file with gzip. | [
"Check",
"to",
"see",
"if",
"we",
"should",
"try",
"to",
"compress",
"a",
"file",
"with",
"gzip",
"."
] | ae7a39b1ecdbe3aa8c0162ab2c3f7365bf9a6d75 | https://github.com/jfhbrook/node-ecstatic/blob/ae7a39b1ecdbe3aa8c0162ab2c3f7365bf9a6d75/lib/ecstatic.js#L36-L44 |
6,952 | jfhbrook/node-ecstatic | lib/ecstatic.js | tryServeWithGzip | function tryServeWithGzip() {
fs.stat(gzippedFile, (err, stat) => {
if (!err && stat.isFile()) {
hasGzipId12(gzippedFile, (gzipErr, isGzip) => {
if (!gzipErr && isGzip) {
file = gzippedFile;
serve(stat);
} else {
statFile();
... | javascript | function tryServeWithGzip() {
fs.stat(gzippedFile, (err, stat) => {
if (!err && stat.isFile()) {
hasGzipId12(gzippedFile, (gzipErr, isGzip) => {
if (!gzipErr && isGzip) {
file = gzippedFile;
serve(stat);
} else {
statFile();
... | [
"function",
"tryServeWithGzip",
"(",
")",
"{",
"fs",
".",
"stat",
"(",
"gzippedFile",
",",
"(",
"err",
",",
"stat",
")",
"=>",
"{",
"if",
"(",
"!",
"err",
"&&",
"stat",
".",
"isFile",
"(",
")",
")",
"{",
"hasGzipId12",
"(",
"gzippedFile",
",",
"(",... | serve gzip file if exists and is valid | [
"serve",
"gzip",
"file",
"if",
"exists",
"and",
"is",
"valid"
] | ae7a39b1ecdbe3aa8c0162ab2c3f7365bf9a6d75 | https://github.com/jfhbrook/node-ecstatic/blob/ae7a39b1ecdbe3aa8c0162ab2c3f7365bf9a6d75/lib/ecstatic.js#L433-L448 |
6,953 | jfhbrook/node-ecstatic | lib/ecstatic.js | tryServeWithBrotli | function tryServeWithBrotli(shouldTryGzip) {
fs.stat(brotliFile, (err, stat) => {
if (!err && stat.isFile()) {
file = brotliFile;
serve(stat);
} else if (shouldTryGzip) {
tryServeWithGzip();
} else {
statFile();
}
});
} | javascript | function tryServeWithBrotli(shouldTryGzip) {
fs.stat(brotliFile, (err, stat) => {
if (!err && stat.isFile()) {
file = brotliFile;
serve(stat);
} else if (shouldTryGzip) {
tryServeWithGzip();
} else {
statFile();
}
});
} | [
"function",
"tryServeWithBrotli",
"(",
"shouldTryGzip",
")",
"{",
"fs",
".",
"stat",
"(",
"brotliFile",
",",
"(",
"err",
",",
"stat",
")",
"=>",
"{",
"if",
"(",
"!",
"err",
"&&",
"stat",
".",
"isFile",
"(",
")",
")",
"{",
"file",
"=",
"brotliFile",
... | serve brotli file if exists, otherwise try gzip | [
"serve",
"brotli",
"file",
"if",
"exists",
"otherwise",
"try",
"gzip"
] | ae7a39b1ecdbe3aa8c0162ab2c3f7365bf9a6d75 | https://github.com/jfhbrook/node-ecstatic/blob/ae7a39b1ecdbe3aa8c0162ab2c3f7365bf9a6d75/lib/ecstatic.js#L451-L462 |
6,954 | rauchg/slackin | lib/assets/superagent.js | getXHR | function getXHR () {
if (root.XMLHttpRequest
&& ('file:' != root.location.protocol || !root.ActiveXObject)) {
return new XMLHttpRequest
} else {
try { return new ActiveXObject('Microsoft.XMLHTTP') } catch(e) {}
try { return new ActiveXObject('Msxml2.XMLHTTP.6.0') } catch(e) {}
... | javascript | function getXHR () {
if (root.XMLHttpRequest
&& ('file:' != root.location.protocol || !root.ActiveXObject)) {
return new XMLHttpRequest
} else {
try { return new ActiveXObject('Microsoft.XMLHTTP') } catch(e) {}
try { return new ActiveXObject('Msxml2.XMLHTTP.6.0') } catch(e) {}
... | [
"function",
"getXHR",
"(",
")",
"{",
"if",
"(",
"root",
".",
"XMLHttpRequest",
"&&",
"(",
"'file:'",
"!=",
"root",
".",
"location",
".",
"protocol",
"||",
"!",
"root",
".",
"ActiveXObject",
")",
")",
"{",
"return",
"new",
"XMLHttpRequest",
"}",
"else",
... | Determine XHR. | [
"Determine",
"XHR",
"."
] | fa88a860a87cf38d9a1c4007207e6efae4288242 | https://github.com/rauchg/slackin/blob/fa88a860a87cf38d9a1c4007207e6efae4288242/lib/assets/superagent.js#L446-L457 |
6,955 | rauchg/slackin | lib/assets/superagent.js | params | function params (str){
return reduce(str.split(/ *; */), function (obj, str){
var parts = str.split(/ *= */),
key = parts.shift(),
val = parts.shift()
if (key && val) obj[key] = val
return obj
}, {})
} | javascript | function params (str){
return reduce(str.split(/ *; */), function (obj, str){
var parts = str.split(/ *= */),
key = parts.shift(),
val = parts.shift()
if (key && val) obj[key] = val
return obj
}, {})
} | [
"function",
"params",
"(",
"str",
")",
"{",
"return",
"reduce",
"(",
"str",
".",
"split",
"(",
"/",
" *; *",
"/",
")",
",",
"function",
"(",
"obj",
",",
"str",
")",
"{",
"var",
"parts",
"=",
"str",
".",
"split",
"(",
"/",
" *= *",
"/",
")",
","... | Return header field parameters.
@param {String} str
@return {Object}
@api private | [
"Return",
"header",
"field",
"parameters",
"."
] | fa88a860a87cf38d9a1c4007207e6efae4288242 | https://github.com/rauchg/slackin/blob/fa88a860a87cf38d9a1c4007207e6efae4288242/lib/assets/superagent.js#L632-L641 |
6,956 | rauchg/slackin | lib/assets/badge.js | search | function search (){
var replaced = 0
var scripts = document.querySelectorAll('script')
var script
for (var i = 0; i < scripts.length; i++) {
script = scripts[i]
if (!script.src) continue
if (/\/slackin\.js(\?.*)?$/.test(script.src)) {
// replace script with iframe
repla... | javascript | function search (){
var replaced = 0
var scripts = document.querySelectorAll('script')
var script
for (var i = 0; i < scripts.length; i++) {
script = scripts[i]
if (!script.src) continue
if (/\/slackin\.js(\?.*)?$/.test(script.src)) {
// replace script with iframe
repla... | [
"function",
"search",
"(",
")",
"{",
"var",
"replaced",
"=",
"0",
"var",
"scripts",
"=",
"document",
".",
"querySelectorAll",
"(",
"'script'",
")",
"var",
"script",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"scripts",
".",
"length",
";",
"i",
... | search for a script tag pointing to slackin.js | [
"search",
"for",
"a",
"script",
"tag",
"pointing",
"to",
"slackin",
".",
"js"
] | fa88a860a87cf38d9a1c4007207e6efae4288242 | https://github.com/rauchg/slackin/blob/fa88a860a87cf38d9a1c4007207e6efae4288242/lib/assets/badge.js#L12-L29 |
6,957 | rauchg/slackin | lib/assets/badge.js | replace | function replace (script){
var parent = script.parentNode
if (!parent) return
LARGE = /\?large/.test(script.src)
var iframe = document.createElement('iframe')
var iframePath = '/iframe' + (LARGE ? '?large' : '')
iframe.src = script.src.replace(/\/slackin\.js.*/, iframePath)
iframe.style.bor... | javascript | function replace (script){
var parent = script.parentNode
if (!parent) return
LARGE = /\?large/.test(script.src)
var iframe = document.createElement('iframe')
var iframePath = '/iframe' + (LARGE ? '?large' : '')
iframe.src = script.src.replace(/\/slackin\.js.*/, iframePath)
iframe.style.bor... | [
"function",
"replace",
"(",
"script",
")",
"{",
"var",
"parent",
"=",
"script",
".",
"parentNode",
"if",
"(",
"!",
"parent",
")",
"return",
"LARGE",
"=",
"/",
"\\?large",
"/",
".",
"test",
"(",
"script",
".",
"src",
")",
"var",
"iframe",
"=",
"docume... | replace the script tag with an iframe | [
"replace",
"the",
"script",
"tag",
"with",
"an",
"iframe"
] | fa88a860a87cf38d9a1c4007207e6efae4288242 | https://github.com/rauchg/slackin/blob/fa88a860a87cf38d9a1c4007207e6efae4288242/lib/assets/badge.js#L34-L64 |
6,958 | rauchg/slackin | lib/assets/badge.js | setup | function setup (iframe){
var id = Math.random() * (1 << 24) | 0
iframe.contentWindow.postMessage('slackin:' + id, '*')
window.addEventListener('message', function (e){
if (typeof e.data !== 'string') return
// show dialog upon click
if ('slackin-click:' + id === e.data) {
showDia... | javascript | function setup (iframe){
var id = Math.random() * (1 << 24) | 0
iframe.contentWindow.postMessage('slackin:' + id, '*')
window.addEventListener('message', function (e){
if (typeof e.data !== 'string') return
// show dialog upon click
if ('slackin-click:' + id === e.data) {
showDia... | [
"function",
"setup",
"(",
"iframe",
")",
"{",
"var",
"id",
"=",
"Math",
".",
"random",
"(",
")",
"*",
"(",
"1",
"<<",
"24",
")",
"|",
"0",
"iframe",
".",
"contentWindow",
".",
"postMessage",
"(",
"'slackin:'",
"+",
"id",
",",
"'*'",
")",
"window",
... | setup an "RPC" channel between iframe and us | [
"setup",
"an",
"RPC",
"channel",
"between",
"iframe",
"and",
"us"
] | fa88a860a87cf38d9a1c4007207e6efae4288242 | https://github.com/rauchg/slackin/blob/fa88a860a87cf38d9a1c4007207e6efae4288242/lib/assets/badge.js#L67-L94 |
6,959 | rauchg/slackin | lib/badge.js | text | function text ({str, x, y}){
return [
svg(`text fill=#010101 fill-opacity=.3 x=${x} y=${y + 1}`, str),
svg(`text fill=#fff x=${x} y=${y}`, str)
]
} | javascript | function text ({str, x, y}){
return [
svg(`text fill=#010101 fill-opacity=.3 x=${x} y=${y + 1}`, str),
svg(`text fill=#fff x=${x} y=${y}`, str)
]
} | [
"function",
"text",
"(",
"{",
"str",
",",
"x",
",",
"y",
"}",
")",
"{",
"return",
"[",
"svg",
"(",
"`",
"${",
"x",
"}",
"${",
"y",
"+",
"1",
"}",
"`",
",",
"str",
")",
",",
"svg",
"(",
"`",
"${",
"x",
"}",
"${",
"y",
"}",
"`",
",",
"s... | generate text with 1px shadow | [
"generate",
"text",
"with",
"1px",
"shadow"
] | fa88a860a87cf38d9a1c4007207e6efae4288242 | https://github.com/rauchg/slackin/blob/fa88a860a87cf38d9a1c4007207e6efae4288242/lib/badge.js#L26-L31 |
6,960 | rauchg/slackin | lib/assets/client.js | topLevelRedirect | function topLevelRedirect (url) {
if (window === top) location.href = url
else parent.postMessage('slackin-redirect:' + id + ':' + url, '*')
// Q: Why can't we just `top.location.href = url;`?
// A:
// [sandboxing]: http://www.html5rocks.com/en/tutorials/security/sandboxed-iframes/
// [CSP]: http://www.html... | javascript | function topLevelRedirect (url) {
if (window === top) location.href = url
else parent.postMessage('slackin-redirect:' + id + ':' + url, '*')
// Q: Why can't we just `top.location.href = url;`?
// A:
// [sandboxing]: http://www.html5rocks.com/en/tutorials/security/sandboxed-iframes/
// [CSP]: http://www.html... | [
"function",
"topLevelRedirect",
"(",
"url",
")",
"{",
"if",
"(",
"window",
"===",
"top",
")",
"location",
".",
"href",
"=",
"url",
"else",
"parent",
".",
"postMessage",
"(",
"'slackin-redirect:'",
"+",
"id",
"+",
"':'",
"+",
"url",
",",
"'*'",
")",
"//... | redirect, using "RPC" to parent if necessary | [
"redirect",
"using",
"RPC",
"to",
"parent",
"if",
"necessary"
] | fa88a860a87cf38d9a1c4007207e6efae4288242 | https://github.com/rauchg/slackin/blob/fa88a860a87cf38d9a1c4007207e6efae4288242/lib/assets/client.js#L89-L97 |
6,961 | facebook/prop-types | factoryWithTypeCheckers.js | getClassName | function getClassName(propValue) {
if (!propValue.constructor || !propValue.constructor.name) {
return ANONYMOUS;
}
return propValue.constructor.name;
} | javascript | function getClassName(propValue) {
if (!propValue.constructor || !propValue.constructor.name) {
return ANONYMOUS;
}
return propValue.constructor.name;
} | [
"function",
"getClassName",
"(",
"propValue",
")",
"{",
"if",
"(",
"!",
"propValue",
".",
"constructor",
"||",
"!",
"propValue",
".",
"constructor",
".",
"name",
")",
"{",
"return",
"ANONYMOUS",
";",
"}",
"return",
"propValue",
".",
"constructor",
".",
"na... | Returns class name of the object, if any. | [
"Returns",
"class",
"name",
"of",
"the",
"object",
"if",
"any",
"."
] | e32c4900f5ab5fd3acea93e9d2f0d09e4a2f2ceb | https://github.com/facebook/prop-types/blob/e32c4900f5ab5fd3acea93e9d2f0d09e4a2f2ceb/factoryWithTypeCheckers.js#L598-L603 |
6,962 | EddyVerbruggen/nativescript-plugin-firebase | publish/scripts/installer.js | writeBuildscriptHookForCrashlytics | function writeBuildscriptHookForCrashlytics(enable) {
var scriptPath = path.join(appRoot, "hooks", "after-prepare", "firebase-crashlytics-buildscript.js");
if (!enable) {
if (fs.existsSync(scriptPath)) {
fs.unlinkSync(scriptPath);
}
return
}
console.log("Install Crashlytics buildscript hook.... | javascript | function writeBuildscriptHookForCrashlytics(enable) {
var scriptPath = path.join(appRoot, "hooks", "after-prepare", "firebase-crashlytics-buildscript.js");
if (!enable) {
if (fs.existsSync(scriptPath)) {
fs.unlinkSync(scriptPath);
}
return
}
console.log("Install Crashlytics buildscript hook.... | [
"function",
"writeBuildscriptHookForCrashlytics",
"(",
"enable",
")",
"{",
"var",
"scriptPath",
"=",
"path",
".",
"join",
"(",
"appRoot",
",",
"\"hooks\"",
",",
"\"after-prepare\"",
",",
"\"firebase-crashlytics-buildscript.js\"",
")",
";",
"if",
"(",
"!",
"enable",
... | Create the iOS build script for uploading dSYM files to Crashlytics
@param {any} enable Is Crashlytics enabled | [
"Create",
"the",
"iOS",
"build",
"script",
"for",
"uploading",
"dSYM",
"files",
"to",
"Crashlytics"
] | e83ac1c4b6e18eb525ab6fb7ca6802f9cd3940ea | https://github.com/EddyVerbruggen/nativescript-plugin-firebase/blob/e83ac1c4b6e18eb525ab6fb7ca6802f9cd3940ea/publish/scripts/installer.js#L462-L608 |
6,963 | ethantw/Han | src/js/locale/h-ruby.js | renderSimpleRuby | function renderSimpleRuby( $ruby ) {
var frag = $.create( '!' )
var clazz = $ruby.classList
var $rb, $ru
frag.appendChild( $.clone( $ruby ))
$
.tag( 'rt', frag.firstChild )
.forEach(function( $rt ) {
var $rb = $.create( '!' )
var airb = []
var irb
// Consider the previous nodes the impl... | javascript | function renderSimpleRuby( $ruby ) {
var frag = $.create( '!' )
var clazz = $ruby.classList
var $rb, $ru
frag.appendChild( $.clone( $ruby ))
$
.tag( 'rt', frag.firstChild )
.forEach(function( $rt ) {
var $rb = $.create( '!' )
var airb = []
var irb
// Consider the previous nodes the impl... | [
"function",
"renderSimpleRuby",
"(",
"$ruby",
")",
"{",
"var",
"frag",
"=",
"$",
".",
"create",
"(",
"'!'",
")",
"var",
"clazz",
"=",
"$ruby",
".",
"classList",
"var",
"$rb",
",",
"$ru",
"frag",
".",
"appendChild",
"(",
"$",
".",
"clone",
"(",
"$ruby... | 1. Simple ruby polyfill; 2. Inter-character polyfill for Zhuyin | [
"1",
".",
"Simple",
"ruby",
"polyfill",
";",
"2",
".",
"Inter",
"-",
"character",
"polyfill",
"for",
"Zhuyin"
] | 940014b48dded1eaa7fa92fa5a09d9cfc96429a9 | https://github.com/ethantw/Han/blob/940014b48dded1eaa7fa92fa5a09d9cfc96429a9/src/js/locale/h-ruby.js#L11-L46 |
6,964 | ethantw/Han | src/js/locale/h-ruby.js | renderComplexRuby | function renderComplexRuby( $ruby ) {
var frag = $.create( '!' )
var clazz = $ruby.classList
var $cloned, $rb, $ru, maxspan
frag.appendChild( $.clone( $ruby ))
$cloned = frag.firstChild
$rb = $ru = $.tag( 'rb', $cloned )
maxspan = $rb.length
// First of all, deal with Zhuyin containers
// individua... | javascript | function renderComplexRuby( $ruby ) {
var frag = $.create( '!' )
var clazz = $ruby.classList
var $cloned, $rb, $ru, maxspan
frag.appendChild( $.clone( $ruby ))
$cloned = frag.firstChild
$rb = $ru = $.tag( 'rb', $cloned )
maxspan = $rb.length
// First of all, deal with Zhuyin containers
// individua... | [
"function",
"renderComplexRuby",
"(",
"$ruby",
")",
"{",
"var",
"frag",
"=",
"$",
".",
"create",
"(",
"'!'",
")",
"var",
"clazz",
"=",
"$ruby",
".",
"classList",
"var",
"$cloned",
",",
"$rb",
",",
"$ru",
",",
"maxspan",
"frag",
".",
"appendChild",
"(",... | 3. Complex ruby polyfill - Double-lined annotation; - Right-angled annotation. | [
"3",
".",
"Complex",
"ruby",
"polyfill",
"-",
"Double",
"-",
"lined",
"annotation",
";",
"-",
"Right",
"-",
"angled",
"annotation",
"."
] | 940014b48dded1eaa7fa92fa5a09d9cfc96429a9 | https://github.com/ethantw/Han/blob/940014b48dded1eaa7fa92fa5a09d9cfc96429a9/src/js/locale/h-ruby.js#L79-L170 |
6,965 | ethantw/Han | src/js/locale/h-ruby.js | getZhuyinHTML | function getZhuyinHTML( rt ) {
// #### Explanation ####
// * `zhuyin`: the entire phonetic annotation
// * `yin`: the plain pronunciation (w/out tone)
// * `diao`: the tone
// * `len`: the length of the plain pronunciation (`yin`)
var zhuyin = typeof rt === 'string' ? rt : rt.textContent
var yin, ... | javascript | function getZhuyinHTML( rt ) {
// #### Explanation ####
// * `zhuyin`: the entire phonetic annotation
// * `yin`: the plain pronunciation (w/out tone)
// * `diao`: the tone
// * `len`: the length of the plain pronunciation (`yin`)
var zhuyin = typeof rt === 'string' ? rt : rt.textContent
var yin, ... | [
"function",
"getZhuyinHTML",
"(",
"rt",
")",
"{",
"// #### Explanation ####",
"// * `zhuyin`: the entire phonetic annotation",
"// * `yin`: the plain pronunciation (w/out tone)",
"// * `diao`: the tone",
"// * `len`: the length of the plain pronunciation (`yin`)",
"var",
"zhuyin",
... | Create a Zhuyin-form HTML string | [
"Create",
"a",
"Zhuyin",
"-",
"form",
"HTML",
"string"
] | 940014b48dded1eaa7fa92fa5a09d9cfc96429a9 | https://github.com/ethantw/Han/blob/940014b48dded1eaa7fa92fa5a09d9cfc96429a9/src/js/locale/h-ruby.js#L246-L262 |
6,966 | ethantw/Han | src/js/method.js | function( target, attr ) {
if ( typeof attr !== 'object' ) return
var len = attr.length
// Native `NamedNodeMap``:
if (
typeof attr[0] === 'object' &&
'name' in attr[0]
) {
for ( var i = 0; i < len; i++ ) {
if ( attr[ i ].value !== undefined ) {
target.setAttrib... | javascript | function( target, attr ) {
if ( typeof attr !== 'object' ) return
var len = attr.length
// Native `NamedNodeMap``:
if (
typeof attr[0] === 'object' &&
'name' in attr[0]
) {
for ( var i = 0; i < len; i++ ) {
if ( attr[ i ].value !== undefined ) {
target.setAttrib... | [
"function",
"(",
"target",
",",
"attr",
")",
"{",
"if",
"(",
"typeof",
"attr",
"!==",
"'object'",
")",
"return",
"var",
"len",
"=",
"attr",
".",
"length",
"// Native `NamedNodeMap``:",
"if",
"(",
"typeof",
"attr",
"[",
"0",
"]",
"===",
"'object'",
"&&",
... | Set attributes all in once with an object. | [
"Set",
"attributes",
"all",
"in",
"once",
"with",
"an",
"object",
"."
] | 940014b48dded1eaa7fa92fa5a09d9cfc96429a9 | https://github.com/ethantw/Han/blob/940014b48dded1eaa7fa92fa5a09d9cfc96429a9/src/js/method.js#L91-L118 | |
6,967 | ethantw/Han | src/js/method.js | function( target, object ) {
if ((
typeof target === 'object' ||
typeof target === 'function' ) &&
typeof object === 'object'
) {
for ( var name in object ) {
if (object.hasOwnProperty( name )) {
target[ name ] = object[ name ]
}
}
}
return target
... | javascript | function( target, object ) {
if ((
typeof target === 'object' ||
typeof target === 'function' ) &&
typeof object === 'object'
) {
for ( var name in object ) {
if (object.hasOwnProperty( name )) {
target[ name ] = object[ name ]
}
}
}
return target
... | [
"function",
"(",
"target",
",",
"object",
")",
"{",
"if",
"(",
"(",
"typeof",
"target",
"===",
"'object'",
"||",
"typeof",
"target",
"===",
"'function'",
")",
"&&",
"typeof",
"object",
"===",
"'object'",
")",
"{",
"for",
"(",
"var",
"name",
"in",
"obje... | Extend target with an object. | [
"Extend",
"target",
"with",
"an",
"object",
"."
] | 940014b48dded1eaa7fa92fa5a09d9cfc96429a9 | https://github.com/ethantw/Han/blob/940014b48dded1eaa7fa92fa5a09d9cfc96429a9/src/js/method.js#L151-L164 | |
6,968 | ethantw/Han | src/lib/fibre.js/index.js | function() {
var match
var matchIndex = 0
var offset = 0
var regex = this.options.find
var textAggregation = this.getAggregateText()
var matches = []
var self = this
regex = typeof regex === 'string' ? RegExp(escapeRegExp(regex), 'g') : regex
matchAggregation(textA... | javascript | function() {
var match
var matchIndex = 0
var offset = 0
var regex = this.options.find
var textAggregation = this.getAggregateText()
var matches = []
var self = this
regex = typeof regex === 'string' ? RegExp(escapeRegExp(regex), 'g') : regex
matchAggregation(textA... | [
"function",
"(",
")",
"{",
"var",
"match",
"var",
"matchIndex",
"=",
"0",
"var",
"offset",
"=",
"0",
"var",
"regex",
"=",
"this",
".",
"options",
".",
"find",
"var",
"textAggregation",
"=",
"this",
".",
"getAggregateText",
"(",
")",
"var",
"matches",
"... | Searches for all matches that comply with the instance's 'match' option | [
"Searches",
"for",
"all",
"matches",
"that",
"comply",
"with",
"the",
"instance",
"s",
"match",
"option"
] | 940014b48dded1eaa7fa92fa5a09d9cfc96429a9 | https://github.com/ethantw/Han/blob/940014b48dded1eaa7fa92fa5a09d9cfc96429a9/src/lib/fibre.js/index.js#L368-L404 | |
6,969 | ethantw/Han | src/lib/fibre.js/index.js | function() {
var elementFilter = this.options.filterElements
var forceContext = this.options.forceContext
return getText(this.node)
/**
* Gets aggregate text of a node without resorting
* to broken innerText/textContent
*/
function getText(node, txt) {
if (no... | javascript | function() {
var elementFilter = this.options.filterElements
var forceContext = this.options.forceContext
return getText(this.node)
/**
* Gets aggregate text of a node without resorting
* to broken innerText/textContent
*/
function getText(node, txt) {
if (no... | [
"function",
"(",
")",
"{",
"var",
"elementFilter",
"=",
"this",
".",
"options",
".",
"filterElements",
"var",
"forceContext",
"=",
"this",
".",
"options",
".",
"forceContext",
"return",
"getText",
"(",
"this",
".",
"node",
")",
"/**\n * Gets aggregate text... | Gets aggregate text within subject node | [
"Gets",
"aggregate",
"text",
"within",
"subject",
"node"
] | 940014b48dded1eaa7fa92fa5a09d9cfc96429a9 | https://github.com/ethantw/Han/blob/940014b48dded1eaa7fa92fa5a09d9cfc96429a9/src/lib/fibre.js/index.js#L424-L476 | |
6,970 | ethantw/Han | src/lib/fibre.js/index.js | function() {
var matches = this.matches
var node = this.node
var elementFilter = this.options.filterElements
var startPortion,
endPortion,
innerPortions = [],
curNode = node,
match = matches.shift(),
atIndex = 0, // i.e. nodeAtIndex
matchIndex = 0... | javascript | function() {
var matches = this.matches
var node = this.node
var elementFilter = this.options.filterElements
var startPortion,
endPortion,
innerPortions = [],
curNode = node,
match = matches.shift(),
atIndex = 0, // i.e. nodeAtIndex
matchIndex = 0... | [
"function",
"(",
")",
"{",
"var",
"matches",
"=",
"this",
".",
"matches",
"var",
"node",
"=",
"this",
".",
"node",
"var",
"elementFilter",
"=",
"this",
".",
"options",
".",
"filterElements",
"var",
"startPortion",
",",
"endPortion",
",",
"innerPortions",
"... | Steps through the target node, looking for matches, and
calling replaceFn when a match is found. | [
"Steps",
"through",
"the",
"target",
"node",
"looking",
"for",
"matches",
"and",
"calling",
"replaceFn",
"when",
"a",
"match",
"is",
"found",
"."
] | 940014b48dded1eaa7fa92fa5a09d9cfc96429a9 | https://github.com/ethantw/Han/blob/940014b48dded1eaa7fa92fa5a09d9cfc96429a9/src/lib/fibre.js/index.js#L482-L586 | |
6,971 | ethantw/Han | src/js/core.js | function( routine ) {
var it = this
var routine = Array.isArray( routine )
? routine
: this.routine
routine
.forEach(function( method ) {
if (
typeof method === 'string' &&
typeof it[ method ] === 'function'
) {
it[ method ]()
} else if (
... | javascript | function( routine ) {
var it = this
var routine = Array.isArray( routine )
? routine
: this.routine
routine
.forEach(function( method ) {
if (
typeof method === 'string' &&
typeof it[ method ] === 'function'
) {
it[ method ]()
} else if (
... | [
"function",
"(",
"routine",
")",
"{",
"var",
"it",
"=",
"this",
"var",
"routine",
"=",
"Array",
".",
"isArray",
"(",
"routine",
")",
"?",
"routine",
":",
"this",
".",
"routine",
"routine",
".",
"forEach",
"(",
"function",
"(",
"method",
")",
"{",
"if... | Note that the routine set up here will execute only once. The method won't alter the routine in the instance or in the prototype chain. | [
"Note",
"that",
"the",
"routine",
"set",
"up",
"here",
"will",
"execute",
"only",
"once",
".",
"The",
"method",
"won",
"t",
"alter",
"the",
"routine",
"in",
"the",
"instance",
"or",
"in",
"the",
"prototype",
"chain",
"."
] | 940014b48dded1eaa7fa92fa5a09d9cfc96429a9 | https://github.com/ethantw/Han/blob/940014b48dded1eaa7fa92fa5a09d9cfc96429a9/src/js/core.js#L80-L101 | |
6,972 | ethantw/Han | src/js/find.js | function( selector ) {
return (
this
.filter( selector || null )
.avoid( 'h-jinze' )
.replace(
TYPESET.jinze.touwei,
function( portion, match ) {
var elem = $.create( 'h-jinze', 'touwei' )
elem.innerHTML = match[0]
return (( portion.index === 0 && portion.isEnd ) ... | javascript | function( selector ) {
return (
this
.filter( selector || null )
.avoid( 'h-jinze' )
.replace(
TYPESET.jinze.touwei,
function( portion, match ) {
var elem = $.create( 'h-jinze', 'touwei' )
elem.innerHTML = match[0]
return (( portion.index === 0 && portion.isEnd ) ... | [
"function",
"(",
"selector",
")",
"{",
"return",
"(",
"this",
".",
"filter",
"(",
"selector",
"||",
"null",
")",
".",
"avoid",
"(",
"'h-jinze'",
")",
".",
"replace",
"(",
"TYPESET",
".",
"jinze",
".",
"touwei",
",",
"function",
"(",
"portion",
",",
"... | Force punctuation & biaodian typesetting rules to be applied. | [
"Force",
"punctuation",
"&",
"biaodian",
"typesetting",
"rules",
"to",
"be",
"applied",
"."
] | 940014b48dded1eaa7fa92fa5a09d9cfc96429a9 | https://github.com/ethantw/Han/blob/940014b48dded1eaa7fa92fa5a09d9cfc96429a9/src/js/find.js#L86-L128 | |
6,973 | ethantw/Han | src/js/locale/normalize.js | function( context, target ) {
var $$target = $.qsa( target || 'u, ins', context )
var i = $$target.length
traverse: while ( i-- ) {
var $this = $$target[ i ]
var $prev = null
// Ignore all `<wbr>` and comments in between,
// and add class `.adjacent` once two targets
// are n... | javascript | function( context, target ) {
var $$target = $.qsa( target || 'u, ins', context )
var i = $$target.length
traverse: while ( i-- ) {
var $this = $$target[ i ]
var $prev = null
// Ignore all `<wbr>` and comments in between,
// and add class `.adjacent` once two targets
// are n... | [
"function",
"(",
"context",
",",
"target",
")",
"{",
"var",
"$$target",
"=",
"$",
".",
"qsa",
"(",
"target",
"||",
"'u, ins'",
",",
"context",
")",
"var",
"i",
"=",
"$$target",
".",
"length",
"traverse",
":",
"while",
"(",
"i",
"--",
")",
"{",
"var... | Traverse all target elements and address presentational corrections if any two of them are adjacent to each other. | [
"Traverse",
"all",
"target",
"elements",
"and",
"address",
"presentational",
"corrections",
"if",
"any",
"two",
"of",
"them",
"are",
"adjacent",
"to",
"each",
"other",
"."
] | 940014b48dded1eaa7fa92fa5a09d9cfc96429a9 | https://github.com/ethantw/Han/blob/940014b48dded1eaa7fa92fa5a09d9cfc96429a9/src/js/locale/normalize.js#L27-L48 | |
6,974 | ethantw/Han | src/js/locale/normalize.js | function( context, target ) {
var method = target ? 'qsa' : 'tag'
var target = target || 'em'
var $target = $[ method ]( target, context )
$target
.forEach(function( elem ) {
var $elem = Han( elem )
if ( Locale.support.textemphasis ) {
$elem
.avoid( 'rt, h-char' )
... | javascript | function( context, target ) {
var method = target ? 'qsa' : 'tag'
var target = target || 'em'
var $target = $[ method ]( target, context )
$target
.forEach(function( elem ) {
var $elem = Han( elem )
if ( Locale.support.textemphasis ) {
$elem
.avoid( 'rt, h-char' )
... | [
"function",
"(",
"context",
",",
"target",
")",
"{",
"var",
"method",
"=",
"target",
"?",
"'qsa'",
":",
"'tag'",
"var",
"target",
"=",
"target",
"||",
"'em'",
"var",
"$target",
"=",
"$",
"[",
"method",
"]",
"(",
"target",
",",
"context",
")",
"$targe... | Traverse all target elements to render emphasis marks. | [
"Traverse",
"all",
"target",
"elements",
"to",
"render",
"emphasis",
"marks",
"."
] | 940014b48dded1eaa7fa92fa5a09d9cfc96429a9 | https://github.com/ethantw/Han/blob/940014b48dded1eaa7fa92fa5a09d9cfc96429a9/src/js/locale/normalize.js#L52-L80 | |
6,975 | fable-compiler/Fable | src/fable-library/Types.js | inherits | function inherits(subClass, superClass) {
// if (typeof superClass !== "function" && superClass !== null) {
// throw new TypeError(
// "Super expression must either be null or a function, not " +
// typeof superClass
// );
// }
subClass.prototype = Object.create(superClass && superClass.prot... | javascript | function inherits(subClass, superClass) {
// if (typeof superClass !== "function" && superClass !== null) {
// throw new TypeError(
// "Super expression must either be null or a function, not " +
// typeof superClass
// );
// }
subClass.prototype = Object.create(superClass && superClass.prot... | [
"function",
"inherits",
"(",
"subClass",
",",
"superClass",
")",
"{",
"// if (typeof superClass !== \"function\" && superClass !== null) {",
"// throw new TypeError(",
"// \"Super expression must either be null or a function, not \" +",
"// typeof superClass",
"// );",
"// }"... | Taken from Babel helpers | [
"Taken",
"from",
"Babel",
"helpers"
] | de59950a5c1ee3f8294bc67b1aeb3961538b464a | https://github.com/fable-compiler/Fable/blob/de59950a5c1ee3f8294bc67b1aeb3961538b464a/src/fable-library/Types.js#L8-L27 |
6,976 | developit/preact-router | src/index.js | canRoute | function canRoute(url) {
for (let i=ROUTERS.length; i--; ) {
if (ROUTERS[i].canRoute(url)) return true;
}
return false;
} | javascript | function canRoute(url) {
for (let i=ROUTERS.length; i--; ) {
if (ROUTERS[i].canRoute(url)) return true;
}
return false;
} | [
"function",
"canRoute",
"(",
"url",
")",
"{",
"for",
"(",
"let",
"i",
"=",
"ROUTERS",
".",
"length",
";",
"i",
"--",
";",
")",
"{",
"if",
"(",
"ROUTERS",
"[",
"i",
"]",
".",
"canRoute",
"(",
"url",
")",
")",
"return",
"true",
";",
"}",
"return"... | Check if the given URL can be handled by any router instances. | [
"Check",
"if",
"the",
"given",
"URL",
"can",
"be",
"handled",
"by",
"any",
"router",
"instances",
"."
] | ef8983acdd87b55792e20cdc56401dda0ed80e3f | https://github.com/developit/preact-router/blob/ef8983acdd87b55792e20cdc56401dda0ed80e3f/src/index.js#L54-L59 |
6,977 | developit/preact-router | src/index.js | routeTo | function routeTo(url) {
let didRoute = false;
for (let i=0; i<ROUTERS.length; i++) {
if (ROUTERS[i].routeTo(url)===true) {
didRoute = true;
}
}
for (let i=subscribers.length; i--; ) {
subscribers[i](url);
}
return didRoute;
} | javascript | function routeTo(url) {
let didRoute = false;
for (let i=0; i<ROUTERS.length; i++) {
if (ROUTERS[i].routeTo(url)===true) {
didRoute = true;
}
}
for (let i=subscribers.length; i--; ) {
subscribers[i](url);
}
return didRoute;
} | [
"function",
"routeTo",
"(",
"url",
")",
"{",
"let",
"didRoute",
"=",
"false",
";",
"for",
"(",
"let",
"i",
"=",
"0",
";",
"i",
"<",
"ROUTERS",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"ROUTERS",
"[",
"i",
"]",
".",
"routeTo",
"(",
... | Tell all router instances to handle the given URL. | [
"Tell",
"all",
"router",
"instances",
"to",
"handle",
"the",
"given",
"URL",
"."
] | ef8983acdd87b55792e20cdc56401dda0ed80e3f | https://github.com/developit/preact-router/blob/ef8983acdd87b55792e20cdc56401dda0ed80e3f/src/index.js#L63-L74 |
6,978 | patrick-steele-idem/morphdom | dist/morphdom-esm.js | compareNodeNames | function compareNodeNames(fromEl, toEl) {
var fromNodeName = fromEl.nodeName;
var toNodeName = toEl.nodeName;
if (fromNodeName === toNodeName) {
return true;
}
if (toEl.actualize &&
fromNodeName.charCodeAt(0) < 91 && /* from tag name is upper case */
toNodeName.charCodeAt(0... | javascript | function compareNodeNames(fromEl, toEl) {
var fromNodeName = fromEl.nodeName;
var toNodeName = toEl.nodeName;
if (fromNodeName === toNodeName) {
return true;
}
if (toEl.actualize &&
fromNodeName.charCodeAt(0) < 91 && /* from tag name is upper case */
toNodeName.charCodeAt(0... | [
"function",
"compareNodeNames",
"(",
"fromEl",
",",
"toEl",
")",
"{",
"var",
"fromNodeName",
"=",
"fromEl",
".",
"nodeName",
";",
"var",
"toNodeName",
"=",
"toEl",
".",
"nodeName",
";",
"if",
"(",
"fromNodeName",
"===",
"toNodeName",
")",
"{",
"return",
"t... | Returns true if two node's names are the same.
NOTE: We don't bother checking `namespaceURI` because you will never find two HTML elements with the same
nodeName and different namespace URIs.
@param {Element} a
@param {Element} b The target element
@return {boolean} | [
"Returns",
"true",
"if",
"two",
"node",
"s",
"names",
"are",
"the",
"same",
"."
] | da08ab419ae21d305bc5cfb38f2f3d6c2152d1c7 | https://github.com/patrick-steele-idem/morphdom/blob/da08ab419ae21d305bc5cfb38f2f3d6c2152d1c7/dist/morphdom-esm.js#L97-L115 |
6,979 | patrick-steele-idem/morphdom | dist/morphdom-esm.js | createElementNS | function createElementNS(name, namespaceURI) {
return !namespaceURI || namespaceURI === NS_XHTML ?
doc.createElement(name) :
doc.createElementNS(namespaceURI, name);
} | javascript | function createElementNS(name, namespaceURI) {
return !namespaceURI || namespaceURI === NS_XHTML ?
doc.createElement(name) :
doc.createElementNS(namespaceURI, name);
} | [
"function",
"createElementNS",
"(",
"name",
",",
"namespaceURI",
")",
"{",
"return",
"!",
"namespaceURI",
"||",
"namespaceURI",
"===",
"NS_XHTML",
"?",
"doc",
".",
"createElement",
"(",
"name",
")",
":",
"doc",
".",
"createElementNS",
"(",
"namespaceURI",
",",... | Create an element, optionally with a known namespace URI.
@param {string} name the element name, e.g. 'div' or 'svg'
@param {string} [namespaceURI] the element's namespace URI, i.e. the value of
its `xmlns` attribute or its inferred namespace.
@return {Element} | [
"Create",
"an",
"element",
"optionally",
"with",
"a",
"known",
"namespace",
"URI",
"."
] | da08ab419ae21d305bc5cfb38f2f3d6c2152d1c7 | https://github.com/patrick-steele-idem/morphdom/blob/da08ab419ae21d305bc5cfb38f2f3d6c2152d1c7/dist/morphdom-esm.js#L126-L130 |
6,980 | patrick-steele-idem/morphdom | dist/morphdom-esm.js | moveChildren | function moveChildren(fromEl, toEl) {
var curChild = fromEl.firstChild;
while (curChild) {
var nextChild = curChild.nextSibling;
toEl.appendChild(curChild);
curChild = nextChild;
}
return toEl;
} | javascript | function moveChildren(fromEl, toEl) {
var curChild = fromEl.firstChild;
while (curChild) {
var nextChild = curChild.nextSibling;
toEl.appendChild(curChild);
curChild = nextChild;
}
return toEl;
} | [
"function",
"moveChildren",
"(",
"fromEl",
",",
"toEl",
")",
"{",
"var",
"curChild",
"=",
"fromEl",
".",
"firstChild",
";",
"while",
"(",
"curChild",
")",
"{",
"var",
"nextChild",
"=",
"curChild",
".",
"nextSibling",
";",
"toEl",
".",
"appendChild",
"(",
... | Copies the children of one DOM element to another DOM element | [
"Copies",
"the",
"children",
"of",
"one",
"DOM",
"element",
"to",
"another",
"DOM",
"element"
] | da08ab419ae21d305bc5cfb38f2f3d6c2152d1c7 | https://github.com/patrick-steele-idem/morphdom/blob/da08ab419ae21d305bc5cfb38f2f3d6c2152d1c7/dist/morphdom-esm.js#L135-L143 |
6,981 | patrick-steele-idem/morphdom | dist/morphdom-esm.js | removeNode | function removeNode(node, parentNode, skipKeyedNodes) {
if (onBeforeNodeDiscarded(node) === false) {
return;
}
if (parentNode) {
parentNode.removeChild(node);
}
onNodeDiscarded(node);
walkDiscardedChildNodes(node, ... | javascript | function removeNode(node, parentNode, skipKeyedNodes) {
if (onBeforeNodeDiscarded(node) === false) {
return;
}
if (parentNode) {
parentNode.removeChild(node);
}
onNodeDiscarded(node);
walkDiscardedChildNodes(node, ... | [
"function",
"removeNode",
"(",
"node",
",",
"parentNode",
",",
"skipKeyedNodes",
")",
"{",
"if",
"(",
"onBeforeNodeDiscarded",
"(",
"node",
")",
"===",
"false",
")",
"{",
"return",
";",
"}",
"if",
"(",
"parentNode",
")",
"{",
"parentNode",
".",
"removeChil... | Removes a DOM node out of the original DOM
@param {Node} node The node to remove
@param {Node} parentNode The nodes parent
@param {Boolean} skipKeyedNodes If true then elements with keys will be skipped and not discarded.
@return {undefined} | [
"Removes",
"a",
"DOM",
"node",
"out",
"of",
"the",
"original",
"DOM"
] | da08ab419ae21d305bc5cfb38f2f3d6c2152d1c7 | https://github.com/patrick-steele-idem/morphdom/blob/da08ab419ae21d305bc5cfb38f2f3d6c2152d1c7/dist/morphdom-esm.js#L340-L351 |
6,982 | 23/resumable.js | resumable.js | processCallbacks | function processCallbacks(items, cb){
if(!items || items.length === 0){
// empty or no list, invoke callback
return cb();
}
// invoke current function, pass the next part as continuation
items[0](function(){
processCallbacks(items.slice(1), cb);
});
} | javascript | function processCallbacks(items, cb){
if(!items || items.length === 0){
// empty or no list, invoke callback
return cb();
}
// invoke current function, pass the next part as continuation
items[0](function(){
processCallbacks(items.slice(1), cb);
});
} | [
"function",
"processCallbacks",
"(",
"items",
",",
"cb",
")",
"{",
"if",
"(",
"!",
"items",
"||",
"items",
".",
"length",
"===",
"0",
")",
"{",
"// empty or no list, invoke callback",
"return",
"cb",
"(",
")",
";",
"}",
"// invoke current function, pass the next... | cps-style list iteration.
invokes all functions in list and waits for their callback to be
triggered.
@param {Function[]} items list of functions expecting callback parameter
@param {Function} cb callback to trigger after the last callback has been invoked | [
"cps",
"-",
"style",
"list",
"iteration",
".",
"invokes",
"all",
"functions",
"in",
"list",
"and",
"waits",
"for",
"their",
"callback",
"to",
"be",
"triggered",
"."
] | 247f339c4a30e10f559a2770a5a0030de0be9363 | https://github.com/23/resumable.js/blob/247f339c4a30e10f559a2770a5a0030de0be9363/resumable.js#L300-L309 |
6,983 | 23/resumable.js | resumable.js | processDirectory | function processDirectory (directory, path, items, cb) {
var dirReader = directory.createReader();
var allEntries = [];
function readEntries () {
dirReader.readEntries(function(entries){
if (entries.length) {
allEntries = allEntries.concat(entries);
return re... | javascript | function processDirectory (directory, path, items, cb) {
var dirReader = directory.createReader();
var allEntries = [];
function readEntries () {
dirReader.readEntries(function(entries){
if (entries.length) {
allEntries = allEntries.concat(entries);
return re... | [
"function",
"processDirectory",
"(",
"directory",
",",
"path",
",",
"items",
",",
"cb",
")",
"{",
"var",
"dirReader",
"=",
"directory",
".",
"createReader",
"(",
")",
";",
"var",
"allEntries",
"=",
"[",
"]",
";",
"function",
"readEntries",
"(",
")",
"{",... | recursively traverse directory and collect files to upload
@param {Object} directory directory to process
@param {string} path current path
@param {File[]} items target list of items
@param {Function} cb callback invoked after traversing directory | [
"recursively",
"traverse",
"directory",
"and",
"collect",
"files",
"to",
"upload"
] | 247f339c4a30e10f559a2770a5a0030de0be9363 | https://github.com/23/resumable.js/blob/247f339c4a30e10f559a2770a5a0030de0be9363/resumable.js#L318-L341 |
6,984 | 23/resumable.js | resumable.js | loadFiles | function loadFiles(items, event) {
if(!items.length){
return; // nothing to do
}
$.fire('beforeAdd');
var files = [];
processCallbacks(
Array.prototype.map.call(items, function(item){
// bind all properties except for callback
var entry = item;
... | javascript | function loadFiles(items, event) {
if(!items.length){
return; // nothing to do
}
$.fire('beforeAdd');
var files = [];
processCallbacks(
Array.prototype.map.call(items, function(item){
// bind all properties except for callback
var entry = item;
... | [
"function",
"loadFiles",
"(",
"items",
",",
"event",
")",
"{",
"if",
"(",
"!",
"items",
".",
"length",
")",
"{",
"return",
";",
"// nothing to do",
"}",
"$",
".",
"fire",
"(",
"'beforeAdd'",
")",
";",
"var",
"files",
"=",
"[",
"]",
";",
"processCallb... | process items to extract files to be uploaded
@param {File[]} items items to process
@param {Event} event event that led to upload | [
"process",
"items",
"to",
"extract",
"files",
"to",
"be",
"uploaded"
] | 247f339c4a30e10f559a2770a5a0030de0be9363 | https://github.com/23/resumable.js/blob/247f339c4a30e10f559a2770a5a0030de0be9363/resumable.js#L348-L370 |
6,985 | TerriaJS/terriajs | lib/Map/SummaryConcept.js | function(name, options) {
name = defaultValue(name, "Conditions");
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
DisplayVariablesConcept.call(this, name, options);
} | javascript | function(name, options) {
name = defaultValue(name, "Conditions");
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
DisplayVariablesConcept.call(this, name, options);
} | [
"function",
"(",
"name",
",",
"options",
")",
"{",
"name",
"=",
"defaultValue",
"(",
"name",
",",
"\"Conditions\"",
")",
";",
"options",
"=",
"defaultValue",
"(",
"options",
",",
"defaultValue",
".",
"EMPTY_OBJECT",
")",
";",
"DisplayVariablesConcept",
".",
... | Represents the top-level node of a tree which should be displayed using
a different UX to the more usual DisplayVariablesConcept.
Intended for use when the tree is huge, and would take up too much space in the UI.
Contains an items array of Concepts.
@alias SummaryConcept
@constructor
@extends DisplayVariablesConcept
... | [
"Represents",
"the",
"top",
"-",
"level",
"node",
"of",
"a",
"tree",
"which",
"should",
"be",
"displayed",
"using",
"a",
"different",
"UX",
"to",
"the",
"more",
"usual",
"DisplayVariablesConcept",
".",
"Intended",
"for",
"use",
"when",
"the",
"tree",
"is",
... | abcce28ff189f6fdbc0ee541a235ec6cabd90bd5 | https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Map/SummaryConcept.js#L22-L27 | |
6,986 | TerriaJS/terriajs | lib/Map/SummaryConcept.js | closeDescendants | function closeDescendants(concept) {
concept.isOpen = false;
concept.items.forEach(child => {
if (child.items) {
closeDescendants(child);
}
});
} | javascript | function closeDescendants(concept) {
concept.isOpen = false;
concept.items.forEach(child => {
if (child.items) {
closeDescendants(child);
}
});
} | [
"function",
"closeDescendants",
"(",
"concept",
")",
"{",
"concept",
".",
"isOpen",
"=",
"false",
";",
"concept",
".",
"items",
".",
"forEach",
"(",
"child",
"=>",
"{",
"if",
"(",
"child",
".",
"items",
")",
"{",
"closeDescendants",
"(",
"child",
")",
... | Traverses the concepts' descendants, setting isOpen = false as it goes. | [
"Traverses",
"the",
"concepts",
"descendants",
"setting",
"isOpen",
"=",
"false",
"as",
"it",
"goes",
"."
] | abcce28ff189f6fdbc0ee541a235ec6cabd90bd5 | https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Map/SummaryConcept.js#L39-L46 |
6,987 | TerriaJS/terriajs | lib/Models/CatalogFunction.js | function(terria) {
CatalogMember.call(this, terria);
this._loadingPromise = undefined;
this._lastLoadInfluencingValues = undefined;
this._parameters = [];
/**
* Gets or sets a value indicating whether the group is currently loading. This property
* is observable.
* @type {Boolean}
*/
this.isL... | javascript | function(terria) {
CatalogMember.call(this, terria);
this._loadingPromise = undefined;
this._lastLoadInfluencingValues = undefined;
this._parameters = [];
/**
* Gets or sets a value indicating whether the group is currently loading. This property
* is observable.
* @type {Boolean}
*/
this.isL... | [
"function",
"(",
"terria",
")",
"{",
"CatalogMember",
".",
"call",
"(",
"this",
",",
"terria",
")",
";",
"this",
".",
"_loadingPromise",
"=",
"undefined",
";",
"this",
".",
"_lastLoadInfluencingValues",
"=",
"undefined",
";",
"this",
".",
"_parameters",
"=",... | A member of a catalog that does some kind of parameterized processing or analysis.
@alias CatalogFunction
@constructor
@extends CatalogMember
@abstract
@param {Terria} terria The Terria instance. | [
"A",
"member",
"of",
"a",
"catalog",
"that",
"does",
"some",
"kind",
"of",
"parameterized",
"processing",
"or",
"analysis",
"."
] | abcce28ff189f6fdbc0ee541a235ec6cabd90bd5 | https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/CatalogFunction.js#L28-L50 | |
6,988 | TerriaJS/terriajs | lib/Core/replaceUnderscores.js | replaceUnderscores | function replaceUnderscores(string) {
if (typeof string === "string" || string instanceof String) {
return string.replace(/_/g, " ");
}
return string;
} | javascript | function replaceUnderscores(string) {
if (typeof string === "string" || string instanceof String) {
return string.replace(/_/g, " ");
}
return string;
} | [
"function",
"replaceUnderscores",
"(",
"string",
")",
"{",
"if",
"(",
"typeof",
"string",
"===",
"\"string\"",
"||",
"string",
"instanceof",
"String",
")",
"{",
"return",
"string",
".",
"replace",
"(",
"/",
"_",
"/",
"g",
",",
"\" \"",
")",
";",
"}",
"... | Replace all underscores in the string with spaces. If the argument is not a string, return it unchanged.
@param {} string The string to replace. If the argument is not a string, does nothing.
@return {} The argument with all underscores replaced with spaces. If the argument is not a string, returns the argument unchan... | [
"Replace",
"all",
"underscores",
"in",
"the",
"string",
"with",
"spaces",
".",
"If",
"the",
"argument",
"is",
"not",
"a",
"string",
"return",
"it",
"unchanged",
"."
] | abcce28ff189f6fdbc0ee541a235ec6cabd90bd5 | https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Core/replaceUnderscores.js#L8-L13 |
6,989 | TerriaJS/terriajs | lib/Models/SensorObservationServiceCatalogItem.js | extractValues | function extractValues(response) {
var observationData =
response.GetObservationResponse &&
response.GetObservationResponse.observationData;
if (defined(observationData)) {
if (!Array.isArray(observationData)) {
observationData = [observationData];
}
var observations = obse... | javascript | function extractValues(response) {
var observationData =
response.GetObservationResponse &&
response.GetObservationResponse.observationData;
if (defined(observationData)) {
if (!Array.isArray(observationData)) {
observationData = [observationData];
}
var observations = obse... | [
"function",
"extractValues",
"(",
"response",
")",
"{",
"var",
"observationData",
"=",
"response",
".",
"GetObservationResponse",
"&&",
"response",
".",
"GetObservationResponse",
".",
"observationData",
";",
"if",
"(",
"defined",
"(",
"observationData",
")",
")",
... | Iterate over all the points in all the time series in all the observations in all the bodies to get individual result rows. | [
"Iterate",
"over",
"all",
"the",
"points",
"in",
"all",
"the",
"time",
"series",
"in",
"all",
"the",
"observations",
"in",
"all",
"the",
"bodies",
"to",
"get",
"individual",
"result",
"rows",
"."
] | abcce28ff189f6fdbc0ee541a235ec6cabd90bd5 | https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/SensorObservationServiceCatalogItem.js#L527-L572 |
6,990 | TerriaJS/terriajs | lib/Models/SensorObservationServiceCatalogItem.js | loadObservationData | function loadObservationData(item) {
if (!item._featureMapping) {
return;
}
var featuresOfInterest = Object.keys(item._featureMapping);
// Are there too many features to load observations (or we've been asked not to try)?
if (
!item.tryToLoadObservationData ||
featuresOfInterest.length > item.requ... | javascript | function loadObservationData(item) {
if (!item._featureMapping) {
return;
}
var featuresOfInterest = Object.keys(item._featureMapping);
// Are there too many features to load observations (or we've been asked not to try)?
if (
!item.tryToLoadObservationData ||
featuresOfInterest.length > item.requ... | [
"function",
"loadObservationData",
"(",
"item",
")",
"{",
"if",
"(",
"!",
"item",
".",
"_featureMapping",
")",
"{",
"return",
";",
"}",
"var",
"featuresOfInterest",
"=",
"Object",
".",
"keys",
"(",
"item",
".",
"_featureMapping",
")",
";",
"// Are there too ... | Given the features already loaded into item._featureMap, this loads the observations according to the user-selected concepts,
and puts them into item._tableStructure.
If there are too many features, fall back to a tableStructure without the observation data.
@param {SensorObservationServiceCatalogItem} item This catal... | [
"Given",
"the",
"features",
"already",
"loaded",
"into",
"item",
".",
"_featureMap",
"this",
"loads",
"the",
"observations",
"according",
"to",
"the",
"user",
"-",
"selected",
"concepts",
"and",
"puts",
"them",
"into",
"item",
".",
"_tableStructure",
".",
"If"... | abcce28ff189f6fdbc0ee541a235ec6cabd90bd5 | https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/SensorObservationServiceCatalogItem.js#L851-L948 |
6,991 | TerriaJS/terriajs | lib/Models/SensorObservationServiceCatalogItem.js | createColumnsFromMapping | function createColumnsFromMapping(item, tableStructure, identifiers) {
var featureMapping = item._featureMapping;
var addChartColumn = !defined(identifiers);
if (!defined(identifiers)) {
identifiers = Object.keys(featureMapping);
}
var rows = identifiers.map(identifier => featureMapping[identifier]);
va... | javascript | function createColumnsFromMapping(item, tableStructure, identifiers) {
var featureMapping = item._featureMapping;
var addChartColumn = !defined(identifiers);
if (!defined(identifiers)) {
identifiers = Object.keys(featureMapping);
}
var rows = identifiers.map(identifier => featureMapping[identifier]);
va... | [
"function",
"createColumnsFromMapping",
"(",
"item",
",",
"tableStructure",
",",
"identifiers",
")",
"{",
"var",
"featureMapping",
"=",
"item",
".",
"_featureMapping",
";",
"var",
"addChartColumn",
"=",
"!",
"defined",
"(",
"identifiers",
")",
";",
"if",
"(",
... | Converts the featureMapping output by createMappingFromFeatureMembers into columns for a TableStructure.
@param {SensorObservationServiceCatalogItem} item This catalog item.
@param {TableStructure} [tableStructure] Used to set the columns' tableStructure (parent). If identifiers given, output columns line up with the... | [
"Converts",
"the",
"featureMapping",
"output",
"by",
"createMappingFromFeatureMembers",
"into",
"columns",
"for",
"a",
"TableStructure",
"."
] | abcce28ff189f6fdbc0ee541a235ec6cabd90bd5 | https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/SensorObservationServiceCatalogItem.js#L1066-L1103 |
6,992 | TerriaJS/terriajs | lib/Models/AugmentedVirtuality.js | function(terria) {
const that = this;
this._terria = terria;
// Note: We create a persistant object and define a transient property, since knockout needs a persistant variable
// to track, but for state we want a 'maybe' intervalId.
this._eventLoopState = {};
this._manualAlignment = false;
this.... | javascript | function(terria) {
const that = this;
this._terria = terria;
// Note: We create a persistant object and define a transient property, since knockout needs a persistant variable
// to track, but for state we want a 'maybe' intervalId.
this._eventLoopState = {};
this._manualAlignment = false;
this.... | [
"function",
"(",
"terria",
")",
"{",
"const",
"that",
"=",
"this",
";",
"this",
".",
"_terria",
"=",
"terria",
";",
"// Note: We create a persistant object and define a transient property, since knockout needs a persistant variable",
"// to track, but for state we want a 'may... | Manages state for Augmented Virtuality mode.
This mode uses the devices orientation sensors to change the viewers viewport to match the change in orientation.
Term Augmented Virtuality:
"The use of real-world sensor information (e.g., gyroscopes) to control a virtual environment is an additional form
of augmented vir... | [
"Manages",
"state",
"for",
"Augmented",
"Virtuality",
"mode",
"."
] | abcce28ff189f6fdbc0ee541a235ec6cabd90bd5 | https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/AugmentedVirtuality.js#L25-L175 | |
6,993 | TerriaJS/terriajs | lib/Models/MapInteractionMode.js | MapInteractionMode | function MapInteractionMode(options) {
/**
* Gets or sets a callback that is invoked when the user cancels the interaction mode. If this property is undefined,
* the interaction mode cannot be canceled.
* @type {Function}
*/
this.onCancel = options.onCancel;
/**
* Gets or sets the details of a cu... | javascript | function MapInteractionMode(options) {
/**
* Gets or sets a callback that is invoked when the user cancels the interaction mode. If this property is undefined,
* the interaction mode cannot be canceled.
* @type {Function}
*/
this.onCancel = options.onCancel;
/**
* Gets or sets the details of a cu... | [
"function",
"MapInteractionMode",
"(",
"options",
")",
"{",
"/**\n * Gets or sets a callback that is invoked when the user cancels the interaction mode. If this property is undefined,\n * the interaction mode cannot be canceled.\n * @type {Function}\n */",
"this",
".",
"onCancel",
"=",
... | A mode for interacting with the map.
@alias MapInteractionMode
@constructor
@param {Object} [options] Object with the following properties:
@param {Function} [options.onCancel] The function to invoke if the user cancels the interaction mode. The cancel button will
only appear if this property is specified.
@param {S... | [
"A",
"mode",
"for",
"interacting",
"with",
"the",
"map",
"."
] | abcce28ff189f6fdbc0ee541a235ec6cabd90bd5 | https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/MapInteractionMode.js#L18-L62 |
6,994 | TerriaJS/terriajs | lib/Map/MapboxVectorTileImageryProvider.js | function(options) {
this._uriTemplate = new URITemplate(options.url);
if (typeof options.layerName !== "string") {
throw new DeveloperError(
"MapboxVectorTileImageryProvider requires a layer name passed as options.layerName"
);
}
this._layerName = options.layerName;
this._subdomains = defaultV... | javascript | function(options) {
this._uriTemplate = new URITemplate(options.url);
if (typeof options.layerName !== "string") {
throw new DeveloperError(
"MapboxVectorTileImageryProvider requires a layer name passed as options.layerName"
);
}
this._layerName = options.layerName;
this._subdomains = defaultV... | [
"function",
"(",
"options",
")",
"{",
"this",
".",
"_uriTemplate",
"=",
"new",
"URITemplate",
"(",
"options",
".",
"url",
")",
";",
"if",
"(",
"typeof",
"options",
".",
"layerName",
"!==",
"\"string\"",
")",
"{",
"throw",
"new",
"DeveloperError",
"(",
"\... | feature.type == 3 for polygon features | [
"feature",
".",
"type",
"==",
"3",
"for",
"polygon",
"features"
] | abcce28ff189f6fdbc0ee541a235ec6cabd90bd5 | https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Map/MapboxVectorTileImageryProvider.js#L25-L87 | |
6,995 | TerriaJS/terriajs | lib/Map/MapboxVectorTileImageryProvider.js | overzoomGeometry | function overzoomGeometry(rings, nativeTile, newExtent, newTile) {
var diffZ = newTile.level - nativeTile.level;
if (diffZ === 0) {
return rings;
} else {
var newRings = [];
// (offsetX, offsetY) is the (0,0) of the new tile
var offsetX = newExtent * (newTile.x - (nativeTile.x << diffZ));
var ... | javascript | function overzoomGeometry(rings, nativeTile, newExtent, newTile) {
var diffZ = newTile.level - nativeTile.level;
if (diffZ === 0) {
return rings;
} else {
var newRings = [];
// (offsetX, offsetY) is the (0,0) of the new tile
var offsetX = newExtent * (newTile.x - (nativeTile.x << diffZ));
var ... | [
"function",
"overzoomGeometry",
"(",
"rings",
",",
"nativeTile",
",",
"newExtent",
",",
"newTile",
")",
"{",
"var",
"diffZ",
"=",
"newTile",
".",
"level",
"-",
"nativeTile",
".",
"level",
";",
"if",
"(",
"diffZ",
"===",
"0",
")",
"{",
"return",
"rings",
... | Use x,y,level vector tile to produce imagery for newX,newY,newLevel | [
"Use",
"x",
"y",
"level",
"vector",
"tile",
"to",
"produce",
"imagery",
"for",
"newX",
"newY",
"newLevel"
] | abcce28ff189f6fdbc0ee541a235ec6cabd90bd5 | https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Map/MapboxVectorTileImageryProvider.js#L223-L241 |
6,996 | TerriaJS/terriajs | lib/Map/MapboxVectorTileImageryProvider.js | inside | function inside(point, vs) {
// ray-casting algorithm based on
// http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html
var x = point.x,
y = point.y;
var inside = false;
for (var i = 0, j = vs.length - 1; i < vs.length; j = i++) {
var xi = vs[i].x,
yi = vs[i].y;
var xj = v... | javascript | function inside(point, vs) {
// ray-casting algorithm based on
// http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html
var x = point.x,
y = point.y;
var inside = false;
for (var i = 0, j = vs.length - 1; i < vs.length; j = i++) {
var xi = vs[i].x,
yi = vs[i].y;
var xj = v... | [
"function",
"inside",
"(",
"point",
",",
"vs",
")",
"{",
"// ray-casting algorithm based on",
"// http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html",
"var",
"x",
"=",
"point",
".",
"x",
",",
"y",
"=",
"point",
".",
"y",
";",
"var",
"inside",
"="... | Adapted from npm package "point-in-polygon" by James Halliday Licence included in LICENSE.md | [
"Adapted",
"from",
"npm",
"package",
"point",
"-",
"in",
"-",
"polygon",
"by",
"James",
"Halliday",
"Licence",
"included",
"in",
"LICENSE",
".",
"md"
] | abcce28ff189f6fdbc0ee541a235ec6cabd90bd5 | https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Map/MapboxVectorTileImageryProvider.js#L343-L363 |
6,997 | TerriaJS/terriajs | lib/Models/SdmxJsonCatalogItem.js | updateColumns | function updateColumns(item, newColumns) {
item._tableStructure.columns = newColumns;
if (item._tableStructure.columns.length === 0) {
// Nothing to show, so the attempt to redraw will fail; need to explicitly hide the existing regions.
item._regionMapping.hideImageryLayer();
item.terria.currentViewer.n... | javascript | function updateColumns(item, newColumns) {
item._tableStructure.columns = newColumns;
if (item._tableStructure.columns.length === 0) {
// Nothing to show, so the attempt to redraw will fail; need to explicitly hide the existing regions.
item._regionMapping.hideImageryLayer();
item.terria.currentViewer.n... | [
"function",
"updateColumns",
"(",
"item",
",",
"newColumns",
")",
"{",
"item",
".",
"_tableStructure",
".",
"columns",
"=",
"newColumns",
";",
"if",
"(",
"item",
".",
"_tableStructure",
".",
"columns",
".",
"length",
"===",
"0",
")",
"{",
"// Nothing to show... | Sets the tableStructure's columns to the new columns, redraws the map, and closes the feature info panel. | [
"Sets",
"the",
"tableStructure",
"s",
"columns",
"to",
"the",
"new",
"columns",
"redraws",
"the",
"map",
"and",
"closes",
"the",
"feature",
"info",
"panel",
"."
] | abcce28ff189f6fdbc0ee541a235ec6cabd90bd5 | https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/SdmxJsonCatalogItem.js#L627-L636 |
6,998 | TerriaJS/terriajs | lib/Models/SdmxJsonCatalogItem.js | fixSelectedInitially | function fixSelectedInitially(item, conceptDimensions) {
conceptDimensions.forEach(dimension => {
if (defined(item.selectedInitially)) {
var thisSelectedInitially = item.selectedInitially[dimension.id];
if (thisSelectedInitially) {
var valueIds = dimension.values.map(value => value.id);
... | javascript | function fixSelectedInitially(item, conceptDimensions) {
conceptDimensions.forEach(dimension => {
if (defined(item.selectedInitially)) {
var thisSelectedInitially = item.selectedInitially[dimension.id];
if (thisSelectedInitially) {
var valueIds = dimension.values.map(value => value.id);
... | [
"function",
"fixSelectedInitially",
"(",
"item",
",",
"conceptDimensions",
")",
"{",
"conceptDimensions",
".",
"forEach",
"(",
"dimension",
"=>",
"{",
"if",
"(",
"defined",
"(",
"item",
".",
"selectedInitially",
")",
")",
"{",
"var",
"thisSelectedInitially",
"="... | Check if item.selectedInitially has at least one value that exists in dimension.values, and if it doesn't, reset item.selectedInitially. | [
"Check",
"if",
"item",
".",
"selectedInitially",
"has",
"at",
"least",
"one",
"value",
"that",
"exists",
"in",
"dimension",
".",
"values",
"and",
"if",
"it",
"doesn",
"t",
"reset",
"item",
".",
"selectedInitially",
"."
] | abcce28ff189f6fdbc0ee541a235ec6cabd90bd5 | https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/SdmxJsonCatalogItem.js#L1164-L1186 |
6,999 | TerriaJS/terriajs | lib/Models/SdmxJsonCatalogItem.js | buildConcepts | function buildConcepts(item, fullDimensions) {
function isInitiallyActive(dimensionId, value, index) {
if (!defined(item.selectedInitially)) {
return index === 0;
}
var dimensionSelectedInitially = item.selectedInitially[dimensionId];
if (!defined(dimensionSelectedInitially)) {
return inde... | javascript | function buildConcepts(item, fullDimensions) {
function isInitiallyActive(dimensionId, value, index) {
if (!defined(item.selectedInitially)) {
return index === 0;
}
var dimensionSelectedInitially = item.selectedInitially[dimensionId];
if (!defined(dimensionSelectedInitially)) {
return inde... | [
"function",
"buildConcepts",
"(",
"item",
",",
"fullDimensions",
")",
"{",
"function",
"isInitiallyActive",
"(",
"dimensionId",
",",
"value",
",",
"index",
")",
"{",
"if",
"(",
"!",
"defined",
"(",
"item",
".",
"selectedInitially",
")",
")",
"{",
"return",
... | Build out the concepts displayed in the NowViewing panel. Also fixes selectedInitially, if broken. | [
"Build",
"out",
"the",
"concepts",
"displayed",
"in",
"the",
"NowViewing",
"panel",
".",
"Also",
"fixes",
"selectedInitially",
"if",
"broken",
"."
] | abcce28ff189f6fdbc0ee541a235ec6cabd90bd5 | https://github.com/TerriaJS/terriajs/blob/abcce28ff189f6fdbc0ee541a235ec6cabd90bd5/lib/Models/SdmxJsonCatalogItem.js#L1189-L1230 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.