id
int32
0
58k
repo
stringlengths
5
67
path
stringlengths
4
116
func_name
stringlengths
0
58
original_string
stringlengths
52
373k
language
stringclasses
1 value
code
stringlengths
52
373k
code_tokens
list
docstring
stringlengths
4
11.8k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
86
226
21,700
titon/toolkit
dist/toolkit.js
function() { this.fireEvent('showing'); var show = false; this.count++; if (this.count === 1) { this.element.reveal(); show = true; } this.showLoader(); this.fireEvent('shown', [show]); }
javascript
function() { this.fireEvent('showing'); var show = false; this.count++; if (this.count === 1) { this.element.reveal(); show = true; } this.showLoader(); this.fireEvent('shown', [show]); }
[ "function", "(", ")", "{", "this", ".", "fireEvent", "(", "'showing'", ")", ";", "var", "show", "=", "false", ";", "this", ".", "count", "++", ";", "if", "(", "this", ".", "count", "===", "1", ")", "{", "this", ".", "element", ".", "reveal", "(",...
Show the blackout and increase open count.
[ "Show", "the", "blackout", "and", "increase", "open", "count", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L1489-L1504
21,701
titon/toolkit
dist/toolkit.js
function() { var self = $(this), start, target; /** * There's a major bug in Android devices where `touchend` events do not fire * without calling `preventDefault()` in `touchstart` or `touchmove`. * Because of this, we have...
javascript
function() { var self = $(this), start, target; /** * There's a major bug in Android devices where `touchend` events do not fire * without calling `preventDefault()` in `touchstart` or `touchmove`. * Because of this, we have...
[ "function", "(", ")", "{", "var", "self", "=", "$", "(", "this", ")", ",", "start", ",", "target", ";", "/**\n * There's a major bug in Android devices where `touchend` events do not fire\n * without calling `preventDefault()` in `touchstart` or `touchmove`.\n...
Maximum distance to travel in the opposite direction
[ "Maximum", "distance", "to", "travel", "in", "the", "opposite", "direction" ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L1607-L1679
21,702
titon/toolkit
dist/toolkit.js
cleanup
function cleanup() { start = target = null; swiping = false; self.off(moveEvent, move); }
javascript
function cleanup() { start = target = null; swiping = false; self.off(moveEvent, move); }
[ "function", "cleanup", "(", ")", "{", "start", "=", "target", "=", "null", ";", "swiping", "=", "false", ";", "self", ".", "off", "(", "moveEvent", ",", "move", ")", ";", "}" ]
When `touchend` or `touchcancel` is triggered, clean up the swipe state. Also unbind `touchmove` events until another swipe occurs.
[ "When", "touchend", "or", "touchcancel", "is", "triggered", "clean", "up", "the", "swipe", "state", ".", "Also", "unbind", "touchmove", "events", "until", "another", "swipe", "occurs", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L1640-L1645
21,703
titon/toolkit
dist/toolkit.js
function() { var options = this.options; return this.wrapper = this.render(options.wrapperTemplate) .addClass(Toolkit.buildTemplate(options.wrapperClass)) .attr('id', this.id('wrapper')) .appendTo('body'); }
javascript
function() { var options = this.options; return this.wrapper = this.render(options.wrapperTemplate) .addClass(Toolkit.buildTemplate(options.wrapperClass)) .attr('id', this.id('wrapper')) .appendTo('body'); }
[ "function", "(", ")", "{", "var", "options", "=", "this", ".", "options", ";", "return", "this", ".", "wrapper", "=", "this", ".", "render", "(", "options", ".", "wrapperTemplate", ")", ".", "addClass", "(", "Toolkit", ".", "buildTemplate", "(", "options...
Create the elements wrapper. @return {jQuery}
[ "Create", "the", "elements", "wrapper", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L2387-L2394
21,704
titon/toolkit
dist/toolkit.js
function(node, callback) { var elements = this.elements, el, id = $(node).cache('toolkit.cid', function() { return Math.random().toString(32).substr(2); }); if (elements[id]) { el = elements[id]; } else { el = elements[...
javascript
function(node, callback) { var elements = this.elements, el, id = $(node).cache('toolkit.cid', function() { return Math.random().toString(32).substr(2); }); if (elements[id]) { el = elements[id]; } else { el = elements[...
[ "function", "(", "node", ",", "callback", ")", "{", "var", "elements", "=", "this", ".", "elements", ",", "el", ",", "id", "=", "$", "(", "node", ")", ".", "cache", "(", "'toolkit.cid'", ",", "function", "(", ")", "{", "return", "Math", ".", "rando...
Attempt to find and return an element by a unique composite ID. Each element is unique per node. If the element does not exist, create it. @param {jQuery} node @param {Function} [callback] - Callback to trigger once an element is created @returns {jQuery}
[ "Attempt", "to", "find", "and", "return", "an", "element", "by", "a", "unique", "composite", "ID", ".", "Each", "element", "is", "unique", "per", "node", ".", "If", "the", "element", "does", "not", "exist", "create", "it", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L2413-L2431
21,705
titon/toolkit
dist/toolkit.js
function(e) { var node = $(e.currentTarget), element, isNode = (this.node && this.node.is(node)), cid = node.data('toolkit.cid'); // Set the current element based on the nodes composite ID if (cid && this.elements[cid]) { element = this.elements[c...
javascript
function(e) { var node = $(e.currentTarget), element, isNode = (this.node && this.node.is(node)), cid = node.data('toolkit.cid'); // Set the current element based on the nodes composite ID if (cid && this.elements[cid]) { element = this.elements[c...
[ "function", "(", "e", ")", "{", "var", "node", "=", "$", "(", "e", ".", "currentTarget", ")", ",", "element", ",", "isNode", "=", "(", "this", ".", "node", "&&", "this", ".", "node", ".", "is", "(", "node", ")", ")", ",", "cid", "=", "node", ...
Event handler for toggling an element through click or hover events. @param {jQuery.Event} e @private
[ "Event", "handler", "for", "toggling", "an", "element", "through", "click", "or", "hover", "events", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L2461-L2502
21,706
titon/toolkit
dist/toolkit.js
function(node) { var target = this.readValue(node, this.options.getTarget); if (!target || target.substr(0, 1) !== '#') { throw new Error('Drop menu ' + target + ' does not exist'); } return $(target); }
javascript
function(node) { var target = this.readValue(node, this.options.getTarget); if (!target || target.substr(0, 1) !== '#') { throw new Error('Drop menu ' + target + ' does not exist'); } return $(target); }
[ "function", "(", "node", ")", "{", "var", "target", "=", "this", ".", "readValue", "(", "node", ",", "this", ".", "options", ".", "getTarget", ")", ";", "if", "(", "!", "target", "||", "target", ".", "substr", "(", "0", ",", "1", ")", "!==", "'#'...
Find the menu for the current node. @param {jQuery} node
[ "Find", "the", "menu", "for", "the", "current", "node", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L2620-L2628
21,707
titon/toolkit
dist/toolkit.js
function() { var element = this.element, node = this.node; // Clickout check if (!element && !node) { return; } this.fireEvent('hiding', [element, node]); element.conceal(); node .aria('toggled', false) .removeCl...
javascript
function() { var element = this.element, node = this.node; // Clickout check if (!element && !node) { return; } this.fireEvent('hiding', [element, node]); element.conceal(); node .aria('toggled', false) .removeCl...
[ "function", "(", ")", "{", "var", "element", "=", "this", ".", "element", ",", "node", "=", "this", ".", "node", ";", "// Clickout check", "if", "(", "!", "element", "&&", "!", "node", ")", "{", "return", ";", "}", "this", ".", "fireEvent", "(", "'...
Hide the opened menu and reset the nodes active state.
[ "Hide", "the", "opened", "menu", "and", "reset", "the", "nodes", "active", "state", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L2633-L2651
21,708
titon/toolkit
dist/toolkit.js
function(node) { this.node = node = $(node); var element = this.loadElement(node); this.fireEvent('showing', [element, node]); element.reveal(); node .aria('toggled', true) .addClass('is-active'); this.fireEvent('shown', [element, node]); ...
javascript
function(node) { this.node = node = $(node); var element = this.loadElement(node); this.fireEvent('showing', [element, node]); element.reveal(); node .aria('toggled', true) .addClass('is-active'); this.fireEvent('shown', [element, node]); ...
[ "function", "(", "node", ")", "{", "this", ".", "node", "=", "node", "=", "$", "(", "node", ")", ";", "var", "element", "=", "this", ".", "loadElement", "(", "node", ")", ";", "this", ".", "fireEvent", "(", "'showing'", ",", "[", "element", ",", ...
Open the target menu and apply active state to the node. @param {jQuery} node
[ "Open", "the", "target", "menu", "and", "apply", "active", "state", "to", "the", "node", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L2658-L2672
21,709
titon/toolkit
dist/toolkit.js
function(e) { e.preventDefault(); // Hide previous drops this.hide(); // Toggle the menu var node = $(e.currentTarget), menu = this.loadElement(node); if (!menu.is(':shown')) { this.show(node); } else { this.hide(); ...
javascript
function(e) { e.preventDefault(); // Hide previous drops this.hide(); // Toggle the menu var node = $(e.currentTarget), menu = this.loadElement(node); if (!menu.is(':shown')) { this.show(node); } else { this.hide(); ...
[ "function", "(", "e", ")", "{", "e", ".", "preventDefault", "(", ")", ";", "// Hide previous drops", "this", ".", "hide", "(", ")", ";", "// Toggle the menu", "var", "node", "=", "$", "(", "e", ".", "currentTarget", ")", ",", "menu", "=", "this", ".", ...
When a node is clicked, grab the target from the attribute. Validate the target element, then either display or hide. @param {jQuery.Event} e @private
[ "When", "a", "node", "is", "clicked", "grab", "the", "target", "from", "the", "attribute", ".", "Validate", "the", "target", "element", "then", "either", "display", "or", "hide", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L2681-L2697
21,710
titon/toolkit
dist/toolkit.js
function(nodes, url, options) { if (Toolkit.isTouch) { return; // Flyouts shouldn't be usable on touch devices } this.nodes = $(nodes); options = this.setOptions(options); this.createWrapper(); if (options.mode === 'click') { this.addEvents([ ...
javascript
function(nodes, url, options) { if (Toolkit.isTouch) { return; // Flyouts shouldn't be usable on touch devices } this.nodes = $(nodes); options = this.setOptions(options); this.createWrapper(); if (options.mode === 'click') { this.addEvents([ ...
[ "function", "(", "nodes", ",", "url", ",", "options", ")", "{", "if", "(", "Toolkit", ".", "isTouch", ")", "{", "return", ";", "// Flyouts shouldn't be usable on touch devices", "}", "this", ".", "nodes", "=", "$", "(", "nodes", ")", ";", "options", "=", ...
Initialize the flyout. A URL is required during construction. @param {jQuery} nodes @param {String} url @param {Object} [options]
[ "Initialize", "the", "flyout", ".", "A", "URL", "is", "required", "during", "construction", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L2731-L2761
21,711
titon/toolkit
dist/toolkit.js
function(data, depth) { depth = depth || 0; // If root, store the data if (!depth) { this.data = data; } // Store the data indexed by URL if (data.url) { this.dataMap[data.url] = data; } if (data.children) { for (var ...
javascript
function(data, depth) { depth = depth || 0; // If root, store the data if (!depth) { this.data = data; } // Store the data indexed by URL if (data.url) { this.dataMap[data.url] = data; } if (data.children) { for (var ...
[ "function", "(", "data", ",", "depth", ")", "{", "depth", "=", "depth", "||", "0", ";", "// If root, store the data", "if", "(", "!", "depth", ")", "{", "this", ".", "data", "=", "data", ";", "}", "// Store the data indexed by URL", "if", "(", "data", "....
Load the data into the class and save a mapping of it. @param {Object} data @param {Number} [depth]
[ "Load", "the", "data", "into", "the", "class", "and", "save", "a", "mapping", "of", "it", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L2800-L2818
21,712
titon/toolkit
dist/toolkit.js
function() { var options = this.options, node = this.node, element = this.loadElement(node); // Only position if the menu has children if (!element.children().length) { return; } this.fireEvent('showing'); var height = element.outerH...
javascript
function() { var options = this.options, node = this.node, element = this.loadElement(node); // Only position if the menu has children if (!element.children().length) { return; } this.fireEvent('showing'); var height = element.outerH...
[ "function", "(", ")", "{", "var", "options", "=", "this", ".", "options", ",", "node", "=", "this", ".", "node", ",", "element", "=", "this", ".", "loadElement", "(", "node", ")", ";", "// Only position if the menu has children", "if", "(", "!", "element",...
Position the menu below the target node.
[ "Position", "the", "menu", "below", "the", "target", "node", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L2823-L2859
21,713
titon/toolkit
dist/toolkit.js
function(node) { node = $(node); var target = this.readValue(node, this.options.getUrl) || node.attr('href'); // When jumping from one node to another // Immediately hide the other menu and start the timer for the current one if (this.url && target !== this.url) { t...
javascript
function(node) { node = $(node); var target = this.readValue(node, this.options.getUrl) || node.attr('href'); // When jumping from one node to another // Immediately hide the other menu and start the timer for the current one if (this.url && target !== this.url) { t...
[ "function", "(", "node", ")", "{", "node", "=", "$", "(", "node", ")", ";", "var", "target", "=", "this", ".", "readValue", "(", "node", ",", "this", ".", "options", ".", "getUrl", ")", "||", "node", ".", "attr", "(", "'href'", ")", ";", "// When...
Show the menu below the node. @param {jQuery} node
[ "Show", "the", "menu", "below", "the", "node", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L2866-L2895
21,714
titon/toolkit
dist/toolkit.js
function(key, delay, args) { this.clearTimer(key); var func; if (key === 'show') { func = this.position; } else { func = this.hide; } if (func) { this.timers[key] = setTimeout(function() { func.apply(this, args || [])...
javascript
function(key, delay, args) { this.clearTimer(key); var func; if (key === 'show') { func = this.position; } else { func = this.hide; } if (func) { this.timers[key] = setTimeout(function() { func.apply(this, args || [])...
[ "function", "(", "key", ",", "delay", ",", "args", ")", "{", "this", ".", "clearTimer", "(", "key", ")", ";", "var", "func", ";", "if", "(", "key", "===", "'show'", ")", "{", "func", "=", "this", ".", "position", ";", "}", "else", "{", "func", ...
Add a timer that should trigger a function after a delay. @param {String} key @param {Number} delay @param {Array} [args]
[ "Add", "a", "timer", "that", "should", "trigger", "a", "function", "after", "a", "delay", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L2904-L2920
21,715
titon/toolkit
dist/toolkit.js
function(parent) { parent = $(parent); parent.removeClass('is-open'); parent.children(this.ns('menu')) .removeAttr('style') .aria({ expanded: false, hidden: false }) .conceal(); this.fireEvent('hideChild', [...
javascript
function(parent) { parent = $(parent); parent.removeClass('is-open'); parent.children(this.ns('menu')) .removeAttr('style') .aria({ expanded: false, hidden: false }) .conceal(); this.fireEvent('hideChild', [...
[ "function", "(", "parent", ")", "{", "parent", "=", "$", "(", "parent", ")", ";", "parent", ".", "removeClass", "(", "'is-open'", ")", ";", "parent", ".", "children", "(", "this", ".", "ns", "(", "'menu'", ")", ")", ".", "removeAttr", "(", "'style'",...
Event handler to hide the child menu after exiting parent li. @private @param {jQuery} parent
[ "Event", "handler", "to", "hide", "the", "child", "menu", "after", "exiting", "parent", "li", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L3046-L3058
21,716
titon/toolkit
dist/toolkit.js
function(parent) { var menu = parent.children(this.ns('menu')); if (!menu) { return; } menu.aria({ expanded: true, hidden: true }); // Alter width because of columns var children = menu.children(); menu.css('width', ...
javascript
function(parent) { var menu = parent.children(this.ns('menu')); if (!menu) { return; } menu.aria({ expanded: true, hidden: true }); // Alter width because of columns var children = menu.children(); menu.css('width', ...
[ "function", "(", "parent", ")", "{", "var", "menu", "=", "parent", ".", "children", "(", "this", ".", "ns", "(", "'menu'", ")", ")", ";", "if", "(", "!", "menu", ")", "{", "return", ";", "}", "menu", ".", "aria", "(", "{", "expanded", ":", "tru...
Event handler to position the child menu dependent on the position in the page. @private @param {jQuery} parent
[ "Event", "handler", "to", "position", "the", "child", "menu", "dependent", "on", "the", "position", "in", "the", "page", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L3076-L3126
21,717
titon/toolkit
dist/toolkit.js
function(element, options) { element = this.setElement(element); options = this.setOptions(options, element); if (options.checkbox) { element.find(options.checkbox).inputCheckbox(options); } if (options.radio) { element.find(options.radio).inputRadio(opt...
javascript
function(element, options) { element = this.setElement(element); options = this.setOptions(options, element); if (options.checkbox) { element.find(options.checkbox).inputCheckbox(options); } if (options.radio) { element.find(options.radio).inputRadio(opt...
[ "function", "(", "element", ",", "options", ")", "{", "element", "=", "this", ".", "setElement", "(", "element", ")", ";", "options", "=", "this", ".", "setOptions", "(", "options", ",", "element", ")", ";", "if", "(", "options", ".", "checkbox", ")", ...
Initialize the input. @param {jQuery} element @param {Object} [options]
[ "Initialize", "the", "input", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L3167-L3184
21,718
titon/toolkit
dist/toolkit.js
function() { var options = this.options, element = this.element; if (this.name === 'Input') { if (options.checkbox) { element.find(options.checkbox).each(function() { $(this).toolkit('inputCheckbox', 'destroy'); }); ...
javascript
function() { var options = this.options, element = this.element; if (this.name === 'Input') { if (options.checkbox) { element.find(options.checkbox).each(function() { $(this).toolkit('inputCheckbox', 'destroy'); }); ...
[ "function", "(", ")", "{", "var", "options", "=", "this", ".", "options", ",", "element", "=", "this", ".", "element", ";", "if", "(", "this", ".", "name", "===", "'Input'", ")", "{", "if", "(", "options", ".", "checkbox", ")", "{", "element", ".",...
Remove the wrapper before destroying.
[ "Remove", "the", "wrapper", "before", "destroying", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L3189-L3218
21,719
titon/toolkit
dist/toolkit.js
function(from, to) { var classes = ($(from).attr('class') || '').replace(this.options.filterClasses, '').trim(); if (classes) { $(to).addClass(classes); } }
javascript
function(from, to) { var classes = ($(from).attr('class') || '').replace(this.options.filterClasses, '').trim(); if (classes) { $(to).addClass(classes); } }
[ "function", "(", "from", ",", "to", ")", "{", "var", "classes", "=", "(", "$", "(", "from", ")", ".", "attr", "(", "'class'", ")", "||", "''", ")", ".", "replace", "(", "this", ".", "options", ".", "filterClasses", ",", "''", ")", ".", "trim", ...
Copy classes from one element to another, but do not copy `filterClasses` classes. @param {jQuery} from @param {jQuery} to
[ "Copy", "classes", "from", "one", "element", "to", "another", "but", "do", "not", "copy", "filterClasses", "classes", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L3226-L3232
21,720
titon/toolkit
dist/toolkit.js
function() { var input = this.element, wrapper = this.render(this.options.template) .insertBefore(input) .append(input); if (this.options.copyClasses) { this.copyClasses(input, wrapper); } return wrapper; }
javascript
function() { var input = this.element, wrapper = this.render(this.options.template) .insertBefore(input) .append(input); if (this.options.copyClasses) { this.copyClasses(input, wrapper); } return wrapper; }
[ "function", "(", ")", "{", "var", "input", "=", "this", ".", "element", ",", "wrapper", "=", "this", ".", "render", "(", "this", ".", "options", ".", "template", ")", ".", "insertBefore", "(", "input", ")", ".", "append", "(", "input", ")", ";", "i...
Build the element to wrap custom inputs with. Copy over the original class names. @returns {jQuery}
[ "Build", "the", "element", "to", "wrap", "custom", "inputs", "with", ".", "Copy", "over", "the", "original", "class", "names", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L3240-L3251
21,721
titon/toolkit
dist/toolkit.js
function(checkbox, options) { this.element = checkbox = $(checkbox); options = this.setOptions(options, checkbox); this.wrapper = this._buildWrapper(); // Create custom input this.input = this.render(options.checkboxTemplate) .attr('for', checkbox.attr('id')) ...
javascript
function(checkbox, options) { this.element = checkbox = $(checkbox); options = this.setOptions(options, checkbox); this.wrapper = this._buildWrapper(); // Create custom input this.input = this.render(options.checkboxTemplate) .attr('for', checkbox.attr('id')) ...
[ "function", "(", "checkbox", ",", "options", ")", "{", "this", ".", "element", "=", "checkbox", "=", "$", "(", "checkbox", ")", ";", "options", "=", "this", ".", "setOptions", "(", "options", ",", "checkbox", ")", ";", "this", ".", "wrapper", "=", "t...
Initialize the checkbox. @param {jQuery} checkbox @param {Object} [options]
[ "Initialize", "the", "checkbox", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L3278-L3290
21,722
titon/toolkit
dist/toolkit.js
function(radio, options) { this.element = radio = $(radio); options = this.setOptions(options, radio); this.wrapper = this._buildWrapper(); // Create custom input this.input = this.render(options.radioTemplate) .attr('for', radio.attr('id')) .insertAfter(...
javascript
function(radio, options) { this.element = radio = $(radio); options = this.setOptions(options, radio); this.wrapper = this._buildWrapper(); // Create custom input this.input = this.render(options.radioTemplate) .attr('for', radio.attr('id')) .insertAfter(...
[ "function", "(", "radio", ",", "options", ")", "{", "this", ".", "element", "=", "radio", "=", "$", "(", "radio", ")", ";", "options", "=", "this", ".", "setOptions", "(", "options", ",", "radio", ")", ";", "this", ".", "wrapper", "=", "this", ".",...
Initialize the radio. @param {jQuery} radio @param {Object} [options]
[ "Initialize", "the", "radio", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L3312-L3324
21,723
titon/toolkit
dist/toolkit.js
function(select, options) { this.element = select = $(select); options = this.setOptions(options, select); this.multiple = select.prop('multiple'); // Multiple selects must use native controls if (this.multiple && options.native) { return; } // Wrapp...
javascript
function(select, options) { this.element = select = $(select); options = this.setOptions(options, select); this.multiple = select.prop('multiple'); // Multiple selects must use native controls if (this.multiple && options.native) { return; } // Wrapp...
[ "function", "(", "select", ",", "options", ")", "{", "this", ".", "element", "=", "select", "=", "$", "(", "select", ")", ";", "options", "=", "this", ".", "setOptions", "(", "options", ",", "select", ")", ";", "this", ".", "multiple", "=", "select",...
Initialize the select. @param {jQuery} select @param {Object} [options]
[ "Initialize", "the", "select", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L3364-L3406
21,724
titon/toolkit
dist/toolkit.js
function() { var options = this.options, button = this.render(options.selectTemplate) .find(this.ns('arrow', 'select')).html(this.render(options.arrowTemplate)).end() .find(this.ns('label', 'select')).html(Toolkit.messages.loading).end() .css('min-widt...
javascript
function() { var options = this.options, button = this.render(options.selectTemplate) .find(this.ns('arrow', 'select')).html(this.render(options.arrowTemplate)).end() .find(this.ns('label', 'select')).html(Toolkit.messages.loading).end() .css('min-widt...
[ "function", "(", ")", "{", "var", "options", "=", "this", ".", "options", ",", "button", "=", "this", ".", "render", "(", "options", ".", "selectTemplate", ")", ".", "find", "(", "this", ".", "ns", "(", "'arrow'", ",", "'select'", ")", ")", ".", "h...
Build the element to represent the select button with label and arrow. @returns {jQuery}
[ "Build", "the", "element", "to", "represent", "the", "select", "button", "with", "label", "and", "arrow", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L3449-L3461
21,725
titon/toolkit
dist/toolkit.js
function() { var select = this.element, options = this.options, buildOption = this._buildOption.bind(this), renderTemplate = this.render.bind(this), dropdown = renderTemplate(options.optionsTemplate).attr('role', 'listbox').aria('multiselectable', this.multiple), ...
javascript
function() { var select = this.element, options = this.options, buildOption = this._buildOption.bind(this), renderTemplate = this.render.bind(this), dropdown = renderTemplate(options.optionsTemplate).attr('role', 'listbox').aria('multiselectable', this.multiple), ...
[ "function", "(", ")", "{", "var", "select", "=", "this", ".", "element", ",", "options", "=", "this", ".", "options", ",", "buildOption", "=", "this", ".", "_buildOption", ".", "bind", "(", "this", ")", ",", "renderTemplate", "=", "this", ".", "render"...
Build the custom dropdown to hold a list of option items. @returns {jQuery}
[ "Build", "the", "custom", "dropdown", "to", "hold", "a", "list", "of", "option", "items", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L3468-L3532
21,726
titon/toolkit
dist/toolkit.js
function(option, index) { var select = this.element, dropdown = this.dropdown, options = this.options, selected = option.prop('selected'), activeClass = 'is-active'; // Create elements var li = $('<li/>'), content = option.text(), ...
javascript
function(option, index) { var select = this.element, dropdown = this.dropdown, options = this.options, selected = option.prop('selected'), activeClass = 'is-active'; // Create elements var li = $('<li/>'), content = option.text(), ...
[ "function", "(", "option", ",", "index", ")", "{", "var", "select", "=", "this", ".", "element", ",", "dropdown", "=", "this", ".", "dropdown", ",", "options", "=", "this", ".", "options", ",", "selected", "=", "option", ".", "prop", "(", "'selected'",...
Build the list item to represent the select option. @param {jQuery} option @param {Number} index @returns {jQuery}
[ "Build", "the", "list", "item", "to", "represent", "the", "select", "option", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L3541-L3623
21,727
titon/toolkit
dist/toolkit.js
function(index, step, options) { var hideFirst = this.options.hideFirst; index += step; while (($.type(options[index]) === 'undefined') || options[index].disabled || (index === 0 && hideFirst)) { index += step; if (index >= options.length) { index = 0; ...
javascript
function(index, step, options) { var hideFirst = this.options.hideFirst; index += step; while (($.type(options[index]) === 'undefined') || options[index].disabled || (index === 0 && hideFirst)) { index += step; if (index >= options.length) { index = 0; ...
[ "function", "(", "index", ",", "step", ",", "options", ")", "{", "var", "hideFirst", "=", "this", ".", "options", ".", "hideFirst", ";", "index", "+=", "step", ";", "while", "(", "(", "$", ".", "type", "(", "options", "[", "index", "]", ")", "===",...
Loop through the options and determine the index to Skip over missing options, disabled options, or hidden options. @private @param {Number} index @param {Number} step @param {jQuery} options @returns {Number}
[ "Loop", "through", "the", "options", "and", "determine", "the", "index", "to", "Skip", "over", "missing", "options", "disabled", "options", "or", "hidden", "options", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L3635-L3651
21,728
titon/toolkit
dist/toolkit.js
function(e) { var select = $(e.target), options = select.find('option'), opts = this.options, selected = [], label = [], self = this; // Fetch label from selected option options.each(function() { if (this.selected) { ...
javascript
function(e) { var select = $(e.target), options = select.find('option'), opts = this.options, selected = [], label = [], self = this; // Fetch label from selected option options.each(function() { if (this.selected) { ...
[ "function", "(", "e", ")", "{", "var", "select", "=", "$", "(", "e", ".", "target", ")", ",", "options", "=", "select", ".", "find", "(", "'option'", ")", ",", "opts", "=", "this", ".", "options", ",", "selected", "=", "[", "]", ",", "label", "...
Event handler for select option changing. @private @param {jQuery.Event} e
[ "Event", "handler", "for", "select", "option", "changing", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L3659-L3711
21,729
titon/toolkit
dist/toolkit.js
function(e) { if (!this.dropdown.is(':shown')) { return; } if ($.inArray(e.keyCode, [38, 40, 13, 27]) >= 0) { e.preventDefault(); } else { return; } var options = this.element.find('option'), items = this.dropdown.find('a'...
javascript
function(e) { if (!this.dropdown.is(':shown')) { return; } if ($.inArray(e.keyCode, [38, 40, 13, 27]) >= 0) { e.preventDefault(); } else { return; } var options = this.element.find('option'), items = this.dropdown.find('a'...
[ "function", "(", "e", ")", "{", "if", "(", "!", "this", ".", "dropdown", ".", "is", "(", "':shown'", ")", ")", "{", "return", ";", "}", "if", "(", "$", ".", "inArray", "(", "e", ".", "keyCode", ",", "[", "38", ",", "40", ",", "13", ",", "27...
Event handler for cycling through options with up and down keys. @private @param {jQuery.Event} e
[ "Event", "handler", "for", "cycling", "through", "options", "with", "up", "and", "down", "keys", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L3719-L3756
21,730
titon/toolkit
dist/toolkit.js
function(container, options) { container = $(container); options = this.setOptions(options, container); this.items = container.find(this.options.lazyClass); if (container.css('overflow') === 'auto') { this.container = container; } var callback = $.throttle(...
javascript
function(container, options) { container = $(container); options = this.setOptions(options, container); this.items = container.find(this.options.lazyClass); if (container.css('overflow') === 'auto') { this.container = container; } var callback = $.throttle(...
[ "function", "(", "container", ",", "options", ")", "{", "container", "=", "$", "(", "container", ")", ";", "options", "=", "this", ".", "setOptions", "(", "options", ",", "container", ")", ";", "this", ".", "items", "=", "container", ".", "find", "(", ...
Initialize the lazy load. @param {jQuery} container @param {Object} [options]
[ "Initialize", "the", "lazy", "load", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L3831-L3851
21,731
titon/toolkit
dist/toolkit.js
function() { if (this.loaded >= this.items.length) { this.shutdown(); return; } this.fireEvent('loading'); this.items.each(function(index, item) { if (item && this.inViewport(item)) { this.show(item, index); } }.bi...
javascript
function() { if (this.loaded >= this.items.length) { this.shutdown(); return; } this.fireEvent('loading'); this.items.each(function(index, item) { if (item && this.inViewport(item)) { this.show(item, index); } }.bi...
[ "function", "(", ")", "{", "if", "(", "this", ".", "loaded", ">=", "this", ".", "items", ".", "length", ")", "{", "this", ".", "shutdown", "(", ")", ";", "return", ";", "}", "this", ".", "fireEvent", "(", "'loading'", ")", ";", "this", ".", "item...
Loop over the lazy loaded items and verify they are within the viewport.
[ "Loop", "over", "the", "lazy", "loaded", "items", "and", "verify", "they", "are", "within", "the", "viewport", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L3906-L3921
21,732
titon/toolkit
dist/toolkit.js
function(node, index) { node = $(node); this.fireEvent('showing', [node]); // Set the item being loaded for so that events can be fired this.element = node.removeClass(this.options.lazyClass.substr(1)); // Replace src attributes on images node.find('img').each(function...
javascript
function(node, index) { node = $(node); this.fireEvent('showing', [node]); // Set the item being loaded for so that events can be fired this.element = node.removeClass(this.options.lazyClass.substr(1)); // Replace src attributes on images node.find('img').each(function...
[ "function", "(", "node", ",", "index", ")", "{", "node", "=", "$", "(", "node", ")", ";", "this", ".", "fireEvent", "(", "'showing'", ",", "[", "node", "]", ")", ";", "// Set the item being loaded for so that events can be fired", "this", ".", "element", "="...
Show the item by removing the lazy load class. @param {jQuery} node @param {Number} index
[ "Show", "the", "item", "by", "removing", "the", "lazy", "load", "class", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L3944-L3974
21,733
titon/toolkit
dist/toolkit.js
function(element, options) { element = this.setElement(element); options = this.setOptions(options, element); // Add class and set relative positioning if (!element.is('body')) { element.addClass('is-maskable'); var position = element.css('position'); ...
javascript
function(element, options) { element = this.setElement(element); options = this.setOptions(options, element); // Add class and set relative positioning if (!element.is('body')) { element.addClass('is-maskable'); var position = element.css('position'); ...
[ "function", "(", "element", ",", "options", ")", "{", "element", "=", "this", ".", "setElement", "(", "element", ")", ";", "options", "=", "this", ".", "setOptions", "(", "options", ",", "element", ")", ";", "// Add class and set relative positioning", "if", ...
Initialize the mask. @param {jQuery} element @param {Object} [options]
[ "Initialize", "the", "mask", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L4029-L4058
21,734
titon/toolkit
dist/toolkit.js
function(mask) { var options = this.options, message; // Prepare mask mask.addClass('hide').appendTo(this.element); if (this.element.is('body')) { mask.css('position', 'fixed'); } if (options.revealOnClick) { mask.click(this.hide.bin...
javascript
function(mask) { var options = this.options, message; // Prepare mask mask.addClass('hide').appendTo(this.element); if (this.element.is('body')) { mask.css('position', 'fixed'); } if (options.revealOnClick) { mask.click(this.hide.bin...
[ "function", "(", "mask", ")", "{", "var", "options", "=", "this", ".", "options", ",", "message", ";", "// Prepare mask", "mask", ".", "addClass", "(", "'hide'", ")", ".", "appendTo", "(", "this", ".", "element", ")", ";", "if", "(", "this", ".", "el...
Set the element to use as a mask and append it to the target element. Apply optional classes, events, and styles dependent on implementation. @param {jQuery} mask
[ "Set", "the", "element", "to", "use", "as", "a", "mask", "and", "append", "it", "to", "the", "target", "element", ".", "Apply", "optional", "classes", "events", "and", "styles", "dependent", "on", "implementation", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L4089-L4116
21,735
titon/toolkit
dist/toolkit.js
function(nodes, options) { this.nodes = $(nodes); options = this.setOptions(options); this.element = this.createElement() .attr('role', 'dialog') .aria('labelledby', this.id('title')) .aria('describedby', this.id('content')); // Enable fullscreen ...
javascript
function(nodes, options) { this.nodes = $(nodes); options = this.setOptions(options); this.element = this.createElement() .attr('role', 'dialog') .aria('labelledby', this.id('title')) .aria('describedby', this.id('content')); // Enable fullscreen ...
[ "function", "(", "nodes", ",", "options", ")", "{", "this", ".", "nodes", "=", "$", "(", "nodes", ")", ";", "options", "=", "this", ".", "setOptions", "(", "options", ")", ";", "this", ".", "element", "=", "this", ".", "createElement", "(", ")", "....
Initialize the modal. @param {jQuery} nodes @param {Object} [options]
[ "Initialize", "the", "modal", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L4543-L4574
21,736
titon/toolkit
dist/toolkit.js
function(content) { // AJAX is currently loading if (content === true) { return; } // Hide blackout loading message if (this.blackout) { this.blackout.hideLoader(); } this.fireEvent('showing'); var body = this.element.find(this.n...
javascript
function(content) { // AJAX is currently loading if (content === true) { return; } // Hide blackout loading message if (this.blackout) { this.blackout.hideLoader(); } this.fireEvent('showing'); var body = this.element.find(this.n...
[ "function", "(", "content", ")", "{", "// AJAX is currently loading", "if", "(", "content", "===", "true", ")", "{", "return", ";", "}", "// Hide blackout loading message", "if", "(", "this", ".", "blackout", ")", "{", "this", ".", "blackout", ".", "hideLoader...
Position the modal in the center of the screen. @param {String|jQuery} content
[ "Position", "the", "modal", "in", "the", "center", "of", "the", "screen", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L4600-L4627
21,737
titon/toolkit
dist/toolkit.js
function(node, content) { if (node) { this.node = node = $(node); if (!content) { content = this.readValue(node, this.readOption(node, 'getContent')) || node.attr('href'); } } // Show blackout if the element is hidden // If it is visi...
javascript
function(node, content) { if (node) { this.node = node = $(node); if (!content) { content = this.readValue(node, this.readOption(node, 'getContent')) || node.attr('href'); } } // Show blackout if the element is hidden // If it is visi...
[ "function", "(", "node", ",", "content", ")", "{", "if", "(", "node", ")", "{", "this", ".", "node", "=", "node", "=", "$", "(", "node", ")", ";", "if", "(", "!", "content", ")", "{", "content", "=", "this", ".", "readValue", "(", "node", ",", ...
Show the modal with the specified content. @param {jQuery} node @param {String} [content]
[ "Show", "the", "modal", "with", "the", "specified", "content", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L4635-L4656
21,738
titon/toolkit
dist/toolkit.js
function() { var form = this.element.find('form:first'); if (!form) { return; } this.fireEvent('submit', [form]); var options = { url: form.attr('action'), type: (form.attr('method') || 'post').toUpperCase() }; if (window.Fo...
javascript
function() { var form = this.element.find('form:first'); if (!form) { return; } this.fireEvent('submit', [form]); var options = { url: form.attr('action'), type: (form.attr('method') || 'post').toUpperCase() }; if (window.Fo...
[ "function", "(", ")", "{", "var", "form", "=", "this", ".", "element", ".", "find", "(", "'form:first'", ")", ";", "if", "(", "!", "form", ")", "{", "return", ";", "}", "this", ".", "fireEvent", "(", "'submit'", ",", "[", "form", "]", ")", ";", ...
Submit the form found within the modal.
[ "Submit", "the", "form", "found", "within", "the", "modal", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L4661-L4684
21,739
titon/toolkit
dist/toolkit.js
function(element, options) { element = this.setElement(element).attr('role', 'complementary').conceal(); options = this.setOptions(options, element); var animation = options.animation; // Touch devices cannot use squish if (Toolkit.isTouch && animation === 'squish') { ...
javascript
function(element, options) { element = this.setElement(element).attr('role', 'complementary').conceal(); options = this.setOptions(options, element); var animation = options.animation; // Touch devices cannot use squish if (Toolkit.isTouch && animation === 'squish') { ...
[ "function", "(", "element", ",", "options", ")", "{", "element", "=", "this", ".", "setElement", "(", "element", ")", ".", "attr", "(", "'role'", ",", "'complementary'", ")", ".", "conceal", "(", ")", ";", "options", "=", "this", ".", "setOptions", "("...
Initialize off canvas. @param {jQuery} element @param {Object} [options]
[ "Initialize", "off", "canvas", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L4786-L4836
21,740
titon/toolkit
dist/toolkit.js
function() { this.fireEvent('hiding'); this.container.removeClass('move-' + this.opposite); this.element .conceal() .removeClass('is-expanded') .aria('expanded', false); if (this.options.stopScroll) { $('body').removeClass('no-scroll'); ...
javascript
function() { this.fireEvent('hiding'); this.container.removeClass('move-' + this.opposite); this.element .conceal() .removeClass('is-expanded') .aria('expanded', false); if (this.options.stopScroll) { $('body').removeClass('no-scroll'); ...
[ "function", "(", ")", "{", "this", ".", "fireEvent", "(", "'hiding'", ")", ";", "this", ".", "container", ".", "removeClass", "(", "'move-'", "+", "this", ".", "opposite", ")", ";", "this", ".", "element", ".", "conceal", "(", ")", ".", "removeClass", ...
Hide the sidebar and reset the container.
[ "Hide", "the", "sidebar", "and", "reset", "the", "container", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L4848-L4863
21,741
titon/toolkit
dist/toolkit.js
function() { var options = this.options; if (options.hideOthers) { this.secondary.each(function() { var sidebar = $(this); if (sidebar.hasClass('is-expanded')) { sidebar.toolkit('offCanvas', 'hide'); } }); ...
javascript
function() { var options = this.options; if (options.hideOthers) { this.secondary.each(function() { var sidebar = $(this); if (sidebar.hasClass('is-expanded')) { sidebar.toolkit('offCanvas', 'hide'); } }); ...
[ "function", "(", ")", "{", "var", "options", "=", "this", ".", "options", ";", "if", "(", "options", ".", "hideOthers", ")", "{", "this", ".", "secondary", ".", "each", "(", "function", "(", ")", "{", "var", "sidebar", "=", "$", "(", "this", ")", ...
Show the sidebar and squish the container to make room for the sidebar. If hideOthers is true, hide other open sidebars.
[ "Show", "the", "sidebar", "and", "squish", "the", "container", "to", "make", "room", "for", "the", "sidebar", ".", "If", "hideOthers", "is", "true", "hide", "other", "open", "sidebars", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L4869-L4896
21,742
titon/toolkit
dist/toolkit.js
function() { if (!this.options.openOnLoad || this._loaded) { return; } var sidebar = this.element, inner = this.primary, transClass = 'no-transition'; sidebar.addClass(transClass); inner.addClass(transClass); this.show(); //...
javascript
function() { if (!this.options.openOnLoad || this._loaded) { return; } var sidebar = this.element, inner = this.primary, transClass = 'no-transition'; sidebar.addClass(transClass); inner.addClass(transClass); this.show(); //...
[ "function", "(", ")", "{", "if", "(", "!", "this", ".", "options", ".", "openOnLoad", "||", "this", ".", "_loaded", ")", "{", "return", ";", "}", "var", "sidebar", "=", "this", ".", "element", ",", "inner", "=", "this", ".", "primary", ",", "transC...
On page load, immediately display the sidebar. Remove transitions from the sidebar and container so there is no page jumping. Also disable `hideOthers` so multiple sidebars can be displayed on load. @private
[ "On", "page", "load", "immediately", "display", "the", "sidebar", ".", "Remove", "transitions", "from", "the", "sidebar", "and", "container", "so", "there", "is", "no", "page", "jumping", ".", "Also", "disable", "hideOthers", "so", "multiple", "sidebars", "can...
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L4916-L4937
21,743
titon/toolkit
dist/toolkit.js
function(e) { e.preventDefault(); var target = $(e.target), selector = '[data-offcanvas-sidebar]'; if (target.is(selector) || target.parents(selector).length) { return; } this.show(); }
javascript
function(e) { e.preventDefault(); var target = $(e.target), selector = '[data-offcanvas-sidebar]'; if (target.is(selector) || target.parents(selector).length) { return; } this.show(); }
[ "function", "(", "e", ")", "{", "e", ".", "preventDefault", "(", ")", ";", "var", "target", "=", "$", "(", "e", ".", "target", ")", ",", "selector", "=", "'[data-offcanvas-sidebar]'", ";", "if", "(", "target", ".", "is", "(", "selector", ")", "||", ...
When swiping on the container, don't trigger a show if we are trying to hide a sidebar. @private @param {jQuery.Event} e
[ "When", "swiping", "on", "the", "container", "don", "t", "trigger", "a", "show", "if", "we", "are", "trying", "to", "hide", "a", "sidebar", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L4954-L4965
21,744
titon/toolkit
dist/toolkit.js
function(element, options) { element = this.setElement(element); options = this.setOptions(options, element); // Setup classes and ARIA element .attr('role', 'complementary') .addClass(options.animation); // Determine before calculations var init...
javascript
function(element, options) { element = this.setElement(element); options = this.setOptions(options, element); // Setup classes and ARIA element .attr('role', 'complementary') .addClass(options.animation); // Determine before calculations var init...
[ "function", "(", "element", ",", "options", ")", "{", "element", "=", "this", ".", "setElement", "(", "element", ")", ";", "options", "=", "this", ".", "setOptions", "(", "options", ",", "element", ")", ";", "// Setup classes and ARIA", "element", ".", "at...
Initialize the pin. @param {jQuery} element @param {Object} [options]
[ "Initialize", "the", "pin", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L5014-L5039
21,745
titon/toolkit
dist/toolkit.js
function() { var win = $(window), options = this.options, element = this.element, parent = options.context ? element.parents(options.context) : element.parent(); this.viewport = { width: win.width(), height: win.height() }; th...
javascript
function() { var win = $(window), options = this.options, element = this.element, parent = options.context ? element.parents(options.context) : element.parent(); this.viewport = { width: win.width(), height: win.height() }; th...
[ "function", "(", ")", "{", "var", "win", "=", "$", "(", "window", ")", ",", "options", "=", "this", ".", "options", ",", "element", "=", "this", ".", "element", ",", "parent", "=", "options", ".", "context", "?", "element", ".", "parents", "(", "op...
Calculate the dimensions and offsets of the interacting elements.
[ "Calculate", "the", "dimensions", "and", "offsets", "of", "the", "interacting", "elements", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L5054-L5077
21,746
titon/toolkit
dist/toolkit.js
function() { var options = this.options; if (options.calculate) { this.calculate(); } if (!this.active) { return; } var eHeight = this.elementHeight, eTop = this.elementTop, pHeight = this.parentHeight, pTop =...
javascript
function() { var options = this.options; if (options.calculate) { this.calculate(); } if (!this.active) { return; } var eHeight = this.elementHeight, eTop = this.elementTop, pHeight = this.parentHeight, pTop =...
[ "function", "(", ")", "{", "var", "options", "=", "this", ".", "options", ";", "if", "(", "options", ".", "calculate", ")", "{", "this", ".", "calculate", "(", ")", ";", "}", "if", "(", "!", "this", ".", "active", ")", "{", "return", ";", "}", ...
Pin the element along the vertical axis while staying contained within the parent.
[ "Pin", "the", "element", "along", "the", "vertical", "axis", "while", "staying", "contained", "within", "the", "parent", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L5082-L5158
21,747
titon/toolkit
dist/toolkit.js
function(nodes, options) { this.nodes = $(nodes); options = this.setOptions(options); this.createWrapper(); // Remove title attributes if (options.getTitle === 'title') { options.getTitle = 'data-' + this.keyName + '-title'; this.nodes.each(function(i, n...
javascript
function(nodes, options) { this.nodes = $(nodes); options = this.setOptions(options); this.createWrapper(); // Remove title attributes if (options.getTitle === 'title') { options.getTitle = 'data-' + this.keyName + '-title'; this.nodes.each(function(i, n...
[ "function", "(", "nodes", ",", "options", ")", "{", "this", ".", "nodes", "=", "$", "(", "nodes", ")", ";", "options", "=", "this", ".", "setOptions", "(", "options", ")", ";", "this", ".", "createWrapper", "(", ")", ";", "// Remove title attributes", ...
Initialize the tooltip. @param {jQuery} nodes @param {Object} [options]
[ "Initialize", "the", "tooltip", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L5329-L5356
21,748
titon/toolkit
dist/toolkit.js
function(node, content) { this.node = node = $(node).addClass('is-active'); // Load the new element this.loadElement(node, function(tooltip) { tooltip .addClass(this.readOption(node, 'position')) .attr('role', 'tooltip'); }); // Load ...
javascript
function(node, content) { this.node = node = $(node).addClass('is-active'); // Load the new element this.loadElement(node, function(tooltip) { tooltip .addClass(this.readOption(node, 'position')) .attr('role', 'tooltip'); }); // Load ...
[ "function", "(", "node", ",", "content", ")", "{", "this", ".", "node", "=", "node", "=", "$", "(", "node", ")", ".", "addClass", "(", "'is-active'", ")", ";", "// Load the new element", "this", ".", "loadElement", "(", "node", ",", "function", "(", "t...
Show the tooltip and determine whether to grab the content from an AJAX call, a DOM node, or plain text. The content can also be passed as an argument. @param {jQuery} node @param {String|jQuery} [content]
[ "Show", "the", "tooltip", "and", "determine", "whether", "to", "grab", "the", "content", "from", "an", "AJAX", "call", "a", "DOM", "node", "or", "plain", "text", ".", "The", "content", "can", "also", "be", "passed", "as", "an", "argument", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L5434-L5446
21,749
titon/toolkit
dist/toolkit.js
function(e) { e.preventDefault(); var options = this.options; this.element.reveal().positionTo(options.position, e, { left: options.xOffset, top: options.yOffset }, true); }
javascript
function(e) { e.preventDefault(); var options = this.options; this.element.reveal().positionTo(options.position, e, { left: options.xOffset, top: options.yOffset }, true); }
[ "function", "(", "e", ")", "{", "e", ".", "preventDefault", "(", ")", ";", "var", "options", "=", "this", ".", "options", ";", "this", ".", "element", ".", "reveal", "(", ")", ".", "positionTo", "(", "options", ".", "position", ",", "e", ",", "{", ...
Event handler for positioning the tooltip by the mouse. @private @param {jQuery.Event} e
[ "Event", "handler", "for", "positioning", "the", "tooltip", "by", "the", "mouse", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L5454-L5463
21,750
titon/toolkit
dist/toolkit.js
function(nodes, options) { options = options || {}; options.mode = 'click'; // Click only options.follow = false; // Disable mouse follow Tooltip.prototype.constructor.call(this, nodes, options); }
javascript
function(nodes, options) { options = options || {}; options.mode = 'click'; // Click only options.follow = false; // Disable mouse follow Tooltip.prototype.constructor.call(this, nodes, options); }
[ "function", "(", "nodes", ",", "options", ")", "{", "options", "=", "options", "||", "{", "}", ";", "options", ".", "mode", "=", "'click'", ";", "// Click only", "options", ".", "follow", "=", "false", ";", "// Disable mouse follow", "Tooltip", ".", "proto...
Initialize the popover. @param {jQuery} nodes @param {Object} [options]
[ "Initialize", "the", "popover", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L5531-L5537
21,751
titon/toolkit
dist/toolkit.js
function(element, options) { var sections, tabs, self = this; element = this.setElement(element); options = this.setOptions(options, element); // Determine cookie name if (!options.cookie) { options.cookie = element.attr('id'); } // Find all the sec...
javascript
function(element, options) { var sections, tabs, self = this; element = this.setElement(element); options = this.setOptions(options, element); // Determine cookie name if (!options.cookie) { options.cookie = element.attr('id'); } // Find all the sec...
[ "function", "(", "element", ",", "options", ")", "{", "var", "sections", ",", "tabs", ",", "self", "=", "this", ";", "element", "=", "this", ".", "setElement", "(", "element", ")", ";", "options", "=", "this", ".", "setOptions", "(", "options", ",", ...
Initialize the tab. @param {jQuery} element @param {Object} [options]
[ "Initialize", "the", "tab", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L6221-L6293
21,752
titon/toolkit
dist/toolkit.js
function(tab) { tab = $(tab); var index = tab.data('tab-index'), section = this.sections.eq(index), options = this.options, url = this.readValue(tab, this.readOption(tab, 'getUrl')); this.fireEvent('showing', [this.index]); // Load content for AJAX ...
javascript
function(tab) { tab = $(tab); var index = tab.data('tab-index'), section = this.sections.eq(index), options = this.options, url = this.readValue(tab, this.readOption(tab, 'getUrl')); this.fireEvent('showing', [this.index]); // Load content for AJAX ...
[ "function", "(", "tab", ")", "{", "tab", "=", "$", "(", "tab", ")", ";", "var", "index", "=", "tab", ".", "data", "(", "'tab-index'", ")", ",", "section", "=", "this", ".", "sections", ".", "eq", "(", "index", ")", ",", "options", "=", "this", ...
Show the content based on the tab. Can either pass an integer as the index in the collection, or pass an element object for a tab in the collection. @param {jQuery} tab
[ "Show", "the", "content", "based", "on", "the", "tab", ".", "Can", "either", "pass", "an", "integer", "as", "the", "index", "in", "the", "collection", "or", "pass", "an", "element", "object", "for", "a", "tab", "in", "the", "collection", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L6328-L6375
21,753
titon/toolkit
dist/toolkit.js
function(e) { if (this.options.preventDefault || e.currentTarget.getAttribute('href').substr(0, 1) !== '#') { e.preventDefault(); } this.show(e.currentTarget); }
javascript
function(e) { if (this.options.preventDefault || e.currentTarget.getAttribute('href').substr(0, 1) !== '#') { e.preventDefault(); } this.show(e.currentTarget); }
[ "function", "(", "e", ")", "{", "if", "(", "this", ".", "options", ".", "preventDefault", "||", "e", ".", "currentTarget", ".", "getAttribute", "(", "'href'", ")", ".", "substr", "(", "0", ",", "1", ")", "!==", "'#'", ")", "{", "e", ".", "preventDe...
Event callback for tab element click. @private @param {jQuery.Event} e
[ "Event", "callback", "for", "tab", "element", "click", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L6420-L6426
21,754
titon/toolkit
dist/toolkit.js
function(element, options) { this.nodes = element = $(element); // Set to nodes so instances are unset during destroy() options = this.setOptions(options, element); // Create the toasts wrapper this.createWrapper() .addClass(options.position) .attr('role', 'log')...
javascript
function(element, options) { this.nodes = element = $(element); // Set to nodes so instances are unset during destroy() options = this.setOptions(options, element); // Create the toasts wrapper this.createWrapper() .addClass(options.position) .attr('role', 'log')...
[ "function", "(", "element", ",", "options", ")", "{", "this", ".", "nodes", "=", "element", "=", "$", "(", "element", ")", ";", "// Set to nodes so instances are unset during destroy()", "options", "=", "this", ".", "setOptions", "(", "options", ",", "element", ...
Initialize the toast. @param {jQuery} element @param {Object} [options]
[ "Initialize", "the", "toast", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L6454-L6468
21,755
titon/toolkit
dist/toolkit.js
function(content, options) { options = $.extend({}, this.options, options || {}); var self = this, toast = this.render(options.template) .addClass(options.animation) .attr('role', 'note') .html(content) .conceal() ...
javascript
function(content, options) { options = $.extend({}, this.options, options || {}); var self = this, toast = this.render(options.template) .addClass(options.animation) .attr('role', 'note') .html(content) .conceal() ...
[ "function", "(", "content", ",", "options", ")", "{", "options", "=", "$", ".", "extend", "(", "{", "}", ",", "this", ".", "options", ",", "options", "||", "{", "}", ")", ";", "var", "self", "=", "this", ",", "toast", "=", "this", ".", "render", ...
Create a toast element, insert content into it, and append it to the container. @param {*} content @param {Object} [options]
[ "Create", "a", "toast", "element", "insert", "content", "into", "it", "and", "append", "it", "to", "the", "container", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L6476-L6500
21,756
titon/toolkit
dist/toolkit.js
function(element) { element = $(element); // Pass the element since it gets removed this.fireEvent('hiding', [element]); element.transitionend(function() { element.remove(); this.fireEvent('hidden'); }.bind(this)).conceal(); }
javascript
function(element) { element = $(element); // Pass the element since it gets removed this.fireEvent('hiding', [element]); element.transitionend(function() { element.remove(); this.fireEvent('hidden'); }.bind(this)).conceal(); }
[ "function", "(", "element", ")", "{", "element", "=", "$", "(", "element", ")", ";", "// Pass the element since it gets removed", "this", ".", "fireEvent", "(", "'hiding'", ",", "[", "element", "]", ")", ";", "element", ".", "transitionend", "(", "function", ...
Hide the toast after the duration is up. Also remove the element from the DOM once the transition is complete. @param {jQuery} element
[ "Hide", "the", "toast", "after", "the", "duration", "is", "up", ".", "Also", "remove", "the", "element", "from", "the", "DOM", "once", "the", "transition", "is", "complete", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L6508-L6518
21,757
titon/toolkit
dist/toolkit.js
function(input, options) { input = $(input); if (input.prop('tagName').toLowerCase() !== 'input') { throw new Error('TypeAhead must be initialized on an input field'); } var self = this; options = this.setOptions(options, input); this.element = this.createE...
javascript
function(input, options) { input = $(input); if (input.prop('tagName').toLowerCase() !== 'input') { throw new Error('TypeAhead must be initialized on an input field'); } var self = this; options = this.setOptions(options, input); this.element = this.createE...
[ "function", "(", "input", ",", "options", ")", "{", "input", "=", "$", "(", "input", ")", ";", "if", "(", "input", ".", "prop", "(", "'tagName'", ")", ".", "toLowerCase", "(", ")", "!==", "'input'", ")", "{", "throw", "new", "Error", "(", "'TypeAhe...
Initialize the type ahead. @param {jQuery} input @param {Object} [options]
[ "Initialize", "the", "type", "ahead", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L6582-L6668
21,758
titon/toolkit
dist/toolkit.js
function(item) { var a = $('<a/>', { href: 'javascript:;', role: 'option', 'aria-selected': 'false' }); a.append( this.render(this.options.titleTemplate).html(this.highlight(item.title)) ); if (item.description) { a.append( this.render(th...
javascript
function(item) { var a = $('<a/>', { href: 'javascript:;', role: 'option', 'aria-selected': 'false' }); a.append( this.render(this.options.titleTemplate).html(this.highlight(item.title)) ); if (item.description) { a.append( this.render(th...
[ "function", "(", "item", ")", "{", "var", "a", "=", "$", "(", "'<a/>'", ",", "{", "href", ":", "'javascript:;'", ",", "role", ":", "'option'", ",", "'aria-selected'", ":", "'false'", "}", ")", ";", "a", ".", "append", "(", "this", ".", "render", "(...
Build the anchor link that will be used in the list. @param {Object} item @returns {jQuery}
[ "Build", "the", "anchor", "link", "that", "will", "be", "used", "in", "the", "list", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L6686-L6700
21,759
titon/toolkit
dist/toolkit.js
function() { this.fireEvent('hiding'); if (this.shadow) { this.shadow.val(''); } this.input.aria('expanded', false); this.element.conceal(); this.fireEvent('hidden'); }
javascript
function() { this.fireEvent('hiding'); if (this.shadow) { this.shadow.val(''); } this.input.aria('expanded', false); this.element.conceal(); this.fireEvent('hidden'); }
[ "function", "(", ")", "{", "this", ".", "fireEvent", "(", "'hiding'", ")", ";", "if", "(", "this", ".", "shadow", ")", "{", "this", ".", "shadow", ".", "val", "(", "''", ")", ";", "}", "this", ".", "input", ".", "aria", "(", "'expanded'", ",", ...
Hide the list and reset shadow.
[ "Hide", "the", "list", "and", "reset", "shadow", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L6705-L6716
21,760
titon/toolkit
dist/toolkit.js
function(item) { var terms = this.term.replace(/[\-\[\]\{\}()*+?.,\\^$|#]/g, '\\$&').split(' '), options = this.options, callback = function(match) { return this.render(options.highlightTemplate).html(match).toString(); }.bind(this); for (var i = 0, t...
javascript
function(item) { var terms = this.term.replace(/[\-\[\]\{\}()*+?.,\\^$|#]/g, '\\$&').split(' '), options = this.options, callback = function(match) { return this.render(options.highlightTemplate).html(match).toString(); }.bind(this); for (var i = 0, t...
[ "function", "(", "item", ")", "{", "var", "terms", "=", "this", ".", "term", ".", "replace", "(", "/", "[\\-\\[\\]\\{\\}()*+?.,\\\\^$|#]", "/", "g", ",", "'\\\\$&'", ")", ".", "split", "(", "' '", ")", ",", "options", "=", "this", ".", "options", ",", ...
Highlight the current term within the item string. Split multi-word terms to highlight separately. @param {String} item @returns {String}
[ "Highlight", "the", "current", "term", "within", "the", "item", "string", ".", "Split", "multi", "-", "word", "terms", "to", "highlight", "separately", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L6725-L6737
21,761
titon/toolkit
dist/toolkit.js
function() { if (!this.items.length) { this.hide(); return; } this.fireEvent('showing'); var iPos = this.input.offset(); this.element .css('top', iPos.top + this.input.outerHeight()) .css(Toolkit.isRTL ? 'right' : 'left', iPos.le...
javascript
function() { if (!this.items.length) { this.hide(); return; } this.fireEvent('showing'); var iPos = this.input.offset(); this.element .css('top', iPos.top + this.input.outerHeight()) .css(Toolkit.isRTL ? 'right' : 'left', iPos.le...
[ "function", "(", ")", "{", "if", "(", "!", "this", ".", "items", ".", "length", ")", "{", "this", ".", "hide", "(", ")", ";", "return", ";", "}", "this", ".", "fireEvent", "(", "'showing'", ")", ";", "var", "iPos", "=", "this", ".", "input", "....
Position the menu below the input.
[ "Position", "the", "menu", "below", "the", "input", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L6764-L6782
21,762
titon/toolkit
dist/toolkit.js
function(index, event) { this.index = index; var rows = this.element.find('li'); rows .removeClass('is-active') .find('a') .aria('selected', false); // Select if (index >= 0) { if (this.items[index]) { var ite...
javascript
function(index, event) { this.index = index; var rows = this.element.find('li'); rows .removeClass('is-active') .find('a') .aria('selected', false); // Select if (index >= 0) { if (this.items[index]) { var ite...
[ "function", "(", "index", ",", "event", ")", "{", "this", ".", "index", "=", "index", ";", "var", "rows", "=", "this", ".", "element", ".", "find", "(", "'li'", ")", ";", "rows", ".", "removeClass", "(", "'is-active'", ")", ".", "find", "(", "'a'",...
Select an item in the list. @param {Number} index @param {String} [event]
[ "Select", "an", "item", "in", "the", "list", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L6798-L6829
21,763
titon/toolkit
dist/toolkit.js
function(items) { return items.sort(function(a, b) { return a.title.localeCompare(b.title); }); }
javascript
function(items) { return items.sort(function(a, b) { return a.title.localeCompare(b.title); }); }
[ "function", "(", "items", ")", "{", "return", "items", ".", "sort", "(", "function", "(", "a", ",", "b", ")", "{", "return", "a", ".", "title", ".", "localeCompare", "(", "b", ".", "title", ")", ";", "}", ")", ";", "}" ]
Sort the items. @param {Array} items @returns {Array}
[ "Sort", "the", "items", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L6837-L6841
21,764
titon/toolkit
dist/toolkit.js
function(items) { if (!this.term.length || !items.length) { this.hide(); return; } var options = this.options, term = this.term, categories = { _empty_: [] }, item, list = $('<ul/>'); // Reset this.items = ...
javascript
function(items) { if (!this.term.length || !items.length) { this.hide(); return; } var options = this.options, term = this.term, categories = { _empty_: [] }, item, list = $('<ul/>'); // Reset this.items = ...
[ "function", "(", "items", ")", "{", "if", "(", "!", "this", ".", "term", ".", "length", "||", "!", "items", ".", "length", ")", "{", "this", ".", "hide", "(", ")", ";", "return", ";", "}", "var", "options", "=", "this", ".", "options", ",", "te...
Process the list of items be generating new elements and positioning below the input. @param {Array} items
[ "Process", "the", "list", "of", "items", "be", "generating", "new", "elements", "and", "positioning", "below", "the", "input", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L6848-L6942
21,765
titon/toolkit
dist/toolkit.js
function() { if (!this.shadow) { return; } var term = this.input.val(), termLower = term.toLowerCase(), value = ''; if (this.cache[termLower] && this.cache[termLower][0]) { var title = this.cache[termLower][0].title; if (titl...
javascript
function() { if (!this.shadow) { return; } var term = this.input.val(), termLower = term.toLowerCase(), value = ''; if (this.cache[termLower] && this.cache[termLower][0]) { var title = this.cache[termLower][0].title; if (titl...
[ "function", "(", ")", "{", "if", "(", "!", "this", ".", "shadow", ")", "{", "return", ";", "}", "var", "term", "=", "this", ".", "input", ".", "val", "(", ")", ",", "termLower", "=", "term", ".", "toLowerCase", "(", ")", ",", "value", "=", "''"...
Monitor the current input term to determine the shadow text. Shadow text will reference the term cache. @private
[ "Monitor", "the", "current", "input", "term", "to", "determine", "the", "shadow", "text", ".", "Shadow", "text", "will", "reference", "the", "term", "cache", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L6950-L6968
21,766
titon/toolkit
dist/toolkit.js
function(e) { var items = this.items, length = Math.min(this.options.itemLimit, Math.max(0, items.length)), event = 'cycle'; if (!length || !this.element.is(':shown')) { return; } switch (e.keyCode) { // Cycle upwards (up) cas...
javascript
function(e) { var items = this.items, length = Math.min(this.options.itemLimit, Math.max(0, items.length)), event = 'cycle'; if (!length || !this.element.is(':shown')) { return; } switch (e.keyCode) { // Cycle upwards (up) cas...
[ "function", "(", "e", ")", "{", "var", "items", "=", "this", ".", "items", ",", "length", "=", "Math", ".", "min", "(", "this", ".", "options", ".", "itemLimit", ",", "Math", ".", "max", "(", "0", ",", "items", ".", "length", ")", ")", ",", "ev...
Cycle through the items in the list when an arrow key, esc or enter is released. @private @param {jQuery.Event} e
[ "Cycle", "through", "the", "items", "in", "the", "list", "when", "an", "arrow", "key", "esc", "or", "enter", "is", "released", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L6976-L7044
21,767
titon/toolkit
dist/toolkit.js
function() { var term = this.term, options = this.options, sourceType = $.type(options.source); // Check the cache first if (this.cache[term.toLowerCase()]) { this.source(this.cache[term.toLowerCase()]); // Use the response of an AJAX request ...
javascript
function() { var term = this.term, options = this.options, sourceType = $.type(options.source); // Check the cache first if (this.cache[term.toLowerCase()]) { this.source(this.cache[term.toLowerCase()]); // Use the response of an AJAX request ...
[ "function", "(", ")", "{", "var", "term", "=", "this", ".", "term", ",", "options", "=", "this", ".", "options", ",", "sourceType", "=", "$", ".", "type", "(", "options", ".", "source", ")", ";", "// Check the cache first", "if", "(", "this", ".", "c...
Event handler called for a lookup.
[ "Event", "handler", "called", "for", "a", "lookup", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L7049-L7086
21,768
titon/toolkit
dist/toolkit.js
function(e) { if ($.inArray(e.keyCode, [38, 40, 27, 9, 13]) >= 0) { return; // Handle with onCycle() } clearTimeout(this.timer); var term = this.input.val().trim(); if (term.length < this.options.minLength) { this.fireEvent('reset'); this.hi...
javascript
function(e) { if ($.inArray(e.keyCode, [38, 40, 27, 9, 13]) >= 0) { return; // Handle with onCycle() } clearTimeout(this.timer); var term = this.input.val().trim(); if (term.length < this.options.minLength) { this.fireEvent('reset'); this.hi...
[ "function", "(", "e", ")", "{", "if", "(", "$", ".", "inArray", "(", "e", ".", "keyCode", ",", "[", "38", ",", "40", ",", "27", ",", "9", ",", "13", "]", ")", ">=", "0", ")", "{", "return", ";", "// Handle with onCycle()", "}", "clearTimeout", ...
Lookup items based on the current input value. @private @param {jQuery.Event} e
[ "Lookup", "items", "based", "on", "the", "current", "input", "value", "." ]
f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c
https://github.com/titon/toolkit/blob/f0ed36d14cc6d72a7bdbc09da4b5bf7d3d664f0c/dist/toolkit.js#L7094-L7111
21,769
w8r/avl
src/utils.js
height
function height(node) { return node ? (1 + Math.max(height(node.left), height(node.right))) : 0; }
javascript
function height(node) { return node ? (1 + Math.max(height(node.left), height(node.right))) : 0; }
[ "function", "height", "(", "node", ")", "{", "return", "node", "?", "(", "1", "+", "Math", ".", "max", "(", "height", "(", "node", ".", "left", ")", ",", "height", "(", "node", ".", "right", ")", ")", ")", ":", "0", ";", "}" ]
The function Compute the 'height' of a tree. Height is the number of nodes along the longest path from the root node down to the farthest leaf node. @param {Node} node @return {Number}
[ "The", "function", "Compute", "the", "height", "of", "a", "tree", ".", "Height", "is", "the", "number", "of", "nodes", "along", "the", "longest", "path", "from", "the", "root", "node", "down", "to", "the", "farthest", "leaf", "node", "." ]
601107b38287449aeb01bb7e6da712ac3d0f0c2f
https://github.com/w8r/avl/blob/601107b38287449aeb01bb7e6da712ac3d0f0c2f/src/utils.js#L60-L62
21,770
w8r/avl
src/index.js
rotateLeft
function rotateLeft (node) { var rightNode = node.right; node.right = rightNode.left; if (rightNode.left) rightNode.left.parent = node; rightNode.parent = node.parent; if (rightNode.parent) { if (rightNode.parent.left === node) { rightNode.parent.left = rightNode; } else { rightNode.p...
javascript
function rotateLeft (node) { var rightNode = node.right; node.right = rightNode.left; if (rightNode.left) rightNode.left.parent = node; rightNode.parent = node.parent; if (rightNode.parent) { if (rightNode.parent.left === node) { rightNode.parent.left = rightNode; } else { rightNode.p...
[ "function", "rotateLeft", "(", "node", ")", "{", "var", "rightNode", "=", "node", ".", "right", ";", "node", ".", "right", "=", "rightNode", ".", "left", ";", "if", "(", "rightNode", ".", "left", ")", "rightNode", ".", "left", ".", "parent", "=", "no...
Single left rotation @param {Node} node @return {Node}
[ "Single", "left", "rotation" ]
601107b38287449aeb01bb7e6da712ac3d0f0c2f
https://github.com/w8r/avl/blob/601107b38287449aeb01bb7e6da712ac3d0f0c2f/src/index.js#L41-L69
21,771
Orbs/jspm-git
git.js
function(repo, version, hash, meta, outDir) { var url, tempRepoDir, packageJSONData, self = this; if (meta.vPrefix) { version = 'v' + version; } // Automatically track and cleanup files at exit temp.track(); url = createGitUrl(self.options.baseurl, repo, self.options.reposuffix, self.a...
javascript
function(repo, version, hash, meta, outDir) { var url, tempRepoDir, packageJSONData, self = this; if (meta.vPrefix) { version = 'v' + version; } // Automatically track and cleanup files at exit temp.track(); url = createGitUrl(self.options.baseurl, repo, self.options.reposuffix, self.a...
[ "function", "(", "repo", ",", "version", ",", "hash", ",", "meta", ",", "outDir", ")", "{", "var", "url", ",", "tempRepoDir", ",", "packageJSONData", ",", "self", "=", "this", ";", "if", "(", "meta", ".", "vPrefix", ")", "{", "version", "=", "'v'", ...
always an exact version assumed that this is run after getVersions so the repo exists
[ "always", "an", "exact", "version", "assumed", "that", "this", "is", "run", "after", "getVersions", "so", "the", "repo", "exists" ]
92c8c81835af17970f989dd9083ed2105c24ed69
https://github.com/Orbs/jspm-git/blob/92c8c81835af17970f989dd9083ed2105c24ed69/git.js#L450-L474
21,772
Orbs/jspm-git
git.js
function(pjson, dir) { var main = pjson.main || ''; var libDir = pjson.directories && (pjson.directories.dist || pjson.directories.lib) || '.'; // convert to windows-style paths if necessary main = path.normalize(main); libDir = path.normalize(libDir); if (main.indexOf('!') !== -1) { ret...
javascript
function(pjson, dir) { var main = pjson.main || ''; var libDir = pjson.directories && (pjson.directories.dist || pjson.directories.lib) || '.'; // convert to windows-style paths if necessary main = path.normalize(main); libDir = path.normalize(libDir); if (main.indexOf('!') !== -1) { ret...
[ "function", "(", "pjson", ",", "dir", ")", "{", "var", "main", "=", "pjson", ".", "main", "||", "''", ";", "var", "libDir", "=", "pjson", ".", "directories", "&&", "(", "pjson", ".", "directories", ".", "dist", "||", "pjson", ".", "directories", ".",...
check if the main entry point exists. If not, try the bower.json main.
[ "check", "if", "the", "main", "entry", "point", "exists", ".", "If", "not", "try", "the", "bower", ".", "json", "main", "." ]
92c8c81835af17970f989dd9083ed2105c24ed69
https://github.com/Orbs/jspm-git/blob/92c8c81835af17970f989dd9083ed2105c24ed69/git.js#L477-L534
21,773
opentok/accelerator-screen-sharing-js
src/opentok-screen-sharing.js
function () { var createPublisher = function (publisherDiv) { var innerDeferred = $.Deferred(); var getContainer = function () { if (publisherDiv) { return publisherDiv; } if (typeof _this.screenSharingContainer === 'function') { return document.querySelector(_this.screenSha...
javascript
function () { var createPublisher = function (publisherDiv) { var innerDeferred = $.Deferred(); var getContainer = function () { if (publisherDiv) { return publisherDiv; } if (typeof _this.screenSharingContainer === 'function') { return document.querySelector(_this.screenSha...
[ "function", "(", ")", "{", "var", "createPublisher", "=", "function", "(", "publisherDiv", ")", "{", "var", "innerDeferred", "=", "$", ".", "Deferred", "(", ")", ";", "var", "getContainer", "=", "function", "(", ")", "{", "if", "(", "publisherDiv", ")", ...
Create a publisher for the screen. If we're using annotation, we first need to create the annotion window and get a reference to its annotation container element so that we can pass it to the initPublisher function. @returns {promise} < Resolve: [Object] Container element for annotation in external window >
[ "Create", "a", "publisher", "for", "the", "screen", ".", "If", "we", "re", "using", "annotation", "we", "first", "need", "to", "create", "the", "annotion", "window", "and", "get", "a", "reference", "to", "its", "annotation", "container", "element", "so", "...
cfa1b55525ed193ea1dd5caa4ba5c0eb4a902bf7
https://github.com/opentok/accelerator-screen-sharing-js/blob/cfa1b55525ed193ea1dd5caa4ba5c0eb4a902bf7/src/opentok-screen-sharing.js#L160-L223
21,774
opentok/accelerator-screen-sharing-js
src/opentok-screen-sharing.js
function (annotationContainer) { _session.publish(_this.publisher, function (error) { if (error) { // Let's write our own error message var customError = _.omit(error, 'message'); if (error.code === 1500 && navigator.userAgent.indexOf('Firefox') !== -1) { $('#dialog-form-f...
javascript
function (annotationContainer) { _session.publish(_this.publisher, function (error) { if (error) { // Let's write our own error message var customError = _.omit(error, 'message'); if (error.code === 1500 && navigator.userAgent.indexOf('Firefox') !== -1) { $('#dialog-form-f...
[ "function", "(", "annotationContainer", ")", "{", "_session", ".", "publish", "(", "_this", ".", "publisher", ",", "function", "(", "error", ")", "{", "if", "(", "error", ")", "{", "// Let's write our own error message", "var", "customError", "=", "_", ".", ...
Start publishing the screen @param annotationContainer
[ "Start", "publishing", "the", "screen" ]
cfa1b55525ed193ea1dd5caa4ba5c0eb4a902bf7
https://github.com/opentok/accelerator-screen-sharing-js/blob/cfa1b55525ed193ea1dd5caa4ba5c0eb4a902bf7/src/opentok-screen-sharing.js#L230-L265
21,775
rain1017/quick-pomelo
template/app.js
function(){ if(Object.keys(app.getServers()).length === 0){ quick.logger.shutdown(shutdown); } else{ setTimeout(tryShutdown, 200); } }
javascript
function(){ if(Object.keys(app.getServers()).length === 0){ quick.logger.shutdown(shutdown); } else{ setTimeout(tryShutdown, 200); } }
[ "function", "(", ")", "{", "if", "(", "Object", ".", "keys", "(", "app", ".", "getServers", "(", ")", ")", ".", "length", "===", "0", ")", "{", "quick", ".", "logger", ".", "shutdown", "(", "shutdown", ")", ";", "}", "else", "{", "setTimeout", "(...
Wait for all server stop
[ "Wait", "for", "all", "server", "stop" ]
3d2c83d81ab190e99a3ab8f64385aa29f44c5383
https://github.com/rain1017/quick-pomelo/blob/3d2c83d81ab190e99a3ab8f64385aa29f44c5383/template/app.js#L82-L89
21,776
MariusRumpf/node-lifx
lib/lifx/light.js
Light
function Light(constr) { this.client = constr.client; this.id = constr.id; // Used to target the light this.address = constr.address; this.port = constr.port; this.label = null; this.status = 'on'; this.seenOnDiscovery = constr.seenOnDiscovery; }
javascript
function Light(constr) { this.client = constr.client; this.id = constr.id; // Used to target the light this.address = constr.address; this.port = constr.port; this.label = null; this.status = 'on'; this.seenOnDiscovery = constr.seenOnDiscovery; }
[ "function", "Light", "(", "constr", ")", "{", "this", ".", "client", "=", "constr", ".", "client", ";", "this", ".", "id", "=", "constr", ".", "id", ";", "// Used to target the light", "this", ".", "address", "=", "constr", ".", "address", ";", "this", ...
A representation of a light bulb @class @param {Obj} constr constructor object @param {Lifx/Client} constr.client the client the light belongs to @param {String} constr.id the id used to target the light @param {String} constr.address ip address of the light @param {Number} constr.port port of the light @param {Number}...
[ "A", "representation", "of", "a", "light", "bulb" ]
c5bb37309895f7e8aa86eda69c4ed8a72f6fedf1
https://github.com/MariusRumpf/node-lifx/blob/c5bb37309895f7e8aa86eda69c4ed8a72f6fedf1/lib/lifx/light.js#L18-L27
21,777
MariusRumpf/node-lifx
lib/lifx/client.js
Client
function Client() { EventEmitter.call(this); this.debug = false; this.socket = dgram.createSocket('udp4'); this.isSocketBound = false; this.devices = {}; this.port = null; this.messagesQueue = []; this.sendTimer = null; this.discoveryTimer = null; this.discoveryPacketSequence = 0; this.messageHan...
javascript
function Client() { EventEmitter.call(this); this.debug = false; this.socket = dgram.createSocket('udp4'); this.isSocketBound = false; this.devices = {}; this.port = null; this.messagesQueue = []; this.sendTimer = null; this.discoveryTimer = null; this.discoveryPacketSequence = 0; this.messageHan...
[ "function", "Client", "(", ")", "{", "EventEmitter", ".", "call", "(", "this", ")", ";", "this", ".", "debug", "=", "false", ";", "this", ".", "socket", "=", "dgram", ".", "createSocket", "(", "'udp4'", ")", ";", "this", ".", "isSocketBound", "=", "f...
Creates a lifx client @extends EventEmitter
[ "Creates", "a", "lifx", "client" ]
c5bb37309895f7e8aa86eda69c4ed8a72f6fedf1
https://github.com/MariusRumpf/node-lifx/blob/c5bb37309895f7e8aa86eda69c4ed8a72f6fedf1/lib/lifx/client.js#L16-L45
21,778
samclarke/robots-parser
Robots.js
trimLine
function trimLine(line) { if (!line) { return null; } if (Array.isArray(line)) { return line.map(trimLine); } return String(line).trim(); }
javascript
function trimLine(line) { if (!line) { return null; } if (Array.isArray(line)) { return line.map(trimLine); } return String(line).trim(); }
[ "function", "trimLine", "(", "line", ")", "{", "if", "(", "!", "line", ")", "{", "return", "null", ";", "}", "if", "(", "Array", ".", "isArray", "(", "line", ")", ")", "{", "return", "line", ".", "map", "(", "trimLine", ")", ";", "}", "return", ...
Trims the white space from the start and end of the line. If the line is an array it will strip the white space from the start and end of each element of the array. @param {string|Array} line @return {string|Array} @private
[ "Trims", "the", "white", "space", "from", "the", "start", "and", "end", "of", "the", "line", "." ]
888df9e4d820c36d57191ad7ca6b37218051ea65
https://github.com/samclarke/robots-parser/blob/888df9e4d820c36d57191ad7ca6b37218051ea65/Robots.js#L13-L23
21,779
samclarke/robots-parser
Robots.js
removeComments
function removeComments(line) { var commentStartIndex = line.indexOf('#'); if (commentStartIndex > -1) { return line.substr(0, commentStartIndex); } return line; }
javascript
function removeComments(line) { var commentStartIndex = line.indexOf('#'); if (commentStartIndex > -1) { return line.substr(0, commentStartIndex); } return line; }
[ "function", "removeComments", "(", "line", ")", "{", "var", "commentStartIndex", "=", "line", ".", "indexOf", "(", "'#'", ")", ";", "if", "(", "commentStartIndex", ">", "-", "1", ")", "{", "return", "line", ".", "substr", "(", "0", ",", "commentStartInde...
Remove comments from lines @param {string} line @return {string} @private
[ "Remove", "comments", "from", "lines" ]
888df9e4d820c36d57191ad7ca6b37218051ea65
https://github.com/samclarke/robots-parser/blob/888df9e4d820c36d57191ad7ca6b37218051ea65/Robots.js#L32-L39
21,780
samclarke/robots-parser
Robots.js
formatUserAgent
function formatUserAgent(userAgent) { var formattedUserAgent = userAgent.toLowerCase(); // Strip the version number from robot/1.0 user agents var idx = formattedUserAgent.indexOf('/'); if (idx > -1) { formattedUserAgent = formattedUserAgent.substr(0, idx); } return formattedUserAgent.trim(); }
javascript
function formatUserAgent(userAgent) { var formattedUserAgent = userAgent.toLowerCase(); // Strip the version number from robot/1.0 user agents var idx = formattedUserAgent.indexOf('/'); if (idx > -1) { formattedUserAgent = formattedUserAgent.substr(0, idx); } return formattedUserAgent.trim(); }
[ "function", "formatUserAgent", "(", "userAgent", ")", "{", "var", "formattedUserAgent", "=", "userAgent", ".", "toLowerCase", "(", ")", ";", "// Strip the version number from robot/1.0 user agents", "var", "idx", "=", "formattedUserAgent", ".", "indexOf", "(", "'/'", ...
Normalises the user-agent string by converting it to lower case and removing any version numbers. @param {string} userAgent @return {string} @private
[ "Normalises", "the", "user", "-", "agent", "string", "by", "converting", "it", "to", "lower", "case", "and", "removing", "any", "version", "numbers", "." ]
888df9e4d820c36d57191ad7ca6b37218051ea65
https://github.com/samclarke/robots-parser/blob/888df9e4d820c36d57191ad7ca6b37218051ea65/Robots.js#L66-L76
21,781
samclarke/robots-parser
Robots.js
parsePattern
function parsePattern(pattern) { var regexSpecialChars = /[\-\[\]\/\{\}\(\)\+\?\.\\\^\$\|]/g; // Treat consecutive wildcards as one (#12) var wildCardPattern = /\*+/g; var endOfLinePattern = /\\\$$/; pattern = normaliseEncoding(pattern) if (pattern.indexOf('*') < 0 && pattern.indexOf('$') < 0) { return patter...
javascript
function parsePattern(pattern) { var regexSpecialChars = /[\-\[\]\/\{\}\(\)\+\?\.\\\^\$\|]/g; // Treat consecutive wildcards as one (#12) var wildCardPattern = /\*+/g; var endOfLinePattern = /\\\$$/; pattern = normaliseEncoding(pattern) if (pattern.indexOf('*') < 0 && pattern.indexOf('$') < 0) { return patter...
[ "function", "parsePattern", "(", "pattern", ")", "{", "var", "regexSpecialChars", "=", "/", "[\\-\\[\\]\\/\\{\\}\\(\\)\\+\\?\\.\\\\\\^\\$\\|]", "/", "g", ";", "// Treat consecutive wildcards as one (#12)", "var", "wildCardPattern", "=", "/", "\\*+", "/", "g", ";", "var"...
Converts the pattern into a regexp if it is a wildcard pattern. Returns a string if the pattern isn't a wildcard pattern @param {string} pattern @return {string|RegExp} @private
[ "Converts", "the", "pattern", "into", "a", "regexp", "if", "it", "is", "a", "wildcard", "pattern", "." ]
888df9e4d820c36d57191ad7ca6b37218051ea65
https://github.com/samclarke/robots-parser/blob/888df9e4d820c36d57191ad7ca6b37218051ea65/Robots.js#L119-L137
21,782
samclarke/robots-parser
Robots.js
findRule
function findRule(path, rules) { var matchingRule = null; for (var i=0; i < rules.length; i++) { var rule = rules[i]; if (typeof rule.pattern === 'string') { if (path.indexOf(rule.pattern) !== 0) { continue; } // The longest matching rule takes precedence if (!matchingRule || ...
javascript
function findRule(path, rules) { var matchingRule = null; for (var i=0; i < rules.length; i++) { var rule = rules[i]; if (typeof rule.pattern === 'string') { if (path.indexOf(rule.pattern) !== 0) { continue; } // The longest matching rule takes precedence if (!matchingRule || ...
[ "function", "findRule", "(", "path", ",", "rules", ")", "{", "var", "matchingRule", "=", "null", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "rules", ".", "length", ";", "i", "++", ")", "{", "var", "rule", "=", "rules", "[", "i", "]",...
Returns if a pattern is allowed by the specified rules. @param {string} path @param {Array.<Object>} rules @return {Object?} @private
[ "Returns", "if", "a", "pattern", "is", "allowed", "by", "the", "specified", "rules", "." ]
888df9e4d820c36d57191ad7ca6b37218051ea65
https://github.com/samclarke/robots-parser/blob/888df9e4d820c36d57191ad7ca6b37218051ea65/Robots.js#L199-L222
21,783
SpoonX/aurelia-orm
dist/aurelia-orm.js
asJson
function asJson(entity, shallow) { let json; try { json = JSON.stringify(asObject(entity, shallow)); } catch (error) { json = ''; } return json; }
javascript
function asJson(entity, shallow) { let json; try { json = JSON.stringify(asObject(entity, shallow)); } catch (error) { json = ''; } return json; }
[ "function", "asJson", "(", "entity", ",", "shallow", ")", "{", "let", "json", ";", "try", "{", "json", "=", "JSON", ".", "stringify", "(", "asObject", "(", "entity", ",", "shallow", ")", ")", ";", "}", "catch", "(", "error", ")", "{", "json", "=", ...
Entity representation as json @param {Entity} entity @param {boolean} [shallow] @return {string}
[ "Entity", "representation", "as", "json" ]
d6b5dece74e1f44038de917c38fadb57d6655c18
https://github.com/SpoonX/aurelia-orm/blob/d6b5dece74e1f44038de917c38fadb57d6655c18/dist/aurelia-orm.js#L1112-L1122
21,784
SpoonX/aurelia-orm
dist/aurelia-orm.js
getFlat
function getFlat(entity, json) { let flat = { entity : asObject(entity, true), collections: getCollectionsCompact(entity) }; if (json) { flat = JSON.stringify(flat); } return flat; }
javascript
function getFlat(entity, json) { let flat = { entity : asObject(entity, true), collections: getCollectionsCompact(entity) }; if (json) { flat = JSON.stringify(flat); } return flat; }
[ "function", "getFlat", "(", "entity", ",", "json", ")", "{", "let", "flat", "=", "{", "entity", ":", "asObject", "(", "entity", ",", "true", ")", ",", "collections", ":", "getCollectionsCompact", "(", "entity", ")", "}", ";", "if", "(", "json", ")", ...
Get a flat, plain representation of the entity and its associations. @param {Entity} entity @param {boolean} [json] @return {{}} {entity, collections}
[ "Get", "a", "flat", "plain", "representation", "of", "the", "entity", "and", "its", "associations", "." ]
d6b5dece74e1f44038de917c38fadb57d6655c18
https://github.com/SpoonX/aurelia-orm/blob/d6b5dece74e1f44038de917c38fadb57d6655c18/dist/aurelia-orm.js#L1184-L1195
21,785
SpoonX/aurelia-orm
dist/aurelia-orm.js
getPropertyForAssociation
function getPropertyForAssociation(forEntity, entity) { let associations = forEntity.getMeta().fetch('associations'); return Object.keys(associations).filter(key => { return associations[key].entity === entity.getResource(); })[0]; }
javascript
function getPropertyForAssociation(forEntity, entity) { let associations = forEntity.getMeta().fetch('associations'); return Object.keys(associations).filter(key => { return associations[key].entity === entity.getResource(); })[0]; }
[ "function", "getPropertyForAssociation", "(", "forEntity", ",", "entity", ")", "{", "let", "associations", "=", "forEntity", ".", "getMeta", "(", ")", ".", "fetch", "(", "'associations'", ")", ";", "return", "Object", ".", "keys", "(", "associations", ")", "...
Get the property of the association on this entity. @param {Entity} forEntity @param {Entity} entity @return {string}
[ "Get", "the", "property", "of", "the", "association", "on", "this", "entity", "." ]
d6b5dece74e1f44038de917c38fadb57d6655c18
https://github.com/SpoonX/aurelia-orm/blob/d6b5dece74e1f44038de917c38fadb57d6655c18/dist/aurelia-orm.js#L1205-L1211
21,786
hoodiehq/hoodie-client
lib/events.js
trigger
function trigger (state, eventName) { var args = [].slice.call(arguments, 1) state.emitter.emit.apply(state.emitter, args) return this }
javascript
function trigger (state, eventName) { var args = [].slice.call(arguments, 1) state.emitter.emit.apply(state.emitter, args) return this }
[ "function", "trigger", "(", "state", ",", "eventName", ")", "{", "var", "args", "=", "[", "]", ".", "slice", ".", "call", "(", "arguments", ",", "1", ")", "state", ".", "emitter", ".", "emit", ".", "apply", "(", "state", ".", "emitter", ",", "args"...
trigger a specified event @param {String} eventName Name of event @param {...*} [options] Options
[ "trigger", "a", "specified", "event" ]
e9ceb07e01da0d0a0136fd28b413a8e4fac5ea2b
https://github.com/hoodiehq/hoodie-client/blob/e9ceb07e01da0d0a0136fd28b413a8e4fac5ea2b/lib/events.js#L54-L60
21,787
jhermsmeier/node-vcf
lib/vcard.js
function( key ) { if( this.data[ key ] == null ) { return this.data[ key ] } if( Array.isArray( this.data[ key ] ) ) { return this.data[ key ].map( function( prop ) { return prop.clone() }) } else { return this.data[ key ].clone() } }
javascript
function( key ) { if( this.data[ key ] == null ) { return this.data[ key ] } if( Array.isArray( this.data[ key ] ) ) { return this.data[ key ].map( function( prop ) { return prop.clone() }) } else { return this.data[ key ].clone() } }
[ "function", "(", "key", ")", "{", "if", "(", "this", ".", "data", "[", "key", "]", "==", "null", ")", "{", "return", "this", ".", "data", "[", "key", "]", "}", "if", "(", "Array", ".", "isArray", "(", "this", ".", "data", "[", "key", "]", ")"...
Get a vCard property @param {String} key @return {Object|Array}
[ "Get", "a", "vCard", "property" ]
e0a984fb294fb2b76f0e6bba009357f15195b92d
https://github.com/jhermsmeier/node-vcf/blob/e0a984fb294fb2b76f0e6bba009357f15195b92d/lib/vcard.js#L179-L193
21,788
jhermsmeier/node-vcf
lib/vcard.js
function( key, value, params ) { var prop = new vCard.Property( key, value, params ) this.addProperty( prop ) return this }
javascript
function( key, value, params ) { var prop = new vCard.Property( key, value, params ) this.addProperty( prop ) return this }
[ "function", "(", "key", ",", "value", ",", "params", ")", "{", "var", "prop", "=", "new", "vCard", ".", "Property", "(", "key", ",", "value", ",", "params", ")", "this", ".", "addProperty", "(", "prop", ")", "return", "this", "}" ]
Add a vCard property @param {String} key @param {String} value @param {Object} params
[ "Add", "a", "vCard", "property" ]
e0a984fb294fb2b76f0e6bba009357f15195b92d
https://github.com/jhermsmeier/node-vcf/blob/e0a984fb294fb2b76f0e6bba009357f15195b92d/lib/vcard.js#L211-L215
21,789
jhermsmeier/node-vcf
lib/vcard.js
function( prop ) { var key = prop._field if( Array.isArray( this.data[ key ] ) ) { this.data[ key ].push( prop ) } else if( this.data[ key ] != null ) { this.data[ key ] = [ this.data[ key ], prop ] } else { this.data[ key ] = prop } return this }
javascript
function( prop ) { var key = prop._field if( Array.isArray( this.data[ key ] ) ) { this.data[ key ].push( prop ) } else if( this.data[ key ] != null ) { this.data[ key ] = [ this.data[ key ], prop ] } else { this.data[ key ] = prop } return this }
[ "function", "(", "prop", ")", "{", "var", "key", "=", "prop", ".", "_field", "if", "(", "Array", ".", "isArray", "(", "this", ".", "data", "[", "key", "]", ")", ")", "{", "this", ".", "data", "[", "key", "]", ".", "push", "(", "prop", ")", "}...
Add a vCard property from an already constructed vCard.Property @param {vCard.Property} prop
[ "Add", "a", "vCard", "property", "from", "an", "already", "constructed", "vCard", ".", "Property" ]
e0a984fb294fb2b76f0e6bba009357f15195b92d
https://github.com/jhermsmeier/node-vcf/blob/e0a984fb294fb2b76f0e6bba009357f15195b92d/lib/vcard.js#L232-L246
21,790
jhermsmeier/node-vcf
lib/vcard.js
function( value ) { // Normalize & split var lines = vCard.normalize( value ) .split( /\r?\n/g ) // Keep begin and end markers // for eventual error messages var begin = lines[0] var version = lines[1] var end = lines[ lines.length - 1 ] if( !/BEGIN:VCARD/i.test( begin ) ) ...
javascript
function( value ) { // Normalize & split var lines = vCard.normalize( value ) .split( /\r?\n/g ) // Keep begin and end markers // for eventual error messages var begin = lines[0] var version = lines[1] var end = lines[ lines.length - 1 ] if( !/BEGIN:VCARD/i.test( begin ) ) ...
[ "function", "(", "value", ")", "{", "// Normalize & split", "var", "lines", "=", "vCard", ".", "normalize", "(", "value", ")", ".", "split", "(", "/", "\\r?\\n", "/", "g", ")", "// Keep begin and end markers", "// for eventual error messages", "var", "begin", "=...
Parse a vcf formatted vCard @param {String} value @return {vCard}
[ "Parse", "a", "vcf", "formatted", "vCard" ]
e0a984fb294fb2b76f0e6bba009357f15195b92d
https://github.com/jhermsmeier/node-vcf/blob/e0a984fb294fb2b76f0e6bba009357f15195b92d/lib/vcard.js#L253-L284
21,791
jhermsmeier/node-vcf
lib/vcard.js
function( version ) { version = version || '4.0' var keys = Object.keys( this.data ) var data = [ [ 'version', {}, 'text', version ] ] var prop = null for( var i = 0; i < keys.length; i++ ) { if( keys[i] === 'version' ) continue; prop = this.data[ keys[i] ] if( Array.isArray( pr...
javascript
function( version ) { version = version || '4.0' var keys = Object.keys( this.data ) var data = [ [ 'version', {}, 'text', version ] ] var prop = null for( var i = 0; i < keys.length; i++ ) { if( keys[i] === 'version' ) continue; prop = this.data[ keys[i] ] if( Array.isArray( pr...
[ "function", "(", "version", ")", "{", "version", "=", "version", "||", "'4.0'", "var", "keys", "=", "Object", ".", "keys", "(", "this", ".", "data", ")", "var", "data", "=", "[", "[", "'version'", ",", "{", "}", ",", "'text'", ",", "version", "]", ...
Format the card as jCard @param {String} version='4.0' @return {Array} jCard
[ "Format", "the", "card", "as", "jCard" ]
e0a984fb294fb2b76f0e6bba009357f15195b92d
https://github.com/jhermsmeier/node-vcf/blob/e0a984fb294fb2b76f0e6bba009357f15195b92d/lib/vcard.js#L302-L324
21,792
jhermsmeier/node-vcf
lib/property.js
function( type ) { type = ( type + '' ).toLowerCase() return Array.isArray( this.type ) ? this.type.indexOf( type ) >= 0 : this.type === type }
javascript
function( type ) { type = ( type + '' ).toLowerCase() return Array.isArray( this.type ) ? this.type.indexOf( type ) >= 0 : this.type === type }
[ "function", "(", "type", ")", "{", "type", "=", "(", "type", "+", "''", ")", ".", "toLowerCase", "(", ")", "return", "Array", ".", "isArray", "(", "this", ".", "type", ")", "?", "this", ".", "type", ".", "indexOf", "(", "type", ")", ">=", "0", ...
Check whether the property is of a given type @param {String} type @return {Boolean}
[ "Check", "whether", "the", "property", "is", "of", "a", "given", "type" ]
e0a984fb294fb2b76f0e6bba009357f15195b92d
https://github.com/jhermsmeier/node-vcf/blob/e0a984fb294fb2b76f0e6bba009357f15195b92d/lib/property.js#L70-L75
21,793
jhermsmeier/node-vcf
lib/property.js
function( version ) { var propName = (this.group ? this.group + '.' : '') + capitalDashCase( this._field ) var keys = Object.keys( this ) var params = [] for( var i = 0; i < keys.length; i++ ) { if (keys[i] === 'group') continue params.push( capitalDashCase( keys[i] ) + '=' + this[ keys[i]...
javascript
function( version ) { var propName = (this.group ? this.group + '.' : '') + capitalDashCase( this._field ) var keys = Object.keys( this ) var params = [] for( var i = 0; i < keys.length; i++ ) { if (keys[i] === 'group') continue params.push( capitalDashCase( keys[i] ) + '=' + this[ keys[i]...
[ "function", "(", "version", ")", "{", "var", "propName", "=", "(", "this", ".", "group", "?", "this", ".", "group", "+", "'.'", ":", "''", ")", "+", "capitalDashCase", "(", "this", ".", "_field", ")", "var", "keys", "=", "Object", ".", "keys", "(",...
Format the property as vcf with given version @param {String} version @return {String}
[ "Format", "the", "property", "as", "vcf", "with", "given", "version" ]
e0a984fb294fb2b76f0e6bba009357f15195b92d
https://github.com/jhermsmeier/node-vcf/blob/e0a984fb294fb2b76f0e6bba009357f15195b92d/lib/property.js#L99-L114
21,794
jhermsmeier/node-vcf
lib/property.js
function() { var params = Object.assign({},this) if( params.value === 'text' ) { params.value = void 0 delete params.value } var data = [ this._field, params, this.value || 'text' ] switch( this._field ) { default: data.push( this._data ); break case 'adr': case 'n'...
javascript
function() { var params = Object.assign({},this) if( params.value === 'text' ) { params.value = void 0 delete params.value } var data = [ this._field, params, this.value || 'text' ] switch( this._field ) { default: data.push( this._data ); break case 'adr': case 'n'...
[ "function", "(", ")", "{", "var", "params", "=", "Object", ".", "assign", "(", "{", "}", ",", "this", ")", "if", "(", "params", ".", "value", "===", "'text'", ")", "{", "params", ".", "value", "=", "void", "0", "delete", "params", ".", "value", "...
Format the property as jCard data @return {Array}
[ "Format", "the", "property", "as", "jCard", "data" ]
e0a984fb294fb2b76f0e6bba009357f15195b92d
https://github.com/jhermsmeier/node-vcf/blob/e0a984fb294fb2b76f0e6bba009357f15195b92d/lib/property.js#L128-L148
21,795
waterlock/waterlock
lib/utils.js
function(req, res, user) { var jsonWebTokens = waterlock.config.jsonWebTokens || {}; var expiryUnit = (jsonWebTokens.expiry && jsonWebTokens.expiry.unit) || 'days'; var expiryLength = (jsonWebTokens.expiry && jsonWebTokens.expiry.length) || 7; var expires = moment().add(expiryLength, expiryUnit).valueOf...
javascript
function(req, res, user) { var jsonWebTokens = waterlock.config.jsonWebTokens || {}; var expiryUnit = (jsonWebTokens.expiry && jsonWebTokens.expiry.unit) || 'days'; var expiryLength = (jsonWebTokens.expiry && jsonWebTokens.expiry.length) || 7; var expires = moment().add(expiryLength, expiryUnit).valueOf...
[ "function", "(", "req", ",", "res", ",", "user", ")", "{", "var", "jsonWebTokens", "=", "waterlock", ".", "config", ".", "jsonWebTokens", "||", "{", "}", ";", "var", "expiryUnit", "=", "(", "jsonWebTokens", ".", "expiry", "&&", "jsonWebTokens", ".", "exp...
Creates a new JWT token @param {Integer} req @param {Object} res @param {Object} user the user model @return {Object} the created jwt token. @api public
[ "Creates", "a", "new", "JWT", "token" ]
088c7f9c641f626e6ebe9de4eec68f7eddf8d094
https://github.com/waterlock/waterlock/blob/088c7f9c641f626e6ebe9de4eec68f7eddf8d094/lib/utils.js#L73-L95
21,796
waterlock/waterlock
lib/utils.js
function(req){ var token = null; if (req.headers && req.headers.authorization) { var parts = req.headers.authorization.split(' '); if (parts.length === 2){ var scheme = parts[0]; var credentials = parts[1]; if (/^Bearer$/i.test(scheme)){ token = credentials; ...
javascript
function(req){ var token = null; if (req.headers && req.headers.authorization) { var parts = req.headers.authorization.split(' '); if (parts.length === 2){ var scheme = parts[0]; var credentials = parts[1]; if (/^Bearer$/i.test(scheme)){ token = credentials; ...
[ "function", "(", "req", ")", "{", "var", "token", "=", "null", ";", "if", "(", "req", ".", "headers", "&&", "req", ".", "headers", ".", "authorization", ")", "{", "var", "parts", "=", "req", ".", "headers", ".", "authorization", ".", "split", "(", ...
Return access token from request @param {Object} req the express request object @return {String} token @api public
[ "Return", "access", "token", "from", "request" ]
088c7f9c641f626e6ebe9de4eec68f7eddf8d094
https://github.com/waterlock/waterlock/blob/088c7f9c641f626e6ebe9de4eec68f7eddf8d094/lib/utils.js#L104-L120
21,797
waterlock/waterlock
lib/validator.js
function(token, cb){ try{ // decode the token var _token = waterlock.jwt.decode(token, waterlock.config.jsonWebTokens.secret); // set the time of the request var _reqTime = Date.now(); // If token is expired if(_token.exp <= _reqTime){ waterlock.logger.d...
javascript
function(token, cb){ try{ // decode the token var _token = waterlock.jwt.decode(token, waterlock.config.jsonWebTokens.secret); // set the time of the request var _reqTime = Date.now(); // If token is expired if(_token.exp <= _reqTime){ waterlock.logger.d...
[ "function", "(", "token", ",", "cb", ")", "{", "try", "{", "// decode the token", "var", "_token", "=", "waterlock", ".", "jwt", ".", "decode", "(", "token", ",", "waterlock", ".", "config", ".", "jsonWebTokens", ".", "secret", ")", ";", "// set the time o...
Validates a token @param {String} token the token to be validated @param {Function} cb called when error has occured or token is validated
[ "Validates", "a", "token" ]
088c7f9c641f626e6ebe9de4eec68f7eddf8d094
https://github.com/waterlock/waterlock/blob/088c7f9c641f626e6ebe9de4eec68f7eddf8d094/lib/validator.js#L20-L51
21,798
waterlock/waterlock
lib/validator.js
function(token, cb){ // deserialize the token iss var _iss = token.iss.split('|'); waterlock.User.findOne(_iss[0]).exec(function(err, user){ if(err){ waterlock.logger.debug(err); } cb(err, user); }); }
javascript
function(token, cb){ // deserialize the token iss var _iss = token.iss.split('|'); waterlock.User.findOne(_iss[0]).exec(function(err, user){ if(err){ waterlock.logger.debug(err); } cb(err, user); }); }
[ "function", "(", "token", ",", "cb", ")", "{", "// deserialize the token iss", "var", "_iss", "=", "token", ".", "iss", ".", "split", "(", "'|'", ")", ";", "waterlock", ".", "User", ".", "findOne", "(", "_iss", "[", "0", "]", ")", ".", "exec", "(", ...
Find the user the give token is issued to @param {Object} token The parsed token @param {Function} cb Callback to be called when a user is found or an error has occured
[ "Find", "the", "user", "the", "give", "token", "is", "issued", "to" ]
088c7f9c641f626e6ebe9de4eec68f7eddf8d094
https://github.com/waterlock/waterlock/blob/088c7f9c641f626e6ebe9de4eec68f7eddf8d094/lib/validator.js#L60-L71
21,799
waterlock/waterlock
lib/validator.js
function(req, user){ req.session.authenticated = true; req.session.user = user; }
javascript
function(req, user){ req.session.authenticated = true; req.session.user = user; }
[ "function", "(", "req", ",", "user", ")", "{", "req", ".", "session", ".", "authenticated", "=", "true", ";", "req", ".", "session", ".", "user", "=", "user", ";", "}" ]
Attaches a user object to the Express req session @param {Express request} req the Express request object @param {Waterline DAO} user the waterline user object
[ "Attaches", "a", "user", "object", "to", "the", "Express", "req", "session" ]
088c7f9c641f626e6ebe9de4eec68f7eddf8d094
https://github.com/waterlock/waterlock/blob/088c7f9c641f626e6ebe9de4eec68f7eddf8d094/lib/validator.js#L120-L123