_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3
values | text stringlengths 27 233k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q48800 | getStreamStream | train | function getStreamStream (readable, file) {
return () => {
const counter = new stream.Transform()
counter._transform = function (buf, enc, done) {
file.length += buf.length
| javascript | {
"resource": ""
} |
q48801 | doReconnect | train | function doReconnect() {
//
// Cleanup and recreate the socket associated
// with this instance.
//
self.retry.waiting = true;
self.socket.removeAllListeners();
self.socket = common.createSocket(self._options);
//
// Cleanup reconnect logic once the socket connects
//
self.s... | javascript | {
"resource": ""
} |
q48802 | tryReconnect | train | function tryReconnect() {
self.retry.retries++;
if (self.retry.retries >= self.retry.max) {
return self.emit('error', | javascript | {
"resource": ""
} |
q48803 | assert | train | function assert(expr) {
if (expr) return;
var stack = callsite();
var call = stack[1];
var file = call.getFileName();
var lineno = call.getLineNumber();
| javascript | {
"resource": ""
} |
q48804 | add | train | function add(x, y) {
var z = [];
var n = Math.max(x.length, y.length);
var carry = 0;
var i = 0;
while (i < n || carry) {
var xi = i < x.length ? x[i] : 0;
var yi = | javascript | {
"resource": ""
} |
q48805 | getPluginPath | train | function getPluginPath(rootPath, plugin) {
// Check in project folder
const pluginPath = path.join(rootPath, PROJECT_PLUGIN_FOLDER_NAME, `${plugin}.js`);
if (fs.existsSync(pluginPath)) {
return pluginPath;
}
// Check in src folder
const srcPath = path.join(__dirname, BUILT_IN_PLUGIN_FOLDER_NAME, `${plu... | javascript | {
"resource": ""
} |
q48806 | findDefaultPlugins | train | function findDefaultPlugins() {
const globPath = path.join(__dirname, BUILT_IN_DEFAULT_PLUGIN_FOLDER_NAME);
if (!fs.existsSync(globPath)) {
return [];
}
return walkSync(globPath, {
| javascript | {
"resource": ""
} |
q48807 | filterTags | train | function filterTags(tags, content) {
if (!tags) {
return content;
}
const $ = cheerio.load(content, { xmlMode: false });
const tagOperations = tags.map(tag => ({
// Trim leading + or -, replace * with .*, add ^ and $
tagExp: `^${escapeRegExp(tag.replace(/^(\+|-)/g, '')).replace(/\\\*/, '.*')}$`,
... | javascript | {
"resource": ""
} |
q48808 | rimraf | train | function rimraf(dirPath) {
if (fs.existsSync(dirPath)) {
fs.readdirSync(dirPath).forEach((entry) => {
const entryPath = path.join(dirPath, entry);
if (fs.lstatSync(entryPath).isDirectory()) {
| javascript | {
"resource": ""
} |
q48809 | createDir | train | function createDir(pathArg) {
const { dir, ext } = path.parse(pathArg);
const dirNames = (ext === '')
? pathArg.split(path.sep)
: dir.split(pathArg.sep);
| javascript | {
"resource": ""
} |
q48810 | copyDirSync | train | function copyDirSync(src, dest) {
if (fs.lstatSync(src).isDirectory()) {
const files = fs.readdirSync(src);
files.forEach((file) => {
const curSource = path.join(src, file);
const curDest = path.join(dest, file);
if (fs.lstatSync(curSource).isDirectory()) {
if (!fs.existsSync(curDest... | javascript | {
"resource": ""
} |
q48811 | copyDirAsync | train | function copyDirAsync(src, dest) {
if (fs.lstatSync(src).isDirectory()) {
const files = fs.readdirSync(src);
files.forEach((file) => {
const curSource = path.join(src, file);
const curDest = path.join(dest, file);
if (fs.lstatSync(curSource).isDirectory()) {
if (!fs.existsSync(curDes... | javascript | {
"resource": ""
} |
q48812 | generateHeadingSelector | train | function generateHeadingSelector(headingIndexingLevel) {
let headingsSelector = 'h1';
for (let i = 2; i <= headingIndexingLevel; i += 1) {
| javascript | {
"resource": ""
} |
q48813 | Page | train | function Page(pageConfig) {
this.asset = pageConfig.asset;
this.baseUrl = pageConfig.baseUrl;
this.baseUrlMap = pageConfig.baseUrlMap;
this.content = pageConfig.content || '';
this.faviconUrl = pageConfig.faviconUrl;
this.frontmatterOverride = pageConfig.frontmatter || {};
this.layout = pageConfig.layout;... | javascript | {
"resource": ""
} |
q48814 | generateHeadingSelector | train | function generateHeadingSelector(headingIndexingLevel) {
let headingsSelectors = ['.always-index:header', 'h1'];
for (let i = 2; i <= headingIndexingLevel; i += 1) {
headingsSelectors.push(`h${i}`);
}
headingsSelectors = | javascript | {
"resource": ""
} |
q48815 | getClosestHeading | train | function getClosestHeading($, headingsSelector, element) {
const prevElements = $(element).prevAll();
for (let i = 0; i < prevElements.length; i += 1) {
const currentElement = $(prevElements[i]);
if (currentElement.is(headingsSelector)) {
return currentElement;
}
const childHeadings = currentE... | javascript | {
"resource": ""
} |
q48816 | extractIncludeVariables | train | function extractIncludeVariables(includeElement, contextVariables) {
const includedVariables = { ...contextVariables };
Object.keys(includeElement.attribs).forEach((attribute) => {
if (!attribute.startsWith('var-')) {
return;
}
const variableName = attribute.replace(/^var-/, '');
if (!included... | javascript | {
"resource": ""
} |
q48817 | extractPageVariables | train | function extractPageVariables(fileName, data, userDefinedVariables, includedVariables) {
const $ = cheerio.load(data);
const pageVariables = { };
$('variable').each(function () {
const variableElement = $(this);
const variableName = variableElement.attr('name');
if (!variableName) {
// eslint-di... | javascript | {
"resource": ""
} |
q48818 | extractImportedVariables | train | function extractImportedVariables(context) {
if (!context.importedVariables) {
return {};
}
const importedVariables = {};
Object.entries(context.importedVariables).forEach(([src, variables]) => {
variables.forEach((variableName) => {
const actualFilePath = utils.isUrl()
? src
: pat... | javascript | {
"resource": ""
} |
q48819 | encode | train | function encode(url) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { string: false, local: false };
var callback = arguments[2];
// eslint-disable-line
if (_lodash2.default.isUndefined(url) || _lodash2.default.isNull(url) || !_lodash2.default.isString(url)) {
return cal... | javascript | {
"resource": ""
} |
q48820 | decode | train | function decode(imageBuffer) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { filename: 'saved-image' };
var callback = arguments[2];
// eslint-disable-line
if (!_lodash2.default.isBuffer(imageBuffer)) {
return callback(new Error('The image is not a Buffer object type'))... | javascript | {
"resource": ""
} |
q48821 | newDirectoryApi | train | function newDirectoryApi(input, opts, cb) {
var fd = new FormData(), files = [];
var iterate = function(entries, path, resolve) {
var promises = [];
entries.forEach(function(entry) {
promises.push(new Promise(function(resolve) {
if ("getFilesAndDirectories" in entry) {
... | javascript | {
"resource": ""
} |
q48822 | arrayApi | train | function arrayApi(input, opts, cb) {
var fd = new FormData(), files = [];
[].slice.call(input.files).forEach(function(file) {
fd.append(opts.name, file, | javascript | {
"resource": ""
} |
q48823 | entriesApi | train | function entriesApi(items, opts, cb) {
var fd = new FormData(), files = [], rootPromises = [];
function readEntries(entry, reader, oldEntries, cb) {
var dirReader = reader || entry.createReader();
dirReader.readEntries(function(entries) {
var newEntries = oldEntries ? oldEntries.concat(entr... | javascript | {
"resource": ""
} |
q48824 | train | function(axis, theta) {
var x, y, z, s, c, t, tx, ty;
x = axis.x;
y = axis.y;
z = axis.z;
s = Math.sin(theta);
c = Math.cos(theta);
t = 1 | javascript | {
"resource": ""
} | |
q48825 | train | function(theta) {
_TEMP.identity();
_TEMP.matrix[1][1] = _TEMP.matrix[2][2] = Math.cos(theta);
_TEMP.matrix[2][1] = Math.sin(theta);
| javascript | {
"resource": ""
} | |
q48826 | train | function(p) {
var v = this.b.sub(this.a);
var t = p.sub(this.a).dot(v) / v.magSquared();
// Check to see if t is beyond the extents of the line segment
if (t < 0.0) {
return this.a.copy();
| javascript | {
"resource": ""
} | |
q48827 | train | function(obj_or_mesh,threeMaterials){
var toxiTriangleMesh;
if(arguments.length == 1){ //it needs to be an param object
toxiTriangleMesh = obj_or_mesh.geometry;
threeMaterials = obj_or_mesh.materials;
} else {
toxiTriangleMesh = obj_or_... | javascript | {
"resource": ""
} | |
q48828 | train | function(_p){
var v1 = _p.sub(this.a).normalize(),
v2 = _p.sub(this.b).normalize(),
v3 = _p.sub(this.c).normalize(),
totalAngles = Math.acos(v1.dot(v2));
totalAngles += Math.acos(v2.dot(v3)); | javascript | {
"resource": ""
} | |
q48829 | train | function(list, q){
for(var i=0, l=list.length; i<l; i++){
if( list[i].equalsWitTolerance(q, 0.001) ){
| javascript | {
"resource": ""
} | |
q48830 | train | function(iterator, shapeID, closed){
//if first param wasnt passed in as a pjs Iterator, make it one
if(iterator.hasNext === undefined || iterator.next === undefined){
iterator = new this.app.ObjectIterator( iterator );
}
this.gfx.beginShape(shapeID);
| javascript | {
"resource": ""
} | |
q48831 | train | function(tri,isFullShape){
var isTriangle = function(){
if(tri.a !== undefined && tri.b !== undefined && tri.c !== undefined){
return (tri.a.x !== undefined);
}
return false;
},
isTriangle3D = function(){
if(isTriangle()){
return (tri.a.z !== undefined);
}
return false;
};
if(isFul... | javascript | {
"resource": ""
} | |
q48832 | train | function(a,b) {
if( hasXY( a ) && hasXY( b ) ){
this.x = mathUtils.clip(this.x, a.x, b.x);
this.y = mathUtils.clip(this.y, a.y, b.y);
} else if( isRect( a ) ){
this.x = | javascript | {
"resource": ""
} | |
q48833 | train | function() {
var mag = this.x * this.x + this.y * this.y;
if (mag > | javascript | {
"resource": ""
} | |
q48834 | train | function(theta) {
var co = Math.cos(theta);
var si = Math.sin(theta);
var xx = co * this.x - si * this.y;
this.y = | javascript | {
"resource": ""
} | |
q48835 | train | function(box_or_min, max){
var min;
if( is.AABB( box_or_min ) ){
max = box_or_min.getMax();
min = box_or_min.getMin();
} else {
min = box_or_min;
}
this.x = | javascript | {
"resource": ""
} | |
q48836 | train | function(vec){
var cx = this.y * vec.z - vec.y * this.z;
var cy = this.z * vec.x | javascript | {
"resource": ""
} | |
q48837 | train | function(vec_axis,theta){
var ax = vec_axis.x,
ay = vec_axis.y,
az = vec_axis.z,
ux = ax * this.x,
uy = ax * this.y,
uz = ax * this.z,
vx = ay * this.x,
vy = ay * this.y,
vz = ay * this.z,
wx = az * this.x,
wy = az * this.y,
wz = az * this.z,
si = Math.sin(theta), | javascript | {
"resource": ""
} | |
q48838 | train | function(theta){
var co = Math.cos(theta);
var si = Math.sin(theta);
var zz = co *this.z - si * this.y;
this.y = si | javascript | {
"resource": ""
} | |
q48839 | train | function() {
if (Math.abs(this.x) < 0.5) {
this.x = 0;
} else {
this.x = this.x < 0 ? -1 : 1;
this.y = this.z = 0;
}
if (Math.abs(this.y) < 0.5) {
this.y = 0;
} else {
this.y = this.y < 0 ? -1 : 1;
this.x = this.z = | javascript | {
"resource": ""
} | |
q48840 | train | function( t ){
var idx;
if( this.colors.size() > 2 ){
idx = Math.floor( this.map.getClippedValueFor(t) + 0.5 );
} else {
idx = | javascript | {
"resource": ""
} | |
q48841 | train | function( src, pixels, offset ){
if( typeof offset !== 'number'){
offset = 0;
} else if ( offset < 0 ){
throw new Error("offset into target pixel array is negative");
}
pixels = pixels || new Array(src.length); | javascript | {
"resource": ""
} | |
q48842 | train | function( list, q ){
for( var i=0, l=list.length; i<l; i++){
| javascript | {
"resource": ""
} | |
q48843 | train | function(freq){
if(freq === undefined)freq = 0;
this.phase = (this.phase + freq) % AbstractWave.TWO_PI;
if(this.phase < 0){
| javascript | {
"resource": ""
} | |
q48844 | paramThreeToGL | train | function paramThreeToGL ( p ) {
if ( p === THREE.RepeatWrapping ) return _gl.REPEAT;
if ( p === THREE.ClampToEdgeWrapping ) return _gl.CLAMP_TO_EDGE;
if ( p === THREE.MirroredRepeatWrapping ) return _gl.MIRRORED_REPEAT;
if ( p === THREE.NearestFilter ) return _gl.NEAREST;
if ( p === THREE.NearestMipMapNeare... | javascript | {
"resource": ""
} |
q48845 | prepare | train | function prepare( vector ) {
var vertex = vector.normalize().clone();
vertex.index = that.vertices.push( vertex ) - 1;
// Texture coords are equivalent to map coords, calculate angle and convert to fraction of a circle.
var u = | javascript | {
"resource": ""
} |
q48846 | visible | train | function visible( face, vertex ) {
var va = vertices[ face[ 0 ] ];
var vb = vertices[ face[ 1 ] ];
var vc = vertices[ face[ 2 ] ];
var n = normal( va, vb, vc ); | javascript | {
"resource": ""
} |
q48847 | train | function() {
var newSel = [];
var vertices = this.mesh.getVertices();
var l = vertices.length;
for (var i=0;i<l;i++) {
var v = vertices[i];
if (this.selection.indexOf(v) < 0 ) {
| javascript | {
"resource": ""
} | |
q48848 | train | function(points) {
var l = points.length;
for (var i=0;i<l;i++) {
var v | javascript | {
"resource": ""
} | |
q48849 | train | function(sel2) {
this.checkMeshIdentity(sel2.getMesh());
var removeThese = sel2.getSelection();
var | javascript | {
"resource": ""
} | |
q48850 | train | function( rc ){
if( is.ColorRange(rc) ){
addAll(this.hueConstraint, rc.hueConstraint);
addAll(this.saturationConstraint, rc.saturationConstraint);
addAll(this.brightnessConstraint, rc.brightnessConstraint);
addAll(this.alphaConstraint, rc.alpha... | javascript | {
"resource": ""
} | |
q48851 | train | function( c ){
var isInRange = this.isValueInConstraint(c.hue(), this.hueConstraint);
isInRange &= this.isValueInConstraint(c.saturation(), this.saturationConstraint);
isInRange &= this.isValueInConstraint(c.brightness(), this.brightnessConstraint);
| javascript | {
"resource": ""
} | |
q48852 | train | function( c, num, variance ){
if( arguments.length < 3 ){
variance = ColorRange.DEFAULT_VARIANCE;
}
if( arguments.length === 1 ){
num = c;
c = undefined;
}
var list = new ColorList();
| javascript | {
"resource": ""
} | |
q48853 | train | function(min, max){
min = min || 0.0;
max = typeof max === 'number' ? max : 1.0;
// swap if necessary
if(min > max){
var t= max;
max = min;
| javascript | {
"resource": ""
} | |
q48854 | train | function(a,b,c,n,uvA,uvB,uvC){
//can be 3 args, 4 args, 6 args, or 7 args
//if it was 6 swap vars around,
if( arguments.length == 6 ){
uvC = uvB;
uvB = uvA;
uvA = n;
n = undefined;
}
//7 param method
var va = this.__checkVertex(a);
var vb = this.__checkVertex(b);
var ... | javascript | {
"resource": ""
} | |
q48855 | train | function(m){
var l = m.getFaces().length;
for(var i=0;i<l;i++){
var f = m.getFaces()[i]; | javascript | {
"resource": ""
} | |
q48856 | train | function(array) {
array = array || [];
var i = 0;
var l = this.vertices.length;
for (var j=0;j<l;j++) {
var v = this.vertices[j];
array[i++] | javascript | {
"resource": ""
} | |
q48857 | train | function(array){
array = array || [];
var n = 0;
for(i=0; i<this.vertices.length; i++){
var v = this.vertices[i];
array[n++] = v.normal.x;
| javascript | {
"resource": ""
} | |
q48858 | train | function(array){
array = array || [];
var i = 0;
for(f=0; f<this.faces.length; f++){
var face = this.faces[f];
array[i++] = face.uvA ? face.uvA.x : 0;
array[i++] = face.uvA ? face.uvA.y : 0;
a... | javascript | {
"resource": ""
} | |
q48859 | train | function(vec) {
var matchedVertex = -1;
var l = this.vertices.length;
for(var i=0;i<l;i++)
{
var vert = this.vertices[i];
| javascript | {
"resource": ""
} | |
q48860 | train | function(dir, forward) {
forward = forward || Vec3D.Z_AXIS;
return | javascript | {
"resource": ""
} | |
q48861 | train | function(mat,updateNormals) {
if(updateNormals === undefined){
updateNormals = true;
}
var l = this.vertices.length;
for(var i=0;i<l;i++){
var v = this.vertices[i];
| javascript | {
"resource": ""
} | |
q48862 | train | function(elevation){
if(this.__elevationLength == elevation.length){
for(var i = 0, len = elevation.length; i<len; i++){
this.vertices[i].y = this.elevation[i] = elevation[i];
}
| javascript | {
"resource": ""
} | |
q48863 | train | function(x,z,h){
var index = this._getIndex(x,z);
this.elevation[index] = h;
| javascript | {
"resource": ""
} | |
q48864 | train | function( theta, contrast ){
this.contrast = typeof contrast === 'number' ? contrast : 0.25;
this.theta = | javascript | {
"resource": ""
} | |
q48865 | train | function(a,b,c) {
var opts = {
mesh: undefined,
steps: 12,
thetaOffset: 0
};
if(arguments.length == 1 && typeof arguments[0] == 'object'){ //options object
for(var prop in arguments[0]){
opts[prop] = arguments[0][prop]; | javascript | {
"resource": ""
} | |
q48866 | train | function(theta) {
while (theta < 0) {
theta += mathUtils.TWO_PI;
}
| javascript | {
"resource": ""
} | |
q48867 | train | function( x, y, z ){
if( hasXYZ( x ) ){
//it was 1 param, it was a vector or object
this.vertices.push( new Vec3D(x) );
} else {
| javascript | {
"resource": ""
} | |
q48868 | train | function( step, doAddFinalVertex ){
if( doAddFinalVertex !== false ){
doAddFinalVertex = true;
}
var uniform = [];
if( this.vertices.length < 3 ){
if( this.vertices.length === 2 ){
new Line3D( this.vertices[0], this.vertices[1])
.splitIntoSegments( uniform, step, true );
if( !doAddFi... | javascript | {
"resource": ""
} | |
q48869 | train | function(p,phi,theta) {
var r = 0;
r += Math.pow(mathUtils.sin(this.m[0] * theta), this.m[1]);
r += Math.pow(mathUtils.cos(this.m[2] * theta), this.m[3]);
r += Math.pow(mathUtils.sin(this.m[4] * phi), this.m[5]);
r += Math.pow(mathUtils.cos(this.m[6] * phi), this.m[7]);
... | javascript | {
"resource": ""
} | |
q48870 | train | function(h, s, v) {
return this.setHSV([ | javascript | {
"resource": ""
} | |
q48871 | train | function(r, g,b) {
return this.setRGB([this.rgb[0] + r, | javascript | {
"resource": ""
} | |
q48872 | train | function(c, t) {
if(t === undefined) { t = 0.5; }
var crgb = c.toRGBAArray();
this.rgb[0] += (crgb[0] - this.rgb[0]) * | javascript | {
"resource": ""
} | |
q48873 | train | function(rgba, offset) {
rgba = rgba || [];
offset = offset || 0;
rgba[offset++] = this.rgb[0];
rgba[offset++] = this.rgb[1];
| javascript | {
"resource": ""
} | |
q48874 | train | function(color){
for( var i=0, l= this.colors.length; i<l; | javascript | {
"resource": ""
} | |
q48875 | train | function(){
var r = 0,
g = 0,
b = 0,
a = 0;
this.each(function(c){
r += c.rgb[0];
g += c.rgb[1];
b += c.rgb[2];
a += c.alpha();
});
var num | javascript | {
"resource": ""
} | |
q48876 | train | function(){
var darkest,
minBrightness = Number.MAX_VALUE;
this.each(function(c){
| javascript | {
"resource": ""
} | |
q48877 | train | function(comp, isReversed){
//if a normal ( a, b ) sort function instead of an AccessCriteria,
//wrap it so it can be invoked the same
| javascript | {
"resource": ""
} | |
q48878 | train | function(proxy, isReversed){
if(arguments.length === 1){
isReversed = arguments[0];
proxy = new HSVDistanceProxy();
}
if(this.colors.length === 0){
return this;
}
// Remove the darkest color from the stack,
// put it in the sorted list as starting element.
var root = this.getDarkest(),
stack... | javascript | {
"resource": ""
} | |
q48879 | train | function(g, x, y, z, w) {
var n = g[0] * x + g[1] * y;
| javascript | {
"resource": ""
} | |
q48880 | make | train | function make( type, setters ){
var name = type + 'Accessor', arry = type.toLowerCase(); //make HSV hsv etc
exports[name] = function( comp ){
this.component = comp;
//compare() could easily be used in incorrect scope, bind it
this.compare = bind( this.compare, this );
};
exports[name].prototype.compar... | javascript | {
"resource": ""
} |
q48881 | train | function(theta_p,theta){
if(arguments.length > 1){
this.theta = theta;
this.rootPos = new Vec2D(theta_p);
} else {
this.rootPos = new Vec2D();
| javascript | {
"resource": ""
} | |
q48882 | train | function( origin ){
var centroid = this.getCentroid();
var delta = origin !== undefined ? origin.sub( centroid ) : centroid.invert();
for( var i=0, | javascript | {
"resource": ""
} | |
q48883 | train | function( count ){
var num = this.vertices.length,
longestID = 0,
maxD = 0,
i = 0,
d,
m;
while( num < count ){
//find longest edge
longestID = 0;
maxD = 0;
... | javascript | {
"resource": ""
} | |
q48884 | train | function(){
var isPositive = false,
num = this.vertices.length,
prev,
next,
d0,
d1,
newIsP;
for( var i = 0; i < num; i++ ){
prev = (i===0) ? num -1 : i - 1;
next = (i=... | javascript | {
"resource": ""
} | |
q48885 | train | function( x1, y1, x2, y2, x3, y3, distance, out ){
var c1 = x2,
d1 = y2,
c2 = x2,
d2 = y2;
var dx1,
dy1,
dist1,
dx2,
dy2,
dist2,
insetX,
... | javascript | {
"resource": ""
} | |
q48886 | train | function( minEdgeLen ){
minEdgeLen *= minEdgeLen;
var vs = this.vertices,
reduced = [],
prev = vs[0],
num = vs.length - 1,
vec;
reduced.push(prev);
for( var i = 0; i < num; i++ ){
vec = vs[i];... | javascript | {
"resource": ""
} | |
q48887 | train | function( tolerance ){
//if tolerance is 0, it will be faster to just use 'equals' method
var equals = tolerance ? 'equalsWithTolerance' : 'equals';
var p, prev, i = 0, num = this.vertices.length;
var last;
for( ; i<num; i++ ){
p = this.vertice... | javascript | {
"resource": ""
} | |
q48888 | train | function(val) {
var t = ((val - this._in.min) / this._interval);
return | javascript | {
"resource": ""
} | |
q48889 | onPlayChange | train | function onPlayChange() {
if (paused !== media.paused) {
paused = media.paused;
$(self.play, { 'aria-label': paused ? lang.play || 'play' : lang.pause || 'pause' });
$(self.playSymbol, { 'aria-hidden': !paused }); | javascript | {
"resource": ""
} |
q48890 | onTimeChange | train | function onTimeChange() {
if (currentTime !== media.currentTime || duration !== media.duration) {
currentTime = media.currentTime;
duration = media.duration || 0;
const currentTimePercentage = currentTime / duration;
const currentTimeCode = timeToTimecode(currentTime);
const remainingTimeCode = timeTo... | javascript | {
"resource": ""
} |
q48891 | onLoadStart | train | function onLoadStart() {
media.removeEventListener('canplaythrough', onCanPlayStart);
$(media, { canplaythrough: onCanPlayStart });
$(self.download, { href: media.src, | javascript | {
"resource": ""
} |
q48892 | onCanPlayStart | train | function onCanPlayStart() {
media.removeEventListener('canplaythrough', onCanPlayStart);
// | javascript | {
"resource": ""
} |
q48893 | onVolumeChange | train | function onVolumeChange() {
const volumePercentage = media.muted ? 0 : media.volume;
const isMuted = !volumePercentage;
$(self.volume, { 'aria-valuenow': volumePercentage, 'aria-valuemin': 0, 'aria-valuemax': 1 });
const dirIsInline = /^(ltr|rtl)$/i.test(volumeDir);
const axisProp = dirIsInline ? 'width' : ... | javascript | {
"resource": ""
} |
q48894 | onDownloadClick | train | function onDownloadClick() {
const a = document.head.appendChild($('a', | javascript | {
"resource": ""
} |
q48895 | onFullscreenClick | train | function onFullscreenClick() {
if (requestFullscreen) {
if (player === fullscreenElement()) {
// exit fullscreen
exitFullscreen().call(document);
} else {
// enter fullscreen
requestFullscreen.call(player);
// maintain focus in internet explorer
self.fullscreen.focus();
// maintain... | javascript | {
"resource": ""
} |
q48896 | onTimeKeydown | train | function onTimeKeydown(event) {
const { keyCode, shiftKey } = event;
// 37: LEFT, 38: UP, 39: RIGHT, 40: DOWN
if (37 <= keyCode && 40 >= keyCode) {
event.preventDefault();
| javascript | {
"resource": ""
} |
q48897 | onVolumeKeydown | train | function onVolumeKeydown(event) {
const { keyCode, shiftKey } = event;
// 37: LEFT, 38: UP, 39: RIGHT, 40: DOWN
if (37 <= keyCode && 40 >= keyCode) {
event.preventDefault();
const isLTR = /^(btt|ltr)$/.test(volumeDir);
const offset = 37 === keyCode || | javascript | {
"resource": ""
} |
q48898 | createBindingsTag | train | function createBindingsTag(sourceNode, bindingsSelector) {
if (!bindingsSelector) return sourceNode
return {
...sourceNode,
// inject the selector bindings into the node attributes
| javascript | {
"resource": ""
} |
q48899 | createTagWithBindings | train | function createTagWithBindings(sourceNode, sourceFile, sourceCode) {
const bindingsSelector = isRootNode(sourceNode) ? null : createBindingSelector()
const cloneNode = createBindingsTag(sourceNode, bindingsSelector)
const tagOpeningHTML = nodeToString(cloneNode)
switch(true) {
// EACH bindings have prio 1
... | javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.