repo
stringlengths
5
67
path
stringlengths
4
116
func_name
stringlengths
0
58
original_string
stringlengths
52
373k
language
stringclasses
1 value
code
stringlengths
52
373k
code_tokens
list
docstring
stringlengths
4
11.8k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
86
226
partition
stringclasses
1 value
googlearchive/vrview
src/embed/world-renderer.js
WorldRenderer
function WorldRenderer(params) { this.init_(params.hideFullscreenButton); this.sphereRenderer = new SphereRenderer(this.scene); this.hotspotRenderer = new HotspotRenderer(this); this.hotspotRenderer.on('focus', this.onHotspotFocus_.bind(this)); this.hotspotRenderer.on('blur', this.onHotspotBlur_.bind(this));...
javascript
function WorldRenderer(params) { this.init_(params.hideFullscreenButton); this.sphereRenderer = new SphereRenderer(this.scene); this.hotspotRenderer = new HotspotRenderer(this); this.hotspotRenderer.on('focus', this.onHotspotFocus_.bind(this)); this.hotspotRenderer.on('blur', this.onHotspotBlur_.bind(this));...
[ "function", "WorldRenderer", "(", "params", ")", "{", "this", ".", "init_", "(", "params", ".", "hideFullscreenButton", ")", ";", "this", ".", "sphereRenderer", "=", "new", "SphereRenderer", "(", "this", ".", "scene", ")", ";", "this", ".", "hotspotRenderer"...
The main WebGL rendering entry point. Manages the scene, camera, VR-related rendering updates. Interacts with the WebVRManager. Coordinates the other renderers: SphereRenderer, HotspotRenderer, ReticleRenderer. Also manages the AdaptivePlayer and VideoProxy. Emits the following events: load: when the scene is loaded...
[ "The", "main", "WebGL", "rendering", "entry", "point", ".", "Manages", "the", "scene", "camera", "VR", "-", "related", "rendering", "updates", ".", "Interacts", "with", "the", "WebVRManager", "." ]
610e20c825f65f9a266da399b154d18e7c31de3f
https://github.com/googlearchive/vrview/blob/610e20c825f65f9a266da399b154d18e7c31de3f/src/embed/world-renderer.js#L43-L59
train
googlearchive/vrview
src/api/player.js
Player
function Player(selector, contentInfo) { // Create a VR View iframe depending on the parameters. var iframe = this.createIframe_(contentInfo); this.iframe = iframe; var parentEl = document.querySelector(selector); parentEl.appendChild(iframe); // Make a sender as well, for relying commands to the child IF...
javascript
function Player(selector, contentInfo) { // Create a VR View iframe depending on the parameters. var iframe = this.createIframe_(contentInfo); this.iframe = iframe; var parentEl = document.querySelector(selector); parentEl.appendChild(iframe); // Make a sender as well, for relying commands to the child IF...
[ "function", "Player", "(", "selector", ",", "contentInfo", ")", "{", "// Create a VR View iframe depending on the parameters.", "var", "iframe", "=", "this", ".", "createIframe_", "(", "contentInfo", ")", ";", "this", ".", "iframe", "=", "iframe", ";", "var", "par...
Entry point for the VR View JS API. Emits the following events: ready: When the player is loaded. modechange: When the viewing mode changes (normal, fullscreen, VR). click (id): When a hotspot is clicked.
[ "Entry", "point", "for", "the", "VR", "View", "JS", "API", "." ]
610e20c825f65f9a266da399b154d18e7c31de3f
https://github.com/googlearchive/vrview/blob/610e20c825f65f9a266da399b154d18e7c31de3f/src/api/player.js#L33-L64
train
googlearchive/vrview
src/embed/hotspot-renderer.js
HotspotRenderer
function HotspotRenderer(worldRenderer) { this.worldRenderer = worldRenderer; this.scene = worldRenderer.scene; // Note: this event must be added to document.body and not to window for it to // work inside iOS iframes. var body = document.body; // Bind events for hotspot interaction. if (!Util.isMobile()...
javascript
function HotspotRenderer(worldRenderer) { this.worldRenderer = worldRenderer; this.scene = worldRenderer.scene; // Note: this event must be added to document.body and not to window for it to // work inside iOS iframes. var body = document.body; // Bind events for hotspot interaction. if (!Util.isMobile()...
[ "function", "HotspotRenderer", "(", "worldRenderer", ")", "{", "this", ".", "worldRenderer", "=", "worldRenderer", ";", "this", ".", "scene", "=", "worldRenderer", ".", "scene", ";", "// Note: this event must be added to document.body and not to window for it to", "// work ...
Responsible for rectangular hot spots that the user can interact with. Specific duties: Adding and removing hotspots. Rendering the hotspots (debug mode only). Notifying when hotspots are interacted with. Emits the following events: click (id): a hotspot is clicked. focus (id): a hotspot is focused. blur (id): a hots...
[ "Responsible", "for", "rectangular", "hot", "spots", "that", "the", "user", "can", "interact", "with", "." ]
610e20c825f65f9a266da399b154d18e7c31de3f
https://github.com/googlearchive/vrview/blob/610e20c825f65f9a266da399b154d18e7c31de3f/src/embed/hotspot-renderer.js#L48-L83
train
googlearchive/vrview
src/embed/scene-info.js
SceneInfo
function SceneInfo(opt_params) { var params = opt_params || {}; params.player = { loop: opt_params.loop, volume: opt_params.volume, muted: opt_params.muted }; this.image = params.image !== undefined ? encodeURI(params.image) : undefined; this.preview = params.preview !== undefined ? encodeURI(par...
javascript
function SceneInfo(opt_params) { var params = opt_params || {}; params.player = { loop: opt_params.loop, volume: opt_params.volume, muted: opt_params.muted }; this.image = params.image !== undefined ? encodeURI(params.image) : undefined; this.preview = params.preview !== undefined ? encodeURI(par...
[ "function", "SceneInfo", "(", "opt_params", ")", "{", "var", "params", "=", "opt_params", "||", "{", "}", ";", "params", ".", "player", "=", "{", "loop", ":", "opt_params", ".", "loop", ",", "volume", ":", "opt_params", ".", "volume", ",", "muted", ":"...
Contains all information about a given scene.
[ "Contains", "all", "information", "about", "a", "given", "scene", "." ]
610e20c825f65f9a266da399b154d18e7c31de3f
https://github.com/googlearchive/vrview/blob/610e20c825f65f9a266da399b154d18e7c31de3f/src/embed/scene-info.js#L37-L60
train
expressjs/cookie-session
index.js
cookieSession
function cookieSession (options) { var opts = options || {} // cookie name var name = opts.name || 'session' // secrets var keys = opts.keys if (!keys && opts.secret) keys = [opts.secret] // defaults if (opts.overwrite == null) opts.overwrite = true if (opts.httpOnly == null) opts.httpOnly = true ...
javascript
function cookieSession (options) { var opts = options || {} // cookie name var name = opts.name || 'session' // secrets var keys = opts.keys if (!keys && opts.secret) keys = [opts.secret] // defaults if (opts.overwrite == null) opts.overwrite = true if (opts.httpOnly == null) opts.httpOnly = true ...
[ "function", "cookieSession", "(", "options", ")", "{", "var", "opts", "=", "options", "||", "{", "}", "// cookie name", "var", "name", "=", "opts", ".", "name", "||", "'session'", "// secrets", "var", "keys", "=", "opts", ".", "keys", "if", "(", "!", "...
Create a new cookie session middleware. @param {object} [options] @param {boolean} [options.httpOnly=true] @param {array} [options.keys] @param {string} [options.name=session] Name of the cookie to use @param {boolean} [options.overwrite=true] @param {string} [options.secret] @param {boolean} [options.signed=true] @re...
[ "Create", "a", "new", "cookie", "session", "middleware", "." ]
add5791673964540a5283e7abc553d6840f7adf8
https://github.com/expressjs/cookie-session/blob/add5791673964540a5283e7abc553d6840f7adf8/index.js#L41-L131
train
expressjs/cookie-session
index.js
Session
function Session (ctx, obj) { Object.defineProperty(this, '_ctx', { value: ctx }) if (obj) { for (var key in obj) { this[key] = obj[key] } } }
javascript
function Session (ctx, obj) { Object.defineProperty(this, '_ctx', { value: ctx }) if (obj) { for (var key in obj) { this[key] = obj[key] } } }
[ "function", "Session", "(", "ctx", ",", "obj", ")", "{", "Object", ".", "defineProperty", "(", "this", ",", "'_ctx'", ",", "{", "value", ":", "ctx", "}", ")", "if", "(", "obj", ")", "{", "for", "(", "var", "key", "in", "obj", ")", "{", "this", ...
Session model. @param {Context} ctx @param {Object} obj @private
[ "Session", "model", "." ]
add5791673964540a5283e7abc553d6840f7adf8
https://github.com/expressjs/cookie-session/blob/add5791673964540a5283e7abc553d6840f7adf8/index.js#L141-L151
train
expressjs/cookie-session
index.js
decode
function decode (string) { var body = Buffer.from(string, 'base64').toString('utf8') return JSON.parse(body) }
javascript
function decode (string) { var body = Buffer.from(string, 'base64').toString('utf8') return JSON.parse(body) }
[ "function", "decode", "(", "string", ")", "{", "var", "body", "=", "Buffer", ".", "from", "(", "string", ",", "'base64'", ")", ".", "toString", "(", "'utf8'", ")", "return", "JSON", ".", "parse", "(", "body", ")", "}" ]
Decode the base64 cookie value to an object. @param {String} string @return {Object} @private
[ "Decode", "the", "base64", "cookie", "value", "to", "an", "object", "." ]
add5791673964540a5283e7abc553d6840f7adf8
https://github.com/expressjs/cookie-session/blob/add5791673964540a5283e7abc553d6840f7adf8/index.js#L289-L292
train
expressjs/cookie-session
index.js
encode
function encode (body) { var str = JSON.stringify(body) return Buffer.from(str).toString('base64') }
javascript
function encode (body) { var str = JSON.stringify(body) return Buffer.from(str).toString('base64') }
[ "function", "encode", "(", "body", ")", "{", "var", "str", "=", "JSON", ".", "stringify", "(", "body", ")", "return", "Buffer", ".", "from", "(", "str", ")", ".", "toString", "(", "'base64'", ")", "}" ]
Encode an object into a base64-encoded JSON string. @param {Object} body @return {String} @private
[ "Encode", "an", "object", "into", "a", "base64", "-", "encoded", "JSON", "string", "." ]
add5791673964540a5283e7abc553d6840f7adf8
https://github.com/expressjs/cookie-session/blob/add5791673964540a5283e7abc553d6840f7adf8/index.js#L302-L305
train
expressjs/cookie-session
index.js
tryGetSession
function tryGetSession (req) { var cookies = req.sessionCookies var name = req.sessionKey var opts = req.sessionOptions var str = cookies.get(name, opts) if (!str) { return undefined } debug('parse %s', str) try { return Session.deserialize(req, str) } catch (err) { return undefined ...
javascript
function tryGetSession (req) { var cookies = req.sessionCookies var name = req.sessionKey var opts = req.sessionOptions var str = cookies.get(name, opts) if (!str) { return undefined } debug('parse %s', str) try { return Session.deserialize(req, str) } catch (err) { return undefined ...
[ "function", "tryGetSession", "(", "req", ")", "{", "var", "cookies", "=", "req", ".", "sessionCookies", "var", "name", "=", "req", ".", "sessionKey", "var", "opts", "=", "req", ".", "sessionOptions", "var", "str", "=", "cookies", ".", "get", "(", "name",...
Try getting a session from a request. @private
[ "Try", "getting", "a", "session", "from", "a", "request", "." ]
add5791673964540a5283e7abc553d6840f7adf8
https://github.com/expressjs/cookie-session/blob/add5791673964540a5283e7abc553d6840f7adf8/index.js#L312-L330
train
bfintal/Counter-Up
jquery.counterup.js
function() { $this.text($this.data('counterup-nums').shift()); if ($this.data('counterup-nums').length) { setTimeout($this.data('counterup-func'), $settings.delay); } else { delete $this.data('counterup-nums'); $...
javascript
function() { $this.text($this.data('counterup-nums').shift()); if ($this.data('counterup-nums').length) { setTimeout($this.data('counterup-func'), $settings.delay); } else { delete $this.data('counterup-nums'); $...
[ "function", "(", ")", "{", "$this", ".", "text", "(", "$this", ".", "data", "(", "'counterup-nums'", ")", ".", "shift", "(", ")", ")", ";", "if", "(", "$this", ".", "data", "(", "'counterup-nums'", ")", ".", "length", ")", "{", "setTimeout", "(", "...
Updates the number until we're done
[ "Updates", "the", "number", "until", "we", "re", "done" ]
496d5a038a2b8838e6037896a90a2a5d74bc2a89
https://github.com/bfintal/Counter-Up/blob/496d5a038a2b8838e6037896a90a2a5d74bc2a89/jquery.counterup.js#L61-L70
train
instructure/pdf-annotate.js
src/UI/edit.js
destroyEditOverlay
function destroyEditOverlay() { if (overlay) { overlay.parentNode.removeChild(overlay); overlay = null; } document.removeEventListener('click', handleDocumentClick); document.removeEventListener('keyup', handleDocumentKeyup); document.removeEventListener('mousedown', handleDocumentMousedown); docum...
javascript
function destroyEditOverlay() { if (overlay) { overlay.parentNode.removeChild(overlay); overlay = null; } document.removeEventListener('click', handleDocumentClick); document.removeEventListener('keyup', handleDocumentKeyup); document.removeEventListener('mousedown', handleDocumentMousedown); docum...
[ "function", "destroyEditOverlay", "(", ")", "{", "if", "(", "overlay", ")", "{", "overlay", ".", "parentNode", ".", "removeChild", "(", "overlay", ")", ";", "overlay", "=", "null", ";", "}", "document", ".", "removeEventListener", "(", "'click'", ",", "han...
Destroy the edit overlay if it exists.
[ "Destroy", "the", "edit", "overlay", "if", "it", "exists", "." ]
f56e8aa2027326894861ef6b060824137e79a1be
https://github.com/instructure/pdf-annotate.js/blob/f56e8aa2027326894861ef6b060824137e79a1be/src/UI/edit.js#L95-L107
train
instructure/pdf-annotate.js
src/UI/edit.js
deleteAnnotation
function deleteAnnotation() { if (!overlay) { return; } let annotationId = overlay.getAttribute('data-target-id'); let nodes = document.querySelectorAll(`[data-pdf-annotate-id="${annotationId}"]`); let svg = overlay.parentNode.querySelector('svg.annotationLayer'); let { documentId } = getMetadata(svg); [....
javascript
function deleteAnnotation() { if (!overlay) { return; } let annotationId = overlay.getAttribute('data-target-id'); let nodes = document.querySelectorAll(`[data-pdf-annotate-id="${annotationId}"]`); let svg = overlay.parentNode.querySelector('svg.annotationLayer'); let { documentId } = getMetadata(svg); [....
[ "function", "deleteAnnotation", "(", ")", "{", "if", "(", "!", "overlay", ")", "{", "return", ";", "}", "let", "annotationId", "=", "overlay", ".", "getAttribute", "(", "'data-target-id'", ")", ";", "let", "nodes", "=", "document", ".", "querySelectorAll", ...
Delete currently selected annotation
[ "Delete", "currently", "selected", "annotation" ]
f56e8aa2027326894861ef6b060824137e79a1be
https://github.com/instructure/pdf-annotate.js/blob/f56e8aa2027326894861ef6b060824137e79a1be/src/UI/edit.js#L112-L127
train
instructure/pdf-annotate.js
src/UI/edit.js
handleDocumentClick
function handleDocumentClick(e) { if (!findSVGAtPoint(e.clientX, e.clientY)) { return; } // Remove current overlay let overlay = document.getElementById('pdf-annotate-edit-overlay'); if (overlay) { if (isDragging || e.target === overlay) { return; } destroyEditOverlay(); } }
javascript
function handleDocumentClick(e) { if (!findSVGAtPoint(e.clientX, e.clientY)) { return; } // Remove current overlay let overlay = document.getElementById('pdf-annotate-edit-overlay'); if (overlay) { if (isDragging || e.target === overlay) { return; } destroyEditOverlay(); } }
[ "function", "handleDocumentClick", "(", "e", ")", "{", "if", "(", "!", "findSVGAtPoint", "(", "e", ".", "clientX", ",", "e", ".", "clientY", ")", ")", "{", "return", ";", "}", "// Remove current overlay", "let", "overlay", "=", "document", ".", "getElement...
Handle document.click event @param {Event} e The DOM event that needs to be handled
[ "Handle", "document", ".", "click", "event" ]
f56e8aa2027326894861ef6b060824137e79a1be
https://github.com/instructure/pdf-annotate.js/blob/f56e8aa2027326894861ef6b060824137e79a1be/src/UI/edit.js#L134-L146
train
instructure/pdf-annotate.js
src/UI/text.js
saveText
function saveText() { if (input.value.trim().length > 0) { let clientX = parseInt(input.style.left, 10); let clientY = parseInt(input.style.top, 10); let svg = findSVGAtPoint(clientX, clientY); if (!svg) { return; } let { documentId, pageNumber } = getMetadata(svg); let rect = svg.g...
javascript
function saveText() { if (input.value.trim().length > 0) { let clientX = parseInt(input.style.left, 10); let clientY = parseInt(input.style.top, 10); let svg = findSVGAtPoint(clientX, clientY); if (!svg) { return; } let { documentId, pageNumber } = getMetadata(svg); let rect = svg.g...
[ "function", "saveText", "(", ")", "{", "if", "(", "input", ".", "value", ".", "trim", "(", ")", ".", "length", ">", "0", ")", "{", "let", "clientX", "=", "parseInt", "(", "input", ".", "style", ".", "left", ",", "10", ")", ";", "let", "clientY", ...
Save a text annotation from input
[ "Save", "a", "text", "annotation", "from", "input" ]
f56e8aa2027326894861ef6b060824137e79a1be
https://github.com/instructure/pdf-annotate.js/blob/f56e8aa2027326894861ef6b060824137e79a1be/src/UI/text.js#L65-L96
train
instructure/pdf-annotate.js
src/UI/text.js
closeInput
function closeInput() { if (input) { input.removeEventListener('blur', handleInputBlur); input.removeEventListener('keyup', handleInputKeyup); document.body.removeChild(input); input = null; } }
javascript
function closeInput() { if (input) { input.removeEventListener('blur', handleInputBlur); input.removeEventListener('keyup', handleInputKeyup); document.body.removeChild(input); input = null; } }
[ "function", "closeInput", "(", ")", "{", "if", "(", "input", ")", "{", "input", ".", "removeEventListener", "(", "'blur'", ",", "handleInputBlur", ")", ";", "input", ".", "removeEventListener", "(", "'keyup'", ",", "handleInputKeyup", ")", ";", "document", "...
Close the input
[ "Close", "the", "input" ]
f56e8aa2027326894861ef6b060824137e79a1be
https://github.com/instructure/pdf-annotate.js/blob/f56e8aa2027326894861ef6b060824137e79a1be/src/UI/text.js#L101-L108
train
instructure/pdf-annotate.js
src/render/appendChild.js
transform
function transform(node, viewport) { let trans = getTranslation(viewport); // Let SVG natively transform the element node.setAttribute('transform', `scale(${viewport.scale}) rotate(${viewport.rotation}) translate(${trans.x}, ${trans.y})`); // Manually adjust x/y for nested SVG nodes if (!isFirefox && node...
javascript
function transform(node, viewport) { let trans = getTranslation(viewport); // Let SVG natively transform the element node.setAttribute('transform', `scale(${viewport.scale}) rotate(${viewport.rotation}) translate(${trans.x}, ${trans.y})`); // Manually adjust x/y for nested SVG nodes if (!isFirefox && node...
[ "function", "transform", "(", "node", ",", "viewport", ")", "{", "let", "trans", "=", "getTranslation", "(", "viewport", ")", ";", "// Let SVG natively transform the element", "node", ".", "setAttribute", "(", "'transform'", ",", "`", "${", "viewport", ".", "sca...
Transform the rotation and scale of a node using SVG's native transform attribute. @param {Node} node The node to be transformed @param {Object} viewport The page's viewport data @return {Node}
[ "Transform", "the", "rotation", "and", "scale", "of", "a", "node", "using", "SVG", "s", "native", "transform", "attribute", "." ]
f56e8aa2027326894861ef6b060824137e79a1be
https://github.com/instructure/pdf-annotate.js/blob/f56e8aa2027326894861ef6b060824137e79a1be/src/render/appendChild.js#L51-L100
train
instructure/pdf-annotate.js
src/UI/page.js
scalePage
function scalePage(pageNumber, viewport, context) { let page = document.getElementById(`pageContainer${pageNumber}`); let canvas = page.querySelector('.canvasWrapper canvas'); let svg = page.querySelector('.annotationLayer'); let wrapper = page.querySelector('.canvasWrapper'); let textLayer = page.querySelect...
javascript
function scalePage(pageNumber, viewport, context) { let page = document.getElementById(`pageContainer${pageNumber}`); let canvas = page.querySelector('.canvasWrapper canvas'); let svg = page.querySelector('.annotationLayer'); let wrapper = page.querySelector('.canvasWrapper'); let textLayer = page.querySelect...
[ "function", "scalePage", "(", "pageNumber", ",", "viewport", ",", "context", ")", "{", "let", "page", "=", "document", ".", "getElementById", "(", "`", "${", "pageNumber", "}", "`", ")", ";", "let", "canvas", "=", "page", ".", "querySelector", "(", "'.ca...
Scale the elements of a page. @param {Number} pageNumber The page number to be scaled @param {Object} viewport The viewport of the PDF page (see pdfPage.getViewport(scale, rotate)) @param {Object} context The canvas context that the PDF page is rendered to @return {Array} The transform data for rendering the PDF page
[ "Scale", "the", "elements", "of", "a", "page", "." ]
f56e8aa2027326894861ef6b060824137e79a1be
https://github.com/instructure/pdf-annotate.js/blob/f56e8aa2027326894861ef6b060824137e79a1be/src/UI/page.js#L112-L141
train
instructure/pdf-annotate.js
src/a11y/insertElementWithinElement.js
textLayerElementFromPoint
function textLayerElementFromPoint(x, y, pageNumber) { let svg = document.querySelector(`svg[data-pdf-annotate-page="${pageNumber}"]`); let rect = svg.getBoundingClientRect(); y = scaleUp(svg, {y}).y + rect.top; x = scaleUp(svg, {x}).x + rect.left; return [...svg.parentNode.querySelectorAll('.textLayer [data-...
javascript
function textLayerElementFromPoint(x, y, pageNumber) { let svg = document.querySelector(`svg[data-pdf-annotate-page="${pageNumber}"]`); let rect = svg.getBoundingClientRect(); y = scaleUp(svg, {y}).y + rect.top; x = scaleUp(svg, {x}).x + rect.left; return [...svg.parentNode.querySelectorAll('.textLayer [data-...
[ "function", "textLayerElementFromPoint", "(", "x", ",", "y", ",", "pageNumber", ")", "{", "let", "svg", "=", "document", ".", "querySelector", "(", "`", "${", "pageNumber", "}", "`", ")", ";", "let", "rect", "=", "svg", ".", "getBoundingClientRect", "(", ...
Get a text layer element at a given point on a page @param {Number} x The x coordinate of the point @param {Number} y The y coordinate of the point @param {Number} pageNumber The page to limit elements to @return {Element} First text layer element found at the point
[ "Get", "a", "text", "layer", "element", "at", "a", "given", "point", "on", "a", "page" ]
f56e8aa2027326894861ef6b060824137e79a1be
https://github.com/instructure/pdf-annotate.js/blob/f56e8aa2027326894861ef6b060824137e79a1be/src/a11y/insertElementWithinElement.js#L84-L92
train
instructure/pdf-annotate.js
src/UI/pen.js
savePoint
function savePoint(x, y) { let svg = findSVGAtPoint(x, y); if (!svg) { return; } let rect = svg.getBoundingClientRect(); let point = scaleDown(svg, { x: x - rect.left, y: y - rect.top }); lines.push([point.x, point.y]); if (lines.length <= 1) { return; } if (path) { svg.remov...
javascript
function savePoint(x, y) { let svg = findSVGAtPoint(x, y); if (!svg) { return; } let rect = svg.getBoundingClientRect(); let point = scaleDown(svg, { x: x - rect.left, y: y - rect.top }); lines.push([point.x, point.y]); if (lines.length <= 1) { return; } if (path) { svg.remov...
[ "function", "savePoint", "(", "x", ",", "y", ")", "{", "let", "svg", "=", "findSVGAtPoint", "(", "x", ",", "y", ")", ";", "if", "(", "!", "svg", ")", "{", "return", ";", "}", "let", "rect", "=", "svg", ".", "getBoundingClientRect", "(", ")", ";",...
Save a point to the line being drawn. @param {Number} x The x coordinate of the point @param {Number} y The y coordinate of the point
[ "Save", "a", "point", "to", "the", "line", "being", "drawn", "." ]
f56e8aa2027326894861ef6b060824137e79a1be
https://github.com/instructure/pdf-annotate.js/blob/f56e8aa2027326894861ef6b060824137e79a1be/src/UI/pen.js#L87-L115
train
instructure/pdf-annotate.js
src/a11y/renderScreenReaderHints.js
sortByLinePoint
function sortByLinePoint(a, b) { let lineA = a.lines[0]; let lineB = b.lines[0]; return sortByPoint( {x: lineA[0], y: lineA[1]}, {x: lineB[0], y: lineB[1]} ); }
javascript
function sortByLinePoint(a, b) { let lineA = a.lines[0]; let lineB = b.lines[0]; return sortByPoint( {x: lineA[0], y: lineA[1]}, {x: lineB[0], y: lineB[1]} ); }
[ "function", "sortByLinePoint", "(", "a", ",", "b", ")", "{", "let", "lineA", "=", "a", ".", "lines", "[", "0", "]", ";", "let", "lineB", "=", "b", ".", "lines", "[", "0", "]", ";", "return", "sortByPoint", "(", "{", "x", ":", "lineA", "[", "0",...
Sort annotation by it's first line
[ "Sort", "annotation", "by", "it", "s", "first", "line" ]
f56e8aa2027326894861ef6b060824137e79a1be
https://github.com/instructure/pdf-annotate.js/blob/f56e8aa2027326894861ef6b060824137e79a1be/src/a11y/renderScreenReaderHints.js#L42-L49
train
instructure/pdf-annotate.js
src/UI/point.js
savePoint
function savePoint() { if (input.value.trim().length > 0) { let clientX = parseInt(input.style.left, 10); let clientY = parseInt(input.style.top, 10); let content = input.value.trim(); let svg = findSVGAtPoint(clientX, clientY); if (!svg) { return; } let rect = svg.getBoundingClient...
javascript
function savePoint() { if (input.value.trim().length > 0) { let clientX = parseInt(input.style.left, 10); let clientY = parseInt(input.style.top, 10); let content = input.value.trim(); let svg = findSVGAtPoint(clientX, clientY); if (!svg) { return; } let rect = svg.getBoundingClient...
[ "function", "savePoint", "(", ")", "{", "if", "(", "input", ".", "value", ".", "trim", "(", ")", ".", "length", ">", "0", ")", "{", "let", "clientX", "=", "parseInt", "(", "input", ".", "style", ".", "left", ",", "10", ")", ";", "let", "clientY",...
Save a new point annotation from input
[ "Save", "a", "new", "point", "annotation", "from", "input" ]
f56e8aa2027326894861ef6b060824137e79a1be
https://github.com/instructure/pdf-annotate.js/blob/f56e8aa2027326894861ef6b060824137e79a1be/src/UI/point.js#L62-L95
train
instructure/pdf-annotate.js
shared/pdf_viewer.js
binarySearchFirstItem
function binarySearchFirstItem(items, condition) { var minIndex = 0; var maxIndex = items.length - 1; if (items.length === 0 || !condition(items[maxIndex])) { return items.length; } if (condition(items[minIndex])) { return minIndex; } while (minIndex < maxIndex) { var currentIndex = (minInde...
javascript
function binarySearchFirstItem(items, condition) { var minIndex = 0; var maxIndex = items.length - 1; if (items.length === 0 || !condition(items[maxIndex])) { return items.length; } if (condition(items[minIndex])) { return minIndex; } while (minIndex < maxIndex) { var currentIndex = (minInde...
[ "function", "binarySearchFirstItem", "(", "items", ",", "condition", ")", "{", "var", "minIndex", "=", "0", ";", "var", "maxIndex", "=", "items", ".", "length", "-", "1", ";", "if", "(", "items", ".", "length", "===", "0", "||", "!", "condition", "(", ...
Use binary search to find the index of the first item in a given array which passes a given condition. The items are expected to be sorted in the sense that if the condition is true for one item in the array, then it is also true for all following items. @returns {Number} Index of the first array element to pass the t...
[ "Use", "binary", "search", "to", "find", "the", "index", "of", "the", "first", "item", "in", "a", "given", "array", "which", "passes", "a", "given", "condition", ".", "The", "items", "are", "expected", "to", "be", "sorted", "in", "the", "sense", "that", ...
f56e8aa2027326894861ef6b060824137e79a1be
https://github.com/instructure/pdf-annotate.js/blob/f56e8aa2027326894861ef6b060824137e79a1be/shared/pdf_viewer.js#L161-L182
train
instructure/pdf-annotate.js
shared/pdf_viewer.js
PDFRenderingQueue_renderView
function PDFRenderingQueue_renderView(view) { var state = view.renderingState; switch (state) { case RenderingStates.FINISHED: return false; case RenderingStates.PAUSED: this.highestPriorityPage = view.renderingId; view.resume(); break; case Re...
javascript
function PDFRenderingQueue_renderView(view) { var state = view.renderingState; switch (state) { case RenderingStates.FINISHED: return false; case RenderingStates.PAUSED: this.highestPriorityPage = view.renderingId; view.resume(); break; case Re...
[ "function", "PDFRenderingQueue_renderView", "(", "view", ")", "{", "var", "state", "=", "view", ".", "renderingState", ";", "switch", "(", "state", ")", "{", "case", "RenderingStates", ".", "FINISHED", ":", "return", "false", ";", "case", "RenderingStates", "....
Render a page or thumbnail view. This calls the appropriate function based on the views state. If the view is already rendered it will return false. @param {IRenderableView} view
[ "Render", "a", "page", "or", "thumbnail", "view", ".", "This", "calls", "the", "appropriate", "function", "based", "on", "the", "views", "state", ".", "If", "the", "view", "is", "already", "rendered", "it", "will", "return", "false", "." ]
f56e8aa2027326894861ef6b060824137e79a1be
https://github.com/instructure/pdf-annotate.js/blob/f56e8aa2027326894861ef6b060824137e79a1be/shared/pdf_viewer.js#L846-L867
train
instructure/pdf-annotate.js
src/a11y/initEventHandlers.js
reorderAnnotationsByType
function reorderAnnotationsByType(documentId, pageNumber, type) { PDFJSAnnotate.getStoreAdapter().getAnnotations(documentId, pageNumber) .then((annotations) => { return annotations.annotations.filter((a) => { return a.type === type; }); }) .then((annotations) => { annotations.for...
javascript
function reorderAnnotationsByType(documentId, pageNumber, type) { PDFJSAnnotate.getStoreAdapter().getAnnotations(documentId, pageNumber) .then((annotations) => { return annotations.annotations.filter((a) => { return a.type === type; }); }) .then((annotations) => { annotations.for...
[ "function", "reorderAnnotationsByType", "(", "documentId", ",", "pageNumber", ",", "type", ")", "{", "PDFJSAnnotate", ".", "getStoreAdapter", "(", ")", ".", "getAnnotations", "(", "documentId", ",", "pageNumber", ")", ".", "then", "(", "(", "annotations", ")", ...
Reorder the annotation numbers by annotation type @param {String} documentId The ID of the document @param {Number} pageNumber The page number of the annotations @param {Strig} type The annotation type
[ "Reorder", "the", "annotation", "numbers", "by", "annotation", "type" ]
f56e8aa2027326894861ef6b060824137e79a1be
https://github.com/instructure/pdf-annotate.js/blob/f56e8aa2027326894861ef6b060824137e79a1be/src/a11y/initEventHandlers.js#L30-L45
train
instructure/pdf-annotate.js
src/a11y/initEventHandlers.js
insertComment
function insertComment(documentId, annotationId, comment) { let list = document.querySelector(`pdf-annotate-screenreader-comment-list-${annotationId}`); let promise; if (!list) { promise = renderScreenReaderComments(documentId, annotationId, []).then(() => { list = document.querySelector(`pdf-annotate-...
javascript
function insertComment(documentId, annotationId, comment) { let list = document.querySelector(`pdf-annotate-screenreader-comment-list-${annotationId}`); let promise; if (!list) { promise = renderScreenReaderComments(documentId, annotationId, []).then(() => { list = document.querySelector(`pdf-annotate-...
[ "function", "insertComment", "(", "documentId", ",", "annotationId", ",", "comment", ")", "{", "let", "list", "=", "document", ".", "querySelector", "(", "`", "${", "annotationId", "}", "`", ")", ";", "let", "promise", ";", "if", "(", "!", "list", ")", ...
Insert a screen reader hint for a comment @param {String} documentId The ID of the document @param {String} annotationId The ID of tha assocated annotation @param {Object} comment The comment to insert a hint for
[ "Insert", "a", "screen", "reader", "hint", "for", "a", "comment" ]
f56e8aa2027326894861ef6b060824137e79a1be
https://github.com/instructure/pdf-annotate.js/blob/f56e8aa2027326894861ef6b060824137e79a1be/src/a11y/initEventHandlers.js#L65-L81
train
instructure/pdf-annotate.js
src/a11y/initEventHandlers.js
removeElementById
function removeElementById(elementId) { let el = document.getElementById(elementId); if (el) { el.parentNode.removeChild(el); } }
javascript
function removeElementById(elementId) { let el = document.getElementById(elementId); if (el) { el.parentNode.removeChild(el); } }
[ "function", "removeElementById", "(", "elementId", ")", "{", "let", "el", "=", "document", ".", "getElementById", "(", "elementId", ")", ";", "if", "(", "el", ")", "{", "el", ".", "parentNode", ".", "removeChild", "(", "el", ")", ";", "}", "}" ]
Remove an element from the DOM by it's ID if it exists @param {String} elementID The ID of the element to be removed
[ "Remove", "an", "element", "from", "the", "DOM", "by", "it", "s", "ID", "if", "it", "exists" ]
f56e8aa2027326894861ef6b060824137e79a1be
https://github.com/instructure/pdf-annotate.js/blob/f56e8aa2027326894861ef6b060824137e79a1be/src/a11y/initEventHandlers.js#L98-L103
train
instructure/pdf-annotate.js
src/UI/rect.js
getSelectionRects
function getSelectionRects() { try { let selection = window.getSelection(); let range = selection.getRangeAt(0); let rects = range.getClientRects(); if (rects.length > 0 && rects[0].width > 0 && rects[0].height > 0) { return rects; } } catch (e) {} return null; }
javascript
function getSelectionRects() { try { let selection = window.getSelection(); let range = selection.getRangeAt(0); let rects = range.getClientRects(); if (rects.length > 0 && rects[0].width > 0 && rects[0].height > 0) { return rects; } } catch (e) {} return null; }
[ "function", "getSelectionRects", "(", ")", "{", "try", "{", "let", "selection", "=", "window", ".", "getSelection", "(", ")", ";", "let", "range", "=", "selection", ".", "getRangeAt", "(", "0", ")", ";", "let", "rects", "=", "range", ".", "getClientRects...
Get the current window selection as rects @return {Array} An Array of rects
[ "Get", "the", "current", "window", "selection", "as", "rects" ]
f56e8aa2027326894861ef6b060824137e79a1be
https://github.com/instructure/pdf-annotate.js/blob/f56e8aa2027326894861ef6b060824137e79a1be/src/UI/rect.js#L25-L39
train
instructure/pdf-annotate.js
src/UI/rect.js
saveRect
function saveRect(type, rects, color) { let svg = findSVGAtPoint(rects[0].left, rects[0].top); let node; let annotation; if (!svg) { return; } let boundingRect = svg.getBoundingClientRect(); if (!color) { if (type === 'highlight') { color = 'FFFF00'; } else if (type === 'strikeout') {...
javascript
function saveRect(type, rects, color) { let svg = findSVGAtPoint(rects[0].left, rects[0].top); let node; let annotation; if (!svg) { return; } let boundingRect = svg.getBoundingClientRect(); if (!color) { if (type === 'highlight') { color = 'FFFF00'; } else if (type === 'strikeout') {...
[ "function", "saveRect", "(", "type", ",", "rects", ",", "color", ")", "{", "let", "svg", "=", "findSVGAtPoint", "(", "rects", "[", "0", "]", ".", "left", ",", "rects", "[", "0", "]", ".", "top", ")", ";", "let", "node", ";", "let", "annotation", ...
Save a rect annotation @param {String} type The type of rect (area, highlight, strikeout) @param {Array} rects The rects to use for annotation @param {String} color The color of the rects
[ "Save", "a", "rect", "annotation" ]
f56e8aa2027326894861ef6b060824137e79a1be
https://github.com/instructure/pdf-annotate.js/blob/f56e8aa2027326894861ef6b060824137e79a1be/src/UI/rect.js#L146-L207
train
rikschennink/fitty
dist/fitty.module.js
redraw
function redraw(fitties) { // getting info from the DOM at this point should not trigger a reflow, let's gather as much intel as possible before triggering a reflow // check if styles of all fitties have been computed fitties.filter(function (f) { return !f.styleComputed; }).forEach(function (f)...
javascript
function redraw(fitties) { // getting info from the DOM at this point should not trigger a reflow, let's gather as much intel as possible before triggering a reflow // check if styles of all fitties have been computed fitties.filter(function (f) { return !f.styleComputed; }).forEach(function (f)...
[ "function", "redraw", "(", "fitties", ")", "{", "// getting info from the DOM at this point should not trigger a reflow, let's gather as much intel as possible before triggering a reflow", "// check if styles of all fitties have been computed", "fitties", ".", "filter", "(", "function", "(...
redraws fitties so they nicely fit their parent container
[ "redraws", "fitties", "so", "they", "nicely", "fit", "their", "parent", "container" ]
6c254ac412336a5cb80a5c25adb7779992ce14f8
https://github.com/rikschennink/fitty/blob/6c254ac412336a5cb80a5c25adb7779992ce14f8/dist/fitty.module.js#L58-L86
train
rikschennink/fitty
dist/fitty.module.js
shouldRedraw
function shouldRedraw(f) { return f.dirty !== DrawState.DIRTY_LAYOUT || f.dirty === DrawState.DIRTY_LAYOUT && f.element.parentNode.clientWidth !== f.availableWidth; }
javascript
function shouldRedraw(f) { return f.dirty !== DrawState.DIRTY_LAYOUT || f.dirty === DrawState.DIRTY_LAYOUT && f.element.parentNode.clientWidth !== f.availableWidth; }
[ "function", "shouldRedraw", "(", "f", ")", "{", "return", "f", ".", "dirty", "!==", "DrawState", ".", "DIRTY_LAYOUT", "||", "f", ".", "dirty", "===", "DrawState", ".", "DIRTY_LAYOUT", "&&", "f", ".", "element", ".", "parentNode", ".", "clientWidth", "!==",...
should always redraw if is not dirty layout, if is dirty layout, only redraw if size has changed
[ "should", "always", "redraw", "if", "is", "not", "dirty", "layout", "if", "is", "dirty", "layout", "only", "redraw", "if", "size", "has", "changed" ]
6c254ac412336a5cb80a5c25adb7779992ce14f8
https://github.com/rikschennink/fitty/blob/6c254ac412336a5cb80a5c25adb7779992ce14f8/dist/fitty.module.js#L111-L113
train
rikschennink/fitty
dist/fitty.module.js
computeStyle
function computeStyle(f) { // get style properties var style = w.getComputedStyle(f.element, null); // get current font size in pixels (if we already calculated it, use the calculated version) f.currentFontSize = parseInt(style.getPropertyValue('font-size'), 10); // get display type and wrap mode...
javascript
function computeStyle(f) { // get style properties var style = w.getComputedStyle(f.element, null); // get current font size in pixels (if we already calculated it, use the calculated version) f.currentFontSize = parseInt(style.getPropertyValue('font-size'), 10); // get display type and wrap mode...
[ "function", "computeStyle", "(", "f", ")", "{", "// get style properties", "var", "style", "=", "w", ".", "getComputedStyle", "(", "f", ".", "element", ",", "null", ")", ";", "// get current font size in pixels (if we already calculated it, use the calculated version)", "...
every fitty element is tested for invalid styles
[ "every", "fitty", "element", "is", "tested", "for", "invalid", "styles" ]
6c254ac412336a5cb80a5c25adb7779992ce14f8
https://github.com/rikschennink/fitty/blob/6c254ac412336a5cb80a5c25adb7779992ce14f8/dist/fitty.module.js#L116-L127
train
rikschennink/fitty
dist/fitty.module.js
shouldPreStyle
function shouldPreStyle(f) { var preStyle = false; // if we already tested for prestyling we don't have to do it again if (f.preStyleTestCompleted) { return false; } // should have an inline style, if not, apply if (!/inline-/.test(f.display)) { preStyle = true; f.display = ...
javascript
function shouldPreStyle(f) { var preStyle = false; // if we already tested for prestyling we don't have to do it again if (f.preStyleTestCompleted) { return false; } // should have an inline style, if not, apply if (!/inline-/.test(f.display)) { preStyle = true; f.display = ...
[ "function", "shouldPreStyle", "(", "f", ")", "{", "var", "preStyle", "=", "false", ";", "// if we already tested for prestyling we don't have to do it again", "if", "(", "f", ".", "preStyleTestCompleted", ")", "{", "return", "false", ";", "}", "// should have an inline ...
determines if this fitty requires initial styling, can be prevented by applying correct styles through CSS
[ "determines", "if", "this", "fitty", "requires", "initial", "styling", "can", "be", "prevented", "by", "applying", "correct", "styles", "through", "CSS" ]
6c254ac412336a5cb80a5c25adb7779992ce14f8
https://github.com/rikschennink/fitty/blob/6c254ac412336a5cb80a5c25adb7779992ce14f8/dist/fitty.module.js#L130-L155
train
rikschennink/fitty
dist/fitty.module.js
applyStyle
function applyStyle(f) { // remember original style, we need this to restore the fitty style when unsubscribing if (!f.originalStyle) { f.originalStyle = f.element.getAttribute('style') || ''; } // set the new style to the original style plus the fitty styles f.element.style.cssText = f.orig...
javascript
function applyStyle(f) { // remember original style, we need this to restore the fitty style when unsubscribing if (!f.originalStyle) { f.originalStyle = f.element.getAttribute('style') || ''; } // set the new style to the original style plus the fitty styles f.element.style.cssText = f.orig...
[ "function", "applyStyle", "(", "f", ")", "{", "// remember original style, we need this to restore the fitty style when unsubscribing", "if", "(", "!", "f", ".", "originalStyle", ")", "{", "f", ".", "originalStyle", "=", "f", ".", "element", ".", "getAttribute", "(", ...
apply styles to single fitty
[ "apply", "styles", "to", "single", "fitty" ]
6c254ac412336a5cb80a5c25adb7779992ce14f8
https://github.com/rikschennink/fitty/blob/6c254ac412336a5cb80a5c25adb7779992ce14f8/dist/fitty.module.js#L158-L167
train
rikschennink/fitty
dist/fitty.module.js
dispatchFitEvent
function dispatchFitEvent(f) { f.element.dispatchEvent(new CustomEvent('fit', { detail: { oldValue: f.previousFontSize, newValue: f.currentFontSize, scaleFactor: f.currentFontSize / f.previousFontSize } })); }
javascript
function dispatchFitEvent(f) { f.element.dispatchEvent(new CustomEvent('fit', { detail: { oldValue: f.previousFontSize, newValue: f.currentFontSize, scaleFactor: f.currentFontSize / f.previousFontSize } })); }
[ "function", "dispatchFitEvent", "(", "f", ")", "{", "f", ".", "element", ".", "dispatchEvent", "(", "new", "CustomEvent", "(", "'fit'", ",", "{", "detail", ":", "{", "oldValue", ":", "f", ".", "previousFontSize", ",", "newValue", ":", "f", ".", "currentF...
dispatch a fit event on a fitty
[ "dispatch", "a", "fit", "event", "on", "a", "fitty" ]
6c254ac412336a5cb80a5c25adb7779992ce14f8
https://github.com/rikschennink/fitty/blob/6c254ac412336a5cb80a5c25adb7779992ce14f8/dist/fitty.module.js#L170-L178
train
rikschennink/fitty
dist/fitty.module.js
subscribe
function subscribe(f) { // this is a new fitty so we need to validate if it's styles are in order f.newbie = true; // because it's a new fitty it should also be dirty, we want it to redraw on the first loop f.dirty = true; // we want to be able to update this fitty fitties.push(f); }
javascript
function subscribe(f) { // this is a new fitty so we need to validate if it's styles are in order f.newbie = true; // because it's a new fitty it should also be dirty, we want it to redraw on the first loop f.dirty = true; // we want to be able to update this fitty fitties.push(f); }
[ "function", "subscribe", "(", "f", ")", "{", "// this is a new fitty so we need to validate if it's styles are in order", "f", ".", "newbie", "=", "true", ";", "// because it's a new fitty it should also be dirty, we want it to redraw on the first loop", "f", ".", "dirty", "=", "...
add a new fitty, does not redraw said fitty
[ "add", "a", "new", "fitty", "does", "not", "redraw", "said", "fitty" ]
6c254ac412336a5cb80a5c25adb7779992ce14f8
https://github.com/rikschennink/fitty/blob/6c254ac412336a5cb80a5c25adb7779992ce14f8/dist/fitty.module.js#L189-L199
train
rikschennink/fitty
dist/fitty.module.js
unsubscribe
function unsubscribe(f) { return function () { // remove from fitties array fitties = fitties.filter(function (_) { return _.element !== f.element; }); // stop observing DOM if (f.observeMutations) { f.observer.disconnect(); } // reset font size to inheri...
javascript
function unsubscribe(f) { return function () { // remove from fitties array fitties = fitties.filter(function (_) { return _.element !== f.element; }); // stop observing DOM if (f.observeMutations) { f.observer.disconnect(); } // reset font size to inheri...
[ "function", "unsubscribe", "(", "f", ")", "{", "return", "function", "(", ")", "{", "// remove from fitties array", "fitties", "=", "fitties", ".", "filter", "(", "function", "(", "_", ")", "{", "return", "_", ".", "element", "!==", "f", ".", "element", ...
remove an existing fitty
[ "remove", "an", "existing", "fitty" ]
6c254ac412336a5cb80a5c25adb7779992ce14f8
https://github.com/rikschennink/fitty/blob/6c254ac412336a5cb80a5c25adb7779992ce14f8/dist/fitty.module.js#L202-L218
train
rikschennink/fitty
dist/fitty.module.js
fittyCreate
function fittyCreate(elements, options) { // set options object var fittyOptions = _extends({}, defaultOptions, options); // create fitties var publicFitties = elements.map(function (element) { // create fitty instance var f = _extends({}, fittyOptions, { // internal options for ...
javascript
function fittyCreate(elements, options) { // set options object var fittyOptions = _extends({}, defaultOptions, options); // create fitties var publicFitties = elements.map(function (element) { // create fitty instance var f = _extends({}, fittyOptions, { // internal options for ...
[ "function", "fittyCreate", "(", "elements", ",", "options", ")", "{", "// set options object", "var", "fittyOptions", "=", "_extends", "(", "{", "}", ",", "defaultOptions", ",", "options", ")", ";", "// create fitties", "var", "publicFitties", "=", "elements", "...
array of elements in, fitty instances out
[ "array", "of", "elements", "in", "fitty", "instances", "out" ]
6c254ac412336a5cb80a5c25adb7779992ce14f8
https://github.com/rikschennink/fitty/blob/6c254ac412336a5cb80a5c25adb7779992ce14f8/dist/fitty.module.js#L250-L284
train
rikschennink/fitty
dist/fitty.module.js
fitty
function fitty(target) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; // if target is a string return typeof target === 'string' ? // treat it as a querySelector fittyCreate(toArray(document.querySelectorAll(target)), options) : // create single fitty...
javascript
function fitty(target) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; // if target is a string return typeof target === 'string' ? // treat it as a querySelector fittyCreate(toArray(document.querySelectorAll(target)), options) : // create single fitty...
[ "function", "fitty", "(", "target", ")", "{", "var", "options", "=", "arguments", ".", "length", ">", "1", "&&", "arguments", "[", "1", "]", "!==", "undefined", "?", "arguments", "[", "1", "]", ":", "{", "}", ";", "// if target is a string", "return", ...
fitty creation function
[ "fitty", "creation", "function" ]
6c254ac412336a5cb80a5c25adb7779992ce14f8
https://github.com/rikschennink/fitty/blob/6c254ac412336a5cb80a5c25adb7779992ce14f8/dist/fitty.module.js#L287-L299
train
htmlhint/HTMLHint
bin/formatter.js
loadFormatters
function loadFormatters(){ var arrFiles = glob.sync('./formatters/*.js', { 'cwd': __dirname, 'dot': false, 'nodir': true, 'strict': false, 'silent': true }); var mapFormatters = {}; arrFiles.forEach(function(file){ var fileInfo = path.parse(file); ...
javascript
function loadFormatters(){ var arrFiles = glob.sync('./formatters/*.js', { 'cwd': __dirname, 'dot': false, 'nodir': true, 'strict': false, 'silent': true }); var mapFormatters = {}; arrFiles.forEach(function(file){ var fileInfo = path.parse(file); ...
[ "function", "loadFormatters", "(", ")", "{", "var", "arrFiles", "=", "glob", ".", "sync", "(", "'./formatters/*.js'", ",", "{", "'cwd'", ":", "__dirname", ",", "'dot'", ":", "false", ",", "'nodir'", ":", "true", ",", "'strict'", ":", "false", ",", "'sile...
load all formatters
[ "load", "all", "formatters" ]
bb9a51e407b2ee1cc0173e70326b3ba786cdad69
https://github.com/htmlhint/HTMLHint/blob/bb9a51e407b2ee1cc0173e70326b3ba786cdad69/bin/formatter.js#L21-L36
train
iamceege/tooltipster
src/js/tooltipster.js
function(constructor, obj, pluginName) { // if it's not already bridged if (!obj[pluginName]) { var fn = function() {}; fn.prototype = constructor; var pluginInstance = new fn(); // the _init method has to exist in instance constructors but might be missing // in core constructors i...
javascript
function(constructor, obj, pluginName) { // if it's not already bridged if (!obj[pluginName]) { var fn = function() {}; fn.prototype = constructor; var pluginInstance = new fn(); // the _init method has to exist in instance constructors but might be missing // in core constructors i...
[ "function", "(", "constructor", ",", "obj", ",", "pluginName", ")", "{", "// if it's not already bridged", "if", "(", "!", "obj", "[", "pluginName", "]", ")", "{", "var", "fn", "=", "function", "(", ")", "{", "}", ";", "fn", ".", "prototype", "=", "con...
A function to proxy the public methods of an object onto another @param {object} constructor The constructor to bridge @param {object} obj The object that will get new methods (an instance or the core) @param {string} pluginName A plugin name for the console log message @return {core} @private
[ "A", "function", "to", "proxy", "the", "public", "methods", "of", "an", "object", "onto", "another" ]
bb575f0c8d7494b80cca60a235e14b9477bd1ab7
https://github.com/iamceege/tooltipster/blob/bb575f0c8d7494b80cca60a235e14b9477bd1ab7/src/js/tooltipster.js#L99-L143
train
iamceege/tooltipster
src/js/tooltipster.js
function() { var args = Array.prototype.slice.apply(arguments); if (typeof args[0] == 'string') { args[0] = { type: args[0] }; } // note: the order of emitters matters this.__$emitterPrivate.trigger.apply(this.__$emitterPrivate, args); this.__$emitterPublic.trigger.apply(this.__$emitterPublic, a...
javascript
function() { var args = Array.prototype.slice.apply(arguments); if (typeof args[0] == 'string') { args[0] = { type: args[0] }; } // note: the order of emitters matters this.__$emitterPrivate.trigger.apply(this.__$emitterPrivate, args); this.__$emitterPublic.trigger.apply(this.__$emitterPublic, a...
[ "function", "(", ")", "{", "var", "args", "=", "Array", ".", "prototype", ".", "slice", ".", "apply", "(", "arguments", ")", ";", "if", "(", "typeof", "args", "[", "0", "]", "==", "'string'", ")", "{", "args", "[", "0", "]", "=", "{", "type", "...
Trigger events on the core emitters @returns {core} @protected
[ "Trigger", "events", "on", "the", "core", "emitters" ]
bb575f0c8d7494b80cca60a235e14b9477bd1ab7
https://github.com/iamceege/tooltipster/blob/bb575f0c8d7494b80cca60a235e14b9477bd1ab7/src/js/tooltipster.js#L263-L276
train
iamceege/tooltipster
src/js/tooltipster.js
function(selector) { var instances = [], sel = selector || '.tooltipstered'; $(sel).each(function() { var $this = $(this), ns = $this.data('tooltipster-ns'); if (ns) { $.each(ns, function(i, namespace) { instances.push($this.data(namespace)); }); } }); return i...
javascript
function(selector) { var instances = [], sel = selector || '.tooltipstered'; $(sel).each(function() { var $this = $(this), ns = $this.data('tooltipster-ns'); if (ns) { $.each(ns, function(i, namespace) { instances.push($this.data(namespace)); }); } }); return i...
[ "function", "(", "selector", ")", "{", "var", "instances", "=", "[", "]", ",", "sel", "=", "selector", "||", "'.tooltipstered'", ";", "$", "(", "sel", ")", ".", "each", "(", "function", "(", ")", "{", "var", "$this", "=", "$", "(", "this", ")", "...
Returns instances of all tooltips in the page or an a given element @param {string|HTML object collection} selector optional Use this parameter to restrict the set of objects that will be inspected for the retrieval of instances. By default, all instances in the page are returned. @return {array} An array of instance ...
[ "Returns", "instances", "of", "all", "tooltips", "in", "the", "page", "or", "an", "a", "given", "element" ]
bb575f0c8d7494b80cca60a235e14b9477bd1ab7
https://github.com/iamceege/tooltipster/blob/bb575f0c8d7494b80cca60a235e14b9477bd1ab7/src/js/tooltipster.js#L288-L307
train
iamceege/tooltipster
src/js/tooltipster.js
function() { var self = this, $el = self._$tooltip.find('.tooltipster-content'), formattedContent = self.__Content, format = function(content) { formattedContent = content; }; self._trigger({ type: 'format', content: self.__Content, format: format }); if (self.__options.functio...
javascript
function() { var self = this, $el = self._$tooltip.find('.tooltipster-content'), formattedContent = self.__Content, format = function(content) { formattedContent = content; }; self._trigger({ type: 'format', content: self.__Content, format: format }); if (self.__options.functio...
[ "function", "(", ")", "{", "var", "self", "=", "this", ",", "$el", "=", "self", ".", "_$tooltip", ".", "find", "(", "'.tooltipster-content'", ")", ",", "formattedContent", "=", "self", ".", "__Content", ",", "format", "=", "function", "(", "content", ")"...
Insert the content into the appropriate HTML element of the tooltip @returns {self} @private
[ "Insert", "the", "content", "into", "the", "appropriate", "HTML", "element", "of", "the", "tooltip" ]
bb575f0c8d7494b80cca60a235e14b9477bd1ab7
https://github.com/iamceege/tooltipster/blob/bb575f0c8d7494b80cca60a235e14b9477bd1ab7/src/js/tooltipster.js#L575-L610
train
iamceege/tooltipster
src/js/tooltipster.js
function(content) { // clone if asked. Cloning the object makes sure that each instance has its // own version of the content (in case a same object were provided for several // instances) // reminder: typeof null === object if (content instanceof $ && this.__options.contentCloning) { content = content....
javascript
function(content) { // clone if asked. Cloning the object makes sure that each instance has its // own version of the content (in case a same object were provided for several // instances) // reminder: typeof null === object if (content instanceof $ && this.__options.contentCloning) { content = content....
[ "function", "(", "content", ")", "{", "// clone if asked. Cloning the object makes sure that each instance has its", "// own version of the content (in case a same object were provided for several", "// instances)", "// reminder: typeof null === object", "if", "(", "content", "instanceof", ...
Save the content, cloning it beforehand if need be @param content @returns {self} @private
[ "Save", "the", "content", "cloning", "it", "beforehand", "if", "need", "be" ]
bb575f0c8d7494b80cca60a235e14b9477bd1ab7
https://github.com/iamceege/tooltipster/blob/bb575f0c8d7494b80cca60a235e14b9477bd1ab7/src/js/tooltipster.js#L619-L637
train
iamceege/tooltipster
src/js/tooltipster.js
function(r) { geo.origin.size.height = r.height, geo.origin.windowOffset.left = r.left, geo.origin.windowOffset.top = r.top, geo.origin.size.width = r.width }
javascript
function(r) { geo.origin.size.height = r.height, geo.origin.windowOffset.left = r.left, geo.origin.windowOffset.top = r.top, geo.origin.size.width = r.width }
[ "function", "(", "r", ")", "{", "geo", ".", "origin", ".", "size", ".", "height", "=", "r", ".", "height", ",", "geo", ".", "origin", ".", "windowOffset", ".", "left", "=", "r", ".", "left", ",", "geo", ".", "origin", ".", "windowOffset", ".", "t...
user callback through an event
[ "user", "callback", "through", "an", "event" ]
bb575f0c8d7494b80cca60a235e14b9477bd1ab7
https://github.com/iamceege/tooltipster/blob/bb575f0c8d7494b80cca60a235e14b9477bd1ab7/src/js/tooltipster.js#L832-L837
train
iamceege/tooltipster
src/js/tooltipster.js
function() { if (typeof this.__options.animationDuration == 'number') { this.__options.animationDuration = [this.__options.animationDuration, this.__options.animationDuration]; } if (typeof this.__options.delay == 'number') { this.__options.delay = [this.__options.delay, this.__options.delay]; } ...
javascript
function() { if (typeof this.__options.animationDuration == 'number') { this.__options.animationDuration = [this.__options.animationDuration, this.__options.animationDuration]; } if (typeof this.__options.delay == 'number') { this.__options.delay = [this.__options.delay, this.__options.delay]; } ...
[ "function", "(", ")", "{", "if", "(", "typeof", "this", ".", "__options", ".", "animationDuration", "==", "'number'", ")", "{", "this", ".", "__options", ".", "animationDuration", "=", "[", "this", ".", "__options", ".", "animationDuration", ",", "this", "...
Some options may need to be formated before being used @returns {self} @private
[ "Some", "options", "may", "need", "to", "be", "formated", "before", "being", "used" ]
bb575f0c8d7494b80cca60a235e14b9477bd1ab7
https://github.com/iamceege/tooltipster/blob/bb575f0c8d7494b80cca60a235e14b9477bd1ab7/src/js/tooltipster.js#L924-L980
train
iamceege/tooltipster
src/js/tooltipster.js
function() { var self = this; // in case the selfDestruction option has been changed by a method call if (self.__options.selfDestruction) { // the GC task self.__garbageCollector = setInterval(function() { var now = new Date().getTime(); // forget the old events self.__touchE...
javascript
function() { var self = this; // in case the selfDestruction option has been changed by a method call if (self.__options.selfDestruction) { // the GC task self.__garbageCollector = setInterval(function() { var now = new Date().getTime(); // forget the old events self.__touchE...
[ "function", "(", ")", "{", "var", "self", "=", "this", ";", "// in case the selfDestruction option has been changed by a method call", "if", "(", "self", ".", "__options", ".", "selfDestruction", ")", "{", "// the GC task", "self", ".", "__garbageCollector", "=", "set...
Schedules or cancels the garbage collector task @returns {self} @private
[ "Schedules", "or", "cancels", "the", "garbage", "collector", "task" ]
bb575f0c8d7494b80cca60a235e14b9477bd1ab7
https://github.com/iamceege/tooltipster/blob/bb575f0c8d7494b80cca60a235e14b9477bd1ab7/src/js/tooltipster.js#L988-L1020
train
iamceege/tooltipster
src/js/tooltipster.js
function() { // there is only one possible open timeout: the delayed opening // when the mouseenter/touchstart open triggers are used clearTimeout(this.__timeouts.open); this.__timeouts.open = null; // ... but several close timeouts: the delayed closing when the // mouseleave close trigger is used and...
javascript
function() { // there is only one possible open timeout: the delayed opening // when the mouseenter/touchstart open triggers are used clearTimeout(this.__timeouts.open); this.__timeouts.open = null; // ... but several close timeouts: the delayed closing when the // mouseleave close trigger is used and...
[ "function", "(", ")", "{", "// there is only one possible open timeout: the delayed opening", "// when the mouseenter/touchstart open triggers are used", "clearTimeout", "(", "this", ".", "__timeouts", ".", "open", ")", ";", "this", ".", "__timeouts", ".", "open", "=", "nul...
Clear appearance timeouts @returns {self} @private
[ "Clear", "appearance", "timeouts" ]
bb575f0c8d7494b80cca60a235e14b9477bd1ab7
https://github.com/iamceege/tooltipster/blob/bb575f0c8d7494b80cca60a235e14b9477bd1ab7/src/js/tooltipster.js#L1320-L1335
train
iamceege/tooltipster
src/js/tooltipster.js
function(pluginName, defaultOptions) { var self = this, options = $.extend(true, {}, defaultOptions); // if the plugin options were isolated in a property named after the // plugin, use them (prevents conflicts with other plugins) var pluginOptions = self.__options[pluginName]; // if not, try to g...
javascript
function(pluginName, defaultOptions) { var self = this, options = $.extend(true, {}, defaultOptions); // if the plugin options were isolated in a property named after the // plugin, use them (prevents conflicts with other plugins) var pluginOptions = self.__options[pluginName]; // if not, try to g...
[ "function", "(", "pluginName", ",", "defaultOptions", ")", "{", "var", "self", "=", "this", ",", "options", "=", "$", ".", "extend", "(", "true", ",", "{", "}", ",", "defaultOptions", ")", ";", "// if the plugin options were isolated in a property named after the"...
Meant for plugins to get their options @param {string} pluginName The name of the plugin that asks for its options @param {object} defaultOptions The default options of the plugin @returns {object} The options @protected
[ "Meant", "for", "plugins", "to", "get", "their", "options" ]
bb575f0c8d7494b80cca60a235e14b9477bd1ab7
https://github.com/iamceege/tooltipster/blob/bb575f0c8d7494b80cca60a235e14b9477bd1ab7/src/js/tooltipster.js#L2117-L2168
train
iamceege/tooltipster
src/js/tooltipster.js
function(pluginName) { var plugin = $.tooltipster._plugin(pluginName); if (plugin) { // if there is a constructor for instances if (plugin.instance) { // proxy non-private methods on the instance to allow new instance methods $.tooltipster.__bridge(plugin.instance, this, plugin.name); ...
javascript
function(pluginName) { var plugin = $.tooltipster._plugin(pluginName); if (plugin) { // if there is a constructor for instances if (plugin.instance) { // proxy non-private methods on the instance to allow new instance methods $.tooltipster.__bridge(plugin.instance, this, plugin.name); ...
[ "function", "(", "pluginName", ")", "{", "var", "plugin", "=", "$", ".", "tooltipster", ".", "_plugin", "(", "pluginName", ")", ";", "if", "(", "plugin", ")", "{", "// if there is a constructor for instances", "if", "(", "plugin", ".", "instance", ")", "{", ...
Used at instantiation of the plugin, or afterwards by plugins that activate themselves on existing instances @param {object} pluginName @returns {self} @protected
[ "Used", "at", "instantiation", "of", "the", "plugin", "or", "afterwards", "by", "plugins", "that", "activate", "themselves", "on", "existing", "instances" ]
bb575f0c8d7494b80cca60a235e14b9477bd1ab7
https://github.com/iamceege/tooltipster/blob/bb575f0c8d7494b80cca60a235e14b9477bd1ab7/src/js/tooltipster.js#L2178-L2196
train
iamceege/tooltipster
src/js/tooltipster.js
function(event) { var isEmulated = false, now = new Date().getTime(); for (var i = this.__touchEvents.length - 1; i >= 0; i--) { var e = this.__touchEvents[i]; // delay, in milliseconds. It's supposed to be 300ms in // most browsers (350ms on iOS) to allow a double tap but // can be les...
javascript
function(event) { var isEmulated = false, now = new Date().getTime(); for (var i = this.__touchEvents.length - 1; i >= 0; i--) { var e = this.__touchEvents[i]; // delay, in milliseconds. It's supposed to be 300ms in // most browsers (350ms on iOS) to allow a double tap but // can be les...
[ "function", "(", "event", ")", "{", "var", "isEmulated", "=", "false", ",", "now", "=", "new", "Date", "(", ")", ".", "getTime", "(", ")", ";", "for", "(", "var", "i", "=", "this", ".", "__touchEvents", ".", "length", "-", "1", ";", "i", ">=", ...
This will return true if the event is a mouse event which was emulated by the browser after a touch event. This allows us to really dissociate mouse and touch triggers. There is a margin of error if a real mouse event is fired right after (within the delay shown below) a touch event on the same element, but hopefully ...
[ "This", "will", "return", "true", "if", "the", "event", "is", "a", "mouse", "event", "which", "was", "emulated", "by", "the", "browser", "after", "a", "touch", "event", ".", "This", "allows", "us", "to", "really", "dissociate", "mouse", "and", "touch", "...
bb575f0c8d7494b80cca60a235e14b9477bd1ab7
https://github.com/iamceege/tooltipster/blob/bb575f0c8d7494b80cca60a235e14b9477bd1ab7/src/js/tooltipster.js#L2210-L2234
train
iamceege/tooltipster
src/js/tooltipster.js
function(event) { return ( (this._touchIsTouchEvent(event) && !this._touchSwiped(event.target)) || (!this._touchIsTouchEvent(event) && !this._touchIsEmulatedEvent(event)) ); }
javascript
function(event) { return ( (this._touchIsTouchEvent(event) && !this._touchSwiped(event.target)) || (!this._touchIsTouchEvent(event) && !this._touchIsEmulatedEvent(event)) ); }
[ "function", "(", "event", ")", "{", "return", "(", "(", "this", ".", "_touchIsTouchEvent", "(", "event", ")", "&&", "!", "this", ".", "_touchSwiped", "(", "event", ".", "target", ")", ")", "||", "(", "!", "this", ".", "_touchIsTouchEvent", "(", "event"...
Returns false if the event was an emulated mouse event or a touch event involved in a swipe gesture. @param {object} event @returns {boolean} @protected
[ "Returns", "false", "if", "the", "event", "was", "an", "emulated", "mouse", "event", "or", "a", "touch", "event", "involved", "in", "a", "swipe", "gesture", "." ]
bb575f0c8d7494b80cca60a235e14b9477bd1ab7
https://github.com/iamceege/tooltipster/blob/bb575f0c8d7494b80cca60a235e14b9477bd1ab7/src/js/tooltipster.js#L2244-L2249
train
iamceege/tooltipster
src/js/tooltipster.js
function(event) { if (this._touchIsTouchEvent(event)) { event.time = new Date().getTime(); this.__touchEvents.push(event); } return this; }
javascript
function(event) { if (this._touchIsTouchEvent(event)) { event.time = new Date().getTime(); this.__touchEvents.push(event); } return this; }
[ "function", "(", "event", ")", "{", "if", "(", "this", ".", "_touchIsTouchEvent", "(", "event", ")", ")", "{", "event", ".", "time", "=", "new", "Date", "(", ")", ".", "getTime", "(", ")", ";", "this", ".", "__touchEvents", ".", "push", "(", "event...
Store touch events for a while to detect swiping and emulated mouse events @param {object} event @returns {self} @protected
[ "Store", "touch", "events", "for", "a", "while", "to", "detect", "swiping", "and", "emulated", "mouse", "events" ]
bb575f0c8d7494b80cca60a235e14b9477bd1ab7
https://github.com/iamceege/tooltipster/blob/bb575f0c8d7494b80cca60a235e14b9477bd1ab7/src/js/tooltipster.js#L2269-L2277
train
iamceege/tooltipster
src/js/tooltipster.js
function(target) { var swiped = false; for (var i = this.__touchEvents.length - 1; i >= 0; i--) { var e = this.__touchEvents[i]; if (e.type == 'touchmove') { swiped = true; break; } else if ( e.type == 'touchstart' && target === e.target ) { break; } } retu...
javascript
function(target) { var swiped = false; for (var i = this.__touchEvents.length - 1; i >= 0; i--) { var e = this.__touchEvents[i]; if (e.type == 'touchmove') { swiped = true; break; } else if ( e.type == 'touchstart' && target === e.target ) { break; } } retu...
[ "function", "(", "target", ")", "{", "var", "swiped", "=", "false", ";", "for", "(", "var", "i", "=", "this", ".", "__touchEvents", ".", "length", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "var", "e", "=", "this", ".", "__touchEv...
Returns true if a swipe happened after the last touchstart event fired on event.target. We need to differentiate a swipe from a tap before we let the event open or close the tooltip. A swipe is when a touchmove (scroll) event happens on the body between the touchstart and the touchend events of an element. @param {ob...
[ "Returns", "true", "if", "a", "swipe", "happened", "after", "the", "last", "touchstart", "event", "fired", "on", "event", ".", "target", "." ]
bb575f0c8d7494b80cca60a235e14b9477bd1ab7
https://github.com/iamceege/tooltipster/blob/bb575f0c8d7494b80cca60a235e14b9477bd1ab7/src/js/tooltipster.js#L2291-L2312
train
iamceege/tooltipster
src/js/tooltipster.js
function() { var args = Array.prototype.slice.apply(arguments); if (typeof args[0] == 'string') { args[0] = { type: args[0] }; } // add properties to the event args[0].instance = this; args[0].origin = this._$origin ? this._$origin[0] : null; args[0].tooltip = this._$tooltip ? this._$tooltip[0...
javascript
function() { var args = Array.prototype.slice.apply(arguments); if (typeof args[0] == 'string') { args[0] = { type: args[0] }; } // add properties to the event args[0].instance = this; args[0].origin = this._$origin ? this._$origin[0] : null; args[0].tooltip = this._$tooltip ? this._$tooltip[0...
[ "function", "(", ")", "{", "var", "args", "=", "Array", ".", "prototype", ".", "slice", ".", "apply", "(", "arguments", ")", ";", "if", "(", "typeof", "args", "[", "0", "]", "==", "'string'", ")", "{", "args", "[", "0", "]", "=", "{", "type", "...
Triggers an event on the instance emitters @returns {self} @protected
[ "Triggers", "an", "event", "on", "the", "instance", "emitters" ]
bb575f0c8d7494b80cca60a235e14b9477bd1ab7
https://github.com/iamceege/tooltipster/blob/bb575f0c8d7494b80cca60a235e14b9477bd1ab7/src/js/tooltipster.js#L2320-L2339
train
iamceege/tooltipster
src/js/tooltipster.js
function(pluginName) { var self = this; // if the plugin has been activated on this instance if (self[pluginName]) { var plugin = $.tooltipster._plugin(pluginName); // if there is a constructor for instances if (plugin.instance) { // unbridge $.each(plugin.instance, function(me...
javascript
function(pluginName) { var self = this; // if the plugin has been activated on this instance if (self[pluginName]) { var plugin = $.tooltipster._plugin(pluginName); // if there is a constructor for instances if (plugin.instance) { // unbridge $.each(plugin.instance, function(me...
[ "function", "(", "pluginName", ")", "{", "var", "self", "=", "this", ";", "// if the plugin has been activated on this instance", "if", "(", "self", "[", "pluginName", "]", ")", "{", "var", "plugin", "=", "$", ".", "tooltipster", ".", "_plugin", "(", "pluginNa...
Deactivate a plugin on this instance @returns {self} @protected
[ "Deactivate", "a", "plugin", "on", "this", "instance" ]
bb575f0c8d7494b80cca60a235e14b9477bd1ab7
https://github.com/iamceege/tooltipster/blob/bb575f0c8d7494b80cca60a235e14b9477bd1ab7/src/js/tooltipster.js#L2347-L2382
train
iamceege/tooltipster
src/js/tooltipster.js
function(content) { var self = this; // getter method if (content === undefined) { return self.__Content; } // setter method else { if (!self.__destroyed) { // change the content self.__contentSet(content); if (self.__Content !== null) { // update the tooltip...
javascript
function(content) { var self = this; // getter method if (content === undefined) { return self.__Content; } // setter method else { if (!self.__destroyed) { // change the content self.__contentSet(content); if (self.__Content !== null) { // update the tooltip...
[ "function", "(", "content", ")", "{", "var", "self", "=", "this", ";", "// getter method", "if", "(", "content", "===", "undefined", ")", "{", "return", "self", ".", "__Content", ";", "}", "// setter method", "else", "{", "if", "(", "!", "self", ".", "...
Sets or gets the content of the tooltip @returns {mixed|self} @public
[ "Sets", "or", "gets", "the", "content", "of", "the", "tooltip" ]
bb575f0c8d7494b80cca60a235e14b9477bd1ab7
https://github.com/iamceege/tooltipster/blob/bb575f0c8d7494b80cca60a235e14b9477bd1ab7/src/js/tooltipster.js#L2407-L2474
train
iamceege/tooltipster
src/js/tooltipster.js
function() { var self = this; if (!self.__destroyed) { if(self.__state != 'closed'){ // no closing delay self.option('animationDuration', 0) // force closing ._close(null, null, true); } else { // there might be an open timeout still running self.__timeoutsClear(); ...
javascript
function() { var self = this; if (!self.__destroyed) { if(self.__state != 'closed'){ // no closing delay self.option('animationDuration', 0) // force closing ._close(null, null, true); } else { // there might be an open timeout still running self.__timeoutsClear(); ...
[ "function", "(", ")", "{", "var", "self", "=", "this", ";", "if", "(", "!", "self", ".", "__destroyed", ")", "{", "if", "(", "self", ".", "__state", "!=", "'closed'", ")", "{", "// no closing delay", "self", ".", "option", "(", "'animationDuration'", "...
Destroys the tooltip @returns {self} @public
[ "Destroys", "the", "tooltip" ]
bb575f0c8d7494b80cca60a235e14b9477bd1ab7
https://github.com/iamceege/tooltipster/blob/bb575f0c8d7494b80cca60a235e14b9477bd1ab7/src/js/tooltipster.js#L2482-L2589
train
iamceege/tooltipster
src/js/tooltipster.js
function(o, val) { // getter if (val === undefined) { return this.__options[o]; } // setter else { if (!this.__destroyed) { // change value this.__options[o] = val; // format this.__optionsFormat(); // re-prepare the triggers if needed if ($.inArray(o, ['tri...
javascript
function(o, val) { // getter if (val === undefined) { return this.__options[o]; } // setter else { if (!this.__destroyed) { // change value this.__options[o] = val; // format this.__optionsFormat(); // re-prepare the triggers if needed if ($.inArray(o, ['tri...
[ "function", "(", "o", ",", "val", ")", "{", "// getter", "if", "(", "val", "===", "undefined", ")", "{", "return", "this", ".", "__options", "[", "o", "]", ";", "}", "// setter", "else", "{", "if", "(", "!", "this", ".", "__destroyed", ")", "{", ...
Get or set options. For internal use and advanced users only. @param {string} o Option name @param {mixed} val optional A new value for the option @return {mixed|self} If val is omitted, the value of the option is returned, otherwise the instance itself is returned @public
[ "Get", "or", "set", "options", ".", "For", "internal", "use", "and", "advanced", "users", "only", "." ]
bb575f0c8d7494b80cca60a235e14b9477bd1ab7
https://github.com/iamceege/tooltipster/blob/bb575f0c8d7494b80cca60a235e14b9477bd1ab7/src/js/tooltipster.js#L2750-L2782
train
iamceege/tooltipster
src/js/tooltipster.js
function() { if (!this.__destroyed) { this.__$emitterPublic.triggerHandler.apply(this.__$emitterPublic, Array.prototype.slice.apply(arguments)); } else { this.__destroyError(); } return this; }
javascript
function() { if (!this.__destroyed) { this.__$emitterPublic.triggerHandler.apply(this.__$emitterPublic, Array.prototype.slice.apply(arguments)); } else { this.__destroyError(); } return this; }
[ "function", "(", ")", "{", "if", "(", "!", "this", ".", "__destroyed", ")", "{", "this", ".", "__$emitterPublic", ".", "triggerHandler", ".", "apply", "(", "this", ".", "__$emitterPublic", ",", "Array", ".", "prototype", ".", "slice", ".", "apply", "(", ...
For public use only, not to be used by plugins @returns {self} @public
[ "For", "public", "use", "only", "not", "to", "be", "used", "by", "plugins" ]
bb575f0c8d7494b80cca60a235e14b9477bd1ab7
https://github.com/iamceege/tooltipster/blob/bb575f0c8d7494b80cca60a235e14b9477bd1ab7/src/js/tooltipster.js#L2871-L2881
train
iamceege/tooltipster
src/js/tooltipster.js
function() { this.__forceRedraw(); var tooltipBcr = this.__$tooltip[0].getBoundingClientRect(), result = { size: { // bcr.width/height are not defined in IE8- but in this // case, bcr.right/bottom will have the same value // except in iOS 8+ where tooltipBcr.bottom/right are wrong // after ...
javascript
function() { this.__forceRedraw(); var tooltipBcr = this.__$tooltip[0].getBoundingClientRect(), result = { size: { // bcr.width/height are not defined in IE8- but in this // case, bcr.right/bottom will have the same value // except in iOS 8+ where tooltipBcr.bottom/right are wrong // after ...
[ "function", "(", ")", "{", "this", ".", "__forceRedraw", "(", ")", ";", "var", "tooltipBcr", "=", "this", ".", "__$tooltip", "[", "0", "]", ".", "getBoundingClientRect", "(", ")", ",", "result", "=", "{", "size", ":", "{", "// bcr.width/height are not defi...
Returns the size of the tooltip. When constraints are applied, also returns whether the tooltip fits in the provided dimensions. The idea is to see if the new height is small enough and if the content does not overflow horizontally. @param {int} width @param {int} height @returns {object} An object with a bool `fits` ...
[ "Returns", "the", "size", "of", "the", "tooltip", ".", "When", "constraints", "are", "applied", "also", "returns", "whether", "the", "tooltip", "fits", "in", "the", "provided", "dimensions", ".", "The", "idea", "is", "to", "see", "if", "the", "new", "heigh...
bb575f0c8d7494b80cca60a235e14b9477bd1ab7
https://github.com/iamceege/tooltipster/blob/bb575f0c8d7494b80cca60a235e14b9477bd1ab7/src/js/tooltipster.js#L3202-L3262
train
iamceege/tooltipster
src/js/tooltipster.js
areEqual
function areEqual(a,b) { var same = true; $.each(a, function(i, _) { if (b[i] === undefined || a[i] !== b[i]) { same = false; return false; } }); return same; }
javascript
function areEqual(a,b) { var same = true; $.each(a, function(i, _) { if (b[i] === undefined || a[i] !== b[i]) { same = false; return false; } }); return same; }
[ "function", "areEqual", "(", "a", ",", "b", ")", "{", "var", "same", "=", "true", ";", "$", ".", "each", "(", "a", ",", "function", "(", "i", ",", "_", ")", "{", "if", "(", "b", "[", "i", "]", "===", "undefined", "||", "a", "[", "i", "]", ...
quick & dirty compare function, not bijective nor multidimensional
[ "quick", "&", "dirty", "compare", "function", "not", "bijective", "nor", "multidimensional" ]
bb575f0c8d7494b80cca60a235e14b9477bd1ab7
https://github.com/iamceege/tooltipster/blob/bb575f0c8d7494b80cca60a235e14b9477bd1ab7/src/js/tooltipster.js#L3266-L3275
train
iamceege/tooltipster
src/js/tooltipster.js
bodyContains
function bodyContains($obj) { var id = $obj.attr('id'), el = id ? env.window.document.getElementById(id) : null; // must also check that the element with the id is the one we want return el ? el === $obj[0] : $.contains(env.window.document.body, $obj[0]); }
javascript
function bodyContains($obj) { var id = $obj.attr('id'), el = id ? env.window.document.getElementById(id) : null; // must also check that the element with the id is the one we want return el ? el === $obj[0] : $.contains(env.window.document.body, $obj[0]); }
[ "function", "bodyContains", "(", "$obj", ")", "{", "var", "id", "=", "$obj", ".", "attr", "(", "'id'", ")", ",", "el", "=", "id", "?", "env", ".", "window", ".", "document", ".", "getElementById", "(", "id", ")", ":", "null", ";", "// must also check...
A fast function to check if an element is still in the DOM. It tries to use an id as ids are indexed by the browser, or falls back to jQuery's `contains` method. May fail if two elements have the same id, but so be it @param {object} $obj A jQuery-wrapped HTML element @return {boolean}
[ "A", "fast", "function", "to", "check", "if", "an", "element", "is", "still", "in", "the", "DOM", ".", "It", "tries", "to", "use", "an", "id", "as", "ids", "are", "indexed", "by", "the", "browser", "or", "falls", "back", "to", "jQuery", "s", "contain...
bb575f0c8d7494b80cca60a235e14b9477bd1ab7
https://github.com/iamceege/tooltipster/blob/bb575f0c8d7494b80cca60a235e14b9477bd1ab7/src/js/tooltipster.js#L3286-L3291
train
iamceege/tooltipster
src/js/plugins/tooltipster/sideTip/tooltipster-sideTip.js
function() { return { // if the tooltip should display an arrow that points to the origin arrow: true, // the distance in pixels between the tooltip and the origin distance: 6, // allows to easily change the position of the tooltip functionPosition: null, maxWidth: null, // used t...
javascript
function() { return { // if the tooltip should display an arrow that points to the origin arrow: true, // the distance in pixels between the tooltip and the origin distance: 6, // allows to easily change the position of the tooltip functionPosition: null, maxWidth: null, // used t...
[ "function", "(", ")", "{", "return", "{", "// if the tooltip should display an arrow that points to the origin", "arrow", ":", "true", ",", "// the distance in pixels between the tooltip and the origin", "distance", ":", "6", ",", "// allows to easily change the position of the toolt...
Defaults are provided as a function for an easy override by inheritance @return {object} An object with the defaults options @private
[ "Defaults", "are", "provided", "as", "a", "function", "for", "an", "easy", "override", "by", "inheritance" ]
bb575f0c8d7494b80cca60a235e14b9477bd1ab7
https://github.com/iamceege/tooltipster/blob/bb575f0c8d7494b80cca60a235e14b9477bd1ab7/src/js/plugins/tooltipster/sideTip/tooltipster-sideTip.js#L15-L43
train
iamceege/tooltipster
src/js/plugins/tooltipster/sideTip/tooltipster-sideTip.js
function() { // detach our content object first, so the next jQuery's remove() // call does not unbind its event handlers if (this.__instance.content() instanceof $) { this.__instance.content().detach(); } // remove the tooltip from the DOM this.__instance._$tooltip.remove(); this.__ins...
javascript
function() { // detach our content object first, so the next jQuery's remove() // call does not unbind its event handlers if (this.__instance.content() instanceof $) { this.__instance.content().detach(); } // remove the tooltip from the DOM this.__instance._$tooltip.remove(); this.__ins...
[ "function", "(", ")", "{", "// detach our content object first, so the next jQuery's remove()", "// call does not unbind its event handlers", "if", "(", "this", ".", "__instance", ".", "content", "(", ")", "instanceof", "$", ")", "{", "this", ".", "__instance", ".", "co...
Called when the tooltip has closed @private
[ "Called", "when", "the", "tooltip", "has", "closed" ]
bb575f0c8d7494b80cca60a235e14b9477bd1ab7
https://github.com/iamceege/tooltipster/blob/bb575f0c8d7494b80cca60a235e14b9477bd1ab7/src/js/plugins/tooltipster/sideTip/tooltipster-sideTip.js#L92-L103
train
iamceege/tooltipster
src/js/plugins/tooltipster/sideTip/tooltipster-sideTip.js
function() { // note: we wrap with a .tooltipster-box div to be able to set a margin on it // (.tooltipster-base must not have one) var $html = $( '<div class="tooltipster-base tooltipster-sidetip">' + '<div class="tooltipster-box">' + '<div class="tooltipster-content"></div>' + '</div>...
javascript
function() { // note: we wrap with a .tooltipster-box div to be able to set a margin on it // (.tooltipster-base must not have one) var $html = $( '<div class="tooltipster-base tooltipster-sidetip">' + '<div class="tooltipster-box">' + '<div class="tooltipster-content"></div>' + '</div>...
[ "function", "(", ")", "{", "// note: we wrap with a .tooltipster-box div to be able to set a margin on it", "// (.tooltipster-base must not have one)", "var", "$html", "=", "$", "(", "'<div class=\"tooltipster-base tooltipster-sidetip\">'", "+", "'<div class=\"tooltipster-box\">'", "+", ...
Creates the HTML element of the tooltip. @private
[ "Creates", "the", "HTML", "element", "of", "the", "tooltip", "." ]
bb575f0c8d7494b80cca60a235e14b9477bd1ab7
https://github.com/iamceege/tooltipster/blob/bb575f0c8d7494b80cca60a235e14b9477bd1ab7/src/js/plugins/tooltipster/sideTip/tooltipster-sideTip.js#L110-L150
train
iamceege/tooltipster
doc/js/scripts.js
function(instance, helper, data){ // this function is pretty dumb and does not check if there is actually // enough space available around the tooltip to move it, it just makes it // snap to the grid. You might want to do something smarter in your app! var gridBcr = $('#demo-position-grid')[0]...
javascript
function(instance, helper, data){ // this function is pretty dumb and does not check if there is actually // enough space available around the tooltip to move it, it just makes it // snap to the grid. You might want to do something smarter in your app! var gridBcr = $('#demo-position-grid')[0]...
[ "function", "(", "instance", ",", "helper", ",", "data", ")", "{", "// this function is pretty dumb and does not check if there is actually\r", "// enough space available around the tooltip to move it, it just makes it\r", "// snap to the grid. You might want to do something smarter in your ap...
8 extra pixels for the arrow to overflow the grid
[ "8", "extra", "pixels", "for", "the", "arrow", "to", "overflow", "the", "grid" ]
bb575f0c8d7494b80cca60a235e14b9477bd1ab7
https://github.com/iamceege/tooltipster/blob/bb575f0c8d7494b80cca60a235e14b9477bd1ab7/doc/js/scripts.js#L203-L220
train
dthree/cash
src/commands/rm.js
isWriteable
function isWriteable(file) { let writePermission = true; try { const __fd = fs.openSync(file, 'a'); fs.closeSync(__fd); } catch (e) { /* istanbul ignore next */ writePermission = false; } return writePermission; }
javascript
function isWriteable(file) { let writePermission = true; try { const __fd = fs.openSync(file, 'a'); fs.closeSync(__fd); } catch (e) { /* istanbul ignore next */ writePermission = false; } return writePermission; }
[ "function", "isWriteable", "(", "file", ")", "{", "let", "writePermission", "=", "true", ";", "try", "{", "const", "__fd", "=", "fs", ".", "openSync", "(", "file", ",", "'a'", ")", ";", "fs", ".", "closeSync", "(", "__fd", ")", ";", "}", "catch", "...
Hack to determine if file has write permissions for current user Avoids having to check user, group, etc, but it's probably slow.
[ "Hack", "to", "determine", "if", "file", "has", "write", "permissions", "for", "current", "user", "Avoids", "having", "to", "check", "user", "group", "etc", "but", "it", "s", "probably", "slow", "." ]
3e28dae8bdb71215d5034df9003f3ef2804c2754
https://github.com/dthree/cash/blob/3e28dae8bdb71215d5034df9003f3ef2804c2754/src/commands/rm.js#L147-L158
train
dthree/cash
dist/windows.js
print
function print() { var parts = String(out).split('\n'); /* istanbul ignore next */ if (parts.length > 1) { out = parts.pop(); var logging = String(parts.join('\n')).replace(/\r\r/g, '\r'); slf.log(logging); } /* istanbul ignore next */ if (cl...
javascript
function print() { var parts = String(out).split('\n'); /* istanbul ignore next */ if (parts.length > 1) { out = parts.pop(); var logging = String(parts.join('\n')).replace(/\r\r/g, '\r'); slf.log(logging); } /* istanbul ignore next */ if (cl...
[ "function", "print", "(", ")", "{", "var", "parts", "=", "String", "(", "out", ")", ".", "split", "(", "'\\n'", ")", ";", "/* istanbul ignore next */", "if", "(", "parts", ".", "length", ">", "1", ")", "{", "out", "=", "parts", ".", "pop", "(", ")"...
Properly print stdout as it's fed, waiting for line breaks before sending it to Vorpal.
[ "Properly", "print", "stdout", "as", "it", "s", "fed", "waiting", "for", "line", "breaks", "before", "sending", "it", "to", "Vorpal", "." ]
3e28dae8bdb71215d5034df9003f3ef2804c2754
https://github.com/dthree/cash/blob/3e28dae8bdb71215d5034df9003f3ef2804c2754/dist/windows.js#L84-L98
train
dthree/cash
packages/touch/dist/commands/touch.js
file
function file(path, options) { try { try { fs.lstatSync(path); } catch (e) { // If the file doesn't exist and // the user doesn't want to create it, // we have no purpose in life. Goodbye. if (options.create === false) { throw new Error(e); } els...
javascript
function file(path, options) { try { try { fs.lstatSync(path); } catch (e) { // If the file doesn't exist and // the user doesn't want to create it, // we have no purpose in life. Goodbye. if (options.create === false) { throw new Error(e); } els...
[ "function", "file", "(", "path", ",", "options", ")", "{", "try", "{", "try", "{", "fs", ".", "lstatSync", "(", "path", ")", ";", "}", "catch", "(", "e", ")", "{", "// If the file doesn't exist and", "// the user doesn't want to create it,", "// we have no purpo...
Handler for a single file using touch. @param {String} path @param {Object} options @api private
[ "Handler", "for", "a", "single", "file", "using", "touch", "." ]
3e28dae8bdb71215d5034df9003f3ef2804c2754
https://github.com/dthree/cash/blob/3e28dae8bdb71215d5034df9003f3ef2804c2754/packages/touch/dist/commands/touch.js#L93-L137
train
dthree/cash
packages/ls/dist/commands/ls.js
error
function error(path, e) { var status = void 0; var stdout = void 0; if (e.code === 'ENOENT' && e.syscall === 'scandir') { status = 1; stdout = 'ls: cannot access ' + path + ': No such file or directory'; } else { status = 2; stdout = e.stack; } ls.self.log(stdout); ...
javascript
function error(path, e) { var status = void 0; var stdout = void 0; if (e.code === 'ENOENT' && e.syscall === 'scandir') { status = 1; stdout = 'ls: cannot access ' + path + ': No such file or directory'; } else { status = 2; stdout = e.stack; } ls.self.log(stdout); ...
[ "function", "error", "(", "path", ",", "e", ")", "{", "var", "status", "=", "void", "0", ";", "var", "stdout", "=", "void", "0", ";", "if", "(", "e", ".", "code", "===", "'ENOENT'", "&&", "e", ".", "syscall", "===", "'scandir'", ")", "{", "status...
Returns ls stderr and response codes for errors. @param {String} path @param {Error} e @param {String} e.code @param {String} e.syscall @param {String} e.stack @api private
[ "Returns", "ls", "stderr", "and", "response", "codes", "for", "errors", "." ]
3e28dae8bdb71215d5034df9003f3ef2804c2754
https://github.com/dthree/cash/blob/3e28dae8bdb71215d5034df9003f3ef2804c2754/packages/ls/dist/commands/ls.js#L112-L126
train
dthree/cash
packages/ls/dist/commands/ls.js
execDirRecursive
function execDirRecursive(path, options) { var self = this; var results = []; walkDirRecursive(path, function (pth) { var result = self.execDir(pth, options); results.push(result); }); return results; }
javascript
function execDirRecursive(path, options) { var self = this; var results = []; walkDirRecursive(path, function (pth) { var result = self.execDir(pth, options); results.push(result); }); return results; }
[ "function", "execDirRecursive", "(", "path", ",", "options", ")", "{", "var", "self", "=", "this", ";", "var", "results", "=", "[", "]", ";", "walkDirRecursive", "(", "path", ",", "function", "(", "pth", ")", "{", "var", "result", "=", "self", ".", "...
Recursively executes `execDir`. For use with `ls -R`. @param {String} path @param {Object} options @return {Array} results @api private
[ "Recursively", "executes", "execDir", ".", "For", "use", "with", "ls", "-", "R", "." ]
3e28dae8bdb71215d5034df9003f3ef2804c2754
https://github.com/dthree/cash/blob/3e28dae8bdb71215d5034df9003f3ef2804c2754/packages/ls/dist/commands/ls.js#L139-L148
train
dthree/cash
packages/ls/dist/commands/ls.js
execDir
function execDir(path, options) { var rawFiles = []; function pushFile(file, data) { rawFiles.push({ file: file, data: data }); } // Add in implied current and parent dirs. pushFile('.', fs.statSync('.')); pushFile('..', fs.statSync('..')); // Walk the passed i...
javascript
function execDir(path, options) { var rawFiles = []; function pushFile(file, data) { rawFiles.push({ file: file, data: data }); } // Add in implied current and parent dirs. pushFile('.', fs.statSync('.')); pushFile('..', fs.statSync('..')); // Walk the passed i...
[ "function", "execDir", "(", "path", ",", "options", ")", "{", "var", "rawFiles", "=", "[", "]", ";", "function", "pushFile", "(", "file", ",", "data", ")", "{", "rawFiles", ".", "push", "(", "{", "file", ":", "file", ",", "data", ":", "data", "}", ...
Executes `ls` functionality for a given directory. @param {String} path @param {Object} options @return {{path: String, size: *, results: *}} results @api private
[ "Executes", "ls", "functionality", "for", "a", "given", "directory", "." ]
3e28dae8bdb71215d5034df9003f3ef2804c2754
https://github.com/dthree/cash/blob/3e28dae8bdb71215d5034df9003f3ef2804c2754/packages/ls/dist/commands/ls.js#L160-L181
train
dthree/cash
packages/ls/dist/commands/ls.js
formatAll
function formatAll(results, options, showName) { var stdout = ''; if (showName) { for (var i = 0; i < results.length; ++i) { stdout += results[i].path + ':\n'; if (options.l) { stdout += 'total ' + results[i].size + '\n'; } stdout += results[i].results; if...
javascript
function formatAll(results, options, showName) { var stdout = ''; if (showName) { for (var i = 0; i < results.length; ++i) { stdout += results[i].path + ':\n'; if (options.l) { stdout += 'total ' + results[i].size + '\n'; } stdout += results[i].results; if...
[ "function", "formatAll", "(", "results", ",", "options", ",", "showName", ")", "{", "var", "stdout", "=", "''", ";", "if", "(", "showName", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "results", ".", "length", ";", "++", "i", ")", ...
Concatenates the results of multiple `execDir` functions into their proper form based on options provided. @param {Array} results @param {Object} options @param {boolean} showName @return {String} stdout @api private
[ "Concatenates", "the", "results", "of", "multiple", "execDir", "functions", "into", "their", "proper", "form", "based", "on", "options", "provided", "." ]
3e28dae8bdb71215d5034df9003f3ef2804c2754
https://github.com/dthree/cash/blob/3e28dae8bdb71215d5034df9003f3ef2804c2754/packages/ls/dist/commands/ls.js#L358-L378
train
jackspirou/clientjs
src/client.js
function() { var parser = new(window.UAParser || exports.UAParser); browserData = parser.getResult(); fontDetective = new Detector(); return this; }
javascript
function() { var parser = new(window.UAParser || exports.UAParser); browserData = parser.getResult(); fontDetective = new Detector(); return this; }
[ "function", "(", ")", "{", "var", "parser", "=", "new", "(", "window", ".", "UAParser", "||", "exports", ".", "UAParser", ")", ";", "browserData", "=", "parser", ".", "getResult", "(", ")", ";", "fontDetective", "=", "new", "Detector", "(", ")", ";", ...
Global font detective object. ClientJS constructor which sets the browserData object and returs the client object.
[ "Global", "font", "detective", "object", ".", "ClientJS", "constructor", "which", "sets", "the", "browserData", "object", "and", "returs", "the", "client", "object", "." ]
6674bdd56680e8c8130260634a4086d469d8c7f2
https://github.com/jackspirou/clientjs/blob/6674bdd56680e8c8130260634a4086d469d8c7f2/src/client.js#L137-L142
train
jackspirou/clientjs
src/client.js
function() { var bar = '|'; var userAgent = browserData.ua; var screenPrint = this.getScreenPrint(); var pluginList = this.getPlugins(); var fontList = this.getFonts(); var localStorage = this.isLocalStorage(); var sessionStorage = this.isSessionStorage(); var timeZone =...
javascript
function() { var bar = '|'; var userAgent = browserData.ua; var screenPrint = this.getScreenPrint(); var pluginList = this.getPlugins(); var fontList = this.getFonts(); var localStorage = this.isLocalStorage(); var sessionStorage = this.isSessionStorage(); var timeZone =...
[ "function", "(", ")", "{", "var", "bar", "=", "'|'", ";", "var", "userAgent", "=", "browserData", ".", "ua", ";", "var", "screenPrint", "=", "this", ".", "getScreenPrint", "(", ")", ";", "var", "pluginList", "=", "this", ".", "getPlugins", "(", ")", ...
Get Fingerprint. Return a 32-bit integer representing the browsers fingerprint.
[ "Get", "Fingerprint", ".", "Return", "a", "32", "-", "bit", "integer", "representing", "the", "browsers", "fingerprint", "." ]
6674bdd56680e8c8130260634a4086d469d8c7f2
https://github.com/jackspirou/clientjs/blob/6674bdd56680e8c8130260634a4086d469d8c7f2/src/client.js#L163-L182
train
jackspirou/clientjs
src/client.js
function() { var bar = '|'; var key = ""; for (var i = 0; i < arguments.length; i++) { key += arguments[i] + bar; } return murmurhash3_32_gc(key, 256); }
javascript
function() { var bar = '|'; var key = ""; for (var i = 0; i < arguments.length; i++) { key += arguments[i] + bar; } return murmurhash3_32_gc(key, 256); }
[ "function", "(", ")", "{", "var", "bar", "=", "'|'", ";", "var", "key", "=", "\"\"", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "arguments", ".", "length", ";", "i", "++", ")", "{", "key", "+=", "arguments", "[", "i", "]", "+", "...
Get Custom Fingerprint. Take a string of datapoints and eturn a 32-bit integer representing the browsers fingerprint.
[ "Get", "Custom", "Fingerprint", ".", "Take", "a", "string", "of", "datapoints", "and", "eturn", "a", "32", "-", "bit", "integer", "representing", "the", "browsers", "fingerprint", "." ]
6674bdd56680e8c8130260634a4086d469d8c7f2
https://github.com/jackspirou/clientjs/blob/6674bdd56680e8c8130260634a4086d469d8c7f2/src/client.js#L185-L192
train
jackspirou/clientjs
src/client.js
function() { // detectmobilebrowsers.com JavaScript Mobile Detection Script var dataString = browserData.ua || navigator.vendor || window.opera; return (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobi...
javascript
function() { // detectmobilebrowsers.com JavaScript Mobile Detection Script var dataString = browserData.ua || navigator.vendor || window.opera; return (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobi...
[ "function", "(", ")", "{", "// detectmobilebrowsers.com JavaScript Mobile Detection Script", "var", "dataString", "=", "browserData", ".", "ua", "||", "navigator", ".", "vendor", "||", "window", ".", "opera", ";", "return", "(", "/", "(android|bb\\d+|meego).+mobile|avan...
MOBILE METHODS Is Mobile. Check if the browser is on a mobile device.
[ "MOBILE", "METHODS", "Is", "Mobile", ".", "Check", "if", "the", "browser", "is", "on", "a", "mobile", "device", "." ]
6674bdd56680e8c8130260634a4086d469d8c7f2
https://github.com/jackspirou/clientjs/blob/6674bdd56680e8c8130260634a4086d469d8c7f2/src/client.js#L343-L347
train
jackspirou/clientjs
src/client.js
function() { var pluginsList = ""; for (var i = 0; i < navigator.plugins.length; i++) { if (i == navigator.plugins.length - 1) { pluginsList += navigator.plugins[i].name; } else { pluginsList += navigator.plugins[i].name + ", "; } } return pluginsList...
javascript
function() { var pluginsList = ""; for (var i = 0; i < navigator.plugins.length; i++) { if (i == navigator.plugins.length - 1) { pluginsList += navigator.plugins[i].name; } else { pluginsList += navigator.plugins[i].name + ", "; } } return pluginsList...
[ "function", "(", ")", "{", "var", "pluginsList", "=", "\"\"", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "navigator", ".", "plugins", ".", "length", ";", "i", "++", ")", "{", "if", "(", "i", "==", "navigator", ".", "plugins", ".", "l...
PLUGIN METHODS Get Plugins. Return a string containing a list of installed plugins.
[ "PLUGIN", "METHODS", "Get", "Plugins", ".", "Return", "a", "string", "containing", "a", "list", "of", "installed", "plugins", "." ]
6674bdd56680e8c8130260634a4086d469d8c7f2
https://github.com/jackspirou/clientjs/blob/6674bdd56680e8c8130260634a4086d469d8c7f2/src/client.js#L461-L472
train
jackspirou/clientjs
src/client.js
function() { var mimeTypeList = ""; for (var i = 0; i < navigator.mimeTypes.length; i++) { if (i == navigator.mimeTypes.length - 1) { mimeTypeList += navigator.mimeTypes[i].description; } else { mimeTypeList += navigator.mimeTypes[i].description + ", "; } }...
javascript
function() { var mimeTypeList = ""; for (var i = 0; i < navigator.mimeTypes.length; i++) { if (i == navigator.mimeTypes.length - 1) { mimeTypeList += navigator.mimeTypes[i].description; } else { mimeTypeList += navigator.mimeTypes[i].description + ", "; } }...
[ "function", "(", ")", "{", "var", "mimeTypeList", "=", "\"\"", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "navigator", ".", "mimeTypes", ".", "length", ";", "i", "++", ")", "{", "if", "(", "i", "==", "navigator", ".", "mimeTypes", ".",...
Get Mime Types. Return a string containing a list of installed mime types.
[ "Get", "Mime", "Types", ".", "Return", "a", "string", "containing", "a", "list", "of", "installed", "mime", "types", "." ]
6674bdd56680e8c8130260634a4086d469d8c7f2
https://github.com/jackspirou/clientjs/blob/6674bdd56680e8c8130260634a4086d469d8c7f2/src/client.js#L533-L544
train
jackspirou/clientjs
src/client.js
function() { // create a canvas element var canvas = document.createElement('canvas'); // define a context var that will be used for browsers with canvas support var ctx; // try/catch for older browsers that don't support the canvas element try { // attempt to give ctx a ...
javascript
function() { // create a canvas element var canvas = document.createElement('canvas'); // define a context var that will be used for browsers with canvas support var ctx; // try/catch for older browsers that don't support the canvas element try { // attempt to give ctx a ...
[ "function", "(", ")", "{", "// create a canvas element", "var", "canvas", "=", "document", ".", "createElement", "(", "'canvas'", ")", ";", "// define a context var that will be used for browsers with canvas support", "var", "ctx", ";", "// try/catch for older browsers that don...
Get Canvas Print. Return a string containing the canvas URI data.
[ "Get", "Canvas", "Print", ".", "Return", "a", "string", "containing", "the", "canvas", "URI", "data", "." ]
6674bdd56680e8c8130260634a4086d469d8c7f2
https://github.com/jackspirou/clientjs/blob/6674bdd56680e8c8130260634a4086d469d8c7f2/src/client.js#L648-L683
train
SAP/chevrotain
examples/grammars/tinyc/tinyc.js
createToken
function createToken(options) { const newToken = chevrotain.createToken(options) allTokens.push(newToken) return newToken }
javascript
function createToken(options) { const newToken = chevrotain.createToken(options) allTokens.push(newToken) return newToken }
[ "function", "createToken", "(", "options", ")", "{", "const", "newToken", "=", "chevrotain", ".", "createToken", "(", "options", ")", "allTokens", ".", "push", "(", "newToken", ")", "return", "newToken", "}" ]
Utility to avoid manually building the allTokens array
[ "Utility", "to", "avoid", "manually", "building", "the", "allTokens", "array" ]
1ffe6c74590af8af037dc638d787602571a10a0e
https://github.com/SAP/chevrotain/blob/1ffe6c74590af8af037dc638d787602571a10a0e/examples/grammars/tinyc/tinyc.js#L13-L17
train
SAP/chevrotain
examples/tutorial/tutorial_spec.js
minimizeCst
function minimizeCst(cstElement) { // tokenType idx is auto generated, can't assert over it if (cstElement.tokenType) { delete cstElement.tokenType } // CstNode if (cstElement.children !== undefined) { cstElement.children = _.o...
javascript
function minimizeCst(cstElement) { // tokenType idx is auto generated, can't assert over it if (cstElement.tokenType) { delete cstElement.tokenType } // CstNode if (cstElement.children !== undefined) { cstElement.children = _.o...
[ "function", "minimizeCst", "(", "cstElement", ")", "{", "// tokenType idx is auto generated, can't assert over it", "if", "(", "cstElement", ".", "tokenType", ")", "{", "delete", "cstElement", ".", "tokenType", "}", "// CstNode", "if", "(", "cstElement", ".", "childre...
to make it easier to understand the assertions
[ "to", "make", "it", "easier", "to", "understand", "the", "assertions" ]
1ffe6c74590af8af037dc638d787602571a10a0e
https://github.com/SAP/chevrotain/blob/1ffe6c74590af8af037dc638d787602571a10a0e/examples/tutorial/tutorial_spec.js#L115-L130
train
SAP/chevrotain
examples/custom_apis/combinator/combinator_api.js
toOriginalText
function toOriginalText(item) { if (_.has(item, "tokenName")) { return item.tokenName } else if (item instanceof Rule) { return item.name } else if (_.isString(item)) { return item } else if (_.has(item, "toRule")) { return item.definition.orgText } else { thr...
javascript
function toOriginalText(item) { if (_.has(item, "tokenName")) { return item.tokenName } else if (item instanceof Rule) { return item.name } else if (_.isString(item)) { return item } else if (_.has(item, "toRule")) { return item.definition.orgText } else { thr...
[ "function", "toOriginalText", "(", "item", ")", "{", "if", "(", "_", ".", "has", "(", "item", ",", "\"tokenName\"", ")", ")", "{", "return", "item", ".", "tokenName", "}", "else", "if", "(", "item", "instanceof", "Rule", ")", "{", "return", "item", "...
Attempts to reconstruct the original api usage text for better error message purposes.
[ "Attempts", "to", "reconstruct", "the", "original", "api", "usage", "text", "for", "better", "error", "message", "purposes", "." ]
1ffe6c74590af8af037dc638d787602571a10a0e
https://github.com/SAP/chevrotain/blob/1ffe6c74590af8af037dc638d787602571a10a0e/examples/custom_apis/combinator/combinator_api.js#L150-L162
train
d3/d3-hierarchy
src/tree.js
nextRight
function nextRight(v) { var children = v.children; return children ? children[children.length - 1] : v.t; }
javascript
function nextRight(v) { var children = v.children; return children ? children[children.length - 1] : v.t; }
[ "function", "nextRight", "(", "v", ")", "{", "var", "children", "=", "v", ".", "children", ";", "return", "children", "?", "children", "[", "children", ".", "length", "-", "1", "]", ":", "v", ".", "t", ";", "}" ]
This function works analogously to nextLeft.
[ "This", "function", "works", "analogously", "to", "nextLeft", "." ]
7d22381f87ac7e28ff58f725e70f0a40f5b1c625
https://github.com/d3/d3-hierarchy/blob/7d22381f87ac7e28ff58f725e70f0a40f5b1c625/src/tree.js#L21-L24
train
d3/d3-hierarchy
src/tree.js
firstWalk
function firstWalk(v) { var children = v.children, siblings = v.parent.children, w = v.i ? siblings[v.i - 1] : null; if (children) { executeShifts(v); var midpoint = (children[0].z + children[children.length - 1].z) / 2; if (w) { v.z = w.z + separation(v._, w._); ...
javascript
function firstWalk(v) { var children = v.children, siblings = v.parent.children, w = v.i ? siblings[v.i - 1] : null; if (children) { executeShifts(v); var midpoint = (children[0].z + children[children.length - 1].z) / 2; if (w) { v.z = w.z + separation(v._, w._); ...
[ "function", "firstWalk", "(", "v", ")", "{", "var", "children", "=", "v", ".", "children", ",", "siblings", "=", "v", ".", "parent", ".", "children", ",", "w", "=", "v", ".", "i", "?", "siblings", "[", "v", ".", "i", "-", "1", "]", ":", "null",...
Computes a preliminary x-coordinate for v. Before that, FIRST WALK is applied recursively to the children of v, as well as the function APPORTION. After spacing out the children by calling EXECUTE SHIFTS, the node v is placed to the midpoint of its outermost children.
[ "Computes", "a", "preliminary", "x", "-", "coordinate", "for", "v", ".", "Before", "that", "FIRST", "WALK", "is", "applied", "recursively", "to", "the", "children", "of", "v", "as", "well", "as", "the", "function", "APPORTION", ".", "After", "spacing", "ou...
7d22381f87ac7e28ff58f725e70f0a40f5b1c625
https://github.com/d3/d3-hierarchy/blob/7d22381f87ac7e28ff58f725e70f0a40f5b1c625/src/tree.js#L144-L161
train
imsky/holder
holder.js
function(name, theme) { name != null && theme != null && (App.settings.themes[name] = theme); delete App.vars.cache.themeKeys; return this; }
javascript
function(name, theme) { name != null && theme != null && (App.settings.themes[name] = theme); delete App.vars.cache.themeKeys; return this; }
[ "function", "(", "name", ",", "theme", ")", "{", "name", "!=", "null", "&&", "theme", "!=", "null", "&&", "(", "App", ".", "settings", ".", "themes", "[", "name", "]", "=", "theme", ")", ";", "delete", "App", ".", "vars", ".", "cache", ".", "them...
Adds a theme to default settings @param {string} name Theme name @param {Object} theme Theme object, with foreground, background, size, font, and fontweight properties.
[ "Adds", "a", "theme", "to", "default", "settings" ]
220827ebe4097b9a76f150590f8bdf521803aba8
https://github.com/imsky/holder/blob/220827ebe4097b9a76f150590f8bdf521803aba8/holder.js#L349-L353
train
imsky/holder
holder.js
function(src, el) { //todo: use jquery fallback if available for all QSA references var nodes = DOM.getNodeArray(el); nodes.forEach(function (node) { var img = DOM.newEl('img'); var domProps = {}; domProps[App.setup.dataAttr] = src; DOM.setA...
javascript
function(src, el) { //todo: use jquery fallback if available for all QSA references var nodes = DOM.getNodeArray(el); nodes.forEach(function (node) { var img = DOM.newEl('img'); var domProps = {}; domProps[App.setup.dataAttr] = src; DOM.setA...
[ "function", "(", "src", ",", "el", ")", "{", "//todo: use jquery fallback if available for all QSA references", "var", "nodes", "=", "DOM", ".", "getNodeArray", "(", "el", ")", ";", "nodes", ".", "forEach", "(", "function", "(", "node", ")", "{", "var", "img",...
Appends a placeholder to an element @param {string} src Placeholder URL string @param el A selector or a reference to a DOM node
[ "Appends", "a", "placeholder", "to", "an", "element" ]
220827ebe4097b9a76f150590f8bdf521803aba8
https://github.com/imsky/holder/blob/220827ebe4097b9a76f150590f8bdf521803aba8/holder.js#L361-L372
train
imsky/holder
holder.js
function(el, value) { if (el.holderData) { el.holderData.resizeUpdate = !!value; if (el.holderData.resizeUpdate) { updateResizableElements(el); } } }
javascript
function(el, value) { if (el.holderData) { el.holderData.resizeUpdate = !!value; if (el.holderData.resizeUpdate) { updateResizableElements(el); } } }
[ "function", "(", "el", ",", "value", ")", "{", "if", "(", "el", ".", "holderData", ")", "{", "el", ".", "holderData", ".", "resizeUpdate", "=", "!", "!", "value", ";", "if", "(", "el", ".", "holderData", ".", "resizeUpdate", ")", "{", "updateResizabl...
Sets whether or not an image is updated on resize. If an image is set to be updated, it is immediately rendered. @param {Object} el Image DOM element @param {Boolean} value Resizable update flag value
[ "Sets", "whether", "or", "not", "an", "image", "is", "updated", "on", "resize", ".", "If", "an", "image", "is", "set", "to", "be", "updated", "it", "is", "immediately", "rendered", "." ]
220827ebe4097b9a76f150590f8bdf521803aba8
https://github.com/imsky/holder/blob/220827ebe4097b9a76f150590f8bdf521803aba8/holder.js#L381-L388
train
imsky/holder
holder.js
prepareImageElement
function prepareImageElement(options, engineSettings, src, el) { var holderFlags = parseURL(src.substr(src.lastIndexOf(options.domain)), options); if (holderFlags) { prepareDOMElement({ mode: null, el: el, flags: holderFlags, engineSettings: engineS...
javascript
function prepareImageElement(options, engineSettings, src, el) { var holderFlags = parseURL(src.substr(src.lastIndexOf(options.domain)), options); if (holderFlags) { prepareDOMElement({ mode: null, el: el, flags: holderFlags, engineSettings: engineS...
[ "function", "prepareImageElement", "(", "options", ",", "engineSettings", ",", "src", ",", "el", ")", "{", "var", "holderFlags", "=", "parseURL", "(", "src", ".", "substr", "(", "src", ".", "lastIndexOf", "(", "options", ".", "domain", ")", ")", ",", "op...
Processes provided source attribute and sets up the appropriate rendering workflow @private @param options Instance options from Holder.run @param renderSettings Instance configuration @param src Image URL @param el Image DOM element
[ "Processes", "provided", "source", "attribute", "and", "sets", "up", "the", "appropriate", "rendering", "workflow" ]
220827ebe4097b9a76f150590f8bdf521803aba8
https://github.com/imsky/holder/blob/220827ebe4097b9a76f150590f8bdf521803aba8/holder.js#L576-L586
train
imsky/holder
holder.js
render
function render(renderSettings) { var image = null; var mode = renderSettings.mode; var el = renderSettings.el; var holderSettings = renderSettings.holderSettings; var engineSettings = renderSettings.engineSettings; switch (engineSettings.renderer) { case 'svg': if (...
javascript
function render(renderSettings) { var image = null; var mode = renderSettings.mode; var el = renderSettings.el; var holderSettings = renderSettings.holderSettings; var engineSettings = renderSettings.engineSettings; switch (engineSettings.renderer) { case 'svg': if (...
[ "function", "render", "(", "renderSettings", ")", "{", "var", "image", "=", "null", ";", "var", "mode", "=", "renderSettings", ".", "mode", ";", "var", "el", "=", "renderSettings", ".", "el", ";", "var", "holderSettings", "=", "renderSettings", ".", "holde...
Core function that takes output from renderers and sets it as the source or background-image of the target element @private @param renderSettings Renderer settings
[ "Core", "function", "that", "takes", "output", "from", "renderers", "and", "sets", "it", "as", "the", "source", "or", "background", "-", "image", "of", "the", "target", "element" ]
220827ebe4097b9a76f150590f8bdf521803aba8
https://github.com/imsky/holder/blob/220827ebe4097b9a76f150590f8bdf521803aba8/holder.js#L862-L954
train
imsky/holder
holder.js
textSize
function textSize(width, height, fontSize, scale) { var stageWidth = parseInt(width, 10); var stageHeight = parseInt(height, 10); var bigSide = Math.max(stageWidth, stageHeight); var smallSide = Math.min(stageWidth, stageHeight); var newHeight = 0.8 * Math.min(smallSide, bigSide * scale); ...
javascript
function textSize(width, height, fontSize, scale) { var stageWidth = parseInt(width, 10); var stageHeight = parseInt(height, 10); var bigSide = Math.max(stageWidth, stageHeight); var smallSide = Math.min(stageWidth, stageHeight); var newHeight = 0.8 * Math.min(smallSide, bigSide * scale); ...
[ "function", "textSize", "(", "width", ",", "height", ",", "fontSize", ",", "scale", ")", "{", "var", "stageWidth", "=", "parseInt", "(", "width", ",", "10", ")", ";", "var", "stageHeight", "=", "parseInt", "(", "height", ",", "10", ")", ";", "var", "...
Adaptive text sizing function @private @param width Parent width @param height Parent height @param fontSize Requested text size @param scale Proportional scale of text
[ "Adaptive", "text", "sizing", "function" ]
220827ebe4097b9a76f150590f8bdf521803aba8
https://github.com/imsky/holder/blob/220827ebe4097b9a76f150590f8bdf521803aba8/holder.js#L1150-L1159
train
imsky/holder
holder.js
setInitialDimensions
function setInitialDimensions(el) { if (el.holderData) { var dimensions = dimensionCheck(el); if (dimensions) { var flags = el.holderData.flags; var fluidConfig = { fluidHeight: flags.dimensions.height.slice(-1) == '%', fluidWidth: flag...
javascript
function setInitialDimensions(el) { if (el.holderData) { var dimensions = dimensionCheck(el); if (dimensions) { var flags = el.holderData.flags; var fluidConfig = { fluidHeight: flags.dimensions.height.slice(-1) == '%', fluidWidth: flag...
[ "function", "setInitialDimensions", "(", "el", ")", "{", "if", "(", "el", ".", "holderData", ")", "{", "var", "dimensions", "=", "dimensionCheck", "(", "el", ")", ";", "if", "(", "dimensions", ")", "{", "var", "flags", "=", "el", ".", "holderData", "."...
Sets up aspect ratio metadata for fluid placeholders, in order to preserve proportions when resizing @private @param el Image DOM element
[ "Sets", "up", "aspect", "ratio", "metadata", "for", "fluid", "placeholders", "in", "order", "to", "preserve", "proportions", "when", "resizing" ]
220827ebe4097b9a76f150590f8bdf521803aba8
https://github.com/imsky/holder/blob/220827ebe4097b9a76f150590f8bdf521803aba8/holder.js#L1226-L1252
train
imsky/holder
holder.js
visibilityCheck
function visibilityCheck() { var renderableImages = []; var keys = Object.keys(App.vars.invisibleImages); var el; keys.forEach(function (key) { el = App.vars.invisibleImages[key]; if (dimensionCheck(el) && el.nodeName.toLowerCase() == 'img') { renderableImages.push(el...
javascript
function visibilityCheck() { var renderableImages = []; var keys = Object.keys(App.vars.invisibleImages); var el; keys.forEach(function (key) { el = App.vars.invisibleImages[key]; if (dimensionCheck(el) && el.nodeName.toLowerCase() == 'img') { renderableImages.push(el...
[ "function", "visibilityCheck", "(", ")", "{", "var", "renderableImages", "=", "[", "]", ";", "var", "keys", "=", "Object", ".", "keys", "(", "App", ".", "vars", ".", "invisibleImages", ")", ";", "var", "el", ";", "keys", ".", "forEach", "(", "function"...
Iterates through all current invisible images, and if they're visible, renders them and removes them from further checks. Runs every animation frame. @private
[ "Iterates", "through", "all", "current", "invisible", "images", "and", "if", "they", "re", "visible", "renders", "them", "and", "removes", "them", "from", "further", "checks", ".", "Runs", "every", "animation", "frame", "." ]
220827ebe4097b9a76f150590f8bdf521803aba8
https://github.com/imsky/holder/blob/220827ebe4097b9a76f150590f8bdf521803aba8/holder.js#L1259-L1282
train
imsky/holder
holder.js
startVisibilityCheck
function startVisibilityCheck() { if (!App.vars.visibilityCheckStarted) { global.requestAnimationFrame(visibilityCheck); App.vars.visibilityCheckStarted = true; } }
javascript
function startVisibilityCheck() { if (!App.vars.visibilityCheckStarted) { global.requestAnimationFrame(visibilityCheck); App.vars.visibilityCheckStarted = true; } }
[ "function", "startVisibilityCheck", "(", ")", "{", "if", "(", "!", "App", ".", "vars", ".", "visibilityCheckStarted", ")", "{", "global", ".", "requestAnimationFrame", "(", "visibilityCheck", ")", ";", "App", ".", "vars", ".", "visibilityCheckStarted", "=", "t...
Starts checking for invisible placeholders if not doing so yet. Does nothing otherwise. @private
[ "Starts", "checking", "for", "invisible", "placeholders", "if", "not", "doing", "so", "yet", ".", "Does", "nothing", "otherwise", "." ]
220827ebe4097b9a76f150590f8bdf521803aba8
https://github.com/imsky/holder/blob/220827ebe4097b9a76f150590f8bdf521803aba8/holder.js#L1289-L1294
train
imsky/holder
holder.js
setInvisible
function setInvisible(el) { if (!el.holderData.invisibleId) { App.vars.invisibleId += 1; App.vars.invisibleImages['i' + App.vars.invisibleId] = el; el.holderData.invisibleId = App.vars.invisibleId; } }
javascript
function setInvisible(el) { if (!el.holderData.invisibleId) { App.vars.invisibleId += 1; App.vars.invisibleImages['i' + App.vars.invisibleId] = el; el.holderData.invisibleId = App.vars.invisibleId; } }
[ "function", "setInvisible", "(", "el", ")", "{", "if", "(", "!", "el", ".", "holderData", ".", "invisibleId", ")", "{", "App", ".", "vars", ".", "invisibleId", "+=", "1", ";", "App", ".", "vars", ".", "invisibleImages", "[", "'i'", "+", "App", ".", ...
Sets a unique ID for an image detected to be invisible and adds it to the map of invisible images checked by visibilityCheck @private @param el Invisible DOM element
[ "Sets", "a", "unique", "ID", "for", "an", "image", "detected", "to", "be", "invisible", "and", "adds", "it", "to", "the", "map", "of", "invisible", "images", "checked", "by", "visibilityCheck" ]
220827ebe4097b9a76f150590f8bdf521803aba8
https://github.com/imsky/holder/blob/220827ebe4097b9a76f150590f8bdf521803aba8/holder.js#L1302-L1308
train
imsky/holder
holder.js
debounce
function debounce(fn) { if (!App.vars.debounceTimer) fn.call(this); if (App.vars.debounceTimer) global.clearTimeout(App.vars.debounceTimer); App.vars.debounceTimer = global.setTimeout(function() { App.vars.debounceTimer = null; fn.call(this); }, App.setup.debounce); }
javascript
function debounce(fn) { if (!App.vars.debounceTimer) fn.call(this); if (App.vars.debounceTimer) global.clearTimeout(App.vars.debounceTimer); App.vars.debounceTimer = global.setTimeout(function() { App.vars.debounceTimer = null; fn.call(this); }, App.setup.debounce); }
[ "function", "debounce", "(", "fn", ")", "{", "if", "(", "!", "App", ".", "vars", ".", "debounceTimer", ")", "fn", ".", "call", "(", "this", ")", ";", "if", "(", "App", ".", "vars", ".", "debounceTimer", ")", "global", ".", "clearTimeout", "(", "App...
Helpers Prevents a function from being called too often, waits until a timer elapses to call it again @param fn Function to call
[ "Helpers", "Prevents", "a", "function", "from", "being", "called", "too", "often", "waits", "until", "a", "timer", "elapses", "to", "call", "it", "again" ]
220827ebe4097b9a76f150590f8bdf521803aba8
https://github.com/imsky/holder/blob/220827ebe4097b9a76f150590f8bdf521803aba8/holder.js#L1419-L1426
train
imsky/holder
holder.js
completed
function completed( event ) { // readyState === "complete" is good enough for us to call the dom ready in oldIE if ( w3c || event.type === LOAD || doc[READYSTATE] === COMPLETE ) { detach(); ready(); } }
javascript
function completed( event ) { // readyState === "complete" is good enough for us to call the dom ready in oldIE if ( w3c || event.type === LOAD || doc[READYSTATE] === COMPLETE ) { detach(); ready(); } }
[ "function", "completed", "(", "event", ")", "{", "// readyState === \"complete\" is good enough for us to call the dom ready in oldIE", "if", "(", "w3c", "||", "event", ".", "type", "===", "LOAD", "||", "doc", "[", "READYSTATE", "]", "===", "COMPLETE", ")", "{", "de...
The ready event handler
[ "The", "ready", "event", "handler" ]
220827ebe4097b9a76f150590f8bdf521803aba8
https://github.com/imsky/holder/blob/220827ebe4097b9a76f150590f8bdf521803aba8/holder.js#L1582-L1588
train
imsky/holder
holder.js
detach
function detach() { if ( w3c ) { doc[REMOVEEVENTLISTENER]( DOMCONTENTLOADED, completed, FALSE ); win[REMOVEEVENTLISTENER]( LOAD, completed, FALSE ); } else { doc[DETACHEVENT]( ONREADYSTATECHANGE, completed ); win[DETACHEVENT]( ONLOAD, completed ); ...
javascript
function detach() { if ( w3c ) { doc[REMOVEEVENTLISTENER]( DOMCONTENTLOADED, completed, FALSE ); win[REMOVEEVENTLISTENER]( LOAD, completed, FALSE ); } else { doc[DETACHEVENT]( ONREADYSTATECHANGE, completed ); win[DETACHEVENT]( ONLOAD, completed ); ...
[ "function", "detach", "(", ")", "{", "if", "(", "w3c", ")", "{", "doc", "[", "REMOVEEVENTLISTENER", "]", "(", "DOMCONTENTLOADED", ",", "completed", ",", "FALSE", ")", ";", "win", "[", "REMOVEEVENTLISTENER", "]", "(", "LOAD", ",", "completed", ",", "FALSE...
Clean-up method for dom ready events
[ "Clean", "-", "up", "method", "for", "dom", "ready", "events" ]
220827ebe4097b9a76f150590f8bdf521803aba8
https://github.com/imsky/holder/blob/220827ebe4097b9a76f150590f8bdf521803aba8/holder.js#L1591-L1599
train
wix/react-templates
src/utils.js
usesScopeName
function usesScopeName(scopeNames, node) { function usesScope(root) { return usesScopeName(scopeNames, root) } if (_.isEmpty(scopeNames)) { return false } // rt-if="x" if (node.type === 'Identifier') { return _.includes(scopeNames, node.name) } // rt-if="e({key1: ...
javascript
function usesScopeName(scopeNames, node) { function usesScope(root) { return usesScopeName(scopeNames, root) } if (_.isEmpty(scopeNames)) { return false } // rt-if="x" if (node.type === 'Identifier') { return _.includes(scopeNames, node.name) } // rt-if="e({key1: ...
[ "function", "usesScopeName", "(", "scopeNames", ",", "node", ")", "{", "function", "usesScope", "(", "root", ")", "{", "return", "usesScopeName", "(", "scopeNames", ",", "root", ")", "}", "if", "(", "_", ".", "isEmpty", "(", "scopeNames", ")", ")", "{", ...
return true if any node in the given tree uses a scope name from the given set, false - otherwise. @param scopeNames a set of scope names to find @param node root of a syntax tree generated from an ExpressionStatement or one of its children.
[ "return", "true", "if", "any", "node", "in", "the", "given", "tree", "uses", "a", "scope", "name", "from", "the", "given", "set", "false", "-", "otherwise", "." ]
becfc2b789c412c9189c35dc900ab6185713cdae
https://github.com/wix/react-templates/blob/becfc2b789c412c9189c35dc900ab6185713cdae/src/utils.js#L91-L131
train