code
stringlengths 10
343k
| docstring
stringlengths 36
21.9k
| func_name
stringlengths 1
3.35k
| language
stringclasses 1
value | repo
stringlengths 7
58
| path
stringlengths 4
131
| url
stringlengths 44
195
| license
stringclasses 5
values |
---|---|---|---|---|---|---|---|
getDragAngle(x, y) {
return Math.round(Math.atan2(x, y) * (180 / Math.PI));
} | Get drag angle (up: 180, left: -90, right: 90, down: 0) | getDragAngle ( x , y ) | javascript | ilyashubin/scrollbooster | src/index.js | https://github.com/ilyashubin/scrollbooster/blob/master/src/index.js | MIT |
getDragDirection(angle, tolerance) {
const absAngle = Math.abs(90 - Math.abs(angle));
if (absAngle <= 90 - tolerance) {
return 'horizontal';
} else {
return 'vertical';
}
} | Get drag direction (horizontal or vertical) | getDragDirection ( angle , tolerance ) | javascript | ilyashubin/scrollbooster | src/index.js | https://github.com/ilyashubin/scrollbooster/blob/master/src/index.js | MIT |
setContentPosition(state) {
if (this.props.scrollMode === 'transform') {
this.props.content.style.transform = `translate(${-state.position.x}px, ${-state.position.y}px)`;
}
if (this.props.scrollMode === 'native') {
this.props.viewport.scrollTop = state.position.y;
this.props.viewport.scrollLeft = state.position.x;
}
} | Update DOM container elements metrics (width and height) | setContentPosition ( state ) | javascript | ilyashubin/scrollbooster | src/index.js | https://github.com/ilyashubin/scrollbooster/blob/master/src/index.js | MIT |
function InputStream(bytes) {
/** @type {!Int8Array} */
this.data = bytes;
/** @type {!number} */
this.offset = 0;
} | @constructor
@param {!Int8Array} bytes
@struct | InputStream ( bytes ) | javascript | arfct/itty-bitty | docs/js/brotli/decode.js | https://github.com/arfct/itty-bitty/blob/master/docs/js/brotli/decode.js | MIT |
let makeBrotliDecode = () => {
/**
* @constructor
* @param {!Int8Array} bytes
* @struct
*/
function InputStream(bytes) { | Private scope / static initializer for decoder.
@return {function(!Int8Array, Options=):!Int8Array} | makeBrotliDecode | javascript | arfct/itty-bitty | docs/js/brotli/decode.js | https://github.com/arfct/itty-bitty/blob/master/docs/js/brotli/decode.js | MIT |
function Deflate$1(options) {
this.options = common.assign({
level: Z_DEFAULT_COMPRESSION,
method: Z_DEFLATED$1,
chunkSize: 16384,
windowBits: 15,
memLevel: 8,
strategy: Z_DEFAULT_STRATEGY
}, options || {});
let opt = this.options;
if (opt.raw && (opt.windowBits > 0)) {
opt.windowBits = -opt.windowBits;
}
else if (opt.gzip && (opt.windowBits > 0) && (opt.windowBits < 16)) {
opt.windowBits += 16;
}
this.err = 0; // error code, if happens (0 = Z_OK)
this.msg = ''; // error message
this.ended = false; // used to avoid multiple onEnd() calls
this.chunks = []; // chunks of compressed data
this.strm = new zstream();
this.strm.avail_out = 0;
let status = deflate_1$2.deflateInit2(
this.strm,
opt.level,
opt.method,
opt.windowBits,
opt.memLevel,
opt.strategy
);
if (status !== Z_OK$2) {
throw new Error(messages[status]);
}
if (opt.header) {
deflate_1$2.deflateSetHeader(this.strm, opt.header);
}
if (opt.dictionary) {
let dict;
// Convert data if needed
if (typeof opt.dictionary === 'string') {
// If we need to compress text, change encoding to utf8.
dict = strings.string2buf(opt.dictionary);
} else if (toString$1.call(opt.dictionary) === '[object ArrayBuffer]') {
dict = new Uint8Array(opt.dictionary);
} else {
dict = opt.dictionary;
}
status = deflate_1$2.deflateSetDictionary(this.strm, dict);
if (status !== Z_OK$2) {
throw new Error(messages[status]);
}
this._dict_set = true;
}
} | new Deflate(options)
- options (Object): zlib deflate options.
Creates new deflator instance with specified params. Throws exception
on bad params. Supported options:
- `level`
- `windowBits`
- `memLevel`
- `strategy`
- `dictionary`
[http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)
for more information on these.
Additional options, for internal needs:
- `chunkSize` - size of generated data chunks (16K by default)
- `raw` (Boolean) - do raw deflate
- `gzip` (Boolean) - create gzip wrapper
- `header` (Object) - custom header for gzip
- `text` (Boolean) - true if compressed data believed to be text
- `time` (Number) - modification time, unix timestamp
- `os` (Number) - operation system code
- `extra` (Array) - array of bytes with extra data (max 65536)
- `name` (String) - file name (binary string)
- `comment` (String) - comment (binary string)
- `hcrc` (Boolean) - true if header crc should be added
##### Example:
```javascript
const pako = require('pako')
, chunk1 = new Uint8Array([1,2,3,4,5,6,7,8,9])
, chunk2 = new Uint8Array([10,11,12,13,14,15,16,17,18,19]);
const deflate = new pako.Deflate({ level: 3});
deflate.push(chunk1, false);
deflate.push(chunk2, true); // true -> last chunk
if (deflate.err) { throw new Error(deflate.err); }
console.log(deflate.result);
```
* | $1 ( options ) | javascript | arfct/itty-bitty | docs/js/gzip/pako.js | https://github.com/arfct/itty-bitty/blob/master/docs/js/gzip/pako.js | MIT |
Deflate$1.prototype.push = function (data, flush_mode) {
const strm = this.strm;
const chunkSize = this.options.chunkSize;
let status, _flush_mode;
if (this.ended) { return false; }
if (flush_mode === ~~flush_mode) _flush_mode = flush_mode;
else _flush_mode = flush_mode === true ? Z_FINISH$2 : Z_NO_FLUSH$1;
// Convert data if needed
if (typeof data === 'string') {
// If we need to compress text, change encoding to utf8.
strm.input = strings.string2buf(data);
} else if (toString$1.call(data) === '[object ArrayBuffer]') {
strm.input = new Uint8Array(data);
} else {
strm.input = data;
}
strm.next_in = 0;
strm.avail_in = strm.input.length;
for (;;) {
if (strm.avail_out === 0) {
strm.output = new Uint8Array(chunkSize);
strm.next_out = 0;
strm.avail_out = chunkSize;
}
// Make sure avail_out > 6 to avoid repeating markers
if ((_flush_mode === Z_SYNC_FLUSH || _flush_mode === Z_FULL_FLUSH) && strm.avail_out <= 6) {
this.onData(strm.output.subarray(0, strm.next_out));
strm.avail_out = 0;
continue;
}
status = deflate_1$2.deflate(strm, _flush_mode);
// Ended => flush and finish
if (status === Z_STREAM_END$2) {
if (strm.next_out > 0) {
this.onData(strm.output.subarray(0, strm.next_out));
}
status = deflate_1$2.deflateEnd(this.strm);
this.onEnd(status);
this.ended = true;
return status === Z_OK$2;
}
// Flush if out buffer full
if (strm.avail_out === 0) {
this.onData(strm.output);
continue;
}
// Flush if requested and has data
if (_flush_mode > 0 && strm.next_out > 0) {
this.onData(strm.output.subarray(0, strm.next_out));
strm.avail_out = 0;
continue;
}
if (strm.avail_in === 0) break;
}
return true;
}; | Deflate#push(data[, flush_mode]) -> Boolean
- data (Uint8Array|ArrayBuffer|String): input data. Strings will be
converted to utf8 byte sequence.
- flush_mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes.
See constants. Skipped or `false` means Z_NO_FLUSH, `true` means Z_FINISH.
Sends input data to deflate pipe, generating [[Deflate#onData]] calls with
new compressed chunks. Returns `true` on success. The last data block must
have `flush_mode` Z_FINISH (or `true`). That will flush internal pending
buffers and call [[Deflate#onEnd]].
On fail call [[Deflate#onEnd]] with error code and return false.
##### Example
```javascript
push(chunk, false); // push one of data chunks
...
push(chunk, true); // push last chunk
```
* | $1.prototype.push ( data , flush_mode ) | javascript | arfct/itty-bitty | docs/js/gzip/pako.js | https://github.com/arfct/itty-bitty/blob/master/docs/js/gzip/pako.js | MIT |
Deflate$1.prototype.onData = function (chunk) {
this.chunks.push(chunk);
}; | Deflate#onData(chunk) -> Void
- chunk (Uint8Array): output data.
By default, stores data blocks in `chunks[]` property and glue
those in `onEnd`. Override this handler, if you need another behaviour.
* | $1.prototype.onData ( chunk ) | javascript | arfct/itty-bitty | docs/js/gzip/pako.js | https://github.com/arfct/itty-bitty/blob/master/docs/js/gzip/pako.js | MIT |
Deflate$1.prototype.onEnd = function (status) {
// On success - join
if (status === Z_OK$2) {
this.result = common.flattenChunks(this.chunks);
}
this.chunks = [];
this.err = status;
this.msg = this.strm.msg;
}; | Deflate#onEnd(status) -> Void
- status (Number): deflate status. 0 (Z_OK) on success,
other if not.
Called once after you tell deflate that the input stream is
complete (Z_FINISH). By default - join collected chunks,
free memory and fill `results` / `err` properties.
* | $1.prototype.onEnd ( status ) | javascript | arfct/itty-bitty | docs/js/gzip/pako.js | https://github.com/arfct/itty-bitty/blob/master/docs/js/gzip/pako.js | MIT |
function deflate$1(input, options) {
const deflator = new Deflate$1(options);
deflator.push(input, true);
// That will never happens, if you don't cheat with options :)
if (deflator.err) { throw deflator.msg || messages[deflator.err]; }
return deflator.result;
} | deflate(data[, options]) -> Uint8Array
- data (Uint8Array|String): input data to compress.
- options (Object): zlib deflate options.
Compress `data` with deflate algorithm and `options`.
Supported options are:
- level
- windowBits
- memLevel
- strategy
- dictionary
[http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)
for more information on these.
Sugar (options):
- `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify
negative windowBits implicitly.
##### Example:
```javascript
const pako = require('pako')
const data = new Uint8Array([1,2,3,4,5,6,7,8,9]);
console.log(pako.deflate(data));
```
* | $1 ( input , options ) | javascript | arfct/itty-bitty | docs/js/gzip/pako.js | https://github.com/arfct/itty-bitty/blob/master/docs/js/gzip/pako.js | MIT |
function deflateRaw$1(input, options) {
options = options || {};
options.raw = true;
return deflate$1(input, options);
} | deflateRaw(data[, options]) -> Uint8Array
- data (Uint8Array|String): input data to compress.
- options (Object): zlib deflate options.
The same as [[deflate]], but creates raw data, without wrapper
(header and adler32 crc).
* | $1 ( input , options ) | javascript | arfct/itty-bitty | docs/js/gzip/pako.js | https://github.com/arfct/itty-bitty/blob/master/docs/js/gzip/pako.js | MIT |
function gzip$1(input, options) {
options = options || {};
options.gzip = true;
return deflate$1(input, options);
} | gzip(data[, options]) -> Uint8Array
- data (Uint8Array|String): input data to compress.
- options (Object): zlib deflate options.
The same as [[deflate]], but create gzip wrapper instead of
deflate one.
* | $1 ( input , options ) | javascript | arfct/itty-bitty | docs/js/gzip/pako.js | https://github.com/arfct/itty-bitty/blob/master/docs/js/gzip/pako.js | MIT |
function Inflate$1(options) {
this.options = common.assign({
chunkSize: 1024 * 64,
windowBits: 15,
to: ''
}, options || {});
const opt = this.options;
// Force window size for `raw` data, if not set directly,
// because we have no header for autodetect.
if (opt.raw && (opt.windowBits >= 0) && (opt.windowBits < 16)) {
opt.windowBits = -opt.windowBits;
if (opt.windowBits === 0) { opt.windowBits = -15; }
}
// If `windowBits` not defined (and mode not raw) - set autodetect flag for gzip/deflate
if ((opt.windowBits >= 0) && (opt.windowBits < 16) &&
!(options && options.windowBits)) {
opt.windowBits += 32;
}
// Gzip header has no info about windows size, we can do autodetect only
// for deflate. So, if window size not set, force it to max when gzip possible
if ((opt.windowBits > 15) && (opt.windowBits < 48)) {
// bit 3 (16) -> gzipped data
// bit 4 (32) -> autodetect gzip/deflate
if ((opt.windowBits & 15) === 0) {
opt.windowBits |= 15;
}
}
this.err = 0; // error code, if happens (0 = Z_OK)
this.msg = ''; // error message
this.ended = false; // used to avoid multiple onEnd() calls
this.chunks = []; // chunks of compressed data
this.strm = new zstream();
this.strm.avail_out = 0;
let status = inflate_1$2.inflateInit2(
this.strm,
opt.windowBits
);
if (status !== Z_OK) {
throw new Error(messages[status]);
}
this.header = new gzheader();
inflate_1$2.inflateGetHeader(this.strm, this.header);
// Setup dictionary
if (opt.dictionary) {
// Convert data if needed
if (typeof opt.dictionary === 'string') {
opt.dictionary = strings.string2buf(opt.dictionary);
} else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') {
opt.dictionary = new Uint8Array(opt.dictionary);
}
if (opt.raw) { //In raw mode we need to set the dictionary early
status = inflate_1$2.inflateSetDictionary(this.strm, opt.dictionary);
if (status !== Z_OK) {
throw new Error(messages[status]);
}
}
}
} | new Inflate(options)
- options (Object): zlib inflate options.
Creates new inflator instance with specified params. Throws exception
on bad params. Supported options:
- `windowBits`
- `dictionary`
[http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)
for more information on these.
Additional options, for internal needs:
- `chunkSize` - size of generated data chunks (16K by default)
- `raw` (Boolean) - do raw inflate
- `to` (String) - if equal to 'string', then result will be converted
from utf8 to utf16 (javascript) string. When string output requested,
chunk length can differ from `chunkSize`, depending on content.
By default, when no options set, autodetect deflate/gzip data format via
wrapper header.
##### Example:
```javascript
const pako = require('pako')
const chunk1 = new Uint8Array([1,2,3,4,5,6,7,8,9])
const chunk2 = new Uint8Array([10,11,12,13,14,15,16,17,18,19]);
const inflate = new pako.Inflate({ level: 3});
inflate.push(chunk1, false);
inflate.push(chunk2, true); // true -> last chunk
if (inflate.err) { throw new Error(inflate.err); }
console.log(inflate.result);
```
* | $1 ( options ) | javascript | arfct/itty-bitty | docs/js/gzip/pako.js | https://github.com/arfct/itty-bitty/blob/master/docs/js/gzip/pako.js | MIT |
Inflate$1.prototype.push = function (data, flush_mode) {
const strm = this.strm;
const chunkSize = this.options.chunkSize;
const dictionary = this.options.dictionary;
let status, _flush_mode, last_avail_out;
if (this.ended) return false;
if (flush_mode === ~~flush_mode) _flush_mode = flush_mode;
else _flush_mode = flush_mode === true ? Z_FINISH : Z_NO_FLUSH;
// Convert data if needed
if (toString.call(data) === '[object ArrayBuffer]') {
strm.input = new Uint8Array(data);
} else {
strm.input = data;
}
strm.next_in = 0;
strm.avail_in = strm.input.length;
for (;;) {
if (strm.avail_out === 0) {
strm.output = new Uint8Array(chunkSize);
strm.next_out = 0;
strm.avail_out = chunkSize;
}
status = inflate_1$2.inflate(strm, _flush_mode);
if (status === Z_NEED_DICT && dictionary) {
status = inflate_1$2.inflateSetDictionary(strm, dictionary);
if (status === Z_OK) {
status = inflate_1$2.inflate(strm, _flush_mode);
} else if (status === Z_DATA_ERROR) {
// Replace code with more verbose
status = Z_NEED_DICT;
}
}
// Skip snyc markers if more data follows and not raw mode
while (strm.avail_in > 0 &&
status === Z_STREAM_END &&
strm.state.wrap > 0 &&
data[strm.next_in] !== 0)
{
inflate_1$2.inflateReset(strm);
status = inflate_1$2.inflate(strm, _flush_mode);
}
switch (status) {
case Z_STREAM_ERROR:
case Z_DATA_ERROR:
case Z_NEED_DICT:
case Z_MEM_ERROR:
this.onEnd(status);
this.ended = true;
return false;
}
// Remember real `avail_out` value, because we may patch out buffer content
// to align utf8 strings boundaries.
last_avail_out = strm.avail_out;
if (strm.next_out) {
if (strm.avail_out === 0 || status === Z_STREAM_END) {
if (this.options.to === 'string') {
let next_out_utf8 = strings.utf8border(strm.output, strm.next_out);
let tail = strm.next_out - next_out_utf8;
let utf8str = strings.buf2string(strm.output, next_out_utf8);
// move tail & realign counters
strm.next_out = tail;
strm.avail_out = chunkSize - tail;
if (tail) strm.output.set(strm.output.subarray(next_out_utf8, next_out_utf8 + tail), 0);
this.onData(utf8str);
} else {
this.onData(strm.output.length === strm.next_out ? strm.output : strm.output.subarray(0, strm.next_out));
}
}
}
// Must repeat iteration if out buffer is full
if (status === Z_OK && last_avail_out === 0) continue;
// Finalize if end of stream reached.
if (status === Z_STREAM_END) {
status = inflate_1$2.inflateEnd(this.strm);
this.onEnd(status);
this.ended = true;
return true;
}
if (strm.avail_in === 0) break;
}
return true;
}; | Inflate#push(data[, flush_mode]) -> Boolean
- data (Uint8Array|ArrayBuffer): input data
- flush_mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE
flush modes. See constants. Skipped or `false` means Z_NO_FLUSH,
`true` means Z_FINISH.
Sends input data to inflate pipe, generating [[Inflate#onData]] calls with
new output chunks. Returns `true` on success. If end of stream detected,
[[Inflate#onEnd]] will be called.
`flush_mode` is not needed for normal operation, because end of stream
detected automatically. You may try to use it for advanced things, but
this functionality was not tested.
On fail call [[Inflate#onEnd]] with error code and return false.
##### Example
```javascript
push(chunk, false); // push one of data chunks
...
push(chunk, true); // push last chunk
```
* | $1.prototype.push ( data , flush_mode ) | javascript | arfct/itty-bitty | docs/js/gzip/pako.js | https://github.com/arfct/itty-bitty/blob/master/docs/js/gzip/pako.js | MIT |
Inflate$1.prototype.onData = function (chunk) {
this.chunks.push(chunk);
}; | Inflate#onData(chunk) -> Void
- chunk (Uint8Array|String): output data. When string output requested,
each chunk will be string.
By default, stores data blocks in `chunks[]` property and glue
those in `onEnd`. Override this handler, if you need another behaviour.
* | $1.prototype.onData ( chunk ) | javascript | arfct/itty-bitty | docs/js/gzip/pako.js | https://github.com/arfct/itty-bitty/blob/master/docs/js/gzip/pako.js | MIT |
Inflate$1.prototype.onEnd = function (status) {
// On success - join
if (status === Z_OK) {
if (this.options.to === 'string') {
this.result = this.chunks.join('');
} else {
this.result = common.flattenChunks(this.chunks);
}
}
this.chunks = [];
this.err = status;
this.msg = this.strm.msg;
}; | Inflate#onEnd(status) -> Void
- status (Number): inflate status. 0 (Z_OK) on success,
other if not.
Called either after you tell inflate that the input stream is
complete (Z_FINISH). By default - join collected chunks,
free memory and fill `results` / `err` properties.
* | $1.prototype.onEnd ( status ) | javascript | arfct/itty-bitty | docs/js/gzip/pako.js | https://github.com/arfct/itty-bitty/blob/master/docs/js/gzip/pako.js | MIT |
function inflate$1(input, options) {
const inflator = new Inflate$1(options);
inflator.push(input);
// That will never happens, if you don't cheat with options :)
if (inflator.err) throw inflator.msg || messages[inflator.err];
return inflator.result;
} | inflate(data[, options]) -> Uint8Array|String
- data (Uint8Array): input data to decompress.
- options (Object): zlib inflate options.
Decompress `data` with inflate/ungzip and `options`. Autodetect
format via wrapper header by default. That's why we don't provide
separate `ungzip` method.
Supported options are:
- windowBits
[http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)
for more information.
Sugar (options):
- `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify
negative windowBits implicitly.
- `to` (String) - if equal to 'string', then result will be converted
from utf8 to utf16 (javascript) string. When string output requested,
chunk length can differ from `chunkSize`, depending on content.
##### Example:
```javascript
const pako = require('pako');
const input = pako.deflate(new Uint8Array([1,2,3,4,5,6,7,8,9]));
let output;
try {
output = pako.inflate(input);
} catch (err) {
console.log(err);
}
```
* | $1 ( input , options ) | javascript | arfct/itty-bitty | docs/js/gzip/pako.js | https://github.com/arfct/itty-bitty/blob/master/docs/js/gzip/pako.js | MIT |
function inflateRaw$1(input, options) {
options = options || {};
options.raw = true;
return inflate$1(input, options);
} | inflateRaw(data[, options]) -> Uint8Array|String
- data (Uint8Array): input data to decompress.
- options (Object): zlib inflate options.
The same as [[inflate]], but creates raw data, without wrapper
(header and adler32 crc).
* | $1 ( input , options ) | javascript | arfct/itty-bitty | docs/js/gzip/pako.js | https://github.com/arfct/itty-bitty/blob/master/docs/js/gzip/pako.js | MIT |
function getElementPosition(obj) {
var curleft = 0, curtop = 0;
if (obj.offsetParent) {
do {
curleft += obj.offsetLeft;
curtop += obj.offsetTop;
} while (obj = obj.offsetParent);
return { x: curleft, y: curtop };
}
return undefined;
} | Return the location of the element (x,y) being relative to the document.
@param {Element} obj Element to be located | getElementPosition ( obj ) | javascript | arfct/itty-bitty | docs/render/color.js | https://github.com/arfct/itty-bitty/blob/master/docs/render/color.js | MIT |
findImageSize: function(item) {
var counter = 0,
img = item.img[0],
mfpSetInterval = function(delay) {
if(_imgInterval) {
clearInterval(_imgInterval);
}
// decelerating interval that checks for size of an image
_imgInterval = setInterval(function() {
if(img.naturalWidth > 0) {
mfp._onImageHasSize(item);
return;
}
if(counter > 200) {
clearInterval(_imgInterval);
}
counter++;
if(counter === 3) {
mfpSetInterval(10);
} else if(counter === 40) {
mfpSetInterval(50);
} else if(counter === 100) {
mfpSetInterval(500);
}
}, delay);
};
mfpSetInterval(1);
}, | Function that loops until the image has size to display elements that rely on it asap | findImageSize ( item ) | javascript | erdem/django-map-widgets | mapwidgets/static/mapwidgets/js/staticmap/mw_jquery.magnific-popup.js | https://github.com/erdem/django-map-widgets/blob/master/mapwidgets/static/mapwidgets/js/staticmap/mw_jquery.magnific-popup.js | MIT |
var _getLoopedId = function(index) {
var numSlides = mfp.items.length;
if(index > numSlides - 1) {
return index - numSlides;
} else if(index < 0) {
return numSlides + index;
}
return index;
}, | Get looped index depending on number of slides | _getLoopedId ( index ) | javascript | erdem/django-map-widgets | mapwidgets/static/mapwidgets/js/staticmap/mw_jquery.magnific-popup.js | https://github.com/erdem/django-map-widgets/blob/master/mapwidgets/static/mapwidgets/js/staticmap/mw_jquery.magnific-popup.js | MIT |
function drawResults(image, canvas, faceDetection, poses) {
renderImageToCanvas(image, [VIDEO_WIDTH, VIDEO_HEIGHT], canvas);
const ctx = canvas.getContext('2d');
poses.forEach((pose) => {
if (pose.score >= defaultMinPoseConfidence) {
if (guiState.showKeypoints) {
drawKeypoints(pose.keypoints, defaultMinPartConfidence, ctx);
}
if (guiState.showSkeleton) {
drawSkeleton(pose.keypoints, defaultMinPartConfidence, ctx);
}
}
});
if (guiState.showKeypoints) {
faceDetection.forEach(face => {
Object.values(facePartName2Index).forEach(index => {
let p = face.scaledMesh[index];
drawPoint(ctx, p[1], p[0], 3, 'red');
});
});
}
} | Draws a pose if it passes a minimum confidence onto a canvas.
Only the pose's keypoints that pass a minPartConfidence are drawn. | drawResults ( image , canvas , faceDetection , poses ) | javascript | yemount/pose-animator | static_image.js | https://github.com/yemount/pose-animator/blob/master/static_image.js | Apache-2.0 |
function drawDetectionResults() {
const canvas = multiPersonCanvas();
drawResults(sourceImage, canvas, faceDetection, predictedPoses);
if (!predictedPoses || !predictedPoses.length || !illustration) {
return;
}
skeleton.reset();
canvasScope.project.clear();
if (faceDetection && faceDetection.length > 0) {
let face = Skeleton.toFaceFrame(faceDetection[0]);
illustration.updateSkeleton(predictedPoses[0], face);
} else {
illustration.updateSkeleton(predictedPoses[0], null);
}
illustration.draw(canvasScope, sourceImage.width, sourceImage.height);
if (guiState.showCurves) {
illustration.debugDraw(canvasScope);
}
if (guiState.showLabels) {
illustration.debugDrawLabel(canvasScope);
}
} | Draw the results from the multi-pose estimation on to a canvas | drawDetectionResults ( ) | javascript | yemount/pose-animator | static_image.js | https://github.com/yemount/pose-animator/blob/master/static_image.js | Apache-2.0 |
async function testImageAndEstimatePoses() {
toggleLoadingUI(true);
setStatusText('Loading FaceMesh model...');
document.getElementById('results').style.display = 'none';
// Reload facemesh model to purge states from previous runs.
facemesh = await facemesh_module.load();
// Load an example image
setStatusText('Loading image...');
sourceImage = await loadImage(sourceImages[guiState.sourceImage]);
// Estimates poses
setStatusText('Predicting...');
predictedPoses = await posenet.estimatePoses(sourceImage, {
flipHorizontal: false,
decodingMethod: 'multi-person',
maxDetections: defaultMaxDetections,
scoreThreshold: defaultMinPartConfidence,
nmsRadius: defaultNmsRadius,
});
faceDetection = await facemesh.estimateFaces(sourceImage, false, false);
// Draw poses.
drawDetectionResults();
toggleLoadingUI(false);
document.getElementById('results').style.display = 'block';
} | Loads an image, feeds it into posenet the posenet model, and
calculates poses based on the model outputs | testImageAndEstimatePoses ( ) | javascript | yemount/pose-animator | static_image.js | https://github.com/yemount/pose-animator/blob/master/static_image.js | Apache-2.0 |
export async function bindPage() {
toggleLoadingUI(true);
canvasScope = paper.default;
let canvas = getIllustrationCanvas();
canvas.width = CANVAS_WIDTH;
canvas.height = CANVAS_HEIGHT;
canvasScope.setup(canvas);
await tf.setBackend('webgl');
setStatusText('Loading PoseNet model...');
posenet = await posenet_module.load({
architecture: resnetArchitectureName,
outputStride: defaultStride,
inputResolution: defaultInputResolution,
multiplier: defaultMultiplier,
quantBytes: defaultQuantBytes
});
setupGui(posenet);
setStatusText('Loading SVG file...');
await loadSVG(Object.values(avatarSvgs)[0]);
} | Kicks off the demo by loading the posenet model and estimating
poses on a default image | bindPage ( ) | javascript | yemount/pose-animator | static_image.js | https://github.com/yemount/pose-animator/blob/master/static_image.js | Apache-2.0 |
function setupGui(cameras) {
if (cameras.length > 0) {
guiState.camera = cameras[0].deviceId;
}
const gui = new dat.GUI({width: 300});
let multi = gui.addFolder('Image');
gui.add(guiState, 'avatarSVG', Object.keys(avatarSvgs)).onChange(() => parseSVG(avatarSvgs[guiState.avatarSVG]));
multi.open();
let output = gui.addFolder('Debug control');
output.add(guiState.debug, 'showDetectionDebug');
output.add(guiState.debug, 'showIllustrationDebug');
output.open();
} | Sets up dat.gui controller on the top-right of the window | setupGui ( cameras ) | javascript | yemount/pose-animator | camera.js | https://github.com/yemount/pose-animator/blob/master/camera.js | Apache-2.0 |
function setupFPS() {
stats.showPanel(0); // 0: fps, 1: ms, 2: mb, 3+: custom
document.getElementById('main').appendChild(stats.dom);
} | Sets up a frames per second panel on the top-left of the window | setupFPS ( ) | javascript | yemount/pose-animator | camera.js | https://github.com/yemount/pose-animator/blob/master/camera.js | Apache-2.0 |
function detectPoseInRealTime(video) {
const canvas = document.getElementById('output');
const keypointCanvas = document.getElementById('keypoints');
const videoCtx = canvas.getContext('2d');
const keypointCtx = keypointCanvas.getContext('2d');
canvas.width = videoWidth;
canvas.height = videoHeight;
keypointCanvas.width = videoWidth;
keypointCanvas.height = videoHeight;
async function poseDetectionFrame() {
// Begin monitoring code for frames per second
stats.begin();
let poses = [];
videoCtx.clearRect(0, 0, videoWidth, videoHeight);
// Draw video
videoCtx.save();
videoCtx.scale(-1, 1);
videoCtx.translate(-videoWidth, 0);
videoCtx.drawImage(video, 0, 0, videoWidth, videoHeight);
videoCtx.restore();
// Creates a tensor from an image
const input = tf.browser.fromPixels(canvas);
faceDetection = await facemesh.estimateFaces(input, false, false);
let all_poses = await posenet.estimatePoses(video, {
flipHorizontal: true,
decodingMethod: 'multi-person',
maxDetections: 1,
scoreThreshold: minPartConfidence,
nmsRadius: nmsRadius
});
poses = poses.concat(all_poses);
input.dispose();
keypointCtx.clearRect(0, 0, videoWidth, videoHeight);
if (guiState.debug.showDetectionDebug) {
poses.forEach(({score, keypoints}) => {
if (score >= minPoseConfidence) {
drawKeypoints(keypoints, minPartConfidence, keypointCtx);
drawSkeleton(keypoints, minPartConfidence, keypointCtx);
}
});
faceDetection.forEach(face => {
Object.values(facePartName2Index).forEach(index => {
let p = face.scaledMesh[index];
drawPoint(keypointCtx, p[1], p[0], 2, 'red');
});
});
}
canvasScope.project.clear();
if (poses.length >= 1 && illustration) {
Skeleton.flipPose(poses[0]);
if (faceDetection && faceDetection.length > 0) {
let face = Skeleton.toFaceFrame(faceDetection[0]);
illustration.updateSkeleton(poses[0], face);
} else {
illustration.updateSkeleton(poses[0], null);
}
illustration.draw(canvasScope, videoWidth, videoHeight);
if (guiState.debug.showIllustrationDebug) {
illustration.debugDraw(canvasScope);
}
}
canvasScope.project.activeLayer.scale(
canvasWidth / videoWidth,
canvasHeight / videoHeight,
new canvasScope.Point(0, 0));
// End monitoring code for frames per second
stats.end();
requestAnimationFrame(poseDetectionFrame);
}
poseDetectionFrame();
} | Feeds an image to posenet to estimate poses - this is where the magic
happens. This function loops with a requestAnimationFrame method. | detectPoseInRealTime ( video ) | javascript | yemount/pose-animator | camera.js | https://github.com/yemount/pose-animator/blob/master/camera.js | Apache-2.0 |
export async function bindPage() {
setupCanvas();
toggleLoadingUI(true);
setStatusText('Loading PoseNet model...');
posenet = await posenet_module.load({
architecture: defaultPoseNetArchitecture,
outputStride: defaultStride,
inputResolution: defaultInputResolution,
multiplier: defaultMultiplier,
quantBytes: defaultQuantBytes
});
setStatusText('Loading FaceMesh model...');
facemesh = await facemesh_module.load();
setStatusText('Loading Avatar file...');
let t0 = new Date();
await parseSVG(Object.values(avatarSvgs)[0]);
setStatusText('Setting up camera...');
try {
video = await loadVideo();
} catch (e) {
let info = document.getElementById('info');
info.textContent = 'this device type is not supported yet, ' +
'or this browser does not support video capture: ' + e.toString();
info.style.display = 'block';
throw e;
}
setupGui([], posenet);
setupFPS();
toggleLoadingUI(false);
detectPoseInRealTime(video, posenet);
} | Kicks off the demo by loading the posenet model, finding and loading
available camera devices, and setting off the detectPoseInRealTime function. | bindPage ( ) | javascript | yemount/pose-animator | camera.js | https://github.com/yemount/pose-animator/blob/master/camera.js | Apache-2.0 |
export function toggleLoadingUI(
showLoadingUI, loadingDivId = 'loading', mainDivId = 'main') {
if (showLoadingUI) {
document.getElementById(loadingDivId).style.display = 'block';
document.getElementById(mainDivId).style.display = 'none';
} else {
document.getElementById(loadingDivId).style.display = 'none';
document.getElementById(mainDivId).style.display = 'block';
}
} | Toggles between the loading UI and the main canvas UI. | toggleLoadingUI ( showLoadingUI , loadingDivId = 'loading' , mainDivId = 'main' ) | javascript | yemount/pose-animator | utils/demoUtils.js | https://github.com/yemount/pose-animator/blob/master/utils/demoUtils.js | Apache-2.0 |
export function drawSegment([ay, ax], [by, bx], color, scale, ctx) {
ctx.beginPath();
ctx.moveTo(ax * scale, ay * scale);
ctx.lineTo(bx * scale, by * scale);
ctx.lineWidth = lineWidth;
ctx.strokeStyle = color;
ctx.stroke();
} | Draws a line on a canvas, i.e. a joint | drawSegment ( [ ay , ax ] , [ by , bx ] , color , scale , ctx ) | javascript | yemount/pose-animator | utils/demoUtils.js | https://github.com/yemount/pose-animator/blob/master/utils/demoUtils.js | Apache-2.0 |
export function drawSkeleton(keypoints, minConfidence, ctx, scale = 1) {
const adjacentKeyPoints =
posenet.getAdjacentKeyPoints(keypoints, minConfidence);
adjacentKeyPoints.forEach((keypoints) => {
drawSegment(
toTuple(keypoints[0].position), toTuple(keypoints[1].position), color,
scale, ctx);
});
} | Draws a pose skeleton by looking up all adjacent keypoints/joints | drawSkeleton ( keypoints , minConfidence , ctx , scale = 1 ) | javascript | yemount/pose-animator | utils/demoUtils.js | https://github.com/yemount/pose-animator/blob/master/utils/demoUtils.js | Apache-2.0 |
function getDistance(p0, p1) {
return Math.sqrt((p0.x - p1.x) * (p0.x - p1.x) + (p0.y - p1.y) * (p0.y - p1.y));
} | @license
Copyright 2020 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
============================================================================= | getDistance ( p0 , p1 ) | javascript | yemount/pose-animator | utils/mathUtils.js | https://github.com/yemount/pose-animator/blob/master/utils/mathUtils.js | Apache-2.0 |
function _kvToStr([k, v]) {
if (k === "undefined") {
return "(none):" + v;
}
return k + ":" + v;
} | Return a custom string for the given key/value pair. | _kvToStr ( [ k , v ] ) | javascript | vmallet/ida-plugins | main.js | https://github.com/vmallet/ida-plugins/blob/master/main.js | MIT |
function _sortParenLast([a, c1], [b, c2]) {
let res = 0;
if (a < b) {
res = -1;
} else if (a > b) {
res = 1;
}
if (a.startsWith('(') || b.startsWith('(')) {
res = -res;
}
return res;
} | Compare two [name, count] pairs, putting any name starting with '(' last.
(Not robust.) | _sortParenLast ( [ a , c1 ] , [ b , c2 ] ) | javascript | vmallet/ida-plugins | main.js | https://github.com/vmallet/ida-plugins/blob/master/main.js | MIT |
function buildStats(rows) {
const count = rows.length
const zsrcs = new DefaultDict(0);
const zcats = new DefaultDict(0);
// Count languages, categories
for (const row of rows) {
let data = row.getData();
// Count source language, straightforward
zsrcs[data.src]++;
// Count categories
if (!data.cats) {
zcats["undefined"]++;
} else {
let split = data.cats.split(",");
for (const cat of split) {
zcats[cat.trim()]++;
}
}
}
src_stats = Object.entries(zsrcs).map(map_undefined).sort(_sortParenLast)
cat_stats = Object.entries(zcats).map(map_undefined).sort(_sortParenLast)
return { count, src_stats, cat_stats }
} | Construct the stats text displayed above the table. Ultra crude.
TODO: make this presentable, decide what to keep and what not to.
* | buildStats ( rows ) | javascript | vmallet/ida-plugins | main.js | https://github.com/vmallet/ida-plugins/blob/master/main.js | MIT |
function populateStatElements(parentId, counts) {
let $stats = $(parentId);
$stats.empty()
for (const [name, count] of counts) {
$span = $("<span>", { "class": "stat-elem"})
$span.text(name + " ")
$val = $("<span>", { "class": "stat-val"})
$val.text(count)
$span.append($val)
$stats.append($span)
}
} | Build and attach stat elements for the given counts to the parent element
with id 'parentId'. | populateStatElements ( parentId , counts ) | javascript | vmallet/ida-plugins | main.js | https://github.com/vmallet/ida-plugins/blob/master/main.js | MIT |
function updateStats(rows) {
let { count, src_stats, cat_stats } = buildStats(rows)
$("#plugin-count").text(count)
populateStatElements("#stats-languages", src_stats)
populateStatElements("#stats-categories", cat_stats)
$("#loading").css("visibility", "hidden");
$("#stats").css("visibility", "visible");
} | Update the "showing" stats when the table is changed. | updateStats ( rows ) | javascript | vmallet/ida-plugins | main.js | https://github.com/vmallet/ida-plugins/blob/master/main.js | MIT |
function getCheckedValues(ids) {
vals = [];
for (const id of ids) {
let cb = $(id);
if (cb.is(':checked')) {
vals.push(cb.val());
}
}
return vals;
} | Return the values associated with the checked checkboxes from the set
of checkboxes identified by ids.
@param ids ids of checkboxes
@returns {[]} a list of values, possibly empty | getCheckedValues ( ids ) | javascript | vmallet/ida-plugins | main.js | https://github.com/vmallet/ida-plugins/blob/master/main.js | MIT |
function updateFilter() {
src = getCheckedValues(src_checkboxes);
cats = getCheckedValues(cats_checkboxes);
if (src.length || cats.length) {
table.setFilter(customFilter);
} else {
table.clearFilter();
}
// A bit of a mystery why the table needs to be redrawn. Chalk it to my
// lack of knowledge here...
table.redraw();
} | React to a filter-setup change and update the active filter accordingly. | updateFilter ( ) | javascript | vmallet/ida-plugins | main.js | https://github.com/vmallet/ida-plugins/blob/master/main.js | MIT |
function registerUpdate(ids) {
for (const id of ids) {
$(id).change(updateFilter);
}
} | Make sure the elements corresponding to the given ids update the
filter on change. | registerUpdate ( ids ) | javascript | vmallet/ida-plugins | main.js | https://github.com/vmallet/ida-plugins/blob/master/main.js | MIT |
function extend(a, b) {
var n;
if (!a) {
a = {};
}
for (n in b) {
a[n] = b[n];
}
return a;
} | Extend an object with the members of another
@param {Object} a The object to be extended
@param {Object} b The object to add to the first one | extend ( a , b ) | javascript | WebPlatformTest/HTML5test | scripts/highcharts/highcharts.src.js | https://github.com/WebPlatformTest/HTML5test/blob/master/scripts/highcharts/highcharts.src.js | MIT |
function hash() {
var i = 0,
args = arguments,
length = args.length,
obj = {};
for (; i < length; i++) {
obj[args[i++]] = args[i];
}
return obj;
} | Take an array and turn into a hash with even number arguments as keys and odd numbers as
values. Allows creating constants for commonly used style properties, attributes etc.
Avoid it in performance critical situations like looping | hash ( ) | javascript | WebPlatformTest/HTML5test | scripts/highcharts/highcharts.src.js | https://github.com/WebPlatformTest/HTML5test/blob/master/scripts/highcharts/highcharts.src.js | MIT |
function pInt(s, mag) {
return parseInt(s, mag || 10);
} | Shortcut for parseInt
@param {Object} s
@param {Number} mag Magnitude | pInt ( s , mag ) | javascript | WebPlatformTest/HTML5test | scripts/highcharts/highcharts.src.js | https://github.com/WebPlatformTest/HTML5test/blob/master/scripts/highcharts/highcharts.src.js | MIT |
function isObject(obj) {
return typeof obj === 'object';
} | Check for object
@param {Object} obj | isObject ( obj ) | javascript | WebPlatformTest/HTML5test | scripts/highcharts/highcharts.src.js | https://github.com/WebPlatformTest/HTML5test/blob/master/scripts/highcharts/highcharts.src.js | MIT |
function erase(arr, item) {
var i = arr.length;
while (i--) {
if (arr[i] === item) {
arr.splice(i, 1);
break;
}
}
//return arr;
} | Remove last occurence of an item from an array
@param {Array} arr
@param {Mixed} item | erase ( arr , item ) | javascript | WebPlatformTest/HTML5test | scripts/highcharts/highcharts.src.js | https://github.com/WebPlatformTest/HTML5test/blob/master/scripts/highcharts/highcharts.src.js | MIT |
function defined(obj) {
return obj !== UNDEFINED && obj !== null;
} | Returns true if the object is not null or undefined. Like MooTools' $.defined.
@param {Object} obj | defined ( obj ) | javascript | WebPlatformTest/HTML5test | scripts/highcharts/highcharts.src.js | https://github.com/WebPlatformTest/HTML5test/blob/master/scripts/highcharts/highcharts.src.js | MIT |
function attr(elem, prop, value) {
var key,
setAttribute = 'setAttribute',
ret;
// if the prop is a string
if (isString(prop)) {
// set the value
if (defined(value)) {
elem[setAttribute](prop, value);
// get the value
} else if (elem && elem.getAttribute) { // elem not defined when printing pie demo...
ret = elem.getAttribute(prop);
}
// else if prop is defined, it is a hash of key/value pairs
} else if (defined(prop) && isObject(prop)) {
for (key in prop) {
elem[setAttribute](key, prop[key]);
}
}
return ret;
} | Set or get an attribute or an object of attributes. Can't use jQuery attr because
it attempts to set expando properties on the SVG element, which is not allowed.
@param {Object} elem The DOM element to receive the attribute(s)
@param {String|Object} prop The property or an abject of key-value pairs
@param {String} value The value if a single property is set | attr ( elem , prop , value ) | javascript | WebPlatformTest/HTML5test | scripts/highcharts/highcharts.src.js | https://github.com/WebPlatformTest/HTML5test/blob/master/scripts/highcharts/highcharts.src.js | MIT |
function splat(obj) {
return isArray(obj) ? obj : [obj];
} | Check if an element is an array, and if not, make it into an array. Like
MooTools' $.splat. | splat ( obj ) | javascript | WebPlatformTest/HTML5test | scripts/highcharts/highcharts.src.js | https://github.com/WebPlatformTest/HTML5test/blob/master/scripts/highcharts/highcharts.src.js | MIT |
function pick() {
var args = arguments,
i,
arg,
length = args.length;
for (i = 0; i < length; i++) {
arg = args[i];
if (typeof arg !== 'undefined' && arg !== null) {
return arg;
}
}
} | Return the first value that is defined. Like MooTools' $.pick. | pick ( ) | javascript | WebPlatformTest/HTML5test | scripts/highcharts/highcharts.src.js | https://github.com/WebPlatformTest/HTML5test/blob/master/scripts/highcharts/highcharts.src.js | MIT |
function css(el, styles) {
if (isIE) {
if (styles && styles.opacity !== UNDEFINED) {
styles.filter = 'alpha(opacity=' + (styles.opacity * 100) + ')';
}
}
extend(el.style, styles);
} | Set CSS on a given element
@param {Object} el
@param {Object} styles Style object with camel case property names | css ( el , styles ) | javascript | WebPlatformTest/HTML5test | scripts/highcharts/highcharts.src.js | https://github.com/WebPlatformTest/HTML5test/blob/master/scripts/highcharts/highcharts.src.js | MIT |
function createElement(tag, attribs, styles, parent, nopad) {
var el = doc.createElement(tag);
if (attribs) {
extend(el, attribs);
}
if (nopad) {
css(el, {padding: 0, border: NONE, margin: 0});
}
if (styles) {
css(el, styles);
}
if (parent) {
parent.appendChild(el);
}
return el;
} | Utility function to create element with attributes and styles
@param {Object} tag
@param {Object} attribs
@param {Object} styles
@param {Object} parent
@param {Object} nopad | createElement ( tag , attribs , styles , parent , nopad ) | javascript | WebPlatformTest/HTML5test | scripts/highcharts/highcharts.src.js | https://github.com/WebPlatformTest/HTML5test/blob/master/scripts/highcharts/highcharts.src.js | MIT |
function extendClass(parent, members) {
var object = function () {};
object.prototype = new parent();
extend(object.prototype, members);
return object;
} | Extend a prototyped class by new members
@param {Object} parent
@param {Object} members | extendClass ( parent , members ) | javascript | WebPlatformTest/HTML5test | scripts/highcharts/highcharts.src.js | https://github.com/WebPlatformTest/HTML5test/blob/master/scripts/highcharts/highcharts.src.js | MIT |
function pad(number, length) {
// Create an array of the remaining length +1 and join it with 0's
return new Array((length || 2) + 1 - String(number).length).join(0) + number;
} | Pad a string to a given length by adding 0 to the beginning
@param {Number} number
@param {Number} length | pad ( number , length ) | javascript | WebPlatformTest/HTML5test | scripts/highcharts/highcharts.src.js | https://github.com/WebPlatformTest/HTML5test/blob/master/scripts/highcharts/highcharts.src.js | MIT |
configure: function (chart) {
var renderer = this,
options = chart.options.tooltip,
borderWidth = options.borderWidth,
tooltipDiv = renderer.ttDiv,
tooltipDivStyle = options.style,
tooltipLine = renderer.ttLine,
padding = parseInt(tooltipDivStyle.padding, 10);
// Add border styling from options to the style
tooltipDivStyle = merge(tooltipDivStyle, {
padding: padding + PX,
'background-color': options.backgroundColor,
'border-style': 'solid',
'border-width': borderWidth + PX,
'border-radius': options.borderRadius + PX
});
// Optionally add shadow
if (options.shadow) {
tooltipDivStyle = merge(tooltipDivStyle, {
'box-shadow': '1px 1px 3px gray', // w3c
'-webkit-box-shadow': '1px 1px 3px gray' // webkit
});
}
css(tooltipDiv, tooltipDivStyle);
// Set simple style on the line
css(tooltipLine, {
'border-left': '1px solid darkgray'
});
// This event is triggered when a new tooltip should be shown
addEvent(chart, 'tooltipRefresh', function (args) {
var chartContainer = chart.container,
offsetLeft = chartContainer.offsetLeft,
offsetTop = chartContainer.offsetTop,
position;
// Set the content of the tooltip
tooltipDiv.innerHTML = args.text;
// Compute the best position for the tooltip based on the divs size and container size.
position = placeBox(tooltipDiv.offsetWidth, tooltipDiv.offsetHeight, offsetLeft, offsetTop, chartContainer.offsetWidth, chartContainer.offsetHeight, {x: args.x, y: args.y}, 12);
css(tooltipDiv, {
visibility: VISIBLE,
left: position.x + PX,
top: position.y + PX,
'border-color': args.borderColor
});
// Position the tooltip line
css(tooltipLine, {
visibility: VISIBLE,
left: offsetLeft + args.x + PX,
top: offsetTop + chart.plotTop + PX,
height: chart.plotHeight + PX
});
// This timeout hides the tooltip after 3 seconds
// First clear any existing timer
if (renderer.ttTimer !== UNDEFINED) {
clearTimeout(renderer.ttTimer);
}
// Start a new timer that hides tooltip and line
renderer.ttTimer = setTimeout(function () {
css(tooltipDiv, { visibility: HIDDEN });
css(tooltipLine, { visibility: HIDDEN });
}, 3000);
});
}, | Configures the renderer with the chart. Attach a listener to the event tooltipRefresh.
* | configure ( chart ) | javascript | WebPlatformTest/HTML5test | scripts/highcharts/modules/canvas-tools.src.js | https://github.com/WebPlatformTest/HTML5test/blob/master/scripts/highcharts/modules/canvas-tools.src.js | MIT |
destroy: function () {
var renderer = this;
// Remove the canvas
discardElement(renderer.canvas);
// Kill the timer
if (renderer.ttTimer !== UNDEFINED) {
clearTimeout(renderer.ttTimer);
}
// Remove the divs for tooltip and line
discardElement(renderer.ttLine);
discardElement(renderer.ttDiv);
discardElement(renderer.hiddenSvg);
// Continue with base class
return SVGRenderer.prototype.destroy.apply(renderer);
}, | Extend SVGRenderer.destroy to also destroy the elements added by CanVGRenderer. | destroy ( ) | javascript | WebPlatformTest/HTML5test | scripts/highcharts/modules/canvas-tools.src.js | https://github.com/WebPlatformTest/HTML5test/blob/master/scripts/highcharts/modules/canvas-tools.src.js | MIT |
color: function (color, elem, prop) {
if (color && color.linearGradient) {
// Pick the end color and forward to base implementation
color = color.stops[color.stops.length - 1][1];
}
return SVGRenderer.prototype.color.call(this, color, elem, prop);
}, | Take a color and return it if it's a string, do not make it a gradient even if it is a
gradient. Currently canvg cannot render gradients (turns out black),
see: http://code.google.com/p/canvg/issues/detail?id=104
@param {Object} color The color or config object | color ( color , elem , prop ) | javascript | WebPlatformTest/HTML5test | scripts/highcharts/modules/canvas-tools.src.js | https://github.com/WebPlatformTest/HTML5test/blob/master/scripts/highcharts/modules/canvas-tools.src.js | MIT |
draw: function () {
var renderer = this;
window.canvg(renderer.canvas, renderer.hiddenSvg.innerHTML);
} | Draws the SVG on the canvas or adds a draw invokation to the deferred list. | draw ( ) | javascript | WebPlatformTest/HTML5test | scripts/highcharts/modules/canvas-tools.src.js | https://github.com/WebPlatformTest/HTML5test/blob/master/scripts/highcharts/modules/canvas-tools.src.js | MIT |
init: function (pathAnim) {
if (hasEffect) {
/**
* Animation for Highcharts SVG element wrappers only
* @param {Object} element
* @param {Object} attribute
* @param {Object} to
* @param {Object} options
*/
Effect.HighchartsTransition = Class.create(Effect.Base, {
initialize: function (element, attr, to, options) {
var from,
opts;
this.element = element;
this.key = attr;
from = element.attr ? element.attr(attr) : $(element).getStyle(attr);
// special treatment for paths
if (attr === 'd') {
this.paths = pathAnim.init(
element,
element.d,
to
);
this.toD = to;
// fake values in order to read relative position as a float in update
from = 0;
to = 1;
}
opts = Object.extend((options || {}), {
from: from,
to: to,
attribute: attr
});
this.start(opts);
},
setup: function () {
HighchartsAdapter._extend(this.element);
// If this is the first animation on this object, create the _highcharts_animation helper that
// contain pointers to the animation objects.
if (!this.element._highchart_animation) {
this.element._highchart_animation = {};
}
// Store a reference to this animation instance.
this.element._highchart_animation[this.key] = this;
},
update: function (position) {
var paths = this.paths,
element = this.element,
obj;
if (paths) {
position = pathAnim.step(paths[0], paths[1], position, this.toD);
}
if (element.attr) { // SVGElement
element.attr(this.options.attribute, position);
} else { // HTML, #409
obj = {};
obj[this.options.attribute] = position;
$(element).setStyle(obj);
}
},
finish: function () {
// Delete the property that holds this animation now that it is finished.
// Both canceled animations and complete ones gets a 'finish' call.
delete this.element._highchart_animation[this.key];
}
});
}
}, | Initialize the adapter. This is run once as Highcharts is first run.
@param {Object} pathAnim The helper object to do animations across adapters. | init ( pathAnim ) | javascript | WebPlatformTest/HTML5test | scripts/highcharts/adapters/prototype-adapter.src.js | https://github.com/WebPlatformTest/HTML5test/blob/master/scripts/highcharts/adapters/prototype-adapter.src.js | MIT |
getScript: function (scriptLocation, callback) {
var head = $$('head')[0]; // Returns an array, so pick the first element.
if (head) {
// Append a new 'script' element, set its type and src attributes, add a 'load' handler that calls the callback
head.appendChild(new Element('script', { type: 'text/javascript', src: scriptLocation}).observe('load', callback));
}
}, | Downloads a script and executes a callback when done.
@param {String} scriptLocation
@param {Function} callback | getScript ( scriptLocation , callback ) | javascript | WebPlatformTest/HTML5test | scripts/highcharts/adapters/prototype-adapter.src.js | https://github.com/WebPlatformTest/HTML5test/blob/master/scripts/highcharts/adapters/prototype-adapter.src.js | MIT |
animate: function (el, params, options) {
var isSVGElement = el.attr,
effect,
complete = options && options.complete;
if (isSVGElement && !el.setStyle) {
// add setStyle and getStyle methods for internal use in Moo
el.getStyle = el.attr;
el.setStyle = function () { // property value is given as array in Moo - break it down
var args = arguments;
el.attr.call(el, args[0], args[1][0]);
};
// dirty hack to trick Moo into handling el as an element wrapper
el.$family = function () { return true; };
}
// stop running animations
win.HighchartsAdapter.stop(el);
// define and run the effect
effect = new Fx.Morph(
isSVGElement ? el : $(el),
$extend({
transition: Fx.Transitions.Quad.easeInOut
}, options)
);
// Make sure that the element reference is set when animating svg elements
if (isSVGElement) {
effect.element = el;
}
// special treatment for paths
if (params.d) {
effect.toD = params.d;
}
// jQuery-like events
if (complete) {
effect.addEvent('complete', complete);
}
// run
effect.start(params);
// record for use in stop method
el.fx = effect;
}, | Animate a HTML element or SVG element wrapper
@param {Object} el
@param {Object} params
@param {Object} options jQuery-like animation options: duration, easing, callback | animate ( el , params , options ) | javascript | WebPlatformTest/HTML5test | scripts/highcharts/adapters/mootools-adapter.src.js | https://github.com/WebPlatformTest/HTML5test/blob/master/scripts/highcharts/adapters/mootools-adapter.src.js | MIT |
map: function (arr, fn) {
return arr.map(fn);
}, | Map an array
@param {Array} arr
@param {Function} fn | map ( arr , fn ) | javascript | WebPlatformTest/HTML5test | scripts/highcharts/adapters/mootools-adapter.src.js | https://github.com/WebPlatformTest/HTML5test/blob/master/scripts/highcharts/adapters/mootools-adapter.src.js | MIT |
grep: function (arr, fn) {
return arr.filter(fn);
}, | Grep or filter an array
@param {Array} arr
@param {Function} fn | grep ( arr , fn ) | javascript | WebPlatformTest/HTML5test | scripts/highcharts/adapters/mootools-adapter.src.js | https://github.com/WebPlatformTest/HTML5test/blob/master/scripts/highcharts/adapters/mootools-adapter.src.js | MIT |
merge: function () {
var args = arguments,
args13 = [{}], // MooTools 1.3+
i = args.length,
ret;
if (legacy) {
ret = $merge.apply(null, args);
} else {
while (i--) {
// Boolean argumens should not be merged.
// JQuery explicitly skips this, so we do it here as well.
if (typeof args[i] !== 'boolean') {
args13[i + 1] = args[i];
}
}
ret = Object.merge.apply(Object, args13);
}
return ret;
}, | Deep merge two objects and return a third | merge ( ) | javascript | WebPlatformTest/HTML5test | scripts/highcharts/adapters/mootools-adapter.src.js | https://github.com/WebPlatformTest/HTML5test/blob/master/scripts/highcharts/adapters/mootools-adapter.src.js | MIT |
offset: function (el) {
var offsets = $(el).getOffsets();
return {
left: offsets.x,
top: offsets.y
};
}, | Get the offset of an element relative to the top left corner of the web page | offset ( el ) | javascript | WebPlatformTest/HTML5test | scripts/highcharts/adapters/mootools-adapter.src.js | https://github.com/WebPlatformTest/HTML5test/blob/master/scripts/highcharts/adapters/mootools-adapter.src.js | MIT |
extendWithEvents: function (el) {
// if the addEvent method is not defined, el is a custom Highcharts object
// like series or point
if (!el.addEvent) {
if (el.nodeName) {
el = $(el); // a dynamically generated node
} else {
$extend(el, new Events()); // a custom object
}
}
}, | Extends an object with Events, if its not done | extendWithEvents ( el ) | javascript | WebPlatformTest/HTML5test | scripts/highcharts/adapters/mootools-adapter.src.js | https://github.com/WebPlatformTest/HTML5test/blob/master/scripts/highcharts/adapters/mootools-adapter.src.js | MIT |
addEvent: function (el, type, fn) {
if (typeof type === 'string') { // chart broke due to el being string, type function
if (type === 'unload') { // Moo self destructs before custom unload events
type = 'beforeunload';
}
win.HighchartsAdapter.extendWithEvents(el);
el.addEvent(type, fn);
}
}, | Add an event listener
@param {Object} el HTML element or custom object
@param {String} type Event type
@param {Function} fn Event handler | addEvent ( el , type , fn ) | javascript | WebPlatformTest/HTML5test | scripts/highcharts/adapters/mootools-adapter.src.js | https://github.com/WebPlatformTest/HTML5test/blob/master/scripts/highcharts/adapters/mootools-adapter.src.js | MIT |
stop: function (el) {
if (el.fx) {
el.fx.cancel();
}
} | Stop running animations on the object | stop ( el ) | javascript | WebPlatformTest/HTML5test | scripts/highcharts/adapters/mootools-adapter.src.js | https://github.com/WebPlatformTest/HTML5test/blob/master/scripts/highcharts/adapters/mootools-adapter.src.js | MIT |
routes.accountSetProfilePhoto = function (arg) {
return this.request('account/set_profile_photo', arg, 'user', 'api', 'rpc', 'account_info.write');
}; | Sets a user's profile photo.
Route attributes:
scope: account_info.write
@function Dropbox#accountSetProfilePhoto
@arg {AccountSetProfilePhotoArg} arg - The request parameters.
@returns {Promise.<DropboxResponse<AccountSetProfilePhotoResult>, DropboxResponseError.<AccountSetProfilePhotoError>>} | routes.accountSetProfilePhoto ( arg ) | javascript | dropbox/dropbox-sdk-js | lib/routes.js | https://github.com/dropbox/dropbox-sdk-js/blob/master/lib/routes.js | MIT |
routes.authTokenFromOauth1 = function (arg) {
return this.request('auth/token/from_oauth1', arg, 'app', 'api', 'rpc', null);
}; | Creates an OAuth 2.0 access token from the supplied OAuth 1.0 access token.
@function Dropbox#authTokenFromOauth1
@arg {AuthTokenFromOAuth1Arg} arg - The request parameters.
@returns {Promise.<DropboxResponse<AuthTokenFromOAuth1Result>, DropboxResponseError.<AuthTokenFromOAuth1Error>>} | routes.authTokenFromOauth1 ( arg ) | javascript | dropbox/dropbox-sdk-js | lib/routes.js | https://github.com/dropbox/dropbox-sdk-js/blob/master/lib/routes.js | MIT |
routes.authTokenRevoke = function () {
return this.request('auth/token/revoke', null, 'user', 'api', 'rpc', null);
}; | Disables the access token used to authenticate the call. If there is a
corresponding refresh token for the access token, this disables that refresh
token, as well as any other access tokens for that refresh token.
@function Dropbox#authTokenRevoke
@returns {Promise.<DropboxResponse<void>, DropboxResponseError.<void>>} | routes.authTokenRevoke ( ) | javascript | dropbox/dropbox-sdk-js | lib/routes.js | https://github.com/dropbox/dropbox-sdk-js/blob/master/lib/routes.js | MIT |
routes.checkApp = function (arg) {
return this.request('check/app', arg, 'app', 'api', 'rpc', null);
}; | This endpoint performs App Authentication, validating the supplied app key
and secret, and returns the supplied string, to allow you to test your code
and connection to the Dropbox API. It has no other effect. If you receive an
HTTP 200 response with the supplied query, it indicates at least part of the
Dropbox API infrastructure is working and that the app key and secret valid.
@function Dropbox#checkApp
@arg {CheckEchoArg} arg - The request parameters.
@returns {Promise.<DropboxResponse<CheckEchoResult>, DropboxResponseError.<void>>} | routes.checkApp ( arg ) | javascript | dropbox/dropbox-sdk-js | lib/routes.js | https://github.com/dropbox/dropbox-sdk-js/blob/master/lib/routes.js | MIT |
routes.checkUser = function (arg) {
return this.request('check/user', arg, 'user', 'api', 'rpc', 'account_info.read');
}; | This endpoint performs User Authentication, validating the supplied access
token, and returns the supplied string, to allow you to test your code and
connection to the Dropbox API. It has no other effect. If you receive an HTTP
200 response with the supplied query, it indicates at least part of the
Dropbox API infrastructure is working and that the access token is valid.
Route attributes:
scope: account_info.read
@function Dropbox#checkUser
@arg {CheckEchoArg} arg - The request parameters.
@returns {Promise.<DropboxResponse<CheckEchoResult>, DropboxResponseError.<void>>} | routes.checkUser ( arg ) | javascript | dropbox/dropbox-sdk-js | lib/routes.js | https://github.com/dropbox/dropbox-sdk-js/blob/master/lib/routes.js | MIT |
routes.contactsDeleteManualContacts = function () {
return this.request('contacts/delete_manual_contacts', null, 'user', 'api', 'rpc', 'contacts.write');
}; | Removes all manually added contacts. You'll still keep contacts who are on
your team or who you imported. New contacts will be added when you share.
Route attributes:
scope: contacts.write
@function Dropbox#contactsDeleteManualContacts
@returns {Promise.<DropboxResponse<void>, DropboxResponseError.<void>>} | routes.contactsDeleteManualContacts ( ) | javascript | dropbox/dropbox-sdk-js | lib/routes.js | https://github.com/dropbox/dropbox-sdk-js/blob/master/lib/routes.js | MIT |
routes.contactsDeleteManualContactsBatch = function (arg) {
return this.request('contacts/delete_manual_contacts_batch', arg, 'user', 'api', 'rpc', 'contacts.write');
}; | Removes manually added contacts from the given list.
Route attributes:
scope: contacts.write
@function Dropbox#contactsDeleteManualContactsBatch
@arg {ContactsDeleteManualContactsArg} arg - The request parameters.
@returns {Promise.<DropboxResponse<void>, DropboxResponseError.<ContactsDeleteManualContactsError>>} | routes.contactsDeleteManualContactsBatch ( arg ) | javascript | dropbox/dropbox-sdk-js | lib/routes.js | https://github.com/dropbox/dropbox-sdk-js/blob/master/lib/routes.js | MIT |
routes.filePropertiesPropertiesAdd = function (arg) {
return this.request('file_properties/properties/add', arg, 'user', 'api', 'rpc', 'files.metadata.write');
}; | Add property groups to a Dropbox file. See templates/add_for_user or
templates/add_for_team to create new templates.
Route attributes:
scope: files.metadata.write
@function Dropbox#filePropertiesPropertiesAdd
@arg {FilePropertiesAddPropertiesArg} arg - The request parameters.
@returns {Promise.<DropboxResponse<void>, DropboxResponseError.<FilePropertiesAddPropertiesError>>} | routes.filePropertiesPropertiesAdd ( arg ) | javascript | dropbox/dropbox-sdk-js | lib/routes.js | https://github.com/dropbox/dropbox-sdk-js/blob/master/lib/routes.js | MIT |
routes.filePropertiesPropertiesOverwrite = function (arg) {
return this.request('file_properties/properties/overwrite', arg, 'user', 'api', 'rpc', 'files.metadata.write');
}; | Overwrite property groups associated with a file. This endpoint should be
used instead of properties/update when property groups are being updated via
a "snapshot" instead of via a "delta". In other words, this endpoint will
delete all omitted fields from a property group, whereas properties/update
will only delete fields that are explicitly marked for deletion.
Route attributes:
scope: files.metadata.write
@function Dropbox#filePropertiesPropertiesOverwrite
@arg {FilePropertiesOverwritePropertyGroupArg} arg - The request parameters.
@returns {Promise.<DropboxResponse<void>, DropboxResponseError.<FilePropertiesInvalidPropertyGroupError>>} | routes.filePropertiesPropertiesOverwrite ( arg ) | javascript | dropbox/dropbox-sdk-js | lib/routes.js | https://github.com/dropbox/dropbox-sdk-js/blob/master/lib/routes.js | MIT |
routes.filePropertiesPropertiesRemove = function (arg) {
return this.request('file_properties/properties/remove', arg, 'user', 'api', 'rpc', 'files.metadata.write');
}; | Permanently removes the specified property group from the file. To remove
specific property field key value pairs, see properties/update. To update a
template, see templates/update_for_user or templates/update_for_team. To
remove a template, see templates/remove_for_user or
templates/remove_for_team.
Route attributes:
scope: files.metadata.write
@function Dropbox#filePropertiesPropertiesRemove
@arg {FilePropertiesRemovePropertiesArg} arg - The request parameters.
@returns {Promise.<DropboxResponse<void>, DropboxResponseError.<FilePropertiesRemovePropertiesError>>} | routes.filePropertiesPropertiesRemove ( arg ) | javascript | dropbox/dropbox-sdk-js | lib/routes.js | https://github.com/dropbox/dropbox-sdk-js/blob/master/lib/routes.js | MIT |
routes.filePropertiesPropertiesSearch = function (arg) {
return this.request('file_properties/properties/search', arg, 'user', 'api', 'rpc', 'files.metadata.read');
}; | Search across property templates for particular property field values.
Route attributes:
scope: files.metadata.read
@function Dropbox#filePropertiesPropertiesSearch
@arg {FilePropertiesPropertiesSearchArg} arg - The request parameters.
@returns {Promise.<DropboxResponse<FilePropertiesPropertiesSearchResult>, DropboxResponseError.<FilePropertiesPropertiesSearchError>>} | routes.filePropertiesPropertiesSearch ( arg ) | javascript | dropbox/dropbox-sdk-js | lib/routes.js | https://github.com/dropbox/dropbox-sdk-js/blob/master/lib/routes.js | MIT |
routes.filePropertiesPropertiesSearchContinue = function (arg) {
return this.request('file_properties/properties/search/continue', arg, 'user', 'api', 'rpc', 'files.metadata.read');
}; | Once a cursor has been retrieved from properties/search, use this to paginate
through all search results.
Route attributes:
scope: files.metadata.read
@function Dropbox#filePropertiesPropertiesSearchContinue
@arg {FilePropertiesPropertiesSearchContinueArg} arg - The request parameters.
@returns {Promise.<DropboxResponse<FilePropertiesPropertiesSearchResult>, DropboxResponseError.<FilePropertiesPropertiesSearchContinueError>>} | routes.filePropertiesPropertiesSearchContinue ( arg ) | javascript | dropbox/dropbox-sdk-js | lib/routes.js | https://github.com/dropbox/dropbox-sdk-js/blob/master/lib/routes.js | MIT |
routes.filePropertiesPropertiesUpdate = function (arg) {
return this.request('file_properties/properties/update', arg, 'user', 'api', 'rpc', 'files.metadata.write');
}; | Add, update or remove properties associated with the supplied file and
templates. This endpoint should be used instead of properties/overwrite when
property groups are being updated via a "delta" instead of via a "snapshot" .
In other words, this endpoint will not delete any omitted fields from a
property group, whereas properties/overwrite will delete any fields that are
omitted from a property group.
Route attributes:
scope: files.metadata.write
@function Dropbox#filePropertiesPropertiesUpdate
@arg {FilePropertiesUpdatePropertiesArg} arg - The request parameters.
@returns {Promise.<DropboxResponse<void>, DropboxResponseError.<FilePropertiesUpdatePropertiesError>>} | routes.filePropertiesPropertiesUpdate ( arg ) | javascript | dropbox/dropbox-sdk-js | lib/routes.js | https://github.com/dropbox/dropbox-sdk-js/blob/master/lib/routes.js | MIT |
routes.filePropertiesTemplatesAddForTeam = function (arg) {
return this.request('file_properties/templates/add_for_team', arg, 'team', 'api', 'rpc', 'files.team_metadata.write');
}; | Add a template associated with a team. See properties/add to add properties
to a file or folder. Note: this endpoint will create team-owned templates.
Route attributes:
scope: files.team_metadata.write
@function Dropbox#filePropertiesTemplatesAddForTeam
@arg {FilePropertiesAddTemplateArg} arg - The request parameters.
@returns {Promise.<DropboxResponse<FilePropertiesAddTemplateResult>, DropboxResponseError.<FilePropertiesModifyTemplateError>>} | routes.filePropertiesTemplatesAddForTeam ( arg ) | javascript | dropbox/dropbox-sdk-js | lib/routes.js | https://github.com/dropbox/dropbox-sdk-js/blob/master/lib/routes.js | MIT |
routes.filePropertiesTemplatesAddForUser = function (arg) {
return this.request('file_properties/templates/add_for_user', arg, 'user', 'api', 'rpc', 'files.metadata.write');
}; | Add a template associated with a user. See properties/add to add properties
to a file. This endpoint can't be called on a team member or admin's behalf.
Route attributes:
scope: files.metadata.write
@function Dropbox#filePropertiesTemplatesAddForUser
@arg {FilePropertiesAddTemplateArg} arg - The request parameters.
@returns {Promise.<DropboxResponse<FilePropertiesAddTemplateResult>, DropboxResponseError.<FilePropertiesModifyTemplateError>>} | routes.filePropertiesTemplatesAddForUser ( arg ) | javascript | dropbox/dropbox-sdk-js | lib/routes.js | https://github.com/dropbox/dropbox-sdk-js/blob/master/lib/routes.js | MIT |
routes.filePropertiesTemplatesGetForTeam = function (arg) {
return this.request('file_properties/templates/get_for_team', arg, 'team', 'api', 'rpc', 'files.team_metadata.write');
}; | Get the schema for a specified template.
Route attributes:
scope: files.team_metadata.write
@function Dropbox#filePropertiesTemplatesGetForTeam
@arg {FilePropertiesGetTemplateArg} arg - The request parameters.
@returns {Promise.<DropboxResponse<FilePropertiesGetTemplateResult>, DropboxResponseError.<FilePropertiesTemplateError>>} | routes.filePropertiesTemplatesGetForTeam ( arg ) | javascript | dropbox/dropbox-sdk-js | lib/routes.js | https://github.com/dropbox/dropbox-sdk-js/blob/master/lib/routes.js | MIT |
routes.filePropertiesTemplatesGetForUser = function (arg) {
return this.request('file_properties/templates/get_for_user', arg, 'user', 'api', 'rpc', 'files.metadata.read');
}; | Get the schema for a specified template. This endpoint can't be called on a
team member or admin's behalf.
Route attributes:
scope: files.metadata.read
@function Dropbox#filePropertiesTemplatesGetForUser
@arg {FilePropertiesGetTemplateArg} arg - The request parameters.
@returns {Promise.<DropboxResponse<FilePropertiesGetTemplateResult>, DropboxResponseError.<FilePropertiesTemplateError>>} | routes.filePropertiesTemplatesGetForUser ( arg ) | javascript | dropbox/dropbox-sdk-js | lib/routes.js | https://github.com/dropbox/dropbox-sdk-js/blob/master/lib/routes.js | MIT |
routes.filePropertiesTemplatesListForTeam = function () {
return this.request('file_properties/templates/list_for_team', null, 'team', 'api', 'rpc', 'files.team_metadata.write');
}; | Get the template identifiers for a team. To get the schema of each template
use templates/get_for_team.
Route attributes:
scope: files.team_metadata.write
@function Dropbox#filePropertiesTemplatesListForTeam
@returns {Promise.<DropboxResponse<FilePropertiesListTemplateResult>, DropboxResponseError.<FilePropertiesTemplateError>>} | routes.filePropertiesTemplatesListForTeam ( ) | javascript | dropbox/dropbox-sdk-js | lib/routes.js | https://github.com/dropbox/dropbox-sdk-js/blob/master/lib/routes.js | MIT |
routes.filePropertiesTemplatesListForUser = function () {
return this.request('file_properties/templates/list_for_user', null, 'user', 'api', 'rpc', 'files.metadata.read');
}; | Get the template identifiers for a team. To get the schema of each template
use templates/get_for_user. This endpoint can't be called on a team member or
admin's behalf.
Route attributes:
scope: files.metadata.read
@function Dropbox#filePropertiesTemplatesListForUser
@returns {Promise.<DropboxResponse<FilePropertiesListTemplateResult>, DropboxResponseError.<FilePropertiesTemplateError>>} | routes.filePropertiesTemplatesListForUser ( ) | javascript | dropbox/dropbox-sdk-js | lib/routes.js | https://github.com/dropbox/dropbox-sdk-js/blob/master/lib/routes.js | MIT |
routes.filePropertiesTemplatesRemoveForTeam = function (arg) {
return this.request('file_properties/templates/remove_for_team', arg, 'team', 'api', 'rpc', 'files.team_metadata.write');
}; | Permanently removes the specified template created from
templates/add_for_user. All properties associated with the template will also
be removed. This action cannot be undone.
Route attributes:
scope: files.team_metadata.write
@function Dropbox#filePropertiesTemplatesRemoveForTeam
@arg {FilePropertiesRemoveTemplateArg} arg - The request parameters.
@returns {Promise.<DropboxResponse<void>, DropboxResponseError.<FilePropertiesTemplateError>>} | routes.filePropertiesTemplatesRemoveForTeam ( arg ) | javascript | dropbox/dropbox-sdk-js | lib/routes.js | https://github.com/dropbox/dropbox-sdk-js/blob/master/lib/routes.js | MIT |
routes.filePropertiesTemplatesRemoveForUser = function (arg) {
return this.request('file_properties/templates/remove_for_user', arg, 'user', 'api', 'rpc', 'files.metadata.write');
}; | Permanently removes the specified template created from
templates/add_for_user. All properties associated with the template will also
be removed. This action cannot be undone.
Route attributes:
scope: files.metadata.write
@function Dropbox#filePropertiesTemplatesRemoveForUser
@arg {FilePropertiesRemoveTemplateArg} arg - The request parameters.
@returns {Promise.<DropboxResponse<void>, DropboxResponseError.<FilePropertiesTemplateError>>} | routes.filePropertiesTemplatesRemoveForUser ( arg ) | javascript | dropbox/dropbox-sdk-js | lib/routes.js | https://github.com/dropbox/dropbox-sdk-js/blob/master/lib/routes.js | MIT |
routes.filePropertiesTemplatesUpdateForTeam = function (arg) {
return this.request('file_properties/templates/update_for_team', arg, 'team', 'api', 'rpc', 'files.team_metadata.write');
}; | Update a template associated with a team. This route can update the template
name, the template description and add optional properties to templates.
Route attributes:
scope: files.team_metadata.write
@function Dropbox#filePropertiesTemplatesUpdateForTeam
@arg {FilePropertiesUpdateTemplateArg} arg - The request parameters.
@returns {Promise.<DropboxResponse<FilePropertiesUpdateTemplateResult>, DropboxResponseError.<FilePropertiesModifyTemplateError>>} | routes.filePropertiesTemplatesUpdateForTeam ( arg ) | javascript | dropbox/dropbox-sdk-js | lib/routes.js | https://github.com/dropbox/dropbox-sdk-js/blob/master/lib/routes.js | MIT |
routes.filePropertiesTemplatesUpdateForUser = function (arg) {
return this.request('file_properties/templates/update_for_user', arg, 'user', 'api', 'rpc', 'files.metadata.write');
}; | Update a template associated with a user. This route can update the template
name, the template description and add optional properties to templates. This
endpoint can't be called on a team member or admin's behalf.
Route attributes:
scope: files.metadata.write
@function Dropbox#filePropertiesTemplatesUpdateForUser
@arg {FilePropertiesUpdateTemplateArg} arg - The request parameters.
@returns {Promise.<DropboxResponse<FilePropertiesUpdateTemplateResult>, DropboxResponseError.<FilePropertiesModifyTemplateError>>} | routes.filePropertiesTemplatesUpdateForUser ( arg ) | javascript | dropbox/dropbox-sdk-js | lib/routes.js | https://github.com/dropbox/dropbox-sdk-js/blob/master/lib/routes.js | MIT |
routes.fileRequestsCount = function () {
return this.request('file_requests/count', null, 'user', 'api', 'rpc', 'file_requests.read');
}; | Returns the total number of file requests owned by this user. Includes both
open and closed file requests.
Route attributes:
scope: file_requests.read
@function Dropbox#fileRequestsCount
@returns {Promise.<DropboxResponse<FileRequestsCountFileRequestsResult>, DropboxResponseError.<FileRequestsCountFileRequestsError>>} | routes.fileRequestsCount ( ) | javascript | dropbox/dropbox-sdk-js | lib/routes.js | https://github.com/dropbox/dropbox-sdk-js/blob/master/lib/routes.js | MIT |
routes.fileRequestsCreate = function (arg) {
return this.request('file_requests/create', arg, 'user', 'api', 'rpc', 'file_requests.write');
}; | Creates a file request for this user.
Route attributes:
scope: file_requests.write
@function Dropbox#fileRequestsCreate
@arg {FileRequestsCreateFileRequestArgs} arg - The request parameters.
@returns {Promise.<DropboxResponse<FileRequestsFileRequest>, DropboxResponseError.<FileRequestsCreateFileRequestError>>} | routes.fileRequestsCreate ( arg ) | javascript | dropbox/dropbox-sdk-js | lib/routes.js | https://github.com/dropbox/dropbox-sdk-js/blob/master/lib/routes.js | MIT |
routes.fileRequestsDelete = function (arg) {
return this.request('file_requests/delete', arg, 'user', 'api', 'rpc', 'file_requests.write');
}; | Delete a batch of closed file requests.
Route attributes:
scope: file_requests.write
@function Dropbox#fileRequestsDelete
@arg {FileRequestsDeleteFileRequestArgs} arg - The request parameters.
@returns {Promise.<DropboxResponse<FileRequestsDeleteFileRequestsResult>, DropboxResponseError.<FileRequestsDeleteFileRequestError>>} | routes.fileRequestsDelete ( arg ) | javascript | dropbox/dropbox-sdk-js | lib/routes.js | https://github.com/dropbox/dropbox-sdk-js/blob/master/lib/routes.js | MIT |
routes.fileRequestsDeleteAllClosed = function () {
return this.request('file_requests/delete_all_closed', null, 'user', 'api', 'rpc', 'file_requests.write');
}; | Delete all closed file requests owned by this user.
Route attributes:
scope: file_requests.write
@function Dropbox#fileRequestsDeleteAllClosed
@returns {Promise.<DropboxResponse<FileRequestsDeleteAllClosedFileRequestsResult>, DropboxResponseError.<FileRequestsDeleteAllClosedFileRequestsError>>} | routes.fileRequestsDeleteAllClosed ( ) | javascript | dropbox/dropbox-sdk-js | lib/routes.js | https://github.com/dropbox/dropbox-sdk-js/blob/master/lib/routes.js | MIT |
routes.fileRequestsGet = function (arg) {
return this.request('file_requests/get', arg, 'user', 'api', 'rpc', 'file_requests.read');
}; | Returns the specified file request.
Route attributes:
scope: file_requests.read
@function Dropbox#fileRequestsGet
@arg {FileRequestsGetFileRequestArgs} arg - The request parameters.
@returns {Promise.<DropboxResponse<FileRequestsFileRequest>, DropboxResponseError.<FileRequestsGetFileRequestError>>} | routes.fileRequestsGet ( arg ) | javascript | dropbox/dropbox-sdk-js | lib/routes.js | https://github.com/dropbox/dropbox-sdk-js/blob/master/lib/routes.js | MIT |
routes.fileRequestsListV2 = function (arg) {
return this.request('file_requests/list_v2', arg, 'user', 'api', 'rpc', 'file_requests.read');
}; | Returns a list of file requests owned by this user. For apps with the app
folder permission, this will only return file requests with destinations in
the app folder.
Route attributes:
scope: file_requests.read
@function Dropbox#fileRequestsListV2
@arg {FileRequestsListFileRequestsArg} arg - The request parameters.
@returns {Promise.<DropboxResponse<FileRequestsListFileRequestsV2Result>, DropboxResponseError.<FileRequestsListFileRequestsError>>} | routes.fileRequestsListV2 ( arg ) | javascript | dropbox/dropbox-sdk-js | lib/routes.js | https://github.com/dropbox/dropbox-sdk-js/blob/master/lib/routes.js | MIT |
routes.fileRequestsList = function () {
return this.request('file_requests/list', null, 'user', 'api', 'rpc', 'file_requests.read');
}; | Returns a list of file requests owned by this user. For apps with the app
folder permission, this will only return file requests with destinations in
the app folder.
Route attributes:
scope: file_requests.read
@function Dropbox#fileRequestsList
@returns {Promise.<DropboxResponse<FileRequestsListFileRequestsResult>, DropboxResponseError.<FileRequestsListFileRequestsError>>} | routes.fileRequestsList ( ) | javascript | dropbox/dropbox-sdk-js | lib/routes.js | https://github.com/dropbox/dropbox-sdk-js/blob/master/lib/routes.js | MIT |
routes.fileRequestsListContinue = function (arg) {
return this.request('file_requests/list/continue', arg, 'user', 'api', 'rpc', 'file_requests.read');
}; | Once a cursor has been retrieved from list_v2, use this to paginate through
all file requests. The cursor must come from a previous call to list_v2 or
list/continue.
Route attributes:
scope: file_requests.read
@function Dropbox#fileRequestsListContinue
@arg {FileRequestsListFileRequestsContinueArg} arg - The request parameters.
@returns {Promise.<DropboxResponse<FileRequestsListFileRequestsV2Result>, DropboxResponseError.<FileRequestsListFileRequestsContinueError>>} | routes.fileRequestsListContinue ( arg ) | javascript | dropbox/dropbox-sdk-js | lib/routes.js | https://github.com/dropbox/dropbox-sdk-js/blob/master/lib/routes.js | MIT |
routes.fileRequestsUpdate = function (arg) {
return this.request('file_requests/update', arg, 'user', 'api', 'rpc', 'file_requests.write');
}; | Update a file request.
Route attributes:
scope: file_requests.write
@function Dropbox#fileRequestsUpdate
@arg {FileRequestsUpdateFileRequestArgs} arg - The request parameters.
@returns {Promise.<DropboxResponse<FileRequestsFileRequest>, DropboxResponseError.<FileRequestsUpdateFileRequestError>>} | routes.fileRequestsUpdate ( arg ) | javascript | dropbox/dropbox-sdk-js | lib/routes.js | https://github.com/dropbox/dropbox-sdk-js/blob/master/lib/routes.js | MIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.