code
stringlengths 24
2.07M
| docstring
stringlengths 25
85.3k
| func_name
stringlengths 1
92
| language
stringclasses 1
value | repo
stringlengths 5
64
| path
stringlengths 4
172
| url
stringlengths 44
218
| license
stringclasses 7
values |
---|---|---|---|---|---|---|---|
function select( selector, context, results, seed ) {
var i, tokens, token, type, find,
match = tokenize( selector );
if ( !seed ) {
// Try to minimize operations if there is only one group
if ( match.length === 1 ) {
// Take a shortcut and set the context if the root selector is an ID
tokens = match[0] = match[0].slice( 0 );
if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
support.getById && context.nodeType === 9 && documentIsHTML &&
Expr.relative[ tokens[1].type ] ) {
context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
if ( !context ) {
return results;
}
selector = selector.slice( tokens.shift().value.length );
}
// Fetch a seed set for right-to-left matching
i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
while ( i-- ) {
token = tokens[i];
// Abort if we hit a combinator
if ( Expr.relative[ (type = token.type) ] ) {
break;
}
if ( (find = Expr.find[ type ]) ) {
// Search, expanding context for leading sibling combinators
if ( (seed = find(
token.matches[0].replace( runescape, funescape ),
rsibling.test( tokens[0].type ) && context.parentNode || context
)) ) {
// If seed is empty or no tokens remain, we can return early
tokens.splice( i, 1 );
selector = seed.length && toSelector( tokens );
if ( !selector ) {
push.apply( results, seed );
return results;
}
break;
}
}
}
}
}
// Compile and execute a filtering function
// Provide `match` to avoid retokenization if we modified the selector above
compile( selector, match )(
seed,
context,
!documentIsHTML,
results,
rsibling.test( selector )
);
return results;
}
|
Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem
|
select
|
javascript
|
muaz-khan/WebRTC-Experiment
|
RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
MIT
|
function createOptions( options ) {
var object = optionsCache[ options ] = {};
jQuery.each( options.match( core_rnotwhite ) || [], function( _, flag ) {
object[ flag ] = true;
});
return object;
}
|
Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem
|
createOptions
|
javascript
|
muaz-khan/WebRTC-Experiment
|
RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
MIT
|
fire = function( data ) {
memory = options.memory && data;
fired = true;
firingIndex = firingStart || 0;
firingStart = 0;
firingLength = list.length;
firing = true;
for ( ; list && firingIndex < firingLength; firingIndex++ ) {
if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) {
memory = false; // To prevent further calls using add
break;
}
}
firing = false;
if ( list ) {
if ( stack ) {
if ( stack.length ) {
fire( stack.shift() );
}
} else if ( memory ) {
list = [];
} else {
self.disable();
}
}
}
|
Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem
|
fire
|
javascript
|
muaz-khan/WebRTC-Experiment
|
RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
MIT
|
updateFunc = function( i, contexts, values ) {
return function( value ) {
contexts[ i ] = this;
values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value;
if( values === progressValues ) {
deferred.notifyWith( contexts, values );
} else if ( !( --remaining ) ) {
deferred.resolveWith( contexts, values );
}
};
}
|
Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem
|
updateFunc
|
javascript
|
muaz-khan/WebRTC-Experiment
|
RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
MIT
|
function internalData( elem, name, data, pvt /* Internal Use Only */ ){
if ( !jQuery.acceptData( elem ) ) {
return;
}
var ret, thisCache,
internalKey = jQuery.expando,
// We have to handle DOM nodes and JS objects differently because IE6-7
// can't GC object references properly across the DOM-JS boundary
isNode = elem.nodeType,
// Only DOM nodes need the global jQuery cache; JS object data is
// attached directly to the object so GC can occur automatically
cache = isNode ? jQuery.cache : elem,
// Only defining an ID for JS objects if its cache already exists allows
// the code to shortcut on the same path as a DOM node with no cache
id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey;
// Avoid doing any more work than we need to when trying to get data on an
// object that has no data at all
if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && data === undefined && typeof name === "string" ) {
return;
}
if ( !id ) {
// Only DOM nodes need a new unique ID for each element since their data
// ends up in the global cache
if ( isNode ) {
id = elem[ internalKey ] = core_deletedIds.pop() || jQuery.guid++;
} else {
id = internalKey;
}
}
if ( !cache[ id ] ) {
// Avoid exposing jQuery metadata on plain JS objects when the object
// is serialized using JSON.stringify
cache[ id ] = isNode ? {} : { toJSON: jQuery.noop };
}
// An object can be passed to jQuery.data instead of a key/value pair; this gets
// shallow copied over onto the existing cache
if ( typeof name === "object" || typeof name === "function" ) {
if ( pvt ) {
cache[ id ] = jQuery.extend( cache[ id ], name );
} else {
cache[ id ].data = jQuery.extend( cache[ id ].data, name );
}
}
thisCache = cache[ id ];
// jQuery data() is stored in a separate object inside the object's internal data
// cache in order to avoid key collisions between internal data and user-defined
// data.
if ( !pvt ) {
if ( !thisCache.data ) {
thisCache.data = {};
}
thisCache = thisCache.data;
}
if ( data !== undefined ) {
thisCache[ jQuery.camelCase( name ) ] = data;
}
// Check for both converted-to-camel and non-converted data property names
// If a data property was specified
if ( typeof name === "string" ) {
// First Try to find as-is property data
ret = thisCache[ name ];
// Test for null|undefined property data
if ( ret == null ) {
// Try to find the camelCased property
ret = thisCache[ jQuery.camelCase( name ) ];
}
} else {
ret = thisCache;
}
return ret;
}
|
Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem
|
internalData
|
javascript
|
muaz-khan/WebRTC-Experiment
|
RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
MIT
|
function internalRemoveData( elem, name, pvt ) {
if ( !jQuery.acceptData( elem ) ) {
return;
}
var thisCache, i,
isNode = elem.nodeType,
// See jQuery.data for more information
cache = isNode ? jQuery.cache : elem,
id = isNode ? elem[ jQuery.expando ] : jQuery.expando;
// If there is already no cache entry for this object, there is no
// purpose in continuing
if ( !cache[ id ] ) {
return;
}
if ( name ) {
thisCache = pvt ? cache[ id ] : cache[ id ].data;
if ( thisCache ) {
// Support array or space separated string names for data keys
if ( !jQuery.isArray( name ) ) {
// try the string as a key before any manipulation
if ( name in thisCache ) {
name = [ name ];
} else {
// split the camel cased version by spaces unless a key with the spaces exists
name = jQuery.camelCase( name );
if ( name in thisCache ) {
name = [ name ];
} else {
name = name.split(" ");
}
}
} else {
// If "name" is an array of keys...
// When data is initially created, via ("key", "val") signature,
// keys will be converted to camelCase.
// Since there is no way to tell _how_ a key was added, remove
// both plain key and camelCase key. #12786
// This will only penalize the array argument path.
name = name.concat( jQuery.map( name, jQuery.camelCase ) );
}
i = name.length;
while ( i-- ) {
delete thisCache[ name[i] ];
}
// If there is no data left in the cache, we want to continue
// and let the cache object itself get destroyed
if ( pvt ? !isEmptyDataObject(thisCache) : !jQuery.isEmptyObject(thisCache) ) {
return;
}
}
}
// See jQuery.data for more information
if ( !pvt ) {
delete cache[ id ].data;
// Don't destroy the parent cache unless the internal data object
// had been the only thing left in it
if ( !isEmptyDataObject( cache[ id ] ) ) {
return;
}
}
// Destroy the cache
if ( isNode ) {
jQuery.cleanData( [ elem ], true );
// Use delete when supported for expandos or `cache` is not a window per isWindow (#10080)
/* jshint eqeqeq: false */
} else if ( jQuery.support.deleteExpando || cache != cache.window ) {
/* jshint eqeqeq: true */
delete cache[ id ];
// When all else fails, null
} else {
cache[ id ] = null;
}
}
|
Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem
|
internalRemoveData
|
javascript
|
muaz-khan/WebRTC-Experiment
|
RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
MIT
|
function dataAttr( elem, key, data ) {
// If nothing was found internally, try to fetch any
// data from the HTML5 data-* attribute
if ( data === undefined && elem.nodeType === 1 ) {
var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
data = elem.getAttribute( name );
if ( typeof data === "string" ) {
try {
data = data === "true" ? true :
data === "false" ? false :
data === "null" ? null :
// Only convert to a number if it doesn't change the string
+data + "" === data ? +data :
rbrace.test( data ) ? jQuery.parseJSON( data ) :
data;
} catch( e ) {}
// Make sure we set the data so it isn't changed later
jQuery.data( elem, key, data );
} else {
data = undefined;
}
}
return data;
}
|
Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem
|
dataAttr
|
javascript
|
muaz-khan/WebRTC-Experiment
|
RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
MIT
|
function isEmptyDataObject( obj ) {
var name;
for ( name in obj ) {
// if the public data object is empty, the private is still empty
if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) {
continue;
}
if ( name !== "toJSON" ) {
return false;
}
}
return true;
}
|
Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem
|
isEmptyDataObject
|
javascript
|
muaz-khan/WebRTC-Experiment
|
RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
MIT
|
next = function() {
jQuery.dequeue( elem, type );
}
|
Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem
|
next
|
javascript
|
muaz-khan/WebRTC-Experiment
|
RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
MIT
|
resolve = function() {
if ( !( --count ) ) {
defer.resolveWith( elements, [ elements ] );
}
}
|
Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem
|
resolve
|
javascript
|
muaz-khan/WebRTC-Experiment
|
RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
MIT
|
function returnTrue() {
return true;
}
|
Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem
|
returnTrue
|
javascript
|
muaz-khan/WebRTC-Experiment
|
RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
MIT
|
function returnFalse() {
return false;
}
|
Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem
|
returnFalse
|
javascript
|
muaz-khan/WebRTC-Experiment
|
RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
MIT
|
function safeActiveElement() {
try {
return document.activeElement;
} catch ( err ) { }
}
|
Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem
|
safeActiveElement
|
javascript
|
muaz-khan/WebRTC-Experiment
|
RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
MIT
|
handler = function( event ) {
jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
}
|
Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem
|
handler
|
javascript
|
muaz-khan/WebRTC-Experiment
|
RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
MIT
|
function sibling( cur, dir ) {
do {
cur = cur[ dir ];
} while ( cur && cur.nodeType !== 1 );
return cur;
}
|
Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem
|
sibling
|
javascript
|
muaz-khan/WebRTC-Experiment
|
RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
MIT
|
function winnow( elements, qualifier, not ) {
if ( jQuery.isFunction( qualifier ) ) {
return jQuery.grep( elements, function( elem, i ) {
/* jshint -W018 */
return !!qualifier.call( elem, i, elem ) !== not;
});
}
if ( qualifier.nodeType ) {
return jQuery.grep( elements, function( elem ) {
return ( elem === qualifier ) !== not;
});
}
if ( typeof qualifier === "string" ) {
if ( isSimple.test( qualifier ) ) {
return jQuery.filter( qualifier, elements, not );
}
qualifier = jQuery.filter( qualifier, elements );
}
return jQuery.grep( elements, function( elem ) {
return ( jQuery.inArray( elem, qualifier ) >= 0 ) !== not;
});
}
|
Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem
|
winnow
|
javascript
|
muaz-khan/WebRTC-Experiment
|
RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
MIT
|
function createSafeFragment( document ) {
var list = nodeNames.split( "|" ),
safeFrag = document.createDocumentFragment();
if ( safeFrag.createElement ) {
while ( list.length ) {
safeFrag.createElement(
list.pop()
);
}
}
return safeFrag;
}
|
Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem
|
createSafeFragment
|
javascript
|
muaz-khan/WebRTC-Experiment
|
RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
MIT
|
function manipulationTarget( elem, content ) {
return jQuery.nodeName( elem, "table" ) &&
jQuery.nodeName( content.nodeType === 1 ? content : content.firstChild, "tr" ) ?
elem.getElementsByTagName("tbody")[0] ||
elem.appendChild( elem.ownerDocument.createElement("tbody") ) :
elem;
}
|
Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem
|
manipulationTarget
|
javascript
|
muaz-khan/WebRTC-Experiment
|
RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
MIT
|
function disableScript( elem ) {
elem.type = (jQuery.find.attr( elem, "type" ) !== null) + "/" + elem.type;
return elem;
}
|
Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem
|
disableScript
|
javascript
|
muaz-khan/WebRTC-Experiment
|
RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
MIT
|
function restoreScript( elem ) {
var match = rscriptTypeMasked.exec( elem.type );
if ( match ) {
elem.type = match[1];
} else {
elem.removeAttribute("type");
}
return elem;
}
|
Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem
|
restoreScript
|
javascript
|
muaz-khan/WebRTC-Experiment
|
RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
MIT
|
function setGlobalEval( elems, refElements ) {
var elem,
i = 0;
for ( ; (elem = elems[i]) != null; i++ ) {
jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) );
}
}
|
Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem
|
setGlobalEval
|
javascript
|
muaz-khan/WebRTC-Experiment
|
RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
MIT
|
function cloneCopyEvent( src, dest ) {
if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {
return;
}
var type, i, l,
oldData = jQuery._data( src ),
curData = jQuery._data( dest, oldData ),
events = oldData.events;
if ( events ) {
delete curData.handle;
curData.events = {};
for ( type in events ) {
for ( i = 0, l = events[ type ].length; i < l; i++ ) {
jQuery.event.add( dest, type, events[ type ][ i ] );
}
}
}
// make the cloned public data object a copy from the original
if ( curData.data ) {
curData.data = jQuery.extend( {}, curData.data );
}
}
|
Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem
|
cloneCopyEvent
|
javascript
|
muaz-khan/WebRTC-Experiment
|
RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
MIT
|
function fixCloneNodeIssues( src, dest ) {
var nodeName, e, data;
// We do not need to do anything for non-Elements
if ( dest.nodeType !== 1 ) {
return;
}
nodeName = dest.nodeName.toLowerCase();
// IE6-8 copies events bound via attachEvent when using cloneNode.
if ( !jQuery.support.noCloneEvent && dest[ jQuery.expando ] ) {
data = jQuery._data( dest );
for ( e in data.events ) {
jQuery.removeEvent( dest, e, data.handle );
}
// Event data gets referenced instead of copied if the expando gets copied too
dest.removeAttribute( jQuery.expando );
}
// IE blanks contents when cloning scripts, and tries to evaluate newly-set text
if ( nodeName === "script" && dest.text !== src.text ) {
disableScript( dest ).text = src.text;
restoreScript( dest );
// IE6-10 improperly clones children of object elements using classid.
// IE10 throws NoModificationAllowedError if parent is null, #12132.
} else if ( nodeName === "object" ) {
if ( dest.parentNode ) {
dest.outerHTML = src.outerHTML;
}
// This path appears unavoidable for IE9. When cloning an object
// element in IE9, the outerHTML strategy above is not sufficient.
// If the src has innerHTML and the destination does not,
// copy the src.innerHTML into the dest.innerHTML. #10324
if ( jQuery.support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) {
dest.innerHTML = src.innerHTML;
}
} else if ( nodeName === "input" && manipulation_rcheckableType.test( src.type ) ) {
// IE6-8 fails to persist the checked state of a cloned checkbox
// or radio button. Worse, IE6-7 fail to give the cloned element
// a checked appearance if the defaultChecked value isn't also set
dest.defaultChecked = dest.checked = src.checked;
// IE6-7 get confused and end up setting the value of a cloned
// checkbox/radio button to an empty string instead of "on"
if ( dest.value !== src.value ) {
dest.value = src.value;
}
// IE6-8 fails to return the selected option to the default selected
// state when cloning options
} else if ( nodeName === "option" ) {
dest.defaultSelected = dest.selected = src.defaultSelected;
// IE6-8 fails to set the defaultValue to the correct value when
// cloning other types of input fields
} else if ( nodeName === "input" || nodeName === "textarea" ) {
dest.defaultValue = src.defaultValue;
}
}
|
Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem
|
fixCloneNodeIssues
|
javascript
|
muaz-khan/WebRTC-Experiment
|
RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
MIT
|
function getAll( context, tag ) {
var elems, elem,
i = 0,
found = typeof context.getElementsByTagName !== core_strundefined ? context.getElementsByTagName( tag || "*" ) :
typeof context.querySelectorAll !== core_strundefined ? context.querySelectorAll( tag || "*" ) :
undefined;
if ( !found ) {
for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) {
if ( !tag || jQuery.nodeName( elem, tag ) ) {
found.push( elem );
} else {
jQuery.merge( found, getAll( elem, tag ) );
}
}
}
return tag === undefined || tag && jQuery.nodeName( context, tag ) ?
jQuery.merge( [ context ], found ) :
found;
}
|
Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem
|
getAll
|
javascript
|
muaz-khan/WebRTC-Experiment
|
RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
MIT
|
function fixDefaultChecked( elem ) {
if ( manipulation_rcheckableType.test( elem.type ) ) {
elem.defaultChecked = elem.checked;
}
}
|
Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem
|
fixDefaultChecked
|
javascript
|
muaz-khan/WebRTC-Experiment
|
RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
MIT
|
function vendorPropName( style, name ) {
// shortcut for names that are not vendor prefixed
if ( name in style ) {
return name;
}
// check for vendor prefixed names
var capName = name.charAt(0).toUpperCase() + name.slice(1),
origName = name,
i = cssPrefixes.length;
while ( i-- ) {
name = cssPrefixes[ i ] + capName;
if ( name in style ) {
return name;
}
}
return origName;
}
|
Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem
|
vendorPropName
|
javascript
|
muaz-khan/WebRTC-Experiment
|
RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
MIT
|
function isHidden( elem, el ) {
// isHidden might be called from jQuery#filter function;
// in that case, element will be second argument
elem = el || elem;
return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem );
}
|
Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem
|
isHidden
|
javascript
|
muaz-khan/WebRTC-Experiment
|
RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
MIT
|
function showHide( elements, show ) {
var display, elem, hidden,
values = [],
index = 0,
length = elements.length;
for ( ; index < length; index++ ) {
elem = elements[ index ];
if ( !elem.style ) {
continue;
}
values[ index ] = jQuery._data( elem, "olddisplay" );
display = elem.style.display;
if ( show ) {
// Reset the inline display of this element to learn if it is
// being hidden by cascaded rules or not
if ( !values[ index ] && display === "none" ) {
elem.style.display = "";
}
// Set elements which have been overridden with display: none
// in a stylesheet to whatever the default browser style is
// for such an element
if ( elem.style.display === "" && isHidden( elem ) ) {
values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) );
}
} else {
if ( !values[ index ] ) {
hidden = isHidden( elem );
if ( display && display !== "none" || !hidden ) {
jQuery._data( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) );
}
}
}
}
// Set the display of most of the elements in a second loop
// to avoid the constant reflow
for ( index = 0; index < length; index++ ) {
elem = elements[ index ];
if ( !elem.style ) {
continue;
}
if ( !show || elem.style.display === "none" || elem.style.display === "" ) {
elem.style.display = show ? values[ index ] || "" : "none";
}
}
return elements;
}
|
Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem
|
showHide
|
javascript
|
muaz-khan/WebRTC-Experiment
|
RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
MIT
|
function setPositiveNumber( elem, value, subtract ) {
var matches = rnumsplit.exec( value );
return matches ?
// Guard against undefined "subtract", e.g., when used as in cssHooks
Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) :
value;
}
|
Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem
|
setPositiveNumber
|
javascript
|
muaz-khan/WebRTC-Experiment
|
RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
MIT
|
function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
var i = extra === ( isBorderBox ? "border" : "content" ) ?
// If we already have the right measurement, avoid augmentation
4 :
// Otherwise initialize for horizontal or vertical properties
name === "width" ? 1 : 0,
val = 0;
for ( ; i < 4; i += 2 ) {
// both box models exclude margin, so add it if we want it
if ( extra === "margin" ) {
val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
}
if ( isBorderBox ) {
// border-box includes padding, so remove it if we want content
if ( extra === "content" ) {
val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
}
// at this point, extra isn't border nor margin, so remove border
if ( extra !== "margin" ) {
val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
}
} else {
// at this point, extra isn't content, so add padding
val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
// at this point, extra isn't content nor padding, so add border
if ( extra !== "padding" ) {
val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
}
}
}
return val;
}
|
Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem
|
augmentWidthOrHeight
|
javascript
|
muaz-khan/WebRTC-Experiment
|
RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
MIT
|
function getWidthOrHeight( elem, name, extra ) {
// Start with offset property, which is equivalent to the border-box value
var valueIsBorderBox = true,
val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
styles = getStyles( elem ),
isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
// some non-html elements return undefined for offsetWidth, so check for null/undefined
// svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
// MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
if ( val <= 0 || val == null ) {
// Fall back to computed then uncomputed css if necessary
val = curCSS( elem, name, styles );
if ( val < 0 || val == null ) {
val = elem.style[ name ];
}
// Computed unit is not pixels. Stop here and return.
if ( rnumnonpx.test(val) ) {
return val;
}
// we need the check for style in case a browser which returns unreliable values
// for getComputedStyle silently falls back to the reliable elem.style
valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] );
// Normalize "", auto, and prepare for extra
val = parseFloat( val ) || 0;
}
// use the active box-sizing model to add/subtract irrelevant styles
return ( val +
augmentWidthOrHeight(
elem,
name,
extra || ( isBorderBox ? "border" : "content" ),
valueIsBorderBox,
styles
)
) + "px";
}
|
Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem
|
getWidthOrHeight
|
javascript
|
muaz-khan/WebRTC-Experiment
|
RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
MIT
|
function css_defaultDisplay( nodeName ) {
var doc = document,
display = elemdisplay[ nodeName ];
if ( !display ) {
display = actualDisplay( nodeName, doc );
// If the simple way fails, read from inside an iframe
if ( display === "none" || !display ) {
// Use the already-created iframe if possible
iframe = ( iframe ||
jQuery("<iframe frameborder='0' width='0' height='0'/>")
.css( "cssText", "display:block !important" )
).appendTo( doc.documentElement );
// Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
doc = ( iframe[0].contentWindow || iframe[0].contentDocument ).document;
doc.write("<!doctype html><html><body>");
doc.close();
display = actualDisplay( nodeName, doc );
iframe.detach();
}
// Store the correct default display
elemdisplay[ nodeName ] = display;
}
return display;
}
|
Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem
|
css_defaultDisplay
|
javascript
|
muaz-khan/WebRTC-Experiment
|
RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
MIT
|
function actualDisplay( name, doc ) {
var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),
display = jQuery.css( elem[0], "display" );
elem.remove();
return display;
}
|
Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem
|
actualDisplay
|
javascript
|
muaz-khan/WebRTC-Experiment
|
RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
MIT
|
add = function( key, value ) {
// If value is a function, invoke it and return its value
value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
}
|
Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem
|
add
|
javascript
|
muaz-khan/WebRTC-Experiment
|
RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
MIT
|
function buildParams( prefix, obj, traditional, add ) {
var name;
if ( jQuery.isArray( obj ) ) {
// Serialize array item.
jQuery.each( obj, function( i, v ) {
if ( traditional || rbracket.test( prefix ) ) {
// Treat each array item as a scalar.
add( prefix, v );
} else {
// Item is non-scalar (array or object), encode its numeric index.
buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );
}
});
} else if ( !traditional && jQuery.type( obj ) === "object" ) {
// Serialize object item.
for ( name in obj ) {
buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
}
} else {
// Serialize scalar item.
add( prefix, obj );
}
}
|
Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem
|
buildParams
|
javascript
|
muaz-khan/WebRTC-Experiment
|
RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
MIT
|
function addToPrefiltersOrTransports( structure ) {
// dataTypeExpression is optional and defaults to "*"
return function( dataTypeExpression, func ) {
if ( typeof dataTypeExpression !== "string" ) {
func = dataTypeExpression;
dataTypeExpression = "*";
}
var dataType,
i = 0,
dataTypes = dataTypeExpression.toLowerCase().match( core_rnotwhite ) || [];
if ( jQuery.isFunction( func ) ) {
// For each dataType in the dataTypeExpression
while ( (dataType = dataTypes[i++]) ) {
// Prepend if requested
if ( dataType[0] === "+" ) {
dataType = dataType.slice( 1 ) || "*";
(structure[ dataType ] = structure[ dataType ] || []).unshift( func );
// Otherwise append
} else {
(structure[ dataType ] = structure[ dataType ] || []).push( func );
}
}
}
};
}
|
Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem
|
addToPrefiltersOrTransports
|
javascript
|
muaz-khan/WebRTC-Experiment
|
RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
MIT
|
function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
var inspected = {},
seekingTransport = ( structure === transports );
function inspect( dataType ) {
var selected;
inspected[ dataType ] = true;
jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
if( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
options.dataTypes.unshift( dataTypeOrTransport );
inspect( dataTypeOrTransport );
return false;
} else if ( seekingTransport ) {
return !( selected = dataTypeOrTransport );
}
});
return selected;
}
return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
}
|
Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem
|
inspectPrefiltersOrTransports
|
javascript
|
muaz-khan/WebRTC-Experiment
|
RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
MIT
|
function inspect( dataType ) {
var selected;
inspected[ dataType ] = true;
jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
if( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
options.dataTypes.unshift( dataTypeOrTransport );
inspect( dataTypeOrTransport );
return false;
} else if ( seekingTransport ) {
return !( selected = dataTypeOrTransport );
}
});
return selected;
}
|
Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem
|
inspect
|
javascript
|
muaz-khan/WebRTC-Experiment
|
RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
MIT
|
function ajaxExtend( target, src ) {
var deep, key,
flatOptions = jQuery.ajaxSettings.flatOptions || {};
for ( key in src ) {
if ( src[ key ] !== undefined ) {
( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];
}
}
if ( deep ) {
jQuery.extend( true, target, deep );
}
return target;
}
|
Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem
|
ajaxExtend
|
javascript
|
muaz-khan/WebRTC-Experiment
|
RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
MIT
|
function done( status, nativeStatusText, responses, headers ) {
var isSuccess, success, error, response, modified,
statusText = nativeStatusText;
// Called once
if ( state === 2 ) {
return;
}
// State is "done" now
state = 2;
// Clear timeout if it exists
if ( timeoutTimer ) {
clearTimeout( timeoutTimer );
}
// Dereference transport for early garbage collection
// (no matter how long the jqXHR object will be used)
transport = undefined;
// Cache response headers
responseHeadersString = headers || "";
// Set readyState
jqXHR.readyState = status > 0 ? 4 : 0;
// Determine if successful
isSuccess = status >= 200 && status < 300 || status === 304;
// Get response data
if ( responses ) {
response = ajaxHandleResponses( s, jqXHR, responses );
}
// Convert no matter what (that way responseXXX fields are always set)
response = ajaxConvert( s, response, jqXHR, isSuccess );
// If successful, handle type chaining
if ( isSuccess ) {
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
if ( s.ifModified ) {
modified = jqXHR.getResponseHeader("Last-Modified");
if ( modified ) {
jQuery.lastModified[ cacheURL ] = modified;
}
modified = jqXHR.getResponseHeader("etag");
if ( modified ) {
jQuery.etag[ cacheURL ] = modified;
}
}
// if no content
if ( status === 204 || s.type === "HEAD" ) {
statusText = "nocontent";
// if not modified
} else if ( status === 304 ) {
statusText = "notmodified";
// If we have data, let's convert it
} else {
statusText = response.state;
success = response.data;
error = response.error;
isSuccess = !error;
}
} else {
// We extract error from statusText
// then normalize statusText and status for non-aborts
error = statusText;
if ( status || !statusText ) {
statusText = "error";
if ( status < 0 ) {
status = 0;
}
}
}
// Set data for the fake xhr object
jqXHR.status = status;
jqXHR.statusText = ( nativeStatusText || statusText ) + "";
// Success/Error
if ( isSuccess ) {
deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
} else {
deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
}
// Status-dependent callbacks
jqXHR.statusCode( statusCode );
statusCode = undefined;
if ( fireGlobals ) {
globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
[ jqXHR, s, isSuccess ? success : error ] );
}
// Complete
completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
if ( fireGlobals ) {
globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
// Handle the global AJAX counter
if ( !( --jQuery.active ) ) {
jQuery.event.trigger("ajaxStop");
}
}
}
|
Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem
|
done
|
javascript
|
muaz-khan/WebRTC-Experiment
|
RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
MIT
|
function ajaxHandleResponses( s, jqXHR, responses ) {
var firstDataType, ct, finalDataType, type,
contents = s.contents,
dataTypes = s.dataTypes;
// Remove auto dataType and get content-type in the process
while( dataTypes[ 0 ] === "*" ) {
dataTypes.shift();
if ( ct === undefined ) {
ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
}
}
// Check if we're dealing with a known content-type
if ( ct ) {
for ( type in contents ) {
if ( contents[ type ] && contents[ type ].test( ct ) ) {
dataTypes.unshift( type );
break;
}
}
}
// Check to see if we have a response for the expected dataType
if ( dataTypes[ 0 ] in responses ) {
finalDataType = dataTypes[ 0 ];
} else {
// Try convertible dataTypes
for ( type in responses ) {
if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
finalDataType = type;
break;
}
if ( !firstDataType ) {
firstDataType = type;
}
}
// Or just use first one
finalDataType = finalDataType || firstDataType;
}
// If we found a dataType
// We add the dataType to the list if needed
// and return the corresponding response
if ( finalDataType ) {
if ( finalDataType !== dataTypes[ 0 ] ) {
dataTypes.unshift( finalDataType );
}
return responses[ finalDataType ];
}
}
|
Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem
|
ajaxHandleResponses
|
javascript
|
muaz-khan/WebRTC-Experiment
|
RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
MIT
|
function ajaxConvert( s, response, jqXHR, isSuccess ) {
var conv2, current, conv, tmp, prev,
converters = {},
// Work with a copy of dataTypes in case we need to modify it for conversion
dataTypes = s.dataTypes.slice();
// Create converters map with lowercased keys
if ( dataTypes[ 1 ] ) {
for ( conv in s.converters ) {
converters[ conv.toLowerCase() ] = s.converters[ conv ];
}
}
current = dataTypes.shift();
// Convert to each sequential dataType
while ( current ) {
if ( s.responseFields[ current ] ) {
jqXHR[ s.responseFields[ current ] ] = response;
}
// Apply the dataFilter if provided
if ( !prev && isSuccess && s.dataFilter ) {
response = s.dataFilter( response, s.dataType );
}
prev = current;
current = dataTypes.shift();
if ( current ) {
// There's only work to do if current dataType is non-auto
if ( current === "*" ) {
current = prev;
// Convert response if prev dataType is non-auto and differs from current
} else if ( prev !== "*" && prev !== current ) {
// Seek a direct converter
conv = converters[ prev + " " + current ] || converters[ "* " + current ];
// If none found, seek a pair
if ( !conv ) {
for ( conv2 in converters ) {
// If conv2 outputs current
tmp = conv2.split( " " );
if ( tmp[ 1 ] === current ) {
// If prev can be converted to accepted input
conv = converters[ prev + " " + tmp[ 0 ] ] ||
converters[ "* " + tmp[ 0 ] ];
if ( conv ) {
// Condense equivalence converters
if ( conv === true ) {
conv = converters[ conv2 ];
// Otherwise, insert the intermediate dataType
} else if ( converters[ conv2 ] !== true ) {
current = tmp[ 0 ];
dataTypes.unshift( tmp[ 1 ] );
}
break;
}
}
}
}
// Apply converter (if not an equivalence)
if ( conv !== true ) {
// Unless errors are allowed to bubble, catch and return them
if ( conv && s[ "throws" ] ) {
response = conv( response );
} else {
try {
response = conv( response );
} catch ( e ) {
return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current };
}
}
}
}
}
}
return { state: "success", data: response };
}
|
Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem
|
ajaxConvert
|
javascript
|
muaz-khan/WebRTC-Experiment
|
RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
MIT
|
function createStandardXHR() {
try {
return new window.XMLHttpRequest();
} catch( e ) {}
}
|
Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem
|
createStandardXHR
|
javascript
|
muaz-khan/WebRTC-Experiment
|
RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
MIT
|
function createActiveXHR() {
try {
return new window.ActiveXObject("Microsoft.XMLHTTP");
} catch( e ) {}
}
|
Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem
|
createActiveXHR
|
javascript
|
muaz-khan/WebRTC-Experiment
|
RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
MIT
|
function createFxNow() {
setTimeout(function() {
fxNow = undefined;
});
return ( fxNow = jQuery.now() );
}
|
Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem
|
createFxNow
|
javascript
|
muaz-khan/WebRTC-Experiment
|
RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
MIT
|
function createTween( value, prop, animation ) {
var tween,
collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ),
index = 0,
length = collection.length;
for ( ; index < length; index++ ) {
if ( (tween = collection[ index ].call( animation, prop, value )) ) {
// we're done with this property
return tween;
}
}
}
|
Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem
|
createTween
|
javascript
|
muaz-khan/WebRTC-Experiment
|
RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
MIT
|
function Animation( elem, properties, options ) {
var result,
stopped,
index = 0,
length = animationPrefilters.length,
deferred = jQuery.Deferred().always( function() {
// don't match elem in the :animated selector
delete tick.elem;
}),
tick = function() {
if ( stopped ) {
return false;
}
var currentTime = fxNow || createFxNow(),
remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
// archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497)
temp = remaining / animation.duration || 0,
percent = 1 - temp,
index = 0,
length = animation.tweens.length;
for ( ; index < length ; index++ ) {
animation.tweens[ index ].run( percent );
}
deferred.notifyWith( elem, [ animation, percent, remaining ]);
if ( percent < 1 && length ) {
return remaining;
} else {
deferred.resolveWith( elem, [ animation ] );
return false;
}
},
animation = deferred.promise({
elem: elem,
props: jQuery.extend( {}, properties ),
opts: jQuery.extend( true, { specialEasing: {} }, options ),
originalProperties: properties,
originalOptions: options,
startTime: fxNow || createFxNow(),
duration: options.duration,
tweens: [],
createTween: function( prop, end ) {
var tween = jQuery.Tween( elem, animation.opts, prop, end,
animation.opts.specialEasing[ prop ] || animation.opts.easing );
animation.tweens.push( tween );
return tween;
},
stop: function( gotoEnd ) {
var index = 0,
// if we are going to the end, we want to run all the tweens
// otherwise we skip this part
length = gotoEnd ? animation.tweens.length : 0;
if ( stopped ) {
return this;
}
stopped = true;
for ( ; index < length ; index++ ) {
animation.tweens[ index ].run( 1 );
}
// resolve when we played the last frame
// otherwise, reject
if ( gotoEnd ) {
deferred.resolveWith( elem, [ animation, gotoEnd ] );
} else {
deferred.rejectWith( elem, [ animation, gotoEnd ] );
}
return this;
}
}),
props = animation.props;
propFilter( props, animation.opts.specialEasing );
for ( ; index < length ; index++ ) {
result = animationPrefilters[ index ].call( animation, elem, props, animation.opts );
if ( result ) {
return result;
}
}
jQuery.map( props, createTween, animation );
if ( jQuery.isFunction( animation.opts.start ) ) {
animation.opts.start.call( elem, animation );
}
jQuery.fx.timer(
jQuery.extend( tick, {
elem: elem,
anim: animation,
queue: animation.opts.queue
})
);
// attach callbacks from options
return animation.progress( animation.opts.progress )
.done( animation.opts.done, animation.opts.complete )
.fail( animation.opts.fail )
.always( animation.opts.always );
}
|
Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem
|
Animation
|
javascript
|
muaz-khan/WebRTC-Experiment
|
RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
MIT
|
tick = function() {
if ( stopped ) {
return false;
}
var currentTime = fxNow || createFxNow(),
remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
// archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497)
temp = remaining / animation.duration || 0,
percent = 1 - temp,
index = 0,
length = animation.tweens.length;
for ( ; index < length ; index++ ) {
animation.tweens[ index ].run( percent );
}
deferred.notifyWith( elem, [ animation, percent, remaining ]);
if ( percent < 1 && length ) {
return remaining;
} else {
deferred.resolveWith( elem, [ animation ] );
return false;
}
}
|
Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem
|
tick
|
javascript
|
muaz-khan/WebRTC-Experiment
|
RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
MIT
|
function propFilter( props, specialEasing ) {
var index, name, easing, value, hooks;
// camelCase, specialEasing and expand cssHook pass
for ( index in props ) {
name = jQuery.camelCase( index );
easing = specialEasing[ name ];
value = props[ index ];
if ( jQuery.isArray( value ) ) {
easing = value[ 1 ];
value = props[ index ] = value[ 0 ];
}
if ( index !== name ) {
props[ name ] = value;
delete props[ index ];
}
hooks = jQuery.cssHooks[ name ];
if ( hooks && "expand" in hooks ) {
value = hooks.expand( value );
delete props[ name ];
// not quite $.extend, this wont overwrite keys already present.
// also - reusing 'index' from above because we have the correct "name"
for ( index in value ) {
if ( !( index in props ) ) {
props[ index ] = value[ index ];
specialEasing[ index ] = easing;
}
}
} else {
specialEasing[ name ] = easing;
}
}
}
|
Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem
|
propFilter
|
javascript
|
muaz-khan/WebRTC-Experiment
|
RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
MIT
|
function defaultPrefilter( elem, props, opts ) {
/* jshint validthis: true */
var prop, value, toggle, tween, hooks, oldfire,
anim = this,
orig = {},
style = elem.style,
hidden = elem.nodeType && isHidden( elem ),
dataShow = jQuery._data( elem, "fxshow" );
// handle queue: false promises
if ( !opts.queue ) {
hooks = jQuery._queueHooks( elem, "fx" );
if ( hooks.unqueued == null ) {
hooks.unqueued = 0;
oldfire = hooks.empty.fire;
hooks.empty.fire = function() {
if ( !hooks.unqueued ) {
oldfire();
}
};
}
hooks.unqueued++;
anim.always(function() {
// doing this makes sure that the complete handler will be called
// before this completes
anim.always(function() {
hooks.unqueued--;
if ( !jQuery.queue( elem, "fx" ).length ) {
hooks.empty.fire();
}
});
});
}
// height/width overflow pass
if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
// Make sure that nothing sneaks out
// Record all 3 overflow attributes because IE does not
// change the overflow attribute when overflowX and
// overflowY are set to the same value
opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
// Set display property to inline-block for height/width
// animations on inline elements that are having width/height animated
if ( jQuery.css( elem, "display" ) === "inline" &&
jQuery.css( elem, "float" ) === "none" ) {
// inline-level elements accept inline-block;
// block-level elements need to be inline with layout
if ( !jQuery.support.inlineBlockNeedsLayout || css_defaultDisplay( elem.nodeName ) === "inline" ) {
style.display = "inline-block";
} else {
style.zoom = 1;
}
}
}
if ( opts.overflow ) {
style.overflow = "hidden";
if ( !jQuery.support.shrinkWrapBlocks ) {
anim.always(function() {
style.overflow = opts.overflow[ 0 ];
style.overflowX = opts.overflow[ 1 ];
style.overflowY = opts.overflow[ 2 ];
});
}
}
// show/hide pass
for ( prop in props ) {
value = props[ prop ];
if ( rfxtypes.exec( value ) ) {
delete props[ prop ];
toggle = toggle || value === "toggle";
if ( value === ( hidden ? "hide" : "show" ) ) {
continue;
}
orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
}
}
if ( !jQuery.isEmptyObject( orig ) ) {
if ( dataShow ) {
if ( "hidden" in dataShow ) {
hidden = dataShow.hidden;
}
} else {
dataShow = jQuery._data( elem, "fxshow", {} );
}
// store state if its toggle - enables .stop().toggle() to "reverse"
if ( toggle ) {
dataShow.hidden = !hidden;
}
if ( hidden ) {
jQuery( elem ).show();
} else {
anim.done(function() {
jQuery( elem ).hide();
});
}
anim.done(function() {
var prop;
jQuery._removeData( elem, "fxshow" );
for ( prop in orig ) {
jQuery.style( elem, prop, orig[ prop ] );
}
});
for ( prop in orig ) {
tween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
if ( !( prop in dataShow ) ) {
dataShow[ prop ] = tween.start;
if ( hidden ) {
tween.end = tween.start;
tween.start = prop === "width" || prop === "height" ? 1 : 0;
}
}
}
}
}
|
Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem
|
defaultPrefilter
|
javascript
|
muaz-khan/WebRTC-Experiment
|
RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
MIT
|
function Tween( elem, options, prop, end, easing ) {
return new Tween.prototype.init( elem, options, prop, end, easing );
}
|
Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem
|
Tween
|
javascript
|
muaz-khan/WebRTC-Experiment
|
RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
MIT
|
doAnimation = function() {
// Operate on a copy of prop so per-property easing won't be lost
var anim = Animation( this, jQuery.extend( {}, prop ), optall );
// Empty animations, or finishing resolves immediately
if ( empty || jQuery._data( this, "finish" ) ) {
anim.stop( true );
}
}
|
Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem
|
doAnimation
|
javascript
|
muaz-khan/WebRTC-Experiment
|
RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
MIT
|
stopQueue = function( hooks ) {
var stop = hooks.stop;
delete hooks.stop;
stop( gotoEnd );
}
|
Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem
|
stopQueue
|
javascript
|
muaz-khan/WebRTC-Experiment
|
RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
MIT
|
function genFx( type, includeWidth ) {
var which,
attrs = { height: type },
i = 0;
// if we include width, step value is 1 to do all cssExpand values,
// if we don't include width, step value is 2 to skip over Left and Right
includeWidth = includeWidth? 1 : 0;
for( ; i < 4 ; i += 2 - includeWidth ) {
which = cssExpand[ i ];
attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
}
if ( includeWidth ) {
attrs.opacity = attrs.width = type;
}
return attrs;
}
|
Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem
|
genFx
|
javascript
|
muaz-khan/WebRTC-Experiment
|
RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
MIT
|
function getWindow( elem ) {
return jQuery.isWindow( elem ) ?
elem :
elem.nodeType === 9 ?
elem.defaultView || elem.parentWindow :
false;
}
|
Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem
|
getWindow
|
javascript
|
muaz-khan/WebRTC-Experiment
|
RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/jquery-1.10.2.js
|
MIT
|
function gumCallback(stream) {
if (session.streamCallback) {
session.streamCallback(stream);
}
connection.renegotiate(remoteUserId);
}
|
iOS 11 doesn't allow automatic play and rejects **
|
gumCallback
|
javascript
|
muaz-khan/WebRTC-Experiment
|
RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/RTCMultiConnection.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/RTCMultiConnection.js
|
MIT
|
function applyConstraints(stream, mediaConstraints) {
if (!stream) {
if (!!connection.enableLogs) {
console.error('No stream to applyConstraints.');
}
return;
}
if (mediaConstraints.audio) {
stream.getAudioTracks().forEach(function(track) {
track.applyConstraints(mediaConstraints.audio);
});
}
if (mediaConstraints.video) {
stream.getVideoTracks().forEach(function(track) {
track.applyConstraints(mediaConstraints.video);
});
}
}
|
iOS 11 doesn't allow automatic play and rejects **
|
applyConstraints
|
javascript
|
muaz-khan/WebRTC-Experiment
|
RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/RTCMultiConnection.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/RTCMultiConnection.js
|
MIT
|
function replaceTrack(track, remoteUserId, isVideoTrack) {
if (remoteUserId) {
mPeer.replaceTrack(track, remoteUserId, isVideoTrack);
return;
}
connection.peers.getAllParticipants().forEach(function(participant) {
mPeer.replaceTrack(track, participant, isVideoTrack);
});
}
|
iOS 11 doesn't allow automatic play and rejects **
|
replaceTrack
|
javascript
|
muaz-khan/WebRTC-Experiment
|
RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/RTCMultiConnection.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/RTCMultiConnection.js
|
MIT
|
function gumCallback(stream) {
connection.replaceTrack(stream, remoteUserId, isVideoTrack || session.video || session.screen);
}
|
iOS 11 doesn't allow automatic play and rejects **
|
gumCallback
|
javascript
|
muaz-khan/WebRTC-Experiment
|
RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/RTCMultiConnection.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/RTCMultiConnection.js
|
MIT
|
function keepNextBroadcasterOnServer() {
if (!connection.isInitiator) return;
if (connection.session.oneway || connection.session.broadcast || connection.direction !== 'many-to-many') {
return;
}
var firstBroadcaster = connection.broadcasters[0];
var otherBroadcasters = [];
connection.broadcasters.forEach(function(broadcaster) {
if (broadcaster !== firstBroadcaster) {
otherBroadcasters.push(broadcaster);
}
});
if (connection.autoCloseEntireSession) return;
connection.shiftModerationControl(firstBroadcaster, otherBroadcasters, true);
}
|
iOS 11 doesn't allow automatic play and rejects **
|
keepNextBroadcasterOnServer
|
javascript
|
muaz-khan/WebRTC-Experiment
|
RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/RTCMultiConnection.js
|
https://github.com/muaz-khan/WebRTC-Experiment/blob/master/RTCMultiConnection-SignalR/RTCMultiConnection/Scripts/RTCMultiConnection.js
|
MIT
|
function computeOffsetPixels(offset, contextHeight) {
const pixelOffset = parseOffsetAsPixels(offset);
if (typeof pixelOffset === 'number') {
return pixelOffset;
}
const percentOffset = parseOffsetAsPercentage(offset);
if (typeof percentOffset === 'number') {
return percentOffset * contextHeight;
}
return undefined;
}
|
@param {string|number} offset
@param {number} contextHeight
@return {number} A number representing `offset` converted into pixels.
|
computeOffsetPixels
|
javascript
|
civiccc/react-waypoint
|
src/computeOffsetPixels.js
|
https://github.com/civiccc/react-waypoint/blob/master/src/computeOffsetPixels.js
|
MIT
|
function ensureRefIsProvidedByChild(children, ref) {
if (children && !isDOMElement(children) && !ref) {
throw new Error(errorMessage);
}
}
|
Raise an error if "children" is not a DOM Element and there is no ref provided to Waypoint
@param {?React.element} children
@param {?HTMLElement} ref
@return {undefined}
|
ensureRefIsProvidedByChild
|
javascript
|
civiccc/react-waypoint
|
src/ensureRefIsUsedByChild.js
|
https://github.com/civiccc/react-waypoint/blob/master/src/ensureRefIsUsedByChild.js
|
MIT
|
function getCurrentPosition(bounds) {
if (bounds.viewportBottom - bounds.viewportTop === 0) {
return INVISIBLE;
}
// top is within the viewport
if (bounds.viewportTop <= bounds.waypointTop
&& bounds.waypointTop <= bounds.viewportBottom) {
return INSIDE;
}
// bottom is within the viewport
if (bounds.viewportTop <= bounds.waypointBottom
&& bounds.waypointBottom <= bounds.viewportBottom) {
return INSIDE;
}
// top is above the viewport and bottom is below the viewport
if (bounds.waypointTop <= bounds.viewportTop
&& bounds.viewportBottom <= bounds.waypointBottom) {
return INSIDE;
}
if (bounds.viewportBottom < bounds.waypointTop) {
return BELOW;
}
if (bounds.waypointTop < bounds.viewportTop) {
return ABOVE;
}
return INVISIBLE;
}
|
@param {object} bounds An object with bounds data for the waypoint and
scrollable parent
@return {string} The current position of the waypoint in relation to the
visible portion of the scrollable parent. One of the constants `ABOVE`,
`BELOW`, `INSIDE` or `INVISIBLE`.
|
getCurrentPosition
|
javascript
|
civiccc/react-waypoint
|
src/getCurrentPosition.js
|
https://github.com/civiccc/react-waypoint/blob/master/src/getCurrentPosition.js
|
MIT
|
function isDOMElement(Component) {
return (typeof Component.type === 'string');
}
|
When an element's type is a string, it represents a DOM node with that tag name
https://facebook.github.io/react/blog/2015/12/18/react-components-elements-and-instances.html#dom-elements
@param {React.element} Component
@return {bool} Whether the component is a DOM Element
|
isDOMElement
|
javascript
|
civiccc/react-waypoint
|
src/isDOMElement.js
|
https://github.com/civiccc/react-waypoint/blob/master/src/isDOMElement.js
|
MIT
|
function parseOffsetAsPercentage(str) {
if (str.slice(-1) === '%') {
return parseFloat(str.slice(0, -1)) / 100;
}
return undefined;
}
|
Attempts to parse the offset provided as a prop as a percentage. For
instance, if the component has been provided with the string "20%" as
a value of one of the offset props. If the value matches, then it returns
a numeric version of the prop. For instance, "20%" would become `0.2`.
If `str` isn't a percentage, then `undefined` will be returned.
@param {string} str The value of an offset prop to be converted to a
number.
@return {number|undefined} The numeric version of `str`. Undefined if `str`
was not a percentage.
|
parseOffsetAsPercentage
|
javascript
|
civiccc/react-waypoint
|
src/parseOffsetAsPercentage.js
|
https://github.com/civiccc/react-waypoint/blob/master/src/parseOffsetAsPercentage.js
|
MIT
|
function parseOffsetAsPixels(str) {
if (!isNaN(parseFloat(str)) && isFinite(str)) {
return parseFloat(str);
} if (str.slice(-2) === 'px') {
return parseFloat(str.slice(0, -2));
}
return undefined;
}
|
Attempts to parse the offset provided as a prop as a pixel value. If
parsing fails, then `undefined` is returned. Three examples of values that
will be successfully parsed are:
`20`
"20px"
"20"
@param {string|number} str A string of the form "{number}" or "{number}px",
or just a number.
@return {number|undefined} The numeric version of `str`. Undefined if `str`
was neither a number nor string ending in "px".
|
parseOffsetAsPixels
|
javascript
|
civiccc/react-waypoint
|
src/parseOffsetAsPixels.js
|
https://github.com/civiccc/react-waypoint/blob/master/src/parseOffsetAsPixels.js
|
MIT
|
_findLongestCommonSequence = function (seq1, seq2, seq1IsInLcs, seq2IsInLcs) {
if (!_areTypeOf(Array, seq1, seq2)) {
throw new Error('Array parameters are required')
}
// Deal with edge case
if (_isEmptyArray(seq1) || _isEmptyArray(seq2)) {
return []
}
// Function to calculate lcs lengths
const lcsLens = function (xs, ys) {
let i
let j
let prev
const curr = _getInitializedArray(ys.length + 1, 0)
for (i = 0; i < xs.length; i++) {
prev = curr.slice(0)
for (j = 0; j < ys.length; j++) {
if (xs[i] === ys[j]) {
curr[j + 1] = prev[j] + 1
} else {
curr[j + 1] = Math.max(curr[j], prev[j + 1])
}
}
}
return curr
}
// Function to find lcs and fill in the array to indicate the optimal longest common sequence
const _findLcs = function (xs, xidx, xIsIn, ys) {
let i
let xb
let xe
let llB
let llE
let pivot
let max
let yb
let ye
const nx = xs.length
const ny = ys.length
if (nx === 0) {
return []
}
if (nx === 1) {
if (_hasValue(ys, xs[0])) {
xIsIn[xidx] = true
return [xs[0]]
}
return []
}
i = Math.floor(nx / 2)
xb = xs.slice(0, i)
xe = xs.slice(i)
llB = lcsLens(xb, ys)
llE = lcsLens(xe.slice(0).reverse(), ys.slice(0).reverse())
pivot = 0
max = 0
for (j = 0; j <= ny; j++) {
if (llB[j] + llE[ny - j] > max) {
pivot = j
max = llB[j] + llE[ny - j]
}
}
yb = ys.slice(0, pivot)
ye = ys.slice(pivot)
return _findLcs(xb, xidx, xIsIn, yb).concat(_findLcs(xe, xidx + i, xIsIn, ye))
}
// Fill in seq1IsInLcs to find the optimal longest common subsequence of first sequence
_findLcs(seq1, 0, seq1IsInLcs, seq2)
// Fill in seq2IsInLcs to find the optimal longest common subsequence
// of second sequence and return the result
return _findLcs(seq2, 0, seq2IsInLcs, seq1)
}
|
Finds longest common sequence between two sequences
@see {@link https://wordaligned.org/articles/longest-common-subsequence}
|
_findLongestCommonSequence
|
javascript
|
locutusjs/locutus
|
src/php/xdiff/xdiff_string_diff.js
|
https://github.com/locutusjs/locutus/blob/master/src/php/xdiff/xdiff_string_diff.js
|
MIT
|
_findLongestCommonSequence = function (seq1, seq2, seq1IsInLcs, seq2IsInLcs) {
if (!_areTypeOf(Array, seq1, seq2)) {
throw new Error('Array parameters are required')
}
// Deal with edge case
if (_isEmptyArray(seq1) || _isEmptyArray(seq2)) {
return []
}
// Function to calculate lcs lengths
const lcsLens = function (xs, ys) {
let i
let j
let prev
const curr = _getInitializedArray(ys.length + 1, 0)
for (i = 0; i < xs.length; i++) {
prev = curr.slice(0)
for (j = 0; j < ys.length; j++) {
if (xs[i] === ys[j]) {
curr[j + 1] = prev[j] + 1
} else {
curr[j + 1] = Math.max(curr[j], prev[j + 1])
}
}
}
return curr
}
// Function to find lcs and fill in the array to indicate the optimal longest common sequence
const _findLcs = function (xs, xidx, xIsIn, ys) {
let i
let xb
let xe
let llB
let llE
let pivot
let max
let yb
let ye
const nx = xs.length
const ny = ys.length
if (nx === 0) {
return []
}
if (nx === 1) {
if (_hasValue(ys, xs[0])) {
xIsIn[xidx] = true
return [xs[0]]
}
return []
}
i = Math.floor(nx / 2)
xb = xs.slice(0, i)
xe = xs.slice(i)
llB = lcsLens(xb, ys)
llE = lcsLens(xe.slice(0).reverse(), ys.slice(0).reverse())
pivot = 0
max = 0
for (j = 0; j <= ny; j++) {
if (llB[j] + llE[ny - j] > max) {
pivot = j
max = llB[j] + llE[ny - j]
}
}
yb = ys.slice(0, pivot)
ye = ys.slice(pivot)
return _findLcs(xb, xidx, xIsIn, yb).concat(_findLcs(xe, xidx + i, xIsIn, ye))
}
// Fill in seq1IsInLcs to find the optimal longest common subsequence of first sequence
_findLcs(seq1, 0, seq1IsInLcs, seq2)
// Fill in seq2IsInLcs to find the optimal longest common subsequence
// of second sequence and return the result
return _findLcs(seq2, 0, seq2IsInLcs, seq1)
}
|
Finds longest common sequence between two sequences
@see {@link https://wordaligned.org/articles/longest-common-subsequence}
|
_findLongestCommonSequence
|
javascript
|
locutusjs/locutus
|
src/php/xdiff/xdiff_string_diff.js
|
https://github.com/locutusjs/locutus/blob/master/src/php/xdiff/xdiff_string_diff.js
|
MIT
|
lcsLens = function (xs, ys) {
let i
let j
let prev
const curr = _getInitializedArray(ys.length + 1, 0)
for (i = 0; i < xs.length; i++) {
prev = curr.slice(0)
for (j = 0; j < ys.length; j++) {
if (xs[i] === ys[j]) {
curr[j + 1] = prev[j] + 1
} else {
curr[j + 1] = Math.max(curr[j], prev[j + 1])
}
}
}
return curr
}
|
Finds longest common sequence between two sequences
@see {@link https://wordaligned.org/articles/longest-common-subsequence}
|
lcsLens
|
javascript
|
locutusjs/locutus
|
src/php/xdiff/xdiff_string_diff.js
|
https://github.com/locutusjs/locutus/blob/master/src/php/xdiff/xdiff_string_diff.js
|
MIT
|
lcsLens = function (xs, ys) {
let i
let j
let prev
const curr = _getInitializedArray(ys.length + 1, 0)
for (i = 0; i < xs.length; i++) {
prev = curr.slice(0)
for (j = 0; j < ys.length; j++) {
if (xs[i] === ys[j]) {
curr[j + 1] = prev[j] + 1
} else {
curr[j + 1] = Math.max(curr[j], prev[j + 1])
}
}
}
return curr
}
|
Finds longest common sequence between two sequences
@see {@link https://wordaligned.org/articles/longest-common-subsequence}
|
lcsLens
|
javascript
|
locutusjs/locutus
|
src/php/xdiff/xdiff_string_diff.js
|
https://github.com/locutusjs/locutus/blob/master/src/php/xdiff/xdiff_string_diff.js
|
MIT
|
_findLcs = function (xs, xidx, xIsIn, ys) {
let i
let xb
let xe
let llB
let llE
let pivot
let max
let yb
let ye
const nx = xs.length
const ny = ys.length
if (nx === 0) {
return []
}
if (nx === 1) {
if (_hasValue(ys, xs[0])) {
xIsIn[xidx] = true
return [xs[0]]
}
return []
}
i = Math.floor(nx / 2)
xb = xs.slice(0, i)
xe = xs.slice(i)
llB = lcsLens(xb, ys)
llE = lcsLens(xe.slice(0).reverse(), ys.slice(0).reverse())
pivot = 0
max = 0
for (j = 0; j <= ny; j++) {
if (llB[j] + llE[ny - j] > max) {
pivot = j
max = llB[j] + llE[ny - j]
}
}
yb = ys.slice(0, pivot)
ye = ys.slice(pivot)
return _findLcs(xb, xidx, xIsIn, yb).concat(_findLcs(xe, xidx + i, xIsIn, ye))
}
|
Finds longest common sequence between two sequences
@see {@link https://wordaligned.org/articles/longest-common-subsequence}
|
_findLcs
|
javascript
|
locutusjs/locutus
|
src/php/xdiff/xdiff_string_diff.js
|
https://github.com/locutusjs/locutus/blob/master/src/php/xdiff/xdiff_string_diff.js
|
MIT
|
_findLcs = function (xs, xidx, xIsIn, ys) {
let i
let xb
let xe
let llB
let llE
let pivot
let max
let yb
let ye
const nx = xs.length
const ny = ys.length
if (nx === 0) {
return []
}
if (nx === 1) {
if (_hasValue(ys, xs[0])) {
xIsIn[xidx] = true
return [xs[0]]
}
return []
}
i = Math.floor(nx / 2)
xb = xs.slice(0, i)
xe = xs.slice(i)
llB = lcsLens(xb, ys)
llE = lcsLens(xe.slice(0).reverse(), ys.slice(0).reverse())
pivot = 0
max = 0
for (j = 0; j <= ny; j++) {
if (llB[j] + llE[ny - j] > max) {
pivot = j
max = llB[j] + llE[ny - j]
}
}
yb = ys.slice(0, pivot)
ye = ys.slice(pivot)
return _findLcs(xb, xidx, xIsIn, yb).concat(_findLcs(xe, xidx + i, xIsIn, ye))
}
|
Finds longest common sequence between two sequences
@see {@link https://wordaligned.org/articles/longest-common-subsequence}
|
_findLcs
|
javascript
|
locutusjs/locutus
|
src/php/xdiff/xdiff_string_diff.js
|
https://github.com/locutusjs/locutus/blob/master/src/php/xdiff/xdiff_string_diff.js
|
MIT
|
regularizeLeadingContext = function (context) {
if (context.length === 0 || contextLines === 0) {
return []
}
const contextStartPos = Math.max(context.length - contextLines, 0)
return context.slice(contextStartPos)
}
|
Finds longest common sequence between two sequences
@see {@link https://wordaligned.org/articles/longest-common-subsequence}
|
regularizeLeadingContext
|
javascript
|
locutusjs/locutus
|
src/php/xdiff/xdiff_string_diff.js
|
https://github.com/locutusjs/locutus/blob/master/src/php/xdiff/xdiff_string_diff.js
|
MIT
|
regularizeLeadingContext = function (context) {
if (context.length === 0 || contextLines === 0) {
return []
}
const contextStartPos = Math.max(context.length - contextLines, 0)
return context.slice(contextStartPos)
}
|
Finds longest common sequence between two sequences
@see {@link https://wordaligned.org/articles/longest-common-subsequence}
|
regularizeLeadingContext
|
javascript
|
locutusjs/locutus
|
src/php/xdiff/xdiff_string_diff.js
|
https://github.com/locutusjs/locutus/blob/master/src/php/xdiff/xdiff_string_diff.js
|
MIT
|
regularizeTrailingContext = function (context) {
if (context.length === 0 || contextLines === 0) {
return []
}
return context.slice(0, Math.min(contextLines, context.length))
}
|
Finds longest common sequence between two sequences
@see {@link https://wordaligned.org/articles/longest-common-subsequence}
|
regularizeTrailingContext
|
javascript
|
locutusjs/locutus
|
src/php/xdiff/xdiff_string_diff.js
|
https://github.com/locutusjs/locutus/blob/master/src/php/xdiff/xdiff_string_diff.js
|
MIT
|
regularizeTrailingContext = function (context) {
if (context.length === 0 || contextLines === 0) {
return []
}
return context.slice(0, Math.min(contextLines, context.length))
}
|
Finds longest common sequence between two sequences
@see {@link https://wordaligned.org/articles/longest-common-subsequence}
|
regularizeTrailingContext
|
javascript
|
locutusjs/locutus
|
src/php/xdiff/xdiff_string_diff.js
|
https://github.com/locutusjs/locutus/blob/master/src/php/xdiff/xdiff_string_diff.js
|
MIT
|
function trim (str) {
return str.trim().replace(/^"(.*)"$/, '$1').replace(/^'(.*)'$/, '$1');
}
|
Meta Helper
@description Generate meta tags for HTML header
@example
<%- meta(post) %>
|
trim
|
javascript
|
locutusjs/locutus
|
website/themes/icarus/scripts/meta.js
|
https://github.com/locutusjs/locutus/blob/master/website/themes/icarus/scripts/meta.js
|
MIT
|
function split (str, sep) {
var result = [];
var matched = null;
while (matched = sep.exec(str)) {
result.push(matched[0]);
}
return result;
}
|
Meta Helper
@description Generate meta tags for HTML header
@example
<%- meta(post) %>
|
split
|
javascript
|
locutusjs/locutus
|
website/themes/icarus/scripts/meta.js
|
https://github.com/locutusjs/locutus/blob/master/website/themes/icarus/scripts/meta.js
|
MIT
|
function section(title) {
return $('<section>').addClass('ins-section').append($('<header>').addClass('ins-section-header').text(title))
}
|
Insight search plugin
@author PPOffice { @link https://github.com/ppoffice }
|
section
|
javascript
|
locutusjs/locutus
|
website/themes/icarus/source/js/insight.js
|
https://github.com/locutusjs/locutus/blob/master/website/themes/icarus/source/js/insight.js
|
MIT
|
function searchItem(icon, title, slug, preview, url) {
return $('<div>')
.addClass('ins-selectable')
.addClass('ins-search-item')
.append(
$('<header>')
.append(
$('<i>')
.addClass('fa')
.addClass('fa-' + icon),
)
.append(title != null && title != '' ? title : CONFIG.TRANSLATION['UNTITLED'])
.append(slug ? $('<span>').addClass('ins-slug').text(slug) : null),
)
.append(preview ? $('<p>').addClass('ins-search-preview').text(preview) : null)
.attr('data-url', url)
}
|
Insight search plugin
@author PPOffice { @link https://github.com/ppoffice }
|
searchItem
|
javascript
|
locutusjs/locutus
|
website/themes/icarus/source/js/insight.js
|
https://github.com/locutusjs/locutus/blob/master/website/themes/icarus/source/js/insight.js
|
MIT
|
function sectionFactory(type, array) {
var sectionTitle
var $searchItems
if (array.length === 0) return null
sectionTitle = CONFIG.TRANSLATION[type]
switch (type) {
case 'POSTS':
case 'PAGES':
$searchItems = array.map(function (item) {
// Use config.root instead of permalink to fix url issue
return searchItem('file', item.title, null, item.text.slice(0, 150), CONFIG.ROOT_URL + item.path)
})
break
case 'CATEGORIES':
case 'TAGS':
$searchItems = array.map(function (item) {
return searchItem(type === 'CATEGORIES' ? 'folder' : 'tag', item.name, item.slug, null, item.permalink)
})
break
default:
return null
}
return section(sectionTitle).append($searchItems)
}
|
Insight search plugin
@author PPOffice { @link https://github.com/ppoffice }
|
sectionFactory
|
javascript
|
locutusjs/locutus
|
website/themes/icarus/source/js/insight.js
|
https://github.com/locutusjs/locutus/blob/master/website/themes/icarus/source/js/insight.js
|
MIT
|
function extractToSet(json, key) {
var values = {}
var entries = json.pages.concat(json.posts)
entries.forEach(function (entry) {
if (entry[key]) {
entry[key].forEach(function (value) {
values[value.name] = value
})
}
})
var result = []
for (var key in values) {
result.push(values[key])
}
return result
}
|
Insight search plugin
@author PPOffice { @link https://github.com/ppoffice }
|
extractToSet
|
javascript
|
locutusjs/locutus
|
website/themes/icarus/source/js/insight.js
|
https://github.com/locutusjs/locutus/blob/master/website/themes/icarus/source/js/insight.js
|
MIT
|
function parseKeywords(keywords) {
return keywords
.split(' ')
.filter(function (keyword) {
return !!keyword
})
.map(function (keyword) {
return keyword.toUpperCase()
})
}
|
Insight search plugin
@author PPOffice { @link https://github.com/ppoffice }
|
parseKeywords
|
javascript
|
locutusjs/locutus
|
website/themes/icarus/source/js/insight.js
|
https://github.com/locutusjs/locutus/blob/master/website/themes/icarus/source/js/insight.js
|
MIT
|
function filter(keywords, obj, fields) {
var result = false
var keywordArray = parseKeywords(keywords)
var containKeywords = keywordArray.filter(function (keyword) {
var containFields = fields.filter(function (field) {
if (!obj.hasOwnProperty(field)) return false
if (obj[field].toUpperCase().indexOf(keyword) > -1) return true
})
if (containFields.length > 0) return true
return false
})
return containKeywords.length === keywordArray.length
}
|
Judge if a given post/page/category/tag contains all of the keywords.
@param Object obj Object to be weighted
@param Array<String> fields Object's fields to find matches
|
filter
|
javascript
|
locutusjs/locutus
|
website/themes/icarus/source/js/insight.js
|
https://github.com/locutusjs/locutus/blob/master/website/themes/icarus/source/js/insight.js
|
MIT
|
function filterFactory(keywords) {
return {
POST: function (obj) {
return filter(keywords, obj, ['title', 'text'])
},
PAGE: function (obj) {
return filter(keywords, obj, ['title', 'text'])
},
CATEGORY: function (obj) {
return filter(keywords, obj, ['name', 'slug'])
},
TAG: function (obj) {
return filter(keywords, obj, ['name', 'slug'])
},
}
}
|
Judge if a given post/page/category/tag contains all of the keywords.
@param Object obj Object to be weighted
@param Array<String> fields Object's fields to find matches
|
filterFactory
|
javascript
|
locutusjs/locutus
|
website/themes/icarus/source/js/insight.js
|
https://github.com/locutusjs/locutus/blob/master/website/themes/icarus/source/js/insight.js
|
MIT
|
function weight(keywords, obj, fields, weights) {
var value = 0
parseKeywords(keywords).forEach(function (keyword) {
var pattern = new RegExp(keyword, 'img') // Global, Multi-line, Case-insensitive
fields.forEach(function (field, index) {
if (obj.hasOwnProperty(field)) {
var matches = obj[field].match(pattern)
value += matches ? matches.length * weights[index] : 0
}
})
})
return value
}
|
Calculate the weight of a matched post/page/category/tag.
@param Object obj Object to be weighted
@param Array<String> fields Object's fields to find matches
@param Array<Integer> weights Weight of every field
|
weight
|
javascript
|
locutusjs/locutus
|
website/themes/icarus/source/js/insight.js
|
https://github.com/locutusjs/locutus/blob/master/website/themes/icarus/source/js/insight.js
|
MIT
|
function weightFactory(keywords) {
return {
POST: function (obj) {
return weight(keywords, obj, ['title', 'text'], [3, 1])
},
PAGE: function (obj) {
return weight(keywords, obj, ['title', 'text'], [3, 1])
},
CATEGORY: function (obj) {
return weight(keywords, obj, ['name', 'slug'], [1, 1])
},
TAG: function (obj) {
return weight(keywords, obj, ['name', 'slug'], [1, 1])
},
}
}
|
Calculate the weight of a matched post/page/category/tag.
@param Object obj Object to be weighted
@param Array<String> fields Object's fields to find matches
@param Array<Integer> weights Weight of every field
|
weightFactory
|
javascript
|
locutusjs/locutus
|
website/themes/icarus/source/js/insight.js
|
https://github.com/locutusjs/locutus/blob/master/website/themes/icarus/source/js/insight.js
|
MIT
|
function search(json, keywords) {
var WEIGHTS = weightFactory(keywords)
var FILTERS = filterFactory(keywords)
var posts = json.posts
var pages = json.pages
var tags = extractToSet(json, 'tags')
var categories = extractToSet(json, 'categories')
return {
posts: posts
.filter(FILTERS.POST)
.sort(function (a, b) {
return WEIGHTS.POST(b) - WEIGHTS.POST(a)
})
.slice(0, 5),
pages: pages
.filter(FILTERS.PAGE)
.sort(function (a, b) {
return WEIGHTS.PAGE(b) - WEIGHTS.PAGE(a)
})
.slice(0, 5),
categories: categories
.filter(FILTERS.CATEGORY)
.sort(function (a, b) {
return WEIGHTS.CATEGORY(b) - WEIGHTS.CATEGORY(a)
})
.slice(0, 5),
tags: tags
.filter(FILTERS.TAG)
.sort(function (a, b) {
return WEIGHTS.TAG(b) - WEIGHTS.TAG(a)
})
.slice(0, 5),
}
}
|
Calculate the weight of a matched post/page/category/tag.
@param Object obj Object to be weighted
@param Array<String> fields Object's fields to find matches
@param Array<Integer> weights Weight of every field
|
search
|
javascript
|
locutusjs/locutus
|
website/themes/icarus/source/js/insight.js
|
https://github.com/locutusjs/locutus/blob/master/website/themes/icarus/source/js/insight.js
|
MIT
|
function searchResultToDOM(searchResult) {
$container.empty()
for (var key in searchResult) {
$container.append(sectionFactory(key.toUpperCase(), searchResult[key]))
}
}
|
Calculate the weight of a matched post/page/category/tag.
@param Object obj Object to be weighted
@param Array<String> fields Object's fields to find matches
@param Array<Integer> weights Weight of every field
|
searchResultToDOM
|
javascript
|
locutusjs/locutus
|
website/themes/icarus/source/js/insight.js
|
https://github.com/locutusjs/locutus/blob/master/website/themes/icarus/source/js/insight.js
|
MIT
|
function scrollTo($item) {
if ($item.length === 0) return
var wrapperHeight = $wrapper[0].clientHeight
var itemTop = $item.position().top - $wrapper.scrollTop()
var itemBottom = $item[0].clientHeight + $item.position().top
if (itemBottom > wrapperHeight + $wrapper.scrollTop()) {
$wrapper.scrollTop(itemBottom - $wrapper[0].clientHeight)
}
if (itemTop < 0) {
$wrapper.scrollTop($item.position().top)
}
}
|
Calculate the weight of a matched post/page/category/tag.
@param Object obj Object to be weighted
@param Array<String> fields Object's fields to find matches
@param Array<Integer> weights Weight of every field
|
scrollTo
|
javascript
|
locutusjs/locutus
|
website/themes/icarus/source/js/insight.js
|
https://github.com/locutusjs/locutus/blob/master/website/themes/icarus/source/js/insight.js
|
MIT
|
function selectItemByDiff(value) {
var $items = $.makeArray($container.find('.ins-selectable'))
var prevPosition = -1
$items.forEach(function (item, index) {
if ($(item).hasClass('active')) {
prevPosition = index
return
}
})
var nextPosition = ($items.length + prevPosition + value) % $items.length
$($items[prevPosition]).removeClass('active')
$($items[nextPosition]).addClass('active')
scrollTo($($items[nextPosition]))
}
|
Calculate the weight of a matched post/page/category/tag.
@param Object obj Object to be weighted
@param Array<String> fields Object's fields to find matches
@param Array<Integer> weights Weight of every field
|
selectItemByDiff
|
javascript
|
locutusjs/locutus
|
website/themes/icarus/source/js/insight.js
|
https://github.com/locutusjs/locutus/blob/master/website/themes/icarus/source/js/insight.js
|
MIT
|
function gotoLink($item) {
if ($item && $item.length) {
location.href = $item.attr('data-url')
}
}
|
Calculate the weight of a matched post/page/category/tag.
@param Object obj Object to be weighted
@param Array<String> fields Object's fields to find matches
@param Array<Integer> weights Weight of every field
|
gotoLink
|
javascript
|
locutusjs/locutus
|
website/themes/icarus/source/js/insight.js
|
https://github.com/locutusjs/locutus/blob/master/website/themes/icarus/source/js/insight.js
|
MIT
|
function shutdownWorkers (signal) {
return new Promise((resolve) => {
if (!cluster.isMaster) { return resolve() }
const wIds = Object.keys(cluster.workers)
if (wIds.length === 0) { return resolve() }
// Filter all the valid workers
const workers = wIds.map(id => cluster.workers[id]).filter(v => v)
let workersAlive = 0
let funcRun = 0
// Count the number of alive workers and keep looping until the number is zero.
const fn = () => {
++funcRun
workersAlive = 0
workers.forEach(worker => {
if (!worker.isDead()) {
++workersAlive
if (funcRun === 1) {
// On the first execution of the function, send the received signal to all the workers
// https://github.com/nodejs/node-v0.x-archive/issues/6042#issuecomment-168677045
worker.process.kill(signal)
}
}
})
console.log(workersAlive + ' workers alive')
if (workersAlive === 0) {
// Clear the interval when all workers are dead
clearInterval(interval)
return resolve()
}
}
const interval = setInterval(fn, 1000)
})
}
|
Shutdown all worker processes.
From https://medium.com/@gaurav.lahoti/graceful-shutdown-of-node-js-workers-dd58bbff9e30
@param signal Signal to send to the workers
|
shutdownWorkers
|
javascript
|
godaddy/terminus
|
example/express.cluster.js
|
https://github.com/godaddy/terminus/blob/master/example/express.cluster.js
|
MIT
|
fn = () => {
++funcRun
workersAlive = 0
workers.forEach(worker => {
if (!worker.isDead()) {
++workersAlive
if (funcRun === 1) {
// On the first execution of the function, send the received signal to all the workers
// https://github.com/nodejs/node-v0.x-archive/issues/6042#issuecomment-168677045
worker.process.kill(signal)
}
}
})
console.log(workersAlive + ' workers alive')
if (workersAlive === 0) {
// Clear the interval when all workers are dead
clearInterval(interval)
return resolve()
}
}
|
Shutdown all worker processes.
From https://medium.com/@gaurav.lahoti/graceful-shutdown-of-node-js-workers-dd58bbff9e30
@param signal Signal to send to the workers
|
fn
|
javascript
|
godaddy/terminus
|
example/express.cluster.js
|
https://github.com/godaddy/terminus/blob/master/example/express.cluster.js
|
MIT
|
fn = () => {
++funcRun
workersAlive = 0
workers.forEach(worker => {
if (!worker.isDead()) {
++workersAlive
if (funcRun === 1) {
// On the first execution of the function, send the received signal to all the workers
// https://github.com/nodejs/node-v0.x-archive/issues/6042#issuecomment-168677045
worker.process.kill(signal)
}
}
})
console.log(workersAlive + ' workers alive')
if (workersAlive === 0) {
// Clear the interval when all workers are dead
clearInterval(interval)
return resolve()
}
}
|
Shutdown all worker processes.
From https://medium.com/@gaurav.lahoti/graceful-shutdown-of-node-js-workers-dd58bbff9e30
@param signal Signal to send to the workers
|
fn
|
javascript
|
godaddy/terminus
|
example/express.cluster.js
|
https://github.com/godaddy/terminus/blob/master/example/express.cluster.js
|
MIT
|
function markFunction( fn ) {
fn[ expando ] = true;
return fn;
}
|
Mark a function for special use by Sizzle
@param {Function} fn The function to mark
|
markFunction
|
javascript
|
twbs/bootlint
|
dist/browser/bootlint.js
|
https://github.com/twbs/bootlint/blob/master/dist/browser/bootlint.js
|
MIT
|
function assert( fn ) {
var el = document.createElement( "fieldset" );
try {
return !!fn( el );
} catch ( e ) {
return false;
} finally {
// Remove from its parent by default
if ( el.parentNode ) {
el.parentNode.removeChild( el );
}
// release memory in IE
el = null;
}
}
|
Support testing using an element
@param {Function} fn Passed the created element and returns a boolean result
|
assert
|
javascript
|
twbs/bootlint
|
dist/browser/bootlint.js
|
https://github.com/twbs/bootlint/blob/master/dist/browser/bootlint.js
|
MIT
|
function addHandle( attrs, handler ) {
var arr = attrs.split( "|" ),
i = arr.length;
while ( i-- ) {
Expr.attrHandle[ arr[ i ] ] = handler;
}
}
|
Adds the same handler for all of the specified attrs
@param {String} attrs Pipe-separated list of attributes
@param {Function} handler The method that will be applied
|
addHandle
|
javascript
|
twbs/bootlint
|
dist/browser/bootlint.js
|
https://github.com/twbs/bootlint/blob/master/dist/browser/bootlint.js
|
MIT
|
function siblingCheck( a, b ) {
var cur = b && a,
diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
a.sourceIndex - b.sourceIndex;
// Use IE sourceIndex if available on both nodes
if ( diff ) {
return diff;
}
// Check if b follows a
if ( cur ) {
while ( ( cur = cur.nextSibling ) ) {
if ( cur === b ) {
return -1;
}
}
}
return a ? 1 : -1;
}
|
Checks document order of two siblings
@param {Element} a
@param {Element} b
@returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
|
siblingCheck
|
javascript
|
twbs/bootlint
|
dist/browser/bootlint.js
|
https://github.com/twbs/bootlint/blob/master/dist/browser/bootlint.js
|
MIT
|
function createInputPseudo( type ) {
return function( elem ) {
var name = elem.nodeName.toLowerCase();
return name === "input" && elem.type === type;
};
}
|
Returns a function to use in pseudos for input types
@param {String} type
|
createInputPseudo
|
javascript
|
twbs/bootlint
|
dist/browser/bootlint.js
|
https://github.com/twbs/bootlint/blob/master/dist/browser/bootlint.js
|
MIT
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.