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
mipengine/mip2
packages/mip/src/register-element.js
loadCss
function loadCss (css, name) { if (css) { cssLoader.insertStyleElement(document, document.head, css, name, false) } }
javascript
function loadCss (css, name) { if (css) { cssLoader.insertStyleElement(document, document.head, css, name, false) } }
[ "function", "loadCss", "(", "css", ",", "name", ")", "{", "if", "(", "css", ")", "{", "cssLoader", ".", "insertStyleElement", "(", "document", ",", "document", ".", "head", ",", "css", ",", "name", ",", "false", ")", "}", "}" ]
Add a style tag to head by csstext @param {string} css Css code @param {string} name name
[ "Add", "a", "style", "tag", "to", "head", "by", "csstext" ]
f46dfdd628795d04054667ccd0e89f94e3c73821
https://github.com/mipengine/mip2/blob/f46dfdd628795d04054667ccd0e89f94e3c73821/packages/mip/src/register-element.js#L16-L20
train
mipengine/mip2
packages/mip/src/util/hash.js
ssEnabled
function ssEnabled () { let support = false try { window.sessionStorage.setItem('_t', 1) window.sessionStorage.removeItem('_t') support = true } catch (e) {} return support }
javascript
function ssEnabled () { let support = false try { window.sessionStorage.setItem('_t', 1) window.sessionStorage.removeItem('_t') support = true } catch (e) {} return support }
[ "function", "ssEnabled", "(", ")", "{", "let", "support", "=", "false", "try", "{", "window", ".", "sessionStorage", ".", "setItem", "(", "'_t'", ",", "1", ")", "window", ".", "sessionStorage", ".", "removeItem", "(", "'_t'", ")", "support", "=", "true",...
test ss is available @return {boolean} whether enabled or not
[ "test", "ss", "is", "available" ]
f46dfdd628795d04054667ccd0e89f94e3c73821
https://github.com/mipengine/mip2/blob/f46dfdd628795d04054667ccd0e89f94e3c73821/packages/mip/src/util/hash.js#L150-L159
train
mipengine/mip2
packages/mip/src/vue/core/observer/index.js
dependArray
function dependArray (value) { for (let e, i = 0, l = value.length; i < l; i++) { e = value[i] e && e.__ob__ && e.__ob__.dep.depend() if (Array.isArray(e)) { dependArray(e) } } }
javascript
function dependArray (value) { for (let e, i = 0, l = value.length; i < l; i++) { e = value[i] e && e.__ob__ && e.__ob__.dep.depend() if (Array.isArray(e)) { dependArray(e) } } }
[ "function", "dependArray", "(", "value", ")", "{", "for", "(", "let", "e", ",", "i", "=", "0", ",", "l", "=", "value", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "e", "=", "value", "[", "i", "]", "e", "&&", "e", ".", "__...
Collect dependencies on array elements when the array is touched, since we cannot intercept array element access like property getters.
[ "Collect", "dependencies", "on", "array", "elements", "when", "the", "array", "is", "touched", "since", "we", "cannot", "intercept", "array", "element", "access", "like", "property", "getters", "." ]
f46dfdd628795d04054667ccd0e89f94e3c73821
https://github.com/mipengine/mip2/blob/f46dfdd628795d04054667ccd0e89f94e3c73821/packages/mip/src/vue/core/observer/index.js#L268-L276
train
mipengine/mip2
packages/mip/src/mip1-polyfill/customElement.js
function () { function impl (element) { customElement.call(this, element) } impl.prototype = Object.create(customElement.prototype) return impl }
javascript
function () { function impl (element) { customElement.call(this, element) } impl.prototype = Object.create(customElement.prototype) return impl }
[ "function", "(", ")", "{", "function", "impl", "(", "element", ")", "{", "customElement", ".", "call", "(", "this", ",", "element", ")", "}", "impl", ".", "prototype", "=", "Object", ".", "create", "(", "customElement", ".", "prototype", ")", "return", ...
Create a class of a new type mip element @return {Function}
[ "Create", "a", "class", "of", "a", "new", "type", "mip", "element" ]
f46dfdd628795d04054667ccd0e89f94e3c73821
https://github.com/mipengine/mip2/blob/f46dfdd628795d04054667ccd0e89f94e3c73821/packages/mip/src/mip1-polyfill/customElement.js#L155-L161
train
mipengine/mip2
packages/mip/src/components/mip-shell/switchPage.js
forwardTransitionAndCreate
function forwardTransitionAndCreate (shell, options) { let {sourcePageId, targetPageId, targetPageMeta, onComplete} = options let loading = getLoading(targetPageMeta, {transitionContainsHeader: shell.transitionContainsHeader}) loading.classList.add('slide-enter', 'slide-enter-active') css(loading, 'display', 'b...
javascript
function forwardTransitionAndCreate (shell, options) { let {sourcePageId, targetPageId, targetPageMeta, onComplete} = options let loading = getLoading(targetPageMeta, {transitionContainsHeader: shell.transitionContainsHeader}) loading.classList.add('slide-enter', 'slide-enter-active') css(loading, 'display', 'b...
[ "function", "forwardTransitionAndCreate", "(", "shell", ",", "options", ")", "{", "let", "{", "sourcePageId", ",", "targetPageId", ",", "targetPageMeta", ",", "onComplete", "}", "=", "options", "let", "loading", "=", "getLoading", "(", "targetPageMeta", ",", "{"...
Forward transition and create new iframe @param {Object} shell shell instance @param {Object} options @param {string} options.targetPageId targetPageId @param {Object} options.targetPageMeta pageMeta of target page @param {string} options.sourcePageId sourcePageId @param {Object} options.sourcePageMeta pageMeta of sou...
[ "Forward", "transition", "and", "create", "new", "iframe" ]
f46dfdd628795d04054667ccd0e89f94e3c73821
https://github.com/mipengine/mip2/blob/f46dfdd628795d04054667ccd0e89f94e3c73821/packages/mip/src/components/mip-shell/switchPage.js#L72-L112
train
mipengine/mip2
packages/mip/src/components/mip-shell/switchPage.js
backwardTransitionAndCreate
function backwardTransitionAndCreate (shell, options) { let { targetPageId, targetPageMeta, sourcePageId, sourcePageMeta, onComplete } = options // Goto root page, resume scroll position (Only appears in backward) let rootPageScrollPosition = 0 fixRootPageScroll(shell, {targetPageId}) if...
javascript
function backwardTransitionAndCreate (shell, options) { let { targetPageId, targetPageMeta, sourcePageId, sourcePageMeta, onComplete } = options // Goto root page, resume scroll position (Only appears in backward) let rootPageScrollPosition = 0 fixRootPageScroll(shell, {targetPageId}) if...
[ "function", "backwardTransitionAndCreate", "(", "shell", ",", "options", ")", "{", "let", "{", "targetPageId", ",", "targetPageMeta", ",", "sourcePageId", ",", "sourcePageMeta", ",", "onComplete", "}", "=", "options", "// Goto root page, resume scroll position (Only appea...
Backward transition and create new iframe @param {Object} shell shell instance @param {Object} options @param {string} options.targetPageId targetPageId @param {Object} options.targetPageMeta pageMeta of target page @param {string} options.sourcePageId sourcePageId @param {Object} options.sourcePageMeta pageMeta of so...
[ "Backward", "transition", "and", "create", "new", "iframe" ]
f46dfdd628795d04054667ccd0e89f94e3c73821
https://github.com/mipengine/mip2/blob/f46dfdd628795d04054667ccd0e89f94e3c73821/packages/mip/src/components/mip-shell/switchPage.js#L127-L228
train
mipengine/mip2
packages/mip/src/components/mip-shell/switchPage.js
skipTransitionAndCreate
function skipTransitionAndCreate (shell, options) { let {sourcePageId, targetPageId, onComplete} = options hideAllIFrames() fixRootPageScroll(shell, {sourcePageId, targetPageId}) onComplete && onComplete() let iframe = getIFrame(targetPageId) css(iframe, 'z-index', activeZIndex++) shell.afterSwitchPage...
javascript
function skipTransitionAndCreate (shell, options) { let {sourcePageId, targetPageId, onComplete} = options hideAllIFrames() fixRootPageScroll(shell, {sourcePageId, targetPageId}) onComplete && onComplete() let iframe = getIFrame(targetPageId) css(iframe, 'z-index', activeZIndex++) shell.afterSwitchPage...
[ "function", "skipTransitionAndCreate", "(", "shell", ",", "options", ")", "{", "let", "{", "sourcePageId", ",", "targetPageId", ",", "onComplete", "}", "=", "options", "hideAllIFrames", "(", ")", "fixRootPageScroll", "(", "shell", ",", "{", "sourcePageId", ",", ...
Skip transition and create new iframe @param {Object} shell shell instance @param {Object} options @param {string} options.targetPageId targetPageId @param {Object} options.targetPageMeta pageMeta of target page @param {string} options.sourcePageId sourcePageId @param {Object} options.sourcePageMeta pageMeta of source...
[ "Skip", "transition", "and", "create", "new", "iframe" ]
f46dfdd628795d04054667ccd0e89f94e3c73821
https://github.com/mipengine/mip2/blob/f46dfdd628795d04054667ccd0e89f94e3c73821/packages/mip/src/components/mip-shell/switchPage.js#L418-L429
train
mipengine/mip2
packages/mip/src/mip1-polyfill/element.js
createBaseElementProto
function createBaseElementProto () { if (baseElementProto) { return baseElementProto } // Base element inherits from HTMLElement let proto = Object.create(HTMLElement.prototype) /** * Created callback of MIPElement. It will initialize the element. */ proto.createdCallback = function () { // ...
javascript
function createBaseElementProto () { if (baseElementProto) { return baseElementProto } // Base element inherits from HTMLElement let proto = Object.create(HTMLElement.prototype) /** * Created callback of MIPElement. It will initialize the element. */ proto.createdCallback = function () { // ...
[ "function", "createBaseElementProto", "(", ")", "{", "if", "(", "baseElementProto", ")", "{", "return", "baseElementProto", "}", "// Base element inherits from HTMLElement", "let", "proto", "=", "Object", ".", "create", "(", "HTMLElement", ".", "prototype", ")", "/*...
Create a basic prototype of mip elements classes @return {Object}
[ "Create", "a", "basic", "prototype", "of", "mip", "elements", "classes" ]
f46dfdd628795d04054667ccd0e89f94e3c73821
https://github.com/mipengine/mip2/blob/f46dfdd628795d04054667ccd0e89f94e3c73821/packages/mip/src/mip1-polyfill/element.js#L28-L188
train
mipengine/mip2
packages/mip/src/mip1-polyfill/element.js
createMipElementProto
function createMipElementProto (name) { let proto = Object.create(createBaseElementProto()) proto.name = name return proto }
javascript
function createMipElementProto (name) { let proto = Object.create(createBaseElementProto()) proto.name = name return proto }
[ "function", "createMipElementProto", "(", "name", ")", "{", "let", "proto", "=", "Object", ".", "create", "(", "createBaseElementProto", "(", ")", ")", "proto", ".", "name", "=", "name", "return", "proto", "}" ]
Create a mip element prototype by name @param {string} name The mip element's name @return {Object}
[ "Create", "a", "mip", "element", "prototype", "by", "name" ]
f46dfdd628795d04054667ccd0e89f94e3c73821
https://github.com/mipengine/mip2/blob/f46dfdd628795d04054667ccd0e89f94e3c73821/packages/mip/src/mip1-polyfill/element.js#L196-L200
train
mipengine/mip2
packages/mip/src/util/custom-storage.js
getErrorMess
function getErrorMess (code, name) { let mess switch (code) { case eCode.siteExceed: mess = 'storage space need less than 4k' break case eCode.lsExceed: mess = 'Uncaught DOMException: Failed to execute setItem on Storage: Setting the value of ' + name + ' exceeded the quota at ' + ...
javascript
function getErrorMess (code, name) { let mess switch (code) { case eCode.siteExceed: mess = 'storage space need less than 4k' break case eCode.lsExceed: mess = 'Uncaught DOMException: Failed to execute setItem on Storage: Setting the value of ' + name + ' exceeded the quota at ' + ...
[ "function", "getErrorMess", "(", "code", ",", "name", ")", "{", "let", "mess", "switch", "(", "code", ")", "{", "case", "eCode", ".", "siteExceed", ":", "mess", "=", "'storage space need less than 4k'", "break", "case", "eCode", ".", "lsExceed", ":", "mess",...
Get error message with error code @param {string} code error code @param {string} name error name @return {string} error message
[ "Get", "error", "message", "with", "error", "code" ]
f46dfdd628795d04054667ccd0e89f94e3c73821
https://github.com/mipengine/mip2/blob/f46dfdd628795d04054667ccd0e89f94e3c73821/packages/mip/src/util/custom-storage.js#L506-L517
train
mipengine/mip2
packages/mip/src/util/dom/dom.js
matches
function matches (element, selector) { if (!element || element.nodeType !== 1) { return false } return nativeMatches.call(element, selector) }
javascript
function matches (element, selector) { if (!element || element.nodeType !== 1) { return false } return nativeMatches.call(element, selector) }
[ "function", "matches", "(", "element", ",", "selector", ")", "{", "if", "(", "!", "element", "||", "element", ".", "nodeType", "!==", "1", ")", "{", "return", "false", "}", "return", "nativeMatches", ".", "call", "(", "element", ",", "selector", ")", "...
Support for matches. Check whether a element matches a selector. @param {HTMLElement} element target element @param {string} selector element selector @return {boolean}
[ "Support", "for", "matches", ".", "Check", "whether", "a", "element", "matches", "a", "selector", "." ]
f46dfdd628795d04054667ccd0e89f94e3c73821
https://github.com/mipengine/mip2/blob/f46dfdd628795d04054667ccd0e89f94e3c73821/packages/mip/src/util/dom/dom.js#L34-L39
train
mipengine/mip2
packages/mip/src/util/dom/dom.js
closestTo
function closestTo (element, selector, target) { let closestElement = closest(element, selector) return contains(target, closestElement) ? closestElement : null }
javascript
function closestTo (element, selector, target) { let closestElement = closest(element, selector) return contains(target, closestElement) ? closestElement : null }
[ "function", "closestTo", "(", "element", ",", "selector", ",", "target", ")", "{", "let", "closestElement", "=", "closest", "(", "element", ",", "selector", ")", "return", "contains", "(", "target", ",", "closestElement", ")", "?", "closestElement", ":", "nu...
Find the nearest element that matches the selector from current element to target element. @param {HTMLElement} element element @param {string} selector element selector @param {HTMLElement} target target element @return {?HTMLElement}
[ "Find", "the", "nearest", "element", "that", "matches", "the", "selector", "from", "current", "element", "to", "target", "element", "." ]
f46dfdd628795d04054667ccd0e89f94e3c73821
https://github.com/mipengine/mip2/blob/f46dfdd628795d04054667ccd0e89f94e3c73821/packages/mip/src/util/dom/dom.js#L92-L95
train
mipengine/mip2
packages/mip/src/util/dom/dom.js
create
function create (str) { createTmpElement.innerHTML = str if (!createTmpElement.children.length) { return null } let children = Array.prototype.slice.call(createTmpElement.children) createTmpElement.innerHTML = '' return children.length > 1 ? children : children[0] }
javascript
function create (str) { createTmpElement.innerHTML = str if (!createTmpElement.children.length) { return null } let children = Array.prototype.slice.call(createTmpElement.children) createTmpElement.innerHTML = '' return children.length > 1 ? children : children[0] }
[ "function", "create", "(", "str", ")", "{", "createTmpElement", ".", "innerHTML", "=", "str", "if", "(", "!", "createTmpElement", ".", "children", ".", "length", ")", "{", "return", "null", "}", "let", "children", "=", "Array", ".", "prototype", ".", "sl...
Create a element by string @param {string} str Html string @return {HTMLElement}
[ "Create", "a", "element", "by", "string" ]
f46dfdd628795d04054667ccd0e89f94e3c73821
https://github.com/mipengine/mip2/blob/f46dfdd628795d04054667ccd0e89f94e3c73821/packages/mip/src/util/dom/dom.js#L110-L118
train
mipengine/mip2
packages/mip/src/util/dom/dom.js
onDocumentState
function onDocumentState (doc, stateFn, callback) { let ready = stateFn(doc) if (ready) { callback(doc) return } const readyListener = () => { if (!stateFn(doc)) { return } if (!ready) { ready = true callback(doc) } doc.removeEventListener('readystatechange', r...
javascript
function onDocumentState (doc, stateFn, callback) { let ready = stateFn(doc) if (ready) { callback(doc) return } const readyListener = () => { if (!stateFn(doc)) { return } if (!ready) { ready = true callback(doc) } doc.removeEventListener('readystatechange', r...
[ "function", "onDocumentState", "(", "doc", ",", "stateFn", ",", "callback", ")", "{", "let", "ready", "=", "stateFn", "(", "doc", ")", "if", "(", "ready", ")", "{", "callback", "(", "doc", ")", "return", "}", "const", "readyListener", "=", "(", ")", ...
Calls the callback when document's state satisfies the stateFn. @param {!Document} doc @param {(doc: Document) => boolean} stateFn @param {(doc: Document) => void} callback
[ "Calls", "the", "callback", "when", "document", "s", "state", "satisfies", "the", "stateFn", "." ]
f46dfdd628795d04054667ccd0e89f94e3c73821
https://github.com/mipengine/mip2/blob/f46dfdd628795d04054667ccd0e89f94e3c73821/packages/mip/src/util/dom/dom.js#L205-L228
train
mipengine/mip2
packages/mip/src/util/dom/dom.js
insert
function insert (parent, children) { if (!parent || !children) { return } let nodes = Array.prototype.slice.call(children) if (nodes.length === 0) { nodes.push(children) } for (let i = 0; i < nodes.length; i++) { if (this.contains(nodes[i], parent)) { continue } if (nodes[i] !== pa...
javascript
function insert (parent, children) { if (!parent || !children) { return } let nodes = Array.prototype.slice.call(children) if (nodes.length === 0) { nodes.push(children) } for (let i = 0; i < nodes.length; i++) { if (this.contains(nodes[i], parent)) { continue } if (nodes[i] !== pa...
[ "function", "insert", "(", "parent", ",", "children", ")", "{", "if", "(", "!", "parent", "||", "!", "children", ")", "{", "return", "}", "let", "nodes", "=", "Array", ".", "prototype", ".", "slice", ".", "call", "(", "children", ")", "if", "(", "n...
Insert dom list to a node @param {HTMLElement} parent the node will be inserted @param {Array} children node list which will insert into parent
[ "Insert", "dom", "list", "to", "a", "node" ]
f46dfdd628795d04054667ccd0e89f94e3c73821
https://github.com/mipengine/mip2/blob/f46dfdd628795d04054667ccd0e89f94e3c73821/packages/mip/src/util/dom/dom.js#L246-L262
train
mipengine/mip2
packages/mip/src/util/dom/css.js
prefixProperty
function prefixProperty (property) { property = property.replace(camelReg, (match, first, char) => (first ? char : char.toUpperCase())) if (prefixCache[property]) { return prefixCache[property] } let prop if (!(property in supportElement.style)) { for (let i = 0; i < PREFIX_TYPE.length; i++) { ...
javascript
function prefixProperty (property) { property = property.replace(camelReg, (match, first, char) => (first ? char : char.toUpperCase())) if (prefixCache[property]) { return prefixCache[property] } let prop if (!(property in supportElement.style)) { for (let i = 0; i < PREFIX_TYPE.length; i++) { ...
[ "function", "prefixProperty", "(", "property", ")", "{", "property", "=", "property", ".", "replace", "(", "camelReg", ",", "(", "match", ",", "first", ",", "char", ")", "=>", "(", "first", "?", "char", ":", "char", ".", "toUpperCase", "(", ")", ")", ...
Make sure a property is supported by adding prefix. @param {string} property A property to be checked @return {string} the property or its prefixed version
[ "Make", "sure", "a", "property", "is", "supported", "by", "adding", "prefix", "." ]
f46dfdd628795d04054667ccd0e89f94e3c73821
https://github.com/mipengine/mip2/blob/f46dfdd628795d04054667ccd0e89f94e3c73821/packages/mip/src/util/dom/css.js#L26-L50
train
mipengine/mip2
packages/mip/src/util/dom/css.js
unitProperty
function unitProperty (property, value) { if (value !== +value) { return value } if (unitCache[property]) { return value + unitCache[property] } supportElement.style[property] = 0 let propValue = supportElement.style[property] let match = propValue.match && propValue.match(UNIT_REG) if (matc...
javascript
function unitProperty (property, value) { if (value !== +value) { return value } if (unitCache[property]) { return value + unitCache[property] } supportElement.style[property] = 0 let propValue = supportElement.style[property] let match = propValue.match && propValue.match(UNIT_REG) if (matc...
[ "function", "unitProperty", "(", "property", ",", "value", ")", "{", "if", "(", "value", "!==", "+", "value", ")", "{", "return", "value", "}", "if", "(", "unitCache", "[", "property", "]", ")", "{", "return", "value", "+", "unitCache", "[", "property"...
Obtain the unit of a property and add it to the value has no unit if exists. @param {string} property property @param {(string|number)} value A value maybe needs unit. @return {(string|number)}
[ "Obtain", "the", "unit", "of", "a", "property", "and", "add", "it", "to", "the", "value", "has", "no", "unit", "if", "exists", "." ]
f46dfdd628795d04054667ccd0e89f94e3c73821
https://github.com/mipengine/mip2/blob/f46dfdd628795d04054667ccd0e89f94e3c73821/packages/mip/src/util/dom/css.js#L66-L85
train
mipengine/mip2
packages/mip/src/layout.js
isLayoutSizeDefined
function isLayoutSizeDefined (layout) { return ( layout === LAYOUT.FIXED || layout === LAYOUT.FIXED_HEIGHT || layout === LAYOUT.RESPONSIVE || layout === LAYOUT.FILL || layout === LAYOUT.FLEX_ITEM || layout === LAYOUT.INTRINSIC ) }
javascript
function isLayoutSizeDefined (layout) { return ( layout === LAYOUT.FIXED || layout === LAYOUT.FIXED_HEIGHT || layout === LAYOUT.RESPONSIVE || layout === LAYOUT.FILL || layout === LAYOUT.FLEX_ITEM || layout === LAYOUT.INTRINSIC ) }
[ "function", "isLayoutSizeDefined", "(", "layout", ")", "{", "return", "(", "layout", "===", "LAYOUT", ".", "FIXED", "||", "layout", "===", "LAYOUT", ".", "FIXED_HEIGHT", "||", "layout", "===", "LAYOUT", ".", "RESPONSIVE", "||", "layout", "===", "LAYOUT", "."...
Whether an element with this layout inherently defines the size. @param {Layout} layout layout name @return {boolean}
[ "Whether", "an", "element", "with", "this", "layout", "inherently", "defines", "the", "size", "." ]
f46dfdd628795d04054667ccd0e89f94e3c73821
https://github.com/mipengine/mip2/blob/f46dfdd628795d04054667ccd0e89f94e3c73821/packages/mip/src/layout.js#L79-L88
train
mipengine/mip2
packages/mip/src/vue/core/util/options.js
checkComponents
function checkComponents (options) { for (const key in options.components) { const lower = key.toLowerCase() if (isBuiltInTag(lower) || config.isReservedTag(lower)) { warn( 'Do not use built-in or reserved HTML elements as component ' + 'id: ' + key ) } } }
javascript
function checkComponents (options) { for (const key in options.components) { const lower = key.toLowerCase() if (isBuiltInTag(lower) || config.isReservedTag(lower)) { warn( 'Do not use built-in or reserved HTML elements as component ' + 'id: ' + key ) } } }
[ "function", "checkComponents", "(", "options", ")", "{", "for", "(", "const", "key", "in", "options", ".", "components", ")", "{", "const", "lower", "=", "key", ".", "toLowerCase", "(", ")", "if", "(", "isBuiltInTag", "(", "lower", ")", "||", "config", ...
Validate component names
[ "Validate", "component", "names" ]
f46dfdd628795d04054667ccd0e89f94e3c73821
https://github.com/mipengine/mip2/blob/f46dfdd628795d04054667ccd0e89f94e3c73821/packages/mip/src/vue/core/util/options.js#L277-L287
train
mipengine/mip2
packages/mip/src/base-element.js
lastChildElement
function lastChildElement (parent, callback) { for (let child = parent.lastElementChild; child; child = child.previousElementSibling) { if (callback(child)) { return child } } return null }
javascript
function lastChildElement (parent, callback) { for (let child = parent.lastElementChild; child; child = child.previousElementSibling) { if (callback(child)) { return child } } return null }
[ "function", "lastChildElement", "(", "parent", ",", "callback", ")", "{", "for", "(", "let", "child", "=", "parent", ".", "lastElementChild", ";", "child", ";", "child", "=", "child", ".", "previousElementSibling", ")", "{", "if", "(", "callback", "(", "ch...
Finds the last child element that satisfies the callback. @param {!Element} parent @param {function(!Element):boolean} callback @return {?Element}
[ "Finds", "the", "last", "child", "element", "that", "satisfies", "the", "callback", "." ]
f46dfdd628795d04054667ccd0e89f94e3c73821
https://github.com/mipengine/mip2/blob/f46dfdd628795d04054667ccd0e89f94e3c73821/packages/mip/src/base-element.js#L26-L33
train
mipengine/mip2
packages/mip/src/base-element.js
isInternalNode
function isInternalNode (node) { let tagName = (typeof node === 'string') ? node : node.tagName if (tagName && tagName.toLowerCase().indexOf('mip-i-') === 0) { return true } if (node.tagName && (node.hasAttribute('placeholder') || node.hasAttribute('fallback') || node.hasAttribute('overflow')))...
javascript
function isInternalNode (node) { let tagName = (typeof node === 'string') ? node : node.tagName if (tagName && tagName.toLowerCase().indexOf('mip-i-') === 0) { return true } if (node.tagName && (node.hasAttribute('placeholder') || node.hasAttribute('fallback') || node.hasAttribute('overflow')))...
[ "function", "isInternalNode", "(", "node", ")", "{", "let", "tagName", "=", "(", "typeof", "node", "===", "'string'", ")", "?", "node", ":", "node", ".", "tagName", "if", "(", "tagName", "&&", "tagName", ".", "toLowerCase", "(", ")", ".", "indexOf", "(...
Returns "true" for internal MIP nodes or for placeholder elements. @param {!Node} node @return {boolean}
[ "Returns", "true", "for", "internal", "MIP", "nodes", "or", "for", "placeholder", "elements", "." ]
f46dfdd628795d04054667ccd0e89f94e3c73821
https://github.com/mipengine/mip2/blob/f46dfdd628795d04054667ccd0e89f94e3c73821/packages/mip/src/base-element.js#L40-L52
train
mipengine/mip2
packages/mip/src/util/gesture/index.js
touchHandler
function touchHandler (event) { let opt = this._opt opt.preventDefault && event.preventDefault() opt.stopPropagation && event.stopPropagation() // 如果 touchstart 没有被触发(可能被子元素的 touchstart 回调触发了 stopPropagation), // 那么后续的手势将取消计算 if (event.type !== 'touchstart' && !dataProcessor.startTime) { return } ...
javascript
function touchHandler (event) { let opt = this._opt opt.preventDefault && event.preventDefault() opt.stopPropagation && event.stopPropagation() // 如果 touchstart 没有被触发(可能被子元素的 touchstart 回调触发了 stopPropagation), // 那么后续的手势将取消计算 if (event.type !== 'touchstart' && !dataProcessor.startTime) { return } ...
[ "function", "touchHandler", "(", "event", ")", "{", "let", "opt", "=", "this", ".", "_opt", "opt", ".", "preventDefault", "&&", "event", ".", "preventDefault", "(", ")", "opt", ".", "stopPropagation", "&&", "event", ".", "stopPropagation", "(", ")", "// 如果...
Handle touch event. @inner @param {Event} event event
[ "Handle", "touch", "event", "." ]
f46dfdd628795d04054667ccd0e89f94e3c73821
https://github.com/mipengine/mip2/blob/f46dfdd628795d04054667ccd0e89f94e3c73821/packages/mip/src/util/gesture/index.js#L153-L167
train
mipengine/mip2
packages/mip/src/util/gesture/index.js
listenersHelp
function listenersHelp (element, events, handler, method) { let list = events.split(' ') for (let i = 0, len = list.length; i < len; i++) { let item = list[i] if (method === false) { element.removeEventListener(item, handler) } else { element.addEventListener(item, handler, false) } } ...
javascript
function listenersHelp (element, events, handler, method) { let list = events.split(' ') for (let i = 0, len = list.length; i < len; i++) { let item = list[i] if (method === false) { element.removeEventListener(item, handler) } else { element.addEventListener(item, handler, false) } } ...
[ "function", "listenersHelp", "(", "element", ",", "events", ",", "handler", ",", "method", ")", "{", "let", "list", "=", "events", ".", "split", "(", "' '", ")", "for", "(", "let", "i", "=", "0", ",", "len", "=", "list", ".", "length", ";", "i", ...
Add or remove listeners from an element. @inner @param {HTMLElement} element element @param {string} events Events' name that are splitted by space @param {Function} handler Event handler @param {?boolean} method Add or remove.
[ "Add", "or", "remove", "listeners", "from", "an", "element", "." ]
f46dfdd628795d04054667ccd0e89f94e3c73821
https://github.com/mipengine/mip2/blob/f46dfdd628795d04054667ccd0e89f94e3c73821/packages/mip/src/util/gesture/index.js#L178-L188
train
mipengine/mip2
packages/mip/src/components/mip-bind/watcher.js
flushWatcherQueue
function flushWatcherQueue () { flushing = true let watcher let id queue.sort((a, b) => a.id - b.id) for (index = 0; index < queue.length; index++) { watcher = queue[index] id = watcher.id has[id] = null watcher.run() // in dev build, check and stop circular updates. if (process.env....
javascript
function flushWatcherQueue () { flushing = true let watcher let id queue.sort((a, b) => a.id - b.id) for (index = 0; index < queue.length; index++) { watcher = queue[index] id = watcher.id has[id] = null watcher.run() // in dev build, check and stop circular updates. if (process.env....
[ "function", "flushWatcherQueue", "(", ")", "{", "flushing", "=", "true", "let", "watcher", "let", "id", "queue", ".", "sort", "(", "(", "a", ",", "b", ")", "=>", "a", ".", "id", "-", "b", ".", "id", ")", "for", "(", "index", "=", "0", ";", "ind...
Flush queues and run the watchers.
[ "Flush", "queues", "and", "run", "the", "watchers", "." ]
f46dfdd628795d04054667ccd0e89f94e3c73821
https://github.com/mipengine/mip2/blob/f46dfdd628795d04054667ccd0e89f94e3c73821/packages/mip/src/components/mip-bind/watcher.js#L139-L164
train
mipengine/mip2
packages/mip/src/util/dom/event.js
createEvent
function createEvent (type, data) { let event = document.createEvent(specialEvents[type] || 'Event') event.initEvent(type, true, true) data && (event.data = data) return event }
javascript
function createEvent (type, data) { let event = document.createEvent(specialEvents[type] || 'Event') event.initEvent(type, true, true) data && (event.data = data) return event }
[ "function", "createEvent", "(", "type", ",", "data", ")", "{", "let", "event", "=", "document", ".", "createEvent", "(", "specialEvents", "[", "type", "]", "||", "'Event'", ")", "event", ".", "initEvent", "(", "type", ",", "true", ",", "true", ")", "da...
Create a event object to dispatch @param {string} type Event name @param {?Object} data Custom data @return {Event}
[ "Create", "a", "event", "object", "to", "dispatch" ]
f46dfdd628795d04054667ccd0e89f94e3c73821
https://github.com/mipengine/mip2/blob/f46dfdd628795d04054667ccd0e89f94e3c73821/packages/mip/src/util/dom/event.js#L42-L47
train
mipengine/mip2
packages/mip/src/util/dom/event.js
listenOnce
function listenOnce (element, eventType, listener, optEvtListenerOpts) { let unlisten = listen(element, eventType, event => { unlisten() listener(event) }, optEvtListenerOpts) return unlisten }
javascript
function listenOnce (element, eventType, listener, optEvtListenerOpts) { let unlisten = listen(element, eventType, event => { unlisten() listener(event) }, optEvtListenerOpts) return unlisten }
[ "function", "listenOnce", "(", "element", ",", "eventType", ",", "listener", ",", "optEvtListenerOpts", ")", "{", "let", "unlisten", "=", "listen", "(", "element", ",", "eventType", ",", "event", "=>", "{", "unlisten", "(", ")", "listener", "(", "event", "...
Listens for the specified event on the element and removes the listener as soon as event has been received. @param {!EventTarget} element @param {string} eventType @param {function(!Event)} listener @param {Object=} optEvtListenerOpts @return {!UnlistenDef}
[ "Listens", "for", "the", "specified", "event", "on", "the", "element", "and", "removes", "the", "listener", "as", "soon", "as", "event", "has", "been", "received", "." ]
f46dfdd628795d04054667ccd0e89f94e3c73821
https://github.com/mipengine/mip2/blob/f46dfdd628795d04054667ccd0e89f94e3c73821/packages/mip/src/util/dom/event.js#L63-L69
train
mipengine/mip2
packages/mip/src/util/dom/event.js
loadPromise
function loadPromise (eleOrWindow) { if (isLoaded(eleOrWindow)) { return Promise.resolve(eleOrWindow) } let loadingPromise = new Promise((resolve, reject) => { // Listen once since IE 5/6/7 fire the onload event continuously for // animated GIFs. let {tagName} = eleOrWindow if (tagName === 'A...
javascript
function loadPromise (eleOrWindow) { if (isLoaded(eleOrWindow)) { return Promise.resolve(eleOrWindow) } let loadingPromise = new Promise((resolve, reject) => { // Listen once since IE 5/6/7 fire the onload event continuously for // animated GIFs. let {tagName} = eleOrWindow if (tagName === 'A...
[ "function", "loadPromise", "(", "eleOrWindow", ")", "{", "if", "(", "isLoaded", "(", "eleOrWindow", ")", ")", "{", "return", "Promise", ".", "resolve", "(", "eleOrWindow", ")", "}", "let", "loadingPromise", "=", "new", "Promise", "(", "(", "resolve", ",", ...
Returns a promise that will resolve or fail based on the eleOrWindow's 'load' and 'error' events. Optionally this method takes a timeout, which will reject the promise if the resource has not loaded by then. @param {T} eleOrWindow Supports both Elements and as a special case Windows. @return {!Promise<T>} @template T
[ "Returns", "a", "promise", "that", "will", "resolve", "or", "fail", "based", "on", "the", "eleOrWindow", "s", "load", "and", "error", "events", ".", "Optionally", "this", "method", "takes", "a", "timeout", "which", "will", "reject", "the", "promise", "if", ...
f46dfdd628795d04054667ccd0e89f94e3c73821
https://github.com/mipengine/mip2/blob/f46dfdd628795d04054667ccd0e89f94e3c73821/packages/mip/src/util/dom/event.js#L90-L111
train
cubehouse/themeparks
lib/merlinparks/chessingtonworldofadventures.js
ParseArea
function ParseArea(obj) { if (!obj) return; if (obj.areas) { for (var i in obj.areas) { AddRideName(obj.areas[i]); ParseArea(obj.areas[i]); } } if (obj.items) { for (var j in obj.items) { AddRideName(obj.items[j]); ParseArea(obj.i...
javascript
function ParseArea(obj) { if (!obj) return; if (obj.areas) { for (var i in obj.areas) { AddRideName(obj.areas[i]); ParseArea(obj.areas[i]); } } if (obj.items) { for (var j in obj.items) { AddRideName(obj.items[j]); ParseArea(obj.i...
[ "function", "ParseArea", "(", "obj", ")", "{", "if", "(", "!", "obj", ")", "return", ";", "if", "(", "obj", ".", "areas", ")", "{", "for", "(", "var", "i", "in", "obj", ".", "areas", ")", "{", "AddRideName", "(", "obj", ".", "areas", "[", "i", ...
parse ride names from manually extracted JSON file
[ "parse", "ride", "names", "from", "manually", "extracted", "JSON", "file" ]
0667da6b5c2e178d66257f0090f6cd5a77a003c6
https://github.com/cubehouse/themeparks/blob/0667da6b5c2e178d66257f0090f6cd5a77a003c6/lib/merlinparks/chessingtonworldofadventures.js#L14-L31
train
cubehouse/themeparks
docs/scripts/sunlight.js
function(context) { var evaluate = function(rules, createRule) { var i; rules = rules || []; for (i = 0; i < rules.length; i++) { if (typeof(rules[i]) === "function") { if (rules[i](context)) { return defaultHandleToken("named-ident")(context); } } else if (createRul...
javascript
function(context) { var evaluate = function(rules, createRule) { var i; rules = rules || []; for (i = 0; i < rules.length; i++) { if (typeof(rules[i]) === "function") { if (rules[i](context)) { return defaultHandleToken("named-ident")(context); } } else if (createRul...
[ "function", "(", "context", ")", "{", "var", "evaluate", "=", "function", "(", "rules", ",", "createRule", ")", "{", "var", "i", ";", "rules", "=", "rules", "||", "[", "]", ";", "for", "(", "i", "=", "0", ";", "i", "<", "rules", ".", "length", ...
this handles the named ident mayhem
[ "this", "handles", "the", "named", "ident", "mayhem" ]
0667da6b5c2e178d66257f0090f6cd5a77a003c6
https://github.com/cubehouse/themeparks/blob/0667da6b5c2e178d66257f0090f6cd5a77a003c6/docs/scripts/sunlight.js#L65-L87
train
cubehouse/themeparks
docs/scripts/sunlight.js
last
function last(thing) { return thing.charAt ? thing.charAt(thing.length - 1) : thing[thing.length - 1]; }
javascript
function last(thing) { return thing.charAt ? thing.charAt(thing.length - 1) : thing[thing.length - 1]; }
[ "function", "last", "(", "thing", ")", "{", "return", "thing", ".", "charAt", "?", "thing", ".", "charAt", "(", "thing", ".", "length", "-", "1", ")", ":", "thing", "[", "thing", ".", "length", "-", "1", "]", ";", "}" ]
gets the last character in a string or the last element in an array
[ "gets", "the", "last", "character", "in", "a", "string", "or", "the", "last", "element", "in", "an", "array" ]
0667da6b5c2e178d66257f0090f6cd5a77a003c6
https://github.com/cubehouse/themeparks/blob/0667da6b5c2e178d66257f0090f6cd5a77a003c6/docs/scripts/sunlight.js#L254-L256
train
cubehouse/themeparks
docs/scripts/sunlight.js
merge
function merge(defaultObject, objectToMerge) { var key; if (!objectToMerge) { return defaultObject; } for (key in objectToMerge) { defaultObject[key] = objectToMerge[key]; } return defaultObject; }
javascript
function merge(defaultObject, objectToMerge) { var key; if (!objectToMerge) { return defaultObject; } for (key in objectToMerge) { defaultObject[key] = objectToMerge[key]; } return defaultObject; }
[ "function", "merge", "(", "defaultObject", ",", "objectToMerge", ")", "{", "var", "key", ";", "if", "(", "!", "objectToMerge", ")", "{", "return", "defaultObject", ";", "}", "for", "(", "key", "in", "objectToMerge", ")", "{", "defaultObject", "[", "key", ...
non-recursively merges one object into the other
[ "non", "-", "recursively", "merges", "one", "object", "into", "the", "other" ]
0667da6b5c2e178d66257f0090f6cd5a77a003c6
https://github.com/cubehouse/themeparks/blob/0667da6b5c2e178d66257f0090f6cd5a77a003c6/docs/scripts/sunlight.js#L279-L290
train
cubehouse/themeparks
docs/scripts/sunlight.js
getNextWhile
function getNextWhile(tokens, index, direction, matcher) { var count = 1, token; direction = direction || 1; while (token = tokens[index + (direction * count++)]) { if (!matcher(token)) { return token; } } return undefined; }
javascript
function getNextWhile(tokens, index, direction, matcher) { var count = 1, token; direction = direction || 1; while (token = tokens[index + (direction * count++)]) { if (!matcher(token)) { return token; } } return undefined; }
[ "function", "getNextWhile", "(", "tokens", ",", "index", ",", "direction", ",", "matcher", ")", "{", "var", "count", "=", "1", ",", "token", ";", "direction", "=", "direction", "||", "1", ";", "while", "(", "token", "=", "tokens", "[", "index", "+", ...
gets the next token in the specified direction while matcher matches the current token
[ "gets", "the", "next", "token", "in", "the", "specified", "direction", "while", "matcher", "matches", "the", "current", "token" ]
0667da6b5c2e178d66257f0090f6cd5a77a003c6
https://github.com/cubehouse/themeparks/blob/0667da6b5c2e178d66257f0090f6cd5a77a003c6/docs/scripts/sunlight.js#L424-L436
train
cubehouse/themeparks
docs/scripts/sunlight.js
createHashMap
function createHashMap(wordMap, boundary, caseInsensitive) { //creates a hash table where the hash is the first character of the word var newMap = { }, i, word, firstChar; for (i = 0; i < wordMap.length; i++) { word = caseInsensitive ? wordMap[i].toUpperCase() : wordMap[i]; firstChar = word.char...
javascript
function createHashMap(wordMap, boundary, caseInsensitive) { //creates a hash table where the hash is the first character of the word var newMap = { }, i, word, firstChar; for (i = 0; i < wordMap.length; i++) { word = caseInsensitive ? wordMap[i].toUpperCase() : wordMap[i]; firstChar = word.char...
[ "function", "createHashMap", "(", "wordMap", ",", "boundary", ",", "caseInsensitive", ")", "{", "//creates a hash table where the hash is the first character of the word", "var", "newMap", "=", "{", "}", ",", "i", ",", "word", ",", "firstChar", ";", "for", "(", "i",...
this is crucial for performance
[ "this", "is", "crucial", "for", "performance" ]
0667da6b5c2e178d66257f0090f6cd5a77a003c6
https://github.com/cubehouse/themeparks/blob/0667da6b5c2e178d66257f0090f6cd5a77a003c6/docs/scripts/sunlight.js#L439-L457
train
cubehouse/themeparks
docs/scripts/sunlight.js
switchToEmbeddedLanguageIfNecessary
function switchToEmbeddedLanguageIfNecessary(context) { var i, embeddedLanguage; for (i = 0; i < context.language.embeddedLanguages.length; i++) { if (!languages[context.language.embeddedLanguages[i].language]) { //unregistered language continue; } embeddedLanguage = clone(conte...
javascript
function switchToEmbeddedLanguageIfNecessary(context) { var i, embeddedLanguage; for (i = 0; i < context.language.embeddedLanguages.length; i++) { if (!languages[context.language.embeddedLanguages[i].language]) { //unregistered language continue; } embeddedLanguage = clone(conte...
[ "function", "switchToEmbeddedLanguageIfNecessary", "(", "context", ")", "{", "var", "i", ",", "embeddedLanguage", ";", "for", "(", "i", "=", "0", ";", "i", "<", "context", ".", "language", ".", "embeddedLanguages", ".", "length", ";", "i", "++", ")", "{", ...
called before processing the current
[ "called", "before", "processing", "the", "current" ]
0667da6b5c2e178d66257f0090f6cd5a77a003c6
https://github.com/cubehouse/themeparks/blob/0667da6b5c2e178d66257f0090f6cd5a77a003c6/docs/scripts/sunlight.js#L724-L744
train
cubehouse/themeparks
docs/scripts/sunlight.js
switchBackFromEmbeddedLanguageIfNecessary
function switchBackFromEmbeddedLanguageIfNecessary(context) { var current = last(context.embeddedLanguageStack), lang; if (current && current.switchBack(context)) { context.language = languages[current.parentLanguage]; lang = context.embeddedLanguageStack.pop(); //restore old items co...
javascript
function switchBackFromEmbeddedLanguageIfNecessary(context) { var current = last(context.embeddedLanguageStack), lang; if (current && current.switchBack(context)) { context.language = languages[current.parentLanguage]; lang = context.embeddedLanguageStack.pop(); //restore old items co...
[ "function", "switchBackFromEmbeddedLanguageIfNecessary", "(", "context", ")", "{", "var", "current", "=", "last", "(", "context", ".", "embeddedLanguageStack", ")", ",", "lang", ";", "if", "(", "current", "&&", "current", ".", "switchBack", "(", "context", ")", ...
called after processing the current
[ "called", "after", "processing", "the", "current" ]
0667da6b5c2e178d66257f0090f6cd5a77a003c6
https://github.com/cubehouse/themeparks/blob/0667da6b5c2e178d66257f0090f6cd5a77a003c6/docs/scripts/sunlight.js#L747-L759
train
cubehouse/themeparks
docs/scripts/sunlight.js
highlightRecursive
function highlightRecursive(node) { var match, languageId, currentNodeCount, j, nodes, k, partialContext, container, codeContainer; if (this.isAlreadyHighlighted(node) || (match = this.matchSunlightNode(node)) === null) { return; } languageId = match[1]...
javascript
function highlightRecursive(node) { var match, languageId, currentNodeCount, j, nodes, k, partialContext, container, codeContainer; if (this.isAlreadyHighlighted(node) || (match = this.matchSunlightNode(node)) === null) { return; } languageId = match[1]...
[ "function", "highlightRecursive", "(", "node", ")", "{", "var", "match", ",", "languageId", ",", "currentNodeCount", ",", "j", ",", "nodes", ",", "k", ",", "partialContext", ",", "container", ",", "codeContainer", ";", "if", "(", "this", ".", "isAlreadyHighl...
recursively highlights a DOM node
[ "recursively", "highlights", "a", "DOM", "node" ]
0667da6b5c2e178d66257f0090f6cd5a77a003c6
https://github.com/cubehouse/themeparks/blob/0667da6b5c2e178d66257f0090f6cd5a77a003c6/docs/scripts/sunlight.js#L994-L1064
train
leaflet-extras/leaflet-providers
leaflet-providers.js
function (attr) { if (attr.indexOf('{attribution.') === -1) { return attr; } return attr.replace(/\{attribution.(\w*)\}/, function (match, attributionName) { return attributionReplacer(providers[attributionName].options.attribution); } ); }
javascript
function (attr) { if (attr.indexOf('{attribution.') === -1) { return attr; } return attr.replace(/\{attribution.(\w*)\}/, function (match, attributionName) { return attributionReplacer(providers[attributionName].options.attribution); } ); }
[ "function", "(", "attr", ")", "{", "if", "(", "attr", ".", "indexOf", "(", "'{attribution.'", ")", "===", "-", "1", ")", "{", "return", "attr", ";", "}", "return", "attr", ".", "replace", "(", "/", "\\{attribution.(\\w*)\\}", "/", ",", "function", "(",...
replace attribution placeholders with their values from toplevel provider attribution, recursively
[ "replace", "attribution", "placeholders", "with", "their", "values", "from", "toplevel", "provider", "attribution", "recursively" ]
2f76cf3100c5e0eb0a53def3ea3659f55e49d2b4
https://github.com/leaflet-extras/leaflet-providers/blob/2f76cf3100c5e0eb0a53def3ea3659f55e49d2b4/leaflet-providers.js#L55-L64
train
leaflet-extras/leaflet-providers
preview/vendor/leaflet.draw-src.js
function (/*Point*/ p, /*Point*/ p1, /*Point*/ p2) { return (p2.y - p.y) * (p1.x - p.x) > (p1.y - p.y) * (p2.x - p.x); }
javascript
function (/*Point*/ p, /*Point*/ p1, /*Point*/ p2) { return (p2.y - p.y) * (p1.x - p.x) > (p1.y - p.y) * (p2.x - p.x); }
[ "function", "(", "/*Point*/", "p", ",", "/*Point*/", "p1", ",", "/*Point*/", "p2", ")", "{", "return", "(", "p2", ".", "y", "-", "p", ".", "y", ")", "*", "(", "p1", ".", "x", "-", "p", ".", "x", ")", ">", "(", "p1", ".", "y", "-", "p", "....
check to see if points are in counterclockwise order
[ "check", "to", "see", "if", "points", "are", "in", "counterclockwise", "order" ]
2f76cf3100c5e0eb0a53def3ea3659f55e49d2b4
https://github.com/leaflet-extras/leaflet-providers/blob/2f76cf3100c5e0eb0a53def3ea3659f55e49d2b4/preview/vendor/leaflet.draw-src.js#L1847-L1849
train
leaflet-extras/leaflet-providers
preview/vendor/leaflet.draw-src.js
function (p, p1, maxIndex, minIndex) { var points = this._originalPoints, p2, p3; minIndex = minIndex || 0; // Check all previous line segments (beside the immediately previous) for intersections for (var j = maxIndex; j > minIndex; j--) { p2 = points[j - 1]; p3 = points[j]; if (L.LineUtil.segmen...
javascript
function (p, p1, maxIndex, minIndex) { var points = this._originalPoints, p2, p3; minIndex = minIndex || 0; // Check all previous line segments (beside the immediately previous) for intersections for (var j = maxIndex; j > minIndex; j--) { p2 = points[j - 1]; p3 = points[j]; if (L.LineUtil.segmen...
[ "function", "(", "p", ",", "p1", ",", "maxIndex", ",", "minIndex", ")", "{", "var", "points", "=", "this", ".", "_originalPoints", ",", "p2", ",", "p3", ";", "minIndex", "=", "minIndex", "||", "0", ";", "// Check all previous line segments (beside the immediat...
Checks a line segment intersections with any line segments before its predecessor. Don't need to check the predecessor as will never intersect.
[ "Checks", "a", "line", "segment", "intersections", "with", "any", "line", "segments", "before", "its", "predecessor", ".", "Don", "t", "need", "to", "check", "the", "predecessor", "as", "will", "never", "intersect", "." ]
2f76cf3100c5e0eb0a53def3ea3659f55e49d2b4
https://github.com/leaflet-extras/leaflet-providers/blob/2f76cf3100c5e0eb0a53def3ea3659f55e49d2b4/preview/vendor/leaflet.draw-src.js#L1918-L1935
train
leaflet-extras/leaflet-providers
preview/vendor/leaflet.draw-src.js
function (handler) { return [ { enabled: handler.deleteLastVertex, title: L.drawLocal.draw.toolbar.undo.title, text: L.drawLocal.draw.toolbar.undo.text, callback: handler.deleteLastVertex, context: handler }, { title: L.drawLocal.draw.toolbar.actions.title, text: L.drawLocal.draw....
javascript
function (handler) { return [ { enabled: handler.deleteLastVertex, title: L.drawLocal.draw.toolbar.undo.title, text: L.drawLocal.draw.toolbar.undo.text, callback: handler.deleteLastVertex, context: handler }, { title: L.drawLocal.draw.toolbar.actions.title, text: L.drawLocal.draw....
[ "function", "(", "handler", ")", "{", "return", "[", "{", "enabled", ":", "handler", ".", "deleteLastVertex", ",", "title", ":", "L", ".", "drawLocal", ".", "draw", ".", "toolbar", ".", "undo", ".", "title", ",", "text", ":", "L", ".", "drawLocal", "...
Get the actions part of the toolbar
[ "Get", "the", "actions", "part", "of", "the", "toolbar" ]
2f76cf3100c5e0eb0a53def3ea3659f55e49d2b4
https://github.com/leaflet-extras/leaflet-providers/blob/2f76cf3100c5e0eb0a53def3ea3659f55e49d2b4/preview/vendor/leaflet.draw-src.js#L2444-L2460
train
leaflet-extras/leaflet-providers
preview/preview.js
function (providerName) { if (providerName === 'ignored') { return true; } // reduce the number of layers previewed for some providers if (providerName.startsWith('HERE') || providerName.startsWith('OpenWeatherMap') || providerName.startsWith('MapBox')) { var whitelist = [ // API threshold almost reac...
javascript
function (providerName) { if (providerName === 'ignored') { return true; } // reduce the number of layers previewed for some providers if (providerName.startsWith('HERE') || providerName.startsWith('OpenWeatherMap') || providerName.startsWith('MapBox')) { var whitelist = [ // API threshold almost reac...
[ "function", "(", "providerName", ")", "{", "if", "(", "providerName", "===", "'ignored'", ")", "{", "return", "true", ";", "}", "// reduce the number of layers previewed for some providers", "if", "(", "providerName", ".", "startsWith", "(", "'HERE'", ")", "||", "...
Ignore some providers in the preview
[ "Ignore", "some", "providers", "in", "the", "preview" ]
2f76cf3100c5e0eb0a53def3ea3659f55e49d2b4
https://github.com/leaflet-extras/leaflet-providers/blob/2f76cf3100c5e0eb0a53def3ea3659f55e49d2b4/preview/preview.js#L76-L92
train
MMF-FE/vue-svgicon
dist/lib/build.js
compile
function compile(content, data) { return content.replace(/\${(\w+)}/gi, function (match, name) { return data[name] ? data[name] : ''; }); }
javascript
function compile(content, data) { return content.replace(/\${(\w+)}/gi, function (match, name) { return data[name] ? data[name] : ''; }); }
[ "function", "compile", "(", "content", ",", "data", ")", "{", "return", "content", ".", "replace", "(", "/", "\\${(\\w+)}", "/", "gi", ",", "function", "(", "match", ",", "name", ")", "{", "return", "data", "[", "name", "]", "?", "data", "[", "name",...
simple template compile
[ "simple", "template", "compile" ]
1c5bc46d2e869acd0f962491fea267c086cbc3ce
https://github.com/MMF-FE/vue-svgicon/blob/1c5bc46d2e869acd0f962491fea267c086cbc3ce/dist/lib/build.js#L84-L88
train
MMF-FE/vue-svgicon
dist/lib/build.js
getFilePath
function getFilePath(sourcePath, filename, subDir) { if (subDir === void 0) { subDir = ''; } var filePath = filename .replace(path.resolve(sourcePath), '') .replace(path.basename(filename), ''); if (subDir) { filePath = filePath.replace(subDir + path.sep, ''); } if (/^[\/\\]/...
javascript
function getFilePath(sourcePath, filename, subDir) { if (subDir === void 0) { subDir = ''; } var filePath = filename .replace(path.resolve(sourcePath), '') .replace(path.basename(filename), ''); if (subDir) { filePath = filePath.replace(subDir + path.sep, ''); } if (/^[\/\\]/...
[ "function", "getFilePath", "(", "sourcePath", ",", "filename", ",", "subDir", ")", "{", "if", "(", "subDir", "===", "void", "0", ")", "{", "subDir", "=", "''", ";", "}", "var", "filePath", "=", "filename", ".", "replace", "(", "path", ".", "resolve", ...
get file path by filename
[ "get", "file", "path", "by", "filename" ]
1c5bc46d2e869acd0f962491fea267c086cbc3ce
https://github.com/MMF-FE/vue-svgicon/blob/1c5bc46d2e869acd0f962491fea267c086cbc3ce/dist/lib/build.js#L90-L102
train
MMF-FE/vue-svgicon
dist/lib/build.js
generateIndex
function generateIndex(opts, files, subDir) { if (subDir === void 0) { subDir = ''; } var shouldExport = opts.export; var isES6 = opts.es6; var content = ''; var dirMap = {}; switch (opts.ext) { case 'js': content += '/* eslint-disable */\n'; break; case '...
javascript
function generateIndex(opts, files, subDir) { if (subDir === void 0) { subDir = ''; } var shouldExport = opts.export; var isES6 = opts.es6; var content = ''; var dirMap = {}; switch (opts.ext) { case 'js': content += '/* eslint-disable */\n'; break; case '...
[ "function", "generateIndex", "(", "opts", ",", "files", ",", "subDir", ")", "{", "if", "(", "subDir", "===", "void", "0", ")", "{", "subDir", "=", "''", ";", "}", "var", "shouldExport", "=", "opts", ".", "export", ";", "var", "isES6", "=", "opts", ...
generate index.js, which import all icons
[ "generate", "index", ".", "js", "which", "import", "all", "icons" ]
1c5bc46d2e869acd0f962491fea267c086cbc3ce
https://github.com/MMF-FE/vue-svgicon/blob/1c5bc46d2e869acd0f962491fea267c086cbc3ce/dist/lib/build.js#L104-L163
train
MMF-FE/vue-svgicon
dist/lib/build.js
getSvgoConfig
function getSvgoConfig(svgo) { if (!svgo) { return require('../../default/svgo'); } else if (typeof svgo === 'string') { return require(path.join(process.cwd(), svgo)); } else { return svgo; } }
javascript
function getSvgoConfig(svgo) { if (!svgo) { return require('../../default/svgo'); } else if (typeof svgo === 'string') { return require(path.join(process.cwd(), svgo)); } else { return svgo; } }
[ "function", "getSvgoConfig", "(", "svgo", ")", "{", "if", "(", "!", "svgo", ")", "{", "return", "require", "(", "'../../default/svgo'", ")", ";", "}", "else", "if", "(", "typeof", "svgo", "===", "'string'", ")", "{", "return", "require", "(", "path", "...
get svgo config
[ "get", "svgo", "config" ]
1c5bc46d2e869acd0f962491fea267c086cbc3ce
https://github.com/MMF-FE/vue-svgicon/blob/1c5bc46d2e869acd0f962491fea267c086cbc3ce/dist/lib/build.js#L165-L175
train
MMF-FE/vue-svgicon
dist/lib/build.js
getViewBox
function getViewBox(svgoResult) { var viewBoxMatch = svgoResult.data.match(/viewBox="([-\d\.]+\s[-\d\.]+\s[-\d\.]+\s[-\d\.]+)"/); var viewBox = '0 0 200 200'; if (viewBoxMatch && viewBoxMatch.length > 1) { viewBox = viewBoxMatch[1]; } else if (svgoResult.info.height && svgoResult.info.width)...
javascript
function getViewBox(svgoResult) { var viewBoxMatch = svgoResult.data.match(/viewBox="([-\d\.]+\s[-\d\.]+\s[-\d\.]+\s[-\d\.]+)"/); var viewBox = '0 0 200 200'; if (viewBoxMatch && viewBoxMatch.length > 1) { viewBox = viewBoxMatch[1]; } else if (svgoResult.info.height && svgoResult.info.width)...
[ "function", "getViewBox", "(", "svgoResult", ")", "{", "var", "viewBoxMatch", "=", "svgoResult", ".", "data", ".", "match", "(", "/", "viewBox=\"([-\\d\\.]+\\s[-\\d\\.]+\\s[-\\d\\.]+\\s[-\\d\\.]+)\"", "/", ")", ";", "var", "viewBox", "=", "'0 0 200 200'", ";", "if",...
get svg viewbox
[ "get", "svg", "viewbox" ]
1c5bc46d2e869acd0f962491fea267c086cbc3ce
https://github.com/MMF-FE/vue-svgicon/blob/1c5bc46d2e869acd0f962491fea267c086cbc3ce/dist/lib/build.js#L177-L187
train
MMF-FE/vue-svgicon
dist/lib/build.js
addPid
function addPid(content) { var shapeReg = /<(path|rect|circle|polygon|line|polyline|ellipse)\s/gi; var id = 0; content = content.replace(shapeReg, function (match) { return match + ("pid=\"" + id++ + "\" "); }); return content; }
javascript
function addPid(content) { var shapeReg = /<(path|rect|circle|polygon|line|polyline|ellipse)\s/gi; var id = 0; content = content.replace(shapeReg, function (match) { return match + ("pid=\"" + id++ + "\" "); }); return content; }
[ "function", "addPid", "(", "content", ")", "{", "var", "shapeReg", "=", "/", "<(path|rect|circle|polygon|line|polyline|ellipse)\\s", "/", "gi", ";", "var", "id", "=", "0", ";", "content", "=", "content", ".", "replace", "(", "shapeReg", ",", "function", "(", ...
add pid attr, for css
[ "add", "pid", "attr", "for", "css" ]
1c5bc46d2e869acd0f962491fea267c086cbc3ce
https://github.com/MMF-FE/vue-svgicon/blob/1c5bc46d2e869acd0f962491fea267c086cbc3ce/dist/lib/build.js#L189-L196
train
GoogleChrome/accessibility-developer-tools
src/js/AccessibilityUtils.js
getHtmlInfo
function getHtmlInfo(element) { if (!element) return null; var tagName = element.tagName; if (!tagName) return null; tagName = tagName.toUpperCase(); var infos = axs.constants.TAG_TO_IMPLICIT_SEMANTIC_INFO[tagName]; if (!infos || !infos.length) ...
javascript
function getHtmlInfo(element) { if (!element) return null; var tagName = element.tagName; if (!tagName) return null; tagName = tagName.toUpperCase(); var infos = axs.constants.TAG_TO_IMPLICIT_SEMANTIC_INFO[tagName]; if (!infos || !infos.length) ...
[ "function", "getHtmlInfo", "(", "element", ")", "{", "if", "(", "!", "element", ")", "return", "null", ";", "var", "tagName", "=", "element", ".", "tagName", ";", "if", "(", "!", "tagName", ")", "return", "null", ";", "tagName", "=", "tagName", ".", ...
Helper for implicit semantic functionality. Can be made part of the public API if need be. @param {Element} element @return {?axs.constants.HtmlInfo}
[ "Helper", "for", "implicit", "semantic", "functionality", ".", "Can", "be", "made", "part", "of", "the", "public", "API", "if", "need", "be", "." ]
3d7c96bf34b3146f40aeb2720e0927f221ad8725
https://github.com/GoogleChrome/accessibility-developer-tools/blob/3d7c96bf34b3146f40aeb2720e0927f221ad8725/src/js/AccessibilityUtils.js#L667-L688
train
GoogleChrome/accessibility-developer-tools
src/audits/RequiredOwnedAriaRoleMissing.js
getRequired
function getRequired(element) { var elementRole = axs.utils.getRoles(element); if (!elementRole || !elementRole.applied) return []; var appliedRole = elementRole.applied; if (!appliedRole.valid) return []; return appliedRole.details['mustcontain'] || []; ...
javascript
function getRequired(element) { var elementRole = axs.utils.getRoles(element); if (!elementRole || !elementRole.applied) return []; var appliedRole = elementRole.applied; if (!appliedRole.valid) return []; return appliedRole.details['mustcontain'] || []; ...
[ "function", "getRequired", "(", "element", ")", "{", "var", "elementRole", "=", "axs", ".", "utils", ".", "getRoles", "(", "element", ")", ";", "if", "(", "!", "elementRole", "||", "!", "elementRole", ".", "applied", ")", "return", "[", "]", ";", "var"...
Get a list of the roles this element must contain, if any, based on its ARIA role. @param {Element} element A DOM element. @return {Array.<string>} The roles this element must contain.
[ "Get", "a", "list", "of", "the", "roles", "this", "element", "must", "contain", "if", "any", "based", "on", "its", "ARIA", "role", "." ]
3d7c96bf34b3146f40aeb2720e0927f221ad8725
https://github.com/GoogleChrome/accessibility-developer-tools/blob/3d7c96bf34b3146f40aeb2720e0927f221ad8725/src/audits/RequiredOwnedAriaRoleMissing.js#L75-L83
train
GoogleChrome/accessibility-developer-tools
src/audits/TableHasAppropriateHeaders.js
tableDoesNotHaveHeaderRow
function tableDoesNotHaveHeaderRow(rows) { var headerRow = rows[0]; var headerCells = headerRow.children; for (var i = 0; i < headerCells.length; i++) { if (headerCells[i].tagName != 'TH') { return true; } } return false; }
javascript
function tableDoesNotHaveHeaderRow(rows) { var headerRow = rows[0]; var headerCells = headerRow.children; for (var i = 0; i < headerCells.length; i++) { if (headerCells[i].tagName != 'TH') { return true; } } return false; }
[ "function", "tableDoesNotHaveHeaderRow", "(", "rows", ")", "{", "var", "headerRow", "=", "rows", "[", "0", "]", ";", "var", "headerCells", "=", "headerRow", ".", "children", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "headerCells", ".", "len...
Checks for a header row in a table. @param {NodeList} rows tr elements @returns {boolean} Table does not have a complete header row
[ "Checks", "for", "a", "header", "row", "in", "a", "table", "." ]
3d7c96bf34b3146f40aeb2720e0927f221ad8725
https://github.com/GoogleChrome/accessibility-developer-tools/blob/3d7c96bf34b3146f40aeb2720e0927f221ad8725/src/audits/TableHasAppropriateHeaders.js#L26-L37
train
GoogleChrome/accessibility-developer-tools
src/audits/TableHasAppropriateHeaders.js
tableDoesNotHaveHeaderColumn
function tableDoesNotHaveHeaderColumn(rows) { for (var i = 0; i < rows.length; i++) { if (rows[i].children[0].tagName != 'TH') { return true; } } return false; }
javascript
function tableDoesNotHaveHeaderColumn(rows) { for (var i = 0; i < rows.length; i++) { if (rows[i].children[0].tagName != 'TH') { return true; } } return false; }
[ "function", "tableDoesNotHaveHeaderColumn", "(", "rows", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "rows", ".", "length", ";", "i", "++", ")", "{", "if", "(", "rows", "[", "i", "]", ".", "children", "[", "0", "]", ".", "tagName",...
Checks for a header column in a table. @param {NodeList} rows tr elements @returns {boolean} Table does not have a complete header column
[ "Checks", "for", "a", "header", "column", "in", "a", "table", "." ]
3d7c96bf34b3146f40aeb2720e0927f221ad8725
https://github.com/GoogleChrome/accessibility-developer-tools/blob/3d7c96bf34b3146f40aeb2720e0927f221ad8725/src/audits/TableHasAppropriateHeaders.js#L45-L52
train
GoogleChrome/accessibility-developer-tools
src/audits/TableHasAppropriateHeaders.js
tableDoesNotHaveGridLayout
function tableDoesNotHaveGridLayout(rows) { var headerCells = rows[0].children; for (var i = 1; i < headerCells.length; i++) { if (headerCells[i].tagName != 'TH') { return true; } } for (var i = 1; i < rows.length; i++) { if (rows[i]....
javascript
function tableDoesNotHaveGridLayout(rows) { var headerCells = rows[0].children; for (var i = 1; i < headerCells.length; i++) { if (headerCells[i].tagName != 'TH') { return true; } } for (var i = 1; i < rows.length; i++) { if (rows[i]....
[ "function", "tableDoesNotHaveGridLayout", "(", "rows", ")", "{", "var", "headerCells", "=", "rows", "[", "0", "]", ".", "children", ";", "for", "(", "var", "i", "=", "1", ";", "i", "<", "headerCells", ".", "length", ";", "i", "++", ")", "{", "if", ...
Checks whether a table has grid layout with both row and column headers. @param {NodeList} rows tr elements @returns {boolean} Table does not have a complete grid layout
[ "Checks", "whether", "a", "table", "has", "grid", "layout", "with", "both", "row", "and", "column", "headers", "." ]
3d7c96bf34b3146f40aeb2720e0927f221ad8725
https://github.com/GoogleChrome/accessibility-developer-tools/blob/3d7c96bf34b3146f40aeb2720e0927f221ad8725/src/audits/TableHasAppropriateHeaders.js#L60-L75
train
GoogleChrome/accessibility-developer-tools
src/audits/TableHasAppropriateHeaders.js
isLayoutTable
function isLayoutTable(element) { if (element.childElementCount == 0) { return true; } if (element.hasAttribute('role') && element.getAttribute('role') != 'presentation') { return false; } if (element.getAttribute('role') == 'presentation') { ...
javascript
function isLayoutTable(element) { if (element.childElementCount == 0) { return true; } if (element.hasAttribute('role') && element.getAttribute('role') != 'presentation') { return false; } if (element.getAttribute('role') == 'presentation') { ...
[ "function", "isLayoutTable", "(", "element", ")", "{", "if", "(", "element", ".", "childElementCount", "==", "0", ")", "{", "return", "true", ";", "}", "if", "(", "element", ".", "hasAttribute", "(", "'role'", ")", "&&", "element", ".", "getAttribute", "...
Checks whether a table is a layout table. @returns {boolean} Table is a layout table
[ "Checks", "whether", "a", "table", "is", "a", "layout", "table", "." ]
3d7c96bf34b3146f40aeb2720e0927f221ad8725
https://github.com/GoogleChrome/accessibility-developer-tools/blob/3d7c96bf34b3146f40aeb2720e0927f221ad8725/src/audits/TableHasAppropriateHeaders.js#L82-L105
train
GoogleChrome/accessibility-developer-tools
src/js/Properties.js
hasDirectTextDescendantXpath
function hasDirectTextDescendantXpath() { var selectorResults = ownerDocument.evaluate(axs.properties.TEXT_CONTENT_XPATH, element, null, XPathResult.ANY_...
javascript
function hasDirectTextDescendantXpath() { var selectorResults = ownerDocument.evaluate(axs.properties.TEXT_CONTENT_XPATH, element, null, XPathResult.ANY_...
[ "function", "hasDirectTextDescendantXpath", "(", ")", "{", "var", "selectorResults", "=", "ownerDocument", ".", "evaluate", "(", "axs", ".", "properties", ".", "TEXT_CONTENT_XPATH", ",", "element", ",", "null", ",", "XPathResult", ".", "ANY_TYPE", ",", "null", "...
Determines whether element has a text node as a direct descendant. This method uses XPath on HTML DOM which is not universally supported. @return {boolean}
[ "Determines", "whether", "element", "has", "a", "text", "node", "as", "a", "direct", "descendant", ".", "This", "method", "uses", "XPath", "on", "HTML", "DOM", "which", "is", "not", "universally", "supported", "." ]
3d7c96bf34b3146f40aeb2720e0927f221ad8725
https://github.com/GoogleChrome/accessibility-developer-tools/blob/3d7c96bf34b3146f40aeb2720e0927f221ad8725/src/js/Properties.js#L148-L162
train
GoogleChrome/accessibility-developer-tools
src/js/Audit.js
function(auditRuleName, selectors) { if (!(auditRuleName in this.rules_)) this.rules_[auditRuleName] = {}; if (!('ignore' in this.rules_[auditRuleName])) this.rules_[auditRuleName].ignore = []; Array.prototype.push.call(this.rules_[auditRuleName].ignore, selectors); }
javascript
function(auditRuleName, selectors) { if (!(auditRuleName in this.rules_)) this.rules_[auditRuleName] = {}; if (!('ignore' in this.rules_[auditRuleName])) this.rules_[auditRuleName].ignore = []; Array.prototype.push.call(this.rules_[auditRuleName].ignore, selectors); }
[ "function", "(", "auditRuleName", ",", "selectors", ")", "{", "if", "(", "!", "(", "auditRuleName", "in", "this", ".", "rules_", ")", ")", "this", ".", "rules_", "[", "auditRuleName", "]", "=", "{", "}", ";", "if", "(", "!", "(", "'ignore'", "in", ...
Add the given selectors to the ignore list for the given audit rule. @param {string} auditRuleName The name of the audit rule @param {Array.<string>} selectors Query selectors to match nodes to ignore
[ "Add", "the", "given", "selectors", "to", "the", "ignore", "list", "for", "the", "given", "audit", "rule", "." ]
3d7c96bf34b3146f40aeb2720e0927f221ad8725
https://github.com/GoogleChrome/accessibility-developer-tools/blob/3d7c96bf34b3146f40aeb2720e0927f221ad8725/src/js/Audit.js#L134-L140
train
GoogleChrome/accessibility-developer-tools
src/js/Audit.js
function(auditRuleName, severity) { if (!(auditRuleName in this.rules_)) this.rules_[auditRuleName] = {}; this.rules_[auditRuleName].severity = severity; }
javascript
function(auditRuleName, severity) { if (!(auditRuleName in this.rules_)) this.rules_[auditRuleName] = {}; this.rules_[auditRuleName].severity = severity; }
[ "function", "(", "auditRuleName", ",", "severity", ")", "{", "if", "(", "!", "(", "auditRuleName", "in", "this", ".", "rules_", ")", ")", "this", ".", "rules_", "[", "auditRuleName", "]", "=", "{", "}", ";", "this", ".", "rules_", "[", "auditRuleName",...
Sets the user-specified severity for the given audit rule. This will replace the default severity for that audit rule in the audit results. @param {string} auditRuleName @param {axs.constants.Severity} severity
[ "Sets", "the", "user", "-", "specified", "severity", "for", "the", "given", "audit", "rule", ".", "This", "will", "replace", "the", "default", "severity", "for", "that", "audit", "rule", "in", "the", "audit", "results", "." ]
3d7c96bf34b3146f40aeb2720e0927f221ad8725
https://github.com/GoogleChrome/accessibility-developer-tools/blob/3d7c96bf34b3146f40aeb2720e0927f221ad8725/src/js/Audit.js#L163-L167
train
GoogleChrome/accessibility-developer-tools
src/js/Audit.js
function(auditRuleName, config) { if (!(auditRuleName in this.rules_)) this.rules_[auditRuleName] = {}; this.rules_[auditRuleName].config = config; }
javascript
function(auditRuleName, config) { if (!(auditRuleName in this.rules_)) this.rules_[auditRuleName] = {}; this.rules_[auditRuleName].config = config; }
[ "function", "(", "auditRuleName", ",", "config", ")", "{", "if", "(", "!", "(", "auditRuleName", "in", "this", ".", "rules_", ")", ")", "this", ".", "rules_", "[", "auditRuleName", "]", "=", "{", "}", ";", "this", ".", "rules_", "[", "auditRuleName", ...
Sets the user-specified configuration for the given audit rule. This will vary in structure from rule to rule; see individual rules for configuration options. @param {string} auditRuleName @param {Object} config
[ "Sets", "the", "user", "-", "specified", "configuration", "for", "the", "given", "audit", "rule", ".", "This", "will", "vary", "in", "structure", "from", "rule", "to", "rule", ";", "see", "individual", "rules", "for", "configuration", "options", "." ]
3d7c96bf34b3146f40aeb2720e0927f221ad8725
https://github.com/GoogleChrome/accessibility-developer-tools/blob/3d7c96bf34b3146f40aeb2720e0927f221ad8725/src/js/Audit.js#L184-L188
train
GoogleChrome/accessibility-developer-tools
src/js/Audit.js
function(auditRuleName) { if (!(auditRuleName in this.rules_)) return null; if (!('config' in this.rules_[auditRuleName])) return null; return this.rules_[auditRuleName].config; }
javascript
function(auditRuleName) { if (!(auditRuleName in this.rules_)) return null; if (!('config' in this.rules_[auditRuleName])) return null; return this.rules_[auditRuleName].config; }
[ "function", "(", "auditRuleName", ")", "{", "if", "(", "!", "(", "auditRuleName", "in", "this", ".", "rules_", ")", ")", "return", "null", ";", "if", "(", "!", "(", "'config'", "in", "this", ".", "rules_", "[", "auditRuleName", "]", ")", ")", "return...
Gets the user-specified configuration for the given audit rule. @param {string} auditRuleName @return {Object?} The configuration object for the given audit rule.
[ "Gets", "the", "user", "-", "specified", "configuration", "for", "the", "given", "audit", "rule", "." ]
3d7c96bf34b3146f40aeb2720e0927f221ad8725
https://github.com/GoogleChrome/accessibility-developer-tools/blob/3d7c96bf34b3146f40aeb2720e0927f221ad8725/src/js/Audit.js#L195-L201
train
GoogleChrome/accessibility-developer-tools
src/audits/UncontrolledTabpanel.js
labeledByATab
function labeledByATab(element) { if (element.hasAttribute('aria-labelledby')) { var labelingElements = document.querySelectorAll('#' + element.getAttribute('aria-labelledby')); return labelingElements.length === 1 && labelingElements[0].getAttribute('role') === 'tab'; } ...
javascript
function labeledByATab(element) { if (element.hasAttribute('aria-labelledby')) { var labelingElements = document.querySelectorAll('#' + element.getAttribute('aria-labelledby')); return labelingElements.length === 1 && labelingElements[0].getAttribute('role') === 'tab'; } ...
[ "function", "labeledByATab", "(", "element", ")", "{", "if", "(", "element", ".", "hasAttribute", "(", "'aria-labelledby'", ")", ")", "{", "var", "labelingElements", "=", "document", ".", "querySelectorAll", "(", "'#'", "+", "element", ".", "getAttribute", "("...
Checks if the tabpanel is labeled by a tab @param {Element} element the tabpanel element @returns {boolean} the tabpanel has an aria-labelledby with the id of a tab
[ "Checks", "if", "the", "tabpanel", "is", "labeled", "by", "a", "tab" ]
3d7c96bf34b3146f40aeb2720e0927f221ad8725
https://github.com/GoogleChrome/accessibility-developer-tools/blob/3d7c96bf34b3146f40aeb2720e0927f221ad8725/src/audits/UncontrolledTabpanel.js#L26-L32
train
GoogleChrome/accessibility-developer-tools
src/audits/UncontrolledTabpanel.js
controlledByATab
function controlledByATab(element) { var controlledBy = document.querySelectorAll('[role="tab"][aria-controls="' + element.id + '"]') return element.id && (controlledBy.length === 1); }
javascript
function controlledByATab(element) { var controlledBy = document.querySelectorAll('[role="tab"][aria-controls="' + element.id + '"]') return element.id && (controlledBy.length === 1); }
[ "function", "controlledByATab", "(", "element", ")", "{", "var", "controlledBy", "=", "document", ".", "querySelectorAll", "(", "'[role=\"tab\"][aria-controls=\"'", "+", "element", ".", "id", "+", "'\"]'", ")", "return", "element", ".", "id", "&&", "(", "control...
Checks if the tabpanel is controlled by a tab @param {Element} element the tabpanel element @returns {*|boolean}
[ "Checks", "if", "the", "tabpanel", "is", "controlled", "by", "a", "tab" ]
3d7c96bf34b3146f40aeb2720e0927f221ad8725
https://github.com/GoogleChrome/accessibility-developer-tools/blob/3d7c96bf34b3146f40aeb2720e0927f221ad8725/src/audits/UncontrolledTabpanel.js#L39-L42
train
NekR/offline-plugin
lib/misc/utils.js
arrowFnToNormalFn
function arrowFnToNormalFn(string) { var match = string.match(/^([\s\S]+?)=\>(\s*{)?([\s\S]*?)(}\s*)?$/); if (!match) { return string; } var args = match[1]; var body = match[3]; var needsReturn = !(match[2] && match[4]); args = args.replace(/^(\s*\(\s*)([\s\S]*?)(\s*\)\s*)$/, '$2'); if (needsR...
javascript
function arrowFnToNormalFn(string) { var match = string.match(/^([\s\S]+?)=\>(\s*{)?([\s\S]*?)(}\s*)?$/); if (!match) { return string; } var args = match[1]; var body = match[3]; var needsReturn = !(match[2] && match[4]); args = args.replace(/^(\s*\(\s*)([\s\S]*?)(\s*\)\s*)$/, '$2'); if (needsR...
[ "function", "arrowFnToNormalFn", "(", "string", ")", "{", "var", "match", "=", "string", ".", "match", "(", "/", "^([\\s\\S]+?)=\\>(\\s*{)?([\\s\\S]*?)(}\\s*)?$", "/", ")", ";", "if", "(", "!", "match", ")", "{", "return", "string", ";", "}", "var", "args", ...
Migrate to separate npm-package with full tests
[ "Migrate", "to", "separate", "npm", "-", "package", "with", "full", "tests" ]
71fb6f79da114125e6cb852fa00bb39645349afd
https://github.com/NekR/offline-plugin/blob/71fb6f79da114125e6cb852fa00bb39645349afd/lib/misc/utils.js#L98-L117
train
embark-framework/embark
packages/embark/src/lib/utils/debug_util.js
extend
function extend(filename, async) { if (async._waterfall !== undefined) { return; } async._waterfall = async.waterfall; async.waterfall = function (_tasks, callback) { let tasks = _tasks.map(function (t) { let fn = function () { console.log("async " + filename + ": " + t.name); t.ap...
javascript
function extend(filename, async) { if (async._waterfall !== undefined) { return; } async._waterfall = async.waterfall; async.waterfall = function (_tasks, callback) { let tasks = _tasks.map(function (t) { let fn = function () { console.log("async " + filename + ": " + t.name); t.ap...
[ "function", "extend", "(", "filename", ",", "async", ")", "{", "if", "(", "async", ".", "_waterfall", "!==", "undefined", ")", "{", "return", ";", "}", "async", ".", "_waterfall", "=", "async", ".", "waterfall", ";", "async", ".", "waterfall", "=", "fu...
util to map async method names
[ "util", "to", "map", "async", "method", "names" ]
8b9441967012aefb2349a65623237923c99ec9dc
https://github.com/embark-framework/embark/blob/8b9441967012aefb2349a65623237923c99ec9dc/packages/embark/src/lib/utils/debug_util.js#L3-L18
train
googleapis/nodejs-pubsub
samples/subscriptions.js
worker
function worker(message) { console.log(`Processing "${message.message.data}"...`); setTimeout(() => { console.log(`Finished procesing "${message.message.data}".`); isProcessed = true; }, 30000); }
javascript
function worker(message) { console.log(`Processing "${message.message.data}"...`); setTimeout(() => { console.log(`Finished procesing "${message.message.data}".`); isProcessed = true; }, 30000); }
[ "function", "worker", "(", "message", ")", "{", "console", ".", "log", "(", "`", "${", "message", ".", "message", ".", "data", "}", "`", ")", ";", "setTimeout", "(", "(", ")", "=>", "{", "console", ".", "log", "(", "`", "${", "message", ".", "mes...
The worker function is meant to be non-blocking. It starts a long- running process, such as writing the message to a table, which may take longer than the default 10-sec acknowledge deadline.
[ "The", "worker", "function", "is", "meant", "to", "be", "non", "-", "blocking", ".", "It", "starts", "a", "long", "-", "running", "process", "such", "as", "writing", "the", "message", "to", "a", "table", "which", "may", "take", "longer", "than", "the", ...
22dc668ec16a26b4807ab12afd35356e118e34d1
https://github.com/googleapis/nodejs-pubsub/blob/22dc668ec16a26b4807ab12afd35356e118e34d1/samples/subscriptions.js#L299-L306
train
woocommerce/FlexSlider
bower_components/jquery/src/manipulation.js
setGlobalEval
function setGlobalEval( elems, refElements ) { var elem, i = 0; for ( ; (elem = elems[i]) != null; i++ ) { jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) ); } }
javascript
function setGlobalEval( elems, refElements ) { var elem, i = 0; for ( ; (elem = elems[i]) != null; i++ ) { jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) ); } }
[ "function", "setGlobalEval", "(", "elems", ",", "refElements", ")", "{", "var", "elem", ",", "i", "=", "0", ";", "for", "(", ";", "(", "elem", "=", "elems", "[", "i", "]", ")", "!=", "null", ";", "i", "++", ")", "{", "jQuery", ".", "_data", "("...
Mark scripts as having already been evaluated
[ "Mark", "scripts", "as", "having", "already", "been", "evaluated" ]
690832b7f972298e76e2965714657a2beec9e35c
https://github.com/woocommerce/FlexSlider/blob/690832b7f972298e76e2965714657a2beec9e35c/bower_components/jquery/src/manipulation.js#L126-L132
train
apiaryio/dredd
lib/childProcess.js
signalKill
function signalKill(childProcess, callback) { childProcess.emit('signalKill'); if (IS_WINDOWS) { const taskkill = spawn('taskkill', ['/F', '/T', '/PID', childProcess.pid]); taskkill.on('exit', (exitStatus) => { if (exitStatus) { return callback( new Error(`Unable to forcefully termin...
javascript
function signalKill(childProcess, callback) { childProcess.emit('signalKill'); if (IS_WINDOWS) { const taskkill = spawn('taskkill', ['/F', '/T', '/PID', childProcess.pid]); taskkill.on('exit', (exitStatus) => { if (exitStatus) { return callback( new Error(`Unable to forcefully termin...
[ "function", "signalKill", "(", "childProcess", ",", "callback", ")", "{", "childProcess", ".", "emit", "(", "'signalKill'", ")", ";", "if", "(", "IS_WINDOWS", ")", "{", "const", "taskkill", "=", "spawn", "(", "'taskkill'", ",", "[", "'/F'", ",", "'/T'", ...
Signals the child process to forcefully terminate
[ "Signals", "the", "child", "process", "to", "forcefully", "terminate" ]
8d2764f71072072b1417732300b50b0b388788c1
https://github.com/apiaryio/dredd/blob/8d2764f71072072b1417732300b50b0b388788c1/lib/childProcess.js#L14-L30
train
apiaryio/dredd
lib/childProcess.js
signalTerm
function signalTerm(childProcess, callback) { childProcess.emit('signalTerm'); if (IS_WINDOWS) { // On Windows, there is no such way as SIGTERM or SIGINT. The closest // thing is to interrupt the process with Ctrl+C. Under the hood, that // generates '\u0003' character on stdin of the process and if ...
javascript
function signalTerm(childProcess, callback) { childProcess.emit('signalTerm'); if (IS_WINDOWS) { // On Windows, there is no such way as SIGTERM or SIGINT. The closest // thing is to interrupt the process with Ctrl+C. Under the hood, that // generates '\u0003' character on stdin of the process and if ...
[ "function", "signalTerm", "(", "childProcess", ",", "callback", ")", "{", "childProcess", ".", "emit", "(", "'signalTerm'", ")", ";", "if", "(", "IS_WINDOWS", ")", "{", "// On Windows, there is no such way as SIGTERM or SIGINT. The closest", "// thing is to interrupt the pr...
Signals the child process to gracefully terminate
[ "Signals", "the", "child", "process", "to", "gracefully", "terminate" ]
8d2764f71072072b1417732300b50b0b388788c1
https://github.com/apiaryio/dredd/blob/8d2764f71072072b1417732300b50b0b388788c1/lib/childProcess.js#L34-L59
train
apiaryio/dredd
lib/childProcess.js
check
function check() { if (terminated) { // Successfully terminated clearTimeout(t); return callback(); } if ((Date.now() - start) < timeout) { // Still not terminated, try again signalTerm(childProcess, (err) => { if (err) { return callback(err); } t = setTimeout(c...
javascript
function check() { if (terminated) { // Successfully terminated clearTimeout(t); return callback(); } if ((Date.now() - start) < timeout) { // Still not terminated, try again signalTerm(childProcess, (err) => { if (err) { return callback(err); } t = setTimeout(c...
[ "function", "check", "(", ")", "{", "if", "(", "terminated", ")", "{", "// Successfully terminated", "clearTimeout", "(", "t", ")", ";", "return", "callback", "(", ")", ";", "}", "if", "(", "(", "Date", ".", "now", "(", ")", "-", "start", ")", "<", ...
A function representing one check, whether the process already ended or not. It is repeatedly called until the timeout has passed.
[ "A", "function", "representing", "one", "check", "whether", "the", "process", "already", "ended", "or", "not", ".", "It", "is", "repeatedly", "called", "until", "the", "timeout", "has", "passed", "." ]
8d2764f71072072b1417732300b50b0b388788c1
https://github.com/apiaryio/dredd/blob/8d2764f71072072b1417732300b50b0b388788c1/lib/childProcess.js#L98-L122
train
apiaryio/dredd
lib/configuration/applyLoggingOptions.js
applyLoggingOptions
function applyLoggingOptions(config) { if (config.color === false) { logger.transports.console.colorize = false; reporterOutputLogger.transports.console.colorize = false; } // TODO https://github.com/apiaryio/dredd/issues/1346 if (config.loglevel) { const loglevel = config.loglevel.toLowerCase(); ...
javascript
function applyLoggingOptions(config) { if (config.color === false) { logger.transports.console.colorize = false; reporterOutputLogger.transports.console.colorize = false; } // TODO https://github.com/apiaryio/dredd/issues/1346 if (config.loglevel) { const loglevel = config.loglevel.toLowerCase(); ...
[ "function", "applyLoggingOptions", "(", "config", ")", "{", "if", "(", "config", ".", "color", "===", "false", ")", "{", "logger", ".", "transports", ".", "console", ".", "colorize", "=", "false", ";", "reporterOutputLogger", ".", "transports", ".", "console...
Applies logging options from the given configuration. Operates on the validated normalized config.
[ "Applies", "logging", "options", "from", "the", "given", "configuration", ".", "Operates", "on", "the", "validated", "normalized", "config", "." ]
8d2764f71072072b1417732300b50b0b388788c1
https://github.com/apiaryio/dredd/blob/8d2764f71072072b1417732300b50b0b388788c1/lib/configuration/applyLoggingOptions.js#L8-L34
train
apiaryio/dredd
lib/performRequest.js
performRequest
function performRequest(uri, transactionReq, options, callback) { if (typeof options === 'function') { [options, callback] = [{}, options]; } const logger = options.logger || defaultLogger; const request = options.request || defaultRequest; const httpOptions = Object.assign({}, options.http || {}); httpOptio...
javascript
function performRequest(uri, transactionReq, options, callback) { if (typeof options === 'function') { [options, callback] = [{}, options]; } const logger = options.logger || defaultLogger; const request = options.request || defaultRequest; const httpOptions = Object.assign({}, options.http || {}); httpOptio...
[ "function", "performRequest", "(", "uri", ",", "transactionReq", ",", "options", ",", "callback", ")", "{", "if", "(", "typeof", "options", "===", "'function'", ")", "{", "[", "options", ",", "callback", "]", "=", "[", "{", "}", ",", "options", "]", ";...
Performs the HTTP request as described in the 'transaction.request' object In future we should introduce a 'real' request object as well so user has access to the modifications made on the way. @param {string} uri @param {Object} transactionReq @param {Object} [options] @param {Object} [options.logger] Custom logger ...
[ "Performs", "the", "HTTP", "request", "as", "described", "in", "the", "transaction", ".", "request", "object" ]
8d2764f71072072b1417732300b50b0b388788c1
https://github.com/apiaryio/dredd/blob/8d2764f71072072b1417732300b50b0b388788c1/lib/performRequest.js#L21-L52
train
apiaryio/dredd
lib/performRequest.js
getBodyAsBuffer
function getBodyAsBuffer(body, encoding) { return body instanceof Buffer ? body : Buffer.from(`${body || ''}`, normalizeBodyEncoding(encoding)); }
javascript
function getBodyAsBuffer(body, encoding) { return body instanceof Buffer ? body : Buffer.from(`${body || ''}`, normalizeBodyEncoding(encoding)); }
[ "function", "getBodyAsBuffer", "(", "body", ",", "encoding", ")", "{", "return", "body", "instanceof", "Buffer", "?", "body", ":", "Buffer", ".", "from", "(", "`", "${", "body", "||", "''", "}", "`", ",", "normalizeBodyEncoding", "(", "encoding", ")", ")...
Coerces the HTTP request body to a Buffer @param {string|Buffer} body @param {*} encoding
[ "Coerces", "the", "HTTP", "request", "body", "to", "a", "Buffer" ]
8d2764f71072072b1417732300b50b0b388788c1
https://github.com/apiaryio/dredd/blob/8d2764f71072072b1417732300b50b0b388788c1/lib/performRequest.js#L61-L65
train
apiaryio/dredd
lib/performRequest.js
normalizeContentLengthHeader
function normalizeContentLengthHeader(headers, body, options = {}) { const logger = options.logger || defaultLogger; const modifiedHeaders = Object.assign({}, headers); const calculatedValue = Buffer.byteLength(body); const name = caseless(modifiedHeaders).has('Content-Length'); if (name) { const value =...
javascript
function normalizeContentLengthHeader(headers, body, options = {}) { const logger = options.logger || defaultLogger; const modifiedHeaders = Object.assign({}, headers); const calculatedValue = Buffer.byteLength(body); const name = caseless(modifiedHeaders).has('Content-Length'); if (name) { const value =...
[ "function", "normalizeContentLengthHeader", "(", "headers", ",", "body", ",", "options", "=", "{", "}", ")", "{", "const", "logger", "=", "options", ".", "logger", "||", "defaultLogger", ";", "const", "modifiedHeaders", "=", "Object", ".", "assign", "(", "{"...
Detects an existing Content-Length header and overrides the user-provided header value in case it's out of sync with the real length of the body. @param {Object} headers HTTP request headers @param {Buffer} body HTTP request body @param {Object} [options] @param {Object} [options.logger] Custom logger
[ "Detects", "an", "existing", "Content", "-", "Length", "header", "and", "overrides", "the", "user", "-", "provided", "header", "value", "in", "case", "it", "s", "out", "of", "sync", "with", "the", "real", "length", "of", "the", "body", "." ]
8d2764f71072072b1417732300b50b0b388788c1
https://github.com/apiaryio/dredd/blob/8d2764f71072072b1417732300b50b0b388788c1/lib/performRequest.js#L99-L116
train
apiaryio/dredd
lib/performRequest.js
createTransactionResponse
function createTransactionResponse(response, body) { const transactionRes = { statusCode: response.statusCode, headers: Object.assign({}, response.headers), }; if (Buffer.byteLength(body || '')) { transactionRes.bodyEncoding = detectBodyEncoding(body); transactionRes.body = body.toString(transacti...
javascript
function createTransactionResponse(response, body) { const transactionRes = { statusCode: response.statusCode, headers: Object.assign({}, response.headers), }; if (Buffer.byteLength(body || '')) { transactionRes.bodyEncoding = detectBodyEncoding(body); transactionRes.body = body.toString(transacti...
[ "function", "createTransactionResponse", "(", "response", ",", "body", ")", "{", "const", "transactionRes", "=", "{", "statusCode", ":", "response", ".", "statusCode", ",", "headers", ":", "Object", ".", "assign", "(", "{", "}", ",", "response", ".", "header...
Real transaction response object factory. Serializes binary responses to string using Base64 encoding. @param {Object} response Node.js HTTP response @param {Buffer} body HTTP response body as Buffer
[ "Real", "transaction", "response", "object", "factory", ".", "Serializes", "binary", "responses", "to", "string", "using", "Base64", "encoding", "." ]
8d2764f71072072b1417732300b50b0b388788c1
https://github.com/apiaryio/dredd/blob/8d2764f71072072b1417732300b50b0b388788c1/lib/performRequest.js#L126-L136
train
LeaVerou/awesomplete
awesomplete.js
function(evt) { var li = evt.target; if (li !== this) { while (li && !/li/i.test(li.nodeName)) { li = li.parentNode; } if (li && evt.button === 0) { // Only select on left click evt.preventDefault(); me.select(li, evt.target, evt); } } }
javascript
function(evt) { var li = evt.target; if (li !== this) { while (li && !/li/i.test(li.nodeName)) { li = li.parentNode; } if (li && evt.button === 0) { // Only select on left click evt.preventDefault(); me.select(li, evt.target, evt); } } }
[ "function", "(", "evt", ")", "{", "var", "li", "=", "evt", ".", "target", ";", "if", "(", "li", "!==", "this", ")", "{", "while", "(", "li", "&&", "!", "/", "li", "/", "i", ".", "test", "(", "li", ".", "nodeName", ")", ")", "{", "li", "=", ...
The click event is fired even if the corresponding mousedown event has called preventDefault
[ "The", "click", "event", "is", "fired", "even", "if", "the", "corresponding", "mousedown", "event", "has", "called", "preventDefault" ]
f8bee8dabbb2be47e3fcef9dafabbdaaff9b20aa
https://github.com/LeaVerou/awesomplete/blob/f8bee8dabbb2be47e3fcef9dafabbdaaff9b20aa/awesomplete.js#L106-L120
train
LeaVerou/awesomplete
awesomplete.js
function (i) { var lis = this.ul.children; if (this.selected) { lis[this.index].setAttribute("aria-selected", "false"); } this.index = i; if (i > -1 && lis.length > 0) { lis[i].setAttribute("aria-selected", "true"); this.status.textContent = lis[i].textContent + ", list item " + (i + 1) + " of " ...
javascript
function (i) { var lis = this.ul.children; if (this.selected) { lis[this.index].setAttribute("aria-selected", "false"); } this.index = i; if (i > -1 && lis.length > 0) { lis[i].setAttribute("aria-selected", "true"); this.status.textContent = lis[i].textContent + ", list item " + (i + 1) + " of " ...
[ "function", "(", "i", ")", "{", "var", "lis", "=", "this", ".", "ul", ".", "children", ";", "if", "(", "this", ".", "selected", ")", "{", "lis", "[", "this", ".", "index", "]", ".", "setAttribute", "(", "\"aria-selected\"", ",", "\"false\"", ")", "...
Should not be used, highlights specific item without any checks!
[ "Should", "not", "be", "used", "highlights", "specific", "item", "without", "any", "checks!" ]
f8bee8dabbb2be47e3fcef9dafabbdaaff9b20aa
https://github.com/LeaVerou/awesomplete/blob/f8bee8dabbb2be47e3fcef9dafabbdaaff9b20aa/awesomplete.js#L247-L270
train
thlorenz/doctoc
lib/transform.js
determineTitle
function determineTitle(title, notitle, lines, info) { var defaultTitle = '**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*'; if (notitle) return ''; if (title) return title; return info.hasStart ? lines[info.startIdx + 2] : defaultTitle; }
javascript
function determineTitle(title, notitle, lines, info) { var defaultTitle = '**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*'; if (notitle) return ''; if (title) return title; return info.hasStart ? lines[info.startIdx + 2] : defaultTitle; }
[ "function", "determineTitle", "(", "title", ",", "notitle", ",", "lines", ",", "info", ")", "{", "var", "defaultTitle", "=", "'**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*'", ";", "if", "(", "notitle", ")", "return", "''", ";", ...
Use document context as well as command line args to infer the title
[ "Use", "document", "context", "as", "well", "as", "command", "line", "args", "to", "infer", "the", "title" ]
e4c74ae7b1346e3e42972562a440d94b2a561aa3
https://github.com/thlorenz/doctoc/blob/e4c74ae7b1346e3e42972562a440d94b2a561aa3/lib/transform.js#L101-L107
train
webhintio/hint
packages/formatter-html/src/assets/js/scan/scanner-common.js
function (element, closeAll) { var expanded = typeof closeAll !== 'undefined' ? closeAll : childRulesExpanded(element); if (expanded) { element.textContent = 'close all'; element.classList.remove('closed'); element.classList.add('expanded'); } else { ...
javascript
function (element, closeAll) { var expanded = typeof closeAll !== 'undefined' ? closeAll : childRulesExpanded(element); if (expanded) { element.textContent = 'close all'; element.classList.remove('closed'); element.classList.add('expanded'); } else { ...
[ "function", "(", "element", ",", "closeAll", ")", "{", "var", "expanded", "=", "typeof", "closeAll", "!==", "'undefined'", "?", "closeAll", ":", "childRulesExpanded", "(", "element", ")", ";", "if", "(", "expanded", ")", "{", "element", ".", "textContent", ...
if all rules are closed, toggle button to 'expand all'. if any rule is open, toggle button to 'close all'.
[ "if", "all", "rules", "are", "closed", "toggle", "button", "to", "expand", "all", ".", "if", "any", "rule", "is", "open", "toggle", "button", "to", "close", "all", "." ]
2e15dbe6997d46f377d095b4178ab5dc36146a61
https://github.com/webhintio/hint/blob/2e15dbe6997d46f377d095b4178ab5dc36146a61/packages/formatter-html/src/assets/js/scan/scanner-common.js#L56-L68
train
dollarshaveclub/postmate
build/postmate.es.js
resolveOrigin
function resolveOrigin(url) { var a = document.createElement('a'); a.href = url; var protocol = a.protocol.length > 4 ? a.protocol : window.location.protocol; var host = a.host.length ? a.port === '80' || a.port === '443' ? a.hostname : a.host : window.location.host; return a.origin || protocol + "//" + host;...
javascript
function resolveOrigin(url) { var a = document.createElement('a'); a.href = url; var protocol = a.protocol.length > 4 ? a.protocol : window.location.protocol; var host = a.host.length ? a.port === '80' || a.port === '443' ? a.hostname : a.host : window.location.host; return a.origin || protocol + "//" + host;...
[ "function", "resolveOrigin", "(", "url", ")", "{", "var", "a", "=", "document", ".", "createElement", "(", "'a'", ")", ";", "a", ".", "href", "=", "url", ";", "var", "protocol", "=", "a", ".", "protocol", ".", "length", ">", "4", "?", "a", ".", "...
eslint-disable-line no-console Takes a URL and returns the origin @param {String} url The full URL being requested @return {String} The URLs origin
[ "eslint", "-", "disable", "-", "line", "no", "-", "console", "Takes", "a", "URL", "and", "returns", "the", "origin" ]
6e8fc1193f09ef0acbba55b6b89e8e2dae3af057
https://github.com/dollarshaveclub/postmate/blob/6e8fc1193f09ef0acbba55b6b89e8e2dae3af057/build/postmate.es.js#L50-L56
train
dollarshaveclub/postmate
build/postmate.es.js
resolveValue
function resolveValue(model, property) { var unwrappedContext = typeof model[property] === 'function' ? model[property]() : model[property]; return Postmate.Promise.resolve(unwrappedContext); }
javascript
function resolveValue(model, property) { var unwrappedContext = typeof model[property] === 'function' ? model[property]() : model[property]; return Postmate.Promise.resolve(unwrappedContext); }
[ "function", "resolveValue", "(", "model", ",", "property", ")", "{", "var", "unwrappedContext", "=", "typeof", "model", "[", "property", "]", "===", "'function'", "?", "model", "[", "property", "]", "(", ")", ":", "model", "[", "property", "]", ";", "ret...
Takes a model, and searches for a value by the property @param {Object} model The dictionary to search against @param {String} property A path within a dictionary (i.e. 'window.location.href') @param {Object} data Additional information from the get request that is passed to functions in the child model @r...
[ "Takes", "a", "model", "and", "searches", "for", "a", "value", "by", "the", "property" ]
6e8fc1193f09ef0acbba55b6b89e8e2dae3af057
https://github.com/dollarshaveclub/postmate/blob/6e8fc1193f09ef0acbba55b6b89e8e2dae3af057/build/postmate.es.js#L89-L92
train
dollarshaveclub/postmate
build/postmate.es.js
Postmate
function Postmate(_ref2) { var _ref2$container = _ref2.container, container = _ref2$container === void 0 ? typeof container !== 'undefined' ? container : document.body : _ref2$container, model = _ref2.model, url = _ref2.url, _ref2$classListArray = _ref2.classListArray, classL...
javascript
function Postmate(_ref2) { var _ref2$container = _ref2.container, container = _ref2$container === void 0 ? typeof container !== 'undefined' ? container : document.body : _ref2$container, model = _ref2.model, url = _ref2.url, _ref2$classListArray = _ref2.classListArray, classL...
[ "function", "Postmate", "(", "_ref2", ")", "{", "var", "_ref2$container", "=", "_ref2", ".", "container", ",", "container", "=", "_ref2$container", "===", "void", "0", "?", "typeof", "container", "!==", "'undefined'", "?", "container", ":", "document", ".", ...
eslint-disable-line no-undef Internet Explorer craps itself Sets options related to the Parent @param {Object} object The element to inject the frame into, and the url @return {Promise}
[ "eslint", "-", "disable", "-", "line", "no", "-", "undef", "Internet", "Explorer", "craps", "itself", "Sets", "options", "related", "to", "the", "Parent" ]
6e8fc1193f09ef0acbba55b6b89e8e2dae3af057
https://github.com/dollarshaveclub/postmate/blob/6e8fc1193f09ef0acbba55b6b89e8e2dae3af057/build/postmate.es.js#L287-L302
train
dollarshaveclub/postmate
build/postmate.es.js
Model
function Model(model) { this.child = window; this.model = model; this.parent = this.child.parent; return this.sendHandshakeReply(); }
javascript
function Model(model) { this.child = window; this.model = model; this.parent = this.child.parent; return this.sendHandshakeReply(); }
[ "function", "Model", "(", "model", ")", "{", "this", ".", "child", "=", "window", ";", "this", ".", "model", "=", "model", ";", "this", ".", "parent", "=", "this", ".", "child", ".", "parent", ";", "return", "this", ".", "sendHandshakeReply", "(", ")...
Initializes the child, model, parent, and responds to the Parents handshake @param {Object} model Hash of values, functions, or promises @return {Promise} The Promise that resolves when the handshake has been received
[ "Initializes", "the", "child", "model", "parent", "and", "responds", "to", "the", "Parents", "handshake" ]
6e8fc1193f09ef0acbba55b6b89e8e2dae3af057
https://github.com/dollarshaveclub/postmate/blob/6e8fc1193f09ef0acbba55b6b89e8e2dae3af057/build/postmate.es.js#L418-L423
train
node-inspector/node-inspector
front-end/profiler/CPUProfileBottomUpDataGrid.js
function(profileDataGridNode) { if (!profileDataGridNode) return; this.save(); var currentNode = profileDataGridNode; var focusNode = profileDataGridNode; while (currentNode.parent && (currentNode instanceof WebInspector.ProfileDataGridNode)) { curr...
javascript
function(profileDataGridNode) { if (!profileDataGridNode) return; this.save(); var currentNode = profileDataGridNode; var focusNode = profileDataGridNode; while (currentNode.parent && (currentNode instanceof WebInspector.ProfileDataGridNode)) { curr...
[ "function", "(", "profileDataGridNode", ")", "{", "if", "(", "!", "profileDataGridNode", ")", "return", ";", "this", ".", "save", "(", ")", ";", "var", "currentNode", "=", "profileDataGridNode", ";", "var", "focusNode", "=", "profileDataGridNode", ";", "while"...
When focusing, we keep the entire callstack up to this ancestor. @param {!WebInspector.ProfileDataGridNode} profileDataGridNode
[ "When", "focusing", "we", "keep", "the", "entire", "callstack", "up", "to", "this", "ancestor", "." ]
79e01c049286374f86dd560742a614019c02402f
https://github.com/node-inspector/node-inspector/blob/79e01c049286374f86dd560742a614019c02402f/front-end/profiler/CPUProfileBottomUpDataGrid.js#L253-L275
train
node-inspector/node-inspector
front-end/ui/SplitView.js
function() { if (!this._totalSize) { this._totalSize = this._isVertical ? this.contentElement.offsetWidth : this.contentElement.offsetHeight; this._totalSizeOtherDimension = this._isVertical ? this.contentElement.offsetHeight : this.contentElement.offsetWidth; } retur...
javascript
function() { if (!this._totalSize) { this._totalSize = this._isVertical ? this.contentElement.offsetWidth : this.contentElement.offsetHeight; this._totalSizeOtherDimension = this._isVertical ? this.contentElement.offsetHeight : this.contentElement.offsetWidth; } retur...
[ "function", "(", ")", "{", "if", "(", "!", "this", ".", "_totalSize", ")", "{", "this", ".", "_totalSize", "=", "this", ".", "_isVertical", "?", "this", ".", "contentElement", ".", "offsetWidth", ":", "this", ".", "contentElement", ".", "offsetHeight", "...
Returns total size in DIP. @return {number}
[ "Returns", "total", "size", "in", "DIP", "." ]
79e01c049286374f86dd560742a614019c02402f
https://github.com/node-inspector/node-inspector/blob/79e01c049286374f86dd560742a614019c02402f/front-end/ui/SplitView.js#L423-L430
train
node-inspector/node-inspector
front-end/toolbox/ResponsiveDesignView.js
function(dipWidth, dipHeight, scale) { this._scale = scale; this._dipWidth = dipWidth ? Math.max(dipWidth, 1) : 0; this._dipHeight = dipHeight ? Math.max(dipHeight, 1) : 0; this._updateUI(); }
javascript
function(dipWidth, dipHeight, scale) { this._scale = scale; this._dipWidth = dipWidth ? Math.max(dipWidth, 1) : 0; this._dipHeight = dipHeight ? Math.max(dipHeight, 1) : 0; this._updateUI(); }
[ "function", "(", "dipWidth", ",", "dipHeight", ",", "scale", ")", "{", "this", ".", "_scale", "=", "scale", ";", "this", ".", "_dipWidth", "=", "dipWidth", "?", "Math", ".", "max", "(", "dipWidth", ",", "1", ")", ":", "0", ";", "this", ".", "_dipHe...
WebInspector.OverridesSupport.PageResizer override. @param {number} dipWidth @param {number} dipHeight @param {number} scale
[ "WebInspector", ".", "OverridesSupport", ".", "PageResizer", "override", "." ]
79e01c049286374f86dd560742a614019c02402f
https://github.com/node-inspector/node-inspector/blob/79e01c049286374f86dd560742a614019c02402f/front-end/toolbox/ResponsiveDesignView.js#L167-L173
train
node-inspector/node-inspector
front-end/sources/NavigatorView.js
typeWeight
function typeWeight(treeElement) { var type = treeElement.type(); if (type === WebInspector.NavigatorTreeOutline.Types.Domain) { if (treeElement.titleText === WebInspector.targetManager.inspectedPageDomain()) return 1; return 2; } if (type === ...
javascript
function typeWeight(treeElement) { var type = treeElement.type(); if (type === WebInspector.NavigatorTreeOutline.Types.Domain) { if (treeElement.titleText === WebInspector.targetManager.inspectedPageDomain()) return 1; return 2; } if (type === ...
[ "function", "typeWeight", "(", "treeElement", ")", "{", "var", "type", "=", "treeElement", ".", "type", "(", ")", ";", "if", "(", "type", "===", "WebInspector", ".", "NavigatorTreeOutline", ".", "Types", ".", "Domain", ")", "{", "if", "(", "treeElement", ...
Insert in the alphabetical order, first domains, then folders, then scripts.
[ "Insert", "in", "the", "alphabetical", "order", "first", "domains", "then", "folders", "then", "scripts", "." ]
79e01c049286374f86dd560742a614019c02402f
https://github.com/node-inspector/node-inspector/blob/79e01c049286374f86dd560742a614019c02402f/front-end/sources/NavigatorView.js#L625-L638
train
node-inspector/node-inspector
index.js
buildInspectorUrl
function buildInspectorUrl(inspectorHost, inspectorPort, debugPort, isHttps) { var host = inspectorHost == '0.0.0.0' ? '127.0.0.1' : inspectorHost; var port = inspectorPort; var protocol = isHttps ? 'https' : 'http'; var isUnixSocket = !/^\d+$/.test(port); if (isUnixSocket) { host = path.resolve(__dirnam...
javascript
function buildInspectorUrl(inspectorHost, inspectorPort, debugPort, isHttps) { var host = inspectorHost == '0.0.0.0' ? '127.0.0.1' : inspectorHost; var port = inspectorPort; var protocol = isHttps ? 'https' : 'http'; var isUnixSocket = !/^\d+$/.test(port); if (isUnixSocket) { host = path.resolve(__dirnam...
[ "function", "buildInspectorUrl", "(", "inspectorHost", ",", "inspectorPort", ",", "debugPort", ",", "isHttps", ")", "{", "var", "host", "=", "inspectorHost", "==", "'0.0.0.0'", "?", "'127.0.0.1'", ":", "inspectorHost", ";", "var", "port", "=", "inspectorPort", "...
Build a URL for loading inspector UI in the browser. @param {string|undefined} inspectorHost as configured via --web-host @param {number} inspectorPort as configured via --web-port @param {number} debugPort as configured via --debug in the debugged app @param {number} isHttps as configured via --ssl-cert and --ssl-key ...
[ "Build", "a", "URL", "for", "loading", "inspector", "UI", "in", "the", "browser", "." ]
79e01c049286374f86dd560742a614019c02402f
https://github.com/node-inspector/node-inspector/blob/79e01c049286374f86dd560742a614019c02402f/index.js#L15-L36
train
node-inspector/node-inspector
index.js
buildWebSocketUrl
function buildWebSocketUrl(inspectorHost, inspectorPort, debugPort, isSecure) { var parts = { protocol: isSecure ? 'wss:' : 'ws:', hostname: inspectorHost == '0.0.0.0' ? '127.0.0.1' : inspectorHost, port: inspectorPort, pathname: '/', search: '?port=' + debugPort, slashes: true }; return ...
javascript
function buildWebSocketUrl(inspectorHost, inspectorPort, debugPort, isSecure) { var parts = { protocol: isSecure ? 'wss:' : 'ws:', hostname: inspectorHost == '0.0.0.0' ? '127.0.0.1' : inspectorHost, port: inspectorPort, pathname: '/', search: '?port=' + debugPort, slashes: true }; return ...
[ "function", "buildWebSocketUrl", "(", "inspectorHost", ",", "inspectorPort", ",", "debugPort", ",", "isSecure", ")", "{", "var", "parts", "=", "{", "protocol", ":", "isSecure", "?", "'wss:'", ":", "'ws:'", ",", "hostname", ":", "inspectorHost", "==", "'0.0.0.0...
Build a URL for the WebSocket endpoint. @param {string|undefined} inspectorHost as configured via --web-host @param {number} inspectorPort as configured via --web-port @param {number} debugPort as configured via --debug in the debugged app @param {number} isHttps as configured via --ssl-cert and --ssl-key in the debugg...
[ "Build", "a", "URL", "for", "the", "WebSocket", "endpoint", "." ]
79e01c049286374f86dd560742a614019c02402f
https://github.com/node-inspector/node-inspector/blob/79e01c049286374f86dd560742a614019c02402f/index.js#L45-L56
train
node-inspector/node-inspector
front-end/timeline/TimelinePanel.js
function() { if (!this._searchResults || !this._searchResults.length) return; var index = this._selectedSearchResult ? this._searchResults.indexOf(this._selectedSearchResult) : -1; this._jumpToSearchResult(index + 1); }
javascript
function() { if (!this._searchResults || !this._searchResults.length) return; var index = this._selectedSearchResult ? this._searchResults.indexOf(this._selectedSearchResult) : -1; this._jumpToSearchResult(index + 1); }
[ "function", "(", ")", "{", "if", "(", "!", "this", ".", "_searchResults", "||", "!", "this", ".", "_searchResults", ".", "length", ")", "return", ";", "var", "index", "=", "this", ".", "_selectedSearchResult", "?", "this", ".", "_searchResults", ".", "in...
WebInspector.Searchable implementation
[ "WebInspector", ".", "Searchable", "implementation" ]
79e01c049286374f86dd560742a614019c02402f
https://github.com/node-inspector/node-inspector/blob/79e01c049286374f86dd560742a614019c02402f/front-end/timeline/TimelinePanel.js#L829-L835
train
tempusdominus/bootstrap-4
build/js/tempusdominus-bootstrap-4.js
getSelectorFromElement
function getSelectorFromElement($element) { var selector = $element.data('target'), $selector = void 0; if (!selector) { selector = $element.attr('href') || ''; selector = /^#[a-z]/i.test(selector) ? selector : null; } $selector = $(selector); ...
javascript
function getSelectorFromElement($element) { var selector = $element.data('target'), $selector = void 0; if (!selector) { selector = $element.attr('href') || ''; selector = /^#[a-z]/i.test(selector) ? selector : null; } $selector = $(selector); ...
[ "function", "getSelectorFromElement", "(", "$element", ")", "{", "var", "selector", "=", "$element", ".", "data", "(", "'target'", ")", ",", "$selector", "=", "void", "0", ";", "if", "(", "!", "selector", ")", "{", "selector", "=", "$element", ".", "attr...
eslint-disable-line no-unused-vars ReSharper disable once InconsistentNaming
[ "eslint", "-", "disable", "-", "line", "no", "-", "unused", "-", "vars", "ReSharper", "disable", "once", "InconsistentNaming" ]
540bfae18ca662bacfbea610e0ab8dcce6dd699e
https://github.com/tempusdominus/bootstrap-4/blob/540bfae18ca662bacfbea610e0ab8dcce6dd699e/build/js/tempusdominus-bootstrap-4.js#L1588-L1606
train
dagrejs/dagre
lib/position/bk.js
pass1
function pass1(elem) { xs[elem] = blockG.inEdges(elem).reduce(function(acc, e) { return Math.max(acc, xs[e.v] + blockG.edge(e)); }, 0); }
javascript
function pass1(elem) { xs[elem] = blockG.inEdges(elem).reduce(function(acc, e) { return Math.max(acc, xs[e.v] + blockG.edge(e)); }, 0); }
[ "function", "pass1", "(", "elem", ")", "{", "xs", "[", "elem", "]", "=", "blockG", ".", "inEdges", "(", "elem", ")", ".", "reduce", "(", "function", "(", "acc", ",", "e", ")", "{", "return", "Math", ".", "max", "(", "acc", ",", "xs", "[", "e", ...
First pass, assign smallest coordinates
[ "First", "pass", "assign", "smallest", "coordinates" ]
ec3fd32a2ae9eb413aea5b8bd31fac652a9b6a5e
https://github.com/dagrejs/dagre/blob/ec3fd32a2ae9eb413aea5b8bd31fac652a9b6a5e/lib/position/bk.js#L235-L239
train
dagrejs/dagre
lib/position/bk.js
pass2
function pass2(elem) { var min = blockG.outEdges(elem).reduce(function(acc, e) { return Math.min(acc, xs[e.w] - blockG.edge(e)); }, Number.POSITIVE_INFINITY); var node = g.node(elem); if (min !== Number.POSITIVE_INFINITY && node.borderType !== borderType) { xs[elem] = Math.max(xs[elem], min...
javascript
function pass2(elem) { var min = blockG.outEdges(elem).reduce(function(acc, e) { return Math.min(acc, xs[e.w] - blockG.edge(e)); }, Number.POSITIVE_INFINITY); var node = g.node(elem); if (min !== Number.POSITIVE_INFINITY && node.borderType !== borderType) { xs[elem] = Math.max(xs[elem], min...
[ "function", "pass2", "(", "elem", ")", "{", "var", "min", "=", "blockG", ".", "outEdges", "(", "elem", ")", ".", "reduce", "(", "function", "(", "acc", ",", "e", ")", "{", "return", "Math", ".", "min", "(", "acc", ",", "xs", "[", "e", ".", "w",...
Second pass, assign greatest coordinates
[ "Second", "pass", "assign", "greatest", "coordinates" ]
ec3fd32a2ae9eb413aea5b8bd31fac652a9b6a5e
https://github.com/dagrejs/dagre/blob/ec3fd32a2ae9eb413aea5b8bd31fac652a9b6a5e/lib/position/bk.js#L242-L251
train
jakubpawlowicz/clean-css
docs/js/optimizer.js
function () { this.worker = new Worker('./js/optimizer-worker.js') this.worker.onmessage = function (event) { switch (event.data.command) { case 'optimized': Optimizer.oncomplete(event.data.id, event.data.output, event.data.saved) } } this.worker.onerror = function (event) ...
javascript
function () { this.worker = new Worker('./js/optimizer-worker.js') this.worker.onmessage = function (event) { switch (event.data.command) { case 'optimized': Optimizer.oncomplete(event.data.id, event.data.output, event.data.saved) } } this.worker.onerror = function (event) ...
[ "function", "(", ")", "{", "this", ".", "worker", "=", "new", "Worker", "(", "'./js/optimizer-worker.js'", ")", "this", ".", "worker", ".", "onmessage", "=", "function", "(", "event", ")", "{", "switch", "(", "event", ".", "data", ".", "command", ")", ...
see setOptionsFrom in settings.js
[ "see", "setOptionsFrom", "in", "settings", ".", "js" ]
dc728a8167b7b6f62906115c560be2f5b530f9f6
https://github.com/jakubpawlowicz/clean-css/blob/dc728a8167b7b6f62906115c560be2f5b530f9f6/docs/js/optimizer.js#L4-L15
train
spite/ccapture.js
src/Whammy.js
checkFrames
function checkFrames(frames){ var width = frames[0].width, height = frames[0].height, duration = frames[0].duration; for(var i = 1; i < frames.length; i++){ if(frames[i].width != width) throw "Frame " + (i + 1) + " has a different width"; if(frames[i].height != height) throw "Frame " + (i + 1) + "...
javascript
function checkFrames(frames){ var width = frames[0].width, height = frames[0].height, duration = frames[0].duration; for(var i = 1; i < frames.length; i++){ if(frames[i].width != width) throw "Frame " + (i + 1) + " has a different width"; if(frames[i].height != height) throw "Frame " + (i + 1) + "...
[ "function", "checkFrames", "(", "frames", ")", "{", "var", "width", "=", "frames", "[", "0", "]", ".", "width", ",", "height", "=", "frames", "[", "0", "]", ".", "height", ",", "duration", "=", "frames", "[", "0", "]", ".", "duration", ";", "for", ...
sums the lengths of all the frames and gets the duration, woo
[ "sums", "the", "lengths", "of", "all", "the", "frames", "and", "gets", "the", "duration", "woo" ]
e4bc8fccc1e10d69b79b1c02fd13f3c448a3fb41
https://github.com/spite/ccapture.js/blob/e4bc8fccc1e10d69b79b1c02fd13f3c448a3fb41/src/Whammy.js#L231-L246
train
spite/ccapture.js
src/Whammy.js
parseWebP
function parseWebP(riff){ var VP8 = riff.RIFF[0].WEBP[0]; var frame_start = VP8.indexOf('\x9d\x01\x2a'); //A VP8 keyframe starts with the 0x9d012a header for(var i = 0, c = []; i < 4; i++) c[i] = VP8.charCodeAt(frame_start + 3 + i); var width, horizontal_scale, height, vertical_scale, tmp; //the co...
javascript
function parseWebP(riff){ var VP8 = riff.RIFF[0].WEBP[0]; var frame_start = VP8.indexOf('\x9d\x01\x2a'); //A VP8 keyframe starts with the 0x9d012a header for(var i = 0, c = []; i < 4; i++) c[i] = VP8.charCodeAt(frame_start + 3 + i); var width, horizontal_scale, height, vertical_scale, tmp; //the co...
[ "function", "parseWebP", "(", "riff", ")", "{", "var", "VP8", "=", "riff", ".", "RIFF", "[", "0", "]", ".", "WEBP", "[", "0", "]", ";", "var", "frame_start", "=", "VP8", ".", "indexOf", "(", "'\\x9d\\x01\\x2a'", ")", ";", "//A VP8 keyframe starts with th...
here's something else taken verbatim from weppy, awesome rite?
[ "here", "s", "something", "else", "taken", "verbatim", "from", "weppy", "awesome", "rite?" ]
e4bc8fccc1e10d69b79b1c02fd13f3c448a3fb41
https://github.com/spite/ccapture.js/blob/e4bc8fccc1e10d69b79b1c02fd13f3c448a3fb41/src/Whammy.js#L428-L449
train
spite/ccapture.js
src/webm-writer-0.2.0.js
decodeBase64WebPDataURL
function decodeBase64WebPDataURL(url) { if (typeof url !== "string" || !url.match(/^data:image\/webp;base64,/i)) { return false; } return window.atob(url.substring("data:image\/webp;base64,".length)); }
javascript
function decodeBase64WebPDataURL(url) { if (typeof url !== "string" || !url.match(/^data:image\/webp;base64,/i)) { return false; } return window.atob(url.substring("data:image\/webp;base64,".length)); }
[ "function", "decodeBase64WebPDataURL", "(", "url", ")", "{", "if", "(", "typeof", "url", "!==", "\"string\"", "||", "!", "url", ".", "match", "(", "/", "^data:image\\/webp;base64,", "/", "i", ")", ")", "{", "return", "false", ";", "}", "return", "window", ...
Decode a Base64 data URL into a binary string. Returns the binary string, or false if the URL could not be decoded.
[ "Decode", "a", "Base64", "data", "URL", "into", "a", "binary", "string", "." ]
e4bc8fccc1e10d69b79b1c02fd13f3c448a3fb41
https://github.com/spite/ccapture.js/blob/e4bc8fccc1e10d69b79b1c02fd13f3c448a3fb41/src/webm-writer-0.2.0.js#L473-L479
train
spite/ccapture.js
src/webm-writer-0.2.0.js
renderAsWebP
function renderAsWebP(canvas, quality) { var frame = canvas.toDataURL('image/webp', {quality: quality}); return decodeBase64WebPDataURL(frame); }
javascript
function renderAsWebP(canvas, quality) { var frame = canvas.toDataURL('image/webp', {quality: quality}); return decodeBase64WebPDataURL(frame); }
[ "function", "renderAsWebP", "(", "canvas", ",", "quality", ")", "{", "var", "frame", "=", "canvas", ".", "toDataURL", "(", "'image/webp'", ",", "{", "quality", ":", "quality", "}", ")", ";", "return", "decodeBase64WebPDataURL", "(", "frame", ")", ";", "}" ...
Convert the given canvas to a WebP encoded image and return the image data as a string.
[ "Convert", "the", "given", "canvas", "to", "a", "WebP", "encoded", "image", "and", "return", "the", "image", "data", "as", "a", "string", "." ]
e4bc8fccc1e10d69b79b1c02fd13f3c448a3fb41
https://github.com/spite/ccapture.js/blob/e4bc8fccc1e10d69b79b1c02fd13f3c448a3fb41/src/webm-writer-0.2.0.js#L499-L504
train
spite/ccapture.js
src/webm-writer-0.2.0.js
writeEBML
function writeEBML(buffer, bufferFileOffset, ebml) { // Is the ebml an array of sibling elements? if (Array.isArray(ebml)) { for (var i = 0; i < ebml.length; i++) { writeEBML(buffer, bufferFileOffset, ebml[i]); } // Is this some sor...
javascript
function writeEBML(buffer, bufferFileOffset, ebml) { // Is the ebml an array of sibling elements? if (Array.isArray(ebml)) { for (var i = 0; i < ebml.length; i++) { writeEBML(buffer, bufferFileOffset, ebml[i]); } // Is this some sor...
[ "function", "writeEBML", "(", "buffer", ",", "bufferFileOffset", ",", "ebml", ")", "{", "// Is the ebml an array of sibling elements?", "if", "(", "Array", ".", "isArray", "(", "ebml", ")", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "ebml",...
Write the given EBML object to the provided ArrayBufferStream. The buffer's first byte is at bufferFileOffset inside the video file. This is used to complete offset and dataOffset fields in each EBML structure, indicating the file offset of the first byte of the EBML element and its data payload.
[ "Write", "the", "given", "EBML", "object", "to", "the", "provided", "ArrayBufferStream", "." ]
e4bc8fccc1e10d69b79b1c02fd13f3c448a3fb41
https://github.com/spite/ccapture.js/blob/e4bc8fccc1e10d69b79b1c02fd13f3c448a3fb41/src/webm-writer-0.2.0.js#L537-L621
train
spite/ccapture.js
src/webm-writer-0.2.0.js
createSeekHead
function createSeekHead() { var seekPositionEBMLTemplate = { "id": 0x53AC, // SeekPosition "size": 5, // Allows for 32GB video files "data": 0 // We'll overwrite this when the file is complete ...
javascript
function createSeekHead() { var seekPositionEBMLTemplate = { "id": 0x53AC, // SeekPosition "size": 5, // Allows for 32GB video files "data": 0 // We'll overwrite this when the file is complete ...
[ "function", "createSeekHead", "(", ")", "{", "var", "seekPositionEBMLTemplate", "=", "{", "\"id\"", ":", "0x53AC", ",", "// SeekPosition", "\"size\"", ":", "5", ",", "// Allows for 32GB video files", "\"data\"", ":", "0", "// We'll overwrite this when the file is complete...
Create a SeekHead element with descriptors for the points in the global seekPoints array. 5 bytes of position values are reserved for each node, which lie at the offset point.positionEBML.dataOffset, to be overwritten later.
[ "Create", "a", "SeekHead", "element", "with", "descriptors", "for", "the", "points", "in", "the", "global", "seekPoints", "array", "." ]
e4bc8fccc1e10d69b79b1c02fd13f3c448a3fb41
https://github.com/spite/ccapture.js/blob/e4bc8fccc1e10d69b79b1c02fd13f3c448a3fb41/src/webm-writer-0.2.0.js#L673-L705
train
spite/ccapture.js
src/webm-writer-0.2.0.js
writeHeader
function writeHeader() { seekHead = createSeekHead(); var ebmlHeader = { "id": 0x1a45dfa3, // EBML "data": [ { "id": 0x4286, // EBMLVersion ...
javascript
function writeHeader() { seekHead = createSeekHead(); var ebmlHeader = { "id": 0x1a45dfa3, // EBML "data": [ { "id": 0x4286, // EBMLVersion ...
[ "function", "writeHeader", "(", ")", "{", "seekHead", "=", "createSeekHead", "(", ")", ";", "var", "ebmlHeader", "=", "{", "\"id\"", ":", "0x1a45dfa3", ",", "// EBML", "\"data\"", ":", "[", "{", "\"id\"", ":", "0x4286", ",", "// EBMLVersion", "\"data\"", "...
Write the WebM file header to the stream.
[ "Write", "the", "WebM", "file", "header", "to", "the", "stream", "." ]
e4bc8fccc1e10d69b79b1c02fd13f3c448a3fb41
https://github.com/spite/ccapture.js/blob/e4bc8fccc1e10d69b79b1c02fd13f3c448a3fb41/src/webm-writer-0.2.0.js#L710-L838
train
spite/ccapture.js
src/webm-writer-0.2.0.js
flushClusterFrameBuffer
function flushClusterFrameBuffer() { if (clusterFrameBuffer.length == 0) { return; } // First work out how large of a buffer we need to hold the cluster data var rawImageSize = 0; ...
javascript
function flushClusterFrameBuffer() { if (clusterFrameBuffer.length == 0) { return; } // First work out how large of a buffer we need to hold the cluster data var rawImageSize = 0; ...
[ "function", "flushClusterFrameBuffer", "(", ")", "{", "if", "(", "clusterFrameBuffer", ".", "length", "==", "0", ")", "{", "return", ";", "}", "// First work out how large of a buffer we need to hold the cluster data", "var", "rawImageSize", "=", "0", ";", "for", "(",...
Flush the frames in the current clusterFrameBuffer out to the stream as a Cluster.
[ "Flush", "the", "frames", "in", "the", "current", "clusterFrameBuffer", "out", "to", "the", "stream", "as", "a", "Cluster", "." ]
e4bc8fccc1e10d69b79b1c02fd13f3c448a3fb41
https://github.com/spite/ccapture.js/blob/e4bc8fccc1e10d69b79b1c02fd13f3c448a3fb41/src/webm-writer-0.2.0.js#L940-L972
train
spite/ccapture.js
src/webm-writer-0.2.0.js
rewriteSeekHead
function rewriteSeekHead() { var seekHeadBuffer = new ArrayBufferDataStream(seekHead.size), oldPos = blobBuffer.pos; // Write the rewritten SeekHead element's data payload to the stream (don't need to update the id or size) ...
javascript
function rewriteSeekHead() { var seekHeadBuffer = new ArrayBufferDataStream(seekHead.size), oldPos = blobBuffer.pos; // Write the rewritten SeekHead element's data payload to the stream (don't need to update the id or size) ...
[ "function", "rewriteSeekHead", "(", ")", "{", "var", "seekHeadBuffer", "=", "new", "ArrayBufferDataStream", "(", "seekHead", ".", "size", ")", ",", "oldPos", "=", "blobBuffer", ".", "pos", ";", "// Write the rewritten SeekHead element's data payload to the stream (don't n...
Rewrites the SeekHead element that was initially written to the stream with the offsets of top level elements. Call once writing is complete (so the offset of all top level elements is known).
[ "Rewrites", "the", "SeekHead", "element", "that", "was", "initially", "written", "to", "the", "stream", "with", "the", "offsets", "of", "top", "level", "elements", "." ]
e4bc8fccc1e10d69b79b1c02fd13f3c448a3fb41
https://github.com/spite/ccapture.js/blob/e4bc8fccc1e10d69b79b1c02fd13f3c448a3fb41/src/webm-writer-0.2.0.js#L1005-L1018
train