Updated samples to RC1
This commit is contained in:
Родитель
8e41fbd4be
Коммит
0a7a19743e
|
@ -50,11 +50,11 @@
|
|||
<Content Include="index.html" />
|
||||
<Content Include="noproxy.html" />
|
||||
<Content Include="packages.config" />
|
||||
<None Include="Scripts\jquery-1.8.2.intellisense.js" />
|
||||
<Content Include="Scripts\jquery-1.8.2.js" />
|
||||
<Content Include="Scripts\jquery-1.8.2.min.js" />
|
||||
<Content Include="Scripts\jquery.signalR-1.0.0-alpha2.js" />
|
||||
<Content Include="Scripts\jquery.signalR-1.0.0-alpha2.min.js" />
|
||||
<None Include="Scripts\jquery-1.8.3.intellisense.js" />
|
||||
<Content Include="Scripts\jquery-1.8.3.js" />
|
||||
<Content Include="Scripts\jquery-1.8.3.min.js" />
|
||||
<Content Include="Scripts\jquery.signalR-1.0.0-rc1.js" />
|
||||
<Content Include="Scripts\jquery.signalR-1.0.0-rc1.min.js" />
|
||||
<Content Include="Web.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -1,5 +1,5 @@
|
|||
/*!
|
||||
* jQuery JavaScript Library v1.8.2
|
||||
* jQuery JavaScript Library v1.8.3
|
||||
* http://jquery.com/
|
||||
*
|
||||
* Includes Sizzle.js
|
||||
|
@ -9,7 +9,7 @@
|
|||
* Released under the MIT license
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* Date: Thu Sep 20 2012 21:13:05 GMT-0400 (Eastern Daylight Time)
|
||||
* Date: Tue Nov 13 2012 08:20:33 GMT-0500 (Eastern Standard Time)
|
||||
*/
|
||||
(function( window, undefined ) {
|
||||
var
|
||||
|
@ -186,7 +186,7 @@ jQuery.fn = jQuery.prototype = {
|
|||
selector: "",
|
||||
|
||||
// The current version of jQuery being used
|
||||
jquery: "1.8.2",
|
||||
jquery: "1.8.3",
|
||||
|
||||
// The default length of a jQuery object is 0
|
||||
length: 0,
|
||||
|
@ -999,8 +999,10 @@ jQuery.Callbacks = function( options ) {
|
|||
(function add( args ) {
|
||||
jQuery.each( args, function( _, arg ) {
|
||||
var type = jQuery.type( arg );
|
||||
if ( type === "function" && ( !options.unique || !self.has( arg ) ) ) {
|
||||
list.push( arg );
|
||||
if ( type === "function" ) {
|
||||
if ( !options.unique || !self.has( arg ) ) {
|
||||
list.push( arg );
|
||||
}
|
||||
} else if ( arg && arg.length && type !== "string" ) {
|
||||
// Inspect recursively
|
||||
add( arg );
|
||||
|
@ -1253,24 +1255,23 @@ jQuery.support = (function() {
|
|||
clickFn,
|
||||
div = document.createElement("div");
|
||||
|
||||
// Preliminary tests
|
||||
// Setup
|
||||
div.setAttribute( "className", "t" );
|
||||
div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
|
||||
|
||||
// Support tests won't run in some limited or non-browser environments
|
||||
all = div.getElementsByTagName("*");
|
||||
a = div.getElementsByTagName("a")[ 0 ];
|
||||
a.style.cssText = "top:1px;float:left;opacity:.5";
|
||||
|
||||
// Can't get basic test support
|
||||
if ( !all || !all.length ) {
|
||||
if ( !all || !a || !all.length ) {
|
||||
return {};
|
||||
}
|
||||
|
||||
// First batch of supports tests
|
||||
// First batch of tests
|
||||
select = document.createElement("select");
|
||||
opt = select.appendChild( document.createElement("option") );
|
||||
input = div.getElementsByTagName("input")[ 0 ];
|
||||
|
||||
a.style.cssText = "top:1px;float:left;opacity:.5";
|
||||
support = {
|
||||
// IE strips leading whitespace when .innerHTML is used
|
||||
leadingWhitespace: ( div.firstChild.nodeType === 3 ),
|
||||
|
@ -1312,7 +1313,7 @@ jQuery.support = (function() {
|
|||
// Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
|
||||
getSetAttribute: div.className !== "t",
|
||||
|
||||
// Tests for enctype support on a form(#6743)
|
||||
// Tests for enctype support on a form (#6743)
|
||||
enctype: !!document.createElement("form").enctype,
|
||||
|
||||
// Makes sure cloning an html5 element does not cause problems
|
||||
|
@ -2217,26 +2218,25 @@ jQuery.extend({
|
|||
},
|
||||
select: {
|
||||
get: function( elem ) {
|
||||
var value, i, max, option,
|
||||
index = elem.selectedIndex,
|
||||
values = [],
|
||||
var value, option,
|
||||
options = elem.options,
|
||||
one = elem.type === "select-one";
|
||||
|
||||
// Nothing was selected
|
||||
if ( index < 0 ) {
|
||||
return null;
|
||||
}
|
||||
index = elem.selectedIndex,
|
||||
one = elem.type === "select-one" || index < 0,
|
||||
values = one ? null : [],
|
||||
max = one ? index + 1 : options.length,
|
||||
i = index < 0 ?
|
||||
max :
|
||||
one ? index : 0;
|
||||
|
||||
// Loop through all the selected options
|
||||
i = one ? index : 0;
|
||||
max = one ? index + 1 : options.length;
|
||||
for ( ; i < max; i++ ) {
|
||||
option = options[ i ];
|
||||
|
||||
// Don't return options that are disabled or in a disabled optgroup
|
||||
if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) &&
|
||||
(!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) {
|
||||
// oldIE doesn't update selected after form reset (#2551)
|
||||
if ( ( option.selected || i === index ) &&
|
||||
// Don't return options that are disabled or in a disabled optgroup
|
||||
( jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) &&
|
||||
( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
|
||||
|
||||
// Get the specific value for the option
|
||||
value = jQuery( option ).val();
|
||||
|
@ -2251,11 +2251,6 @@ jQuery.extend({
|
|||
}
|
||||
}
|
||||
|
||||
// Fixes Bug #2551 -- select.val() broken in IE after form.reset()
|
||||
if ( one && !values.length && options.length ) {
|
||||
return jQuery( options[ index ] ).val();
|
||||
}
|
||||
|
||||
return values;
|
||||
},
|
||||
|
||||
|
@ -3233,7 +3228,7 @@ jQuery.removeEvent = document.removeEventListener ?
|
|||
|
||||
if ( elem.detachEvent ) {
|
||||
|
||||
// #8545, #7054, preventing memory leaks for custom events in IE6-8 –
|
||||
// #8545, #7054, preventing memory leaks for custom events in IE6-8
|
||||
// detachEvent needed property on element, by name of that event, to properly expose it to GC
|
||||
if ( typeof elem[ name ] === "undefined" ) {
|
||||
elem[ name ] = null;
|
||||
|
@ -3725,7 +3720,8 @@ var cachedruns,
|
|||
delete cache[ keys.shift() ];
|
||||
}
|
||||
|
||||
return (cache[ key ] = value);
|
||||
// Retrieve with (key + " ") to avoid collision with native Object.prototype properties (see Issue #157)
|
||||
return (cache[ key + " " ] = value);
|
||||
}, cache );
|
||||
},
|
||||
|
||||
|
@ -4259,13 +4255,13 @@ Expr = Sizzle.selectors = {
|
|||
},
|
||||
|
||||
"CLASS": function( className ) {
|
||||
var pattern = classCache[ expando ][ className ];
|
||||
if ( !pattern ) {
|
||||
pattern = classCache( className, new RegExp("(^|" + whitespace + ")" + className + "(" + whitespace + "|$)") );
|
||||
}
|
||||
return function( elem ) {
|
||||
return pattern.test( elem.className || (typeof elem.getAttribute !== strundefined && elem.getAttribute("class")) || "" );
|
||||
};
|
||||
var pattern = classCache[ expando ][ className + " " ];
|
||||
|
||||
return pattern ||
|
||||
(pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
|
||||
classCache( className, function( elem ) {
|
||||
return pattern.test( elem.className || (typeof elem.getAttribute !== strundefined && elem.getAttribute("class")) || "" );
|
||||
});
|
||||
},
|
||||
|
||||
"ATTR": function( name, operator, check ) {
|
||||
|
@ -4511,7 +4507,7 @@ Expr = Sizzle.selectors = {
|
|||
|
||||
"focus": function( elem ) {
|
||||
var doc = elem.ownerDocument;
|
||||
return elem === doc.activeElement && (!doc.hasFocus || doc.hasFocus()) && !!(elem.type || elem.href);
|
||||
return elem === doc.activeElement && (!doc.hasFocus || doc.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
|
||||
},
|
||||
|
||||
"active": function( elem ) {
|
||||
|
@ -4519,11 +4515,11 @@ Expr = Sizzle.selectors = {
|
|||
},
|
||||
|
||||
// Positional types
|
||||
"first": createPositionalPseudo(function( matchIndexes, length, argument ) {
|
||||
"first": createPositionalPseudo(function() {
|
||||
return [ 0 ];
|
||||
}),
|
||||
|
||||
"last": createPositionalPseudo(function( matchIndexes, length, argument ) {
|
||||
"last": createPositionalPseudo(function( matchIndexes, length ) {
|
||||
return [ length - 1 ];
|
||||
}),
|
||||
|
||||
|
@ -4531,14 +4527,14 @@ Expr = Sizzle.selectors = {
|
|||
return [ argument < 0 ? argument + length : argument ];
|
||||
}),
|
||||
|
||||
"even": createPositionalPseudo(function( matchIndexes, length, argument ) {
|
||||
"even": createPositionalPseudo(function( matchIndexes, length ) {
|
||||
for ( var i = 0; i < length; i += 2 ) {
|
||||
matchIndexes.push( i );
|
||||
}
|
||||
return matchIndexes;
|
||||
}),
|
||||
|
||||
"odd": createPositionalPseudo(function( matchIndexes, length, argument ) {
|
||||
"odd": createPositionalPseudo(function( matchIndexes, length ) {
|
||||
for ( var i = 1; i < length; i += 2 ) {
|
||||
matchIndexes.push( i );
|
||||
}
|
||||
|
@ -4659,7 +4655,9 @@ baseHasDuplicate = !hasDuplicate;
|
|||
// Document sorting and removing duplicates
|
||||
Sizzle.uniqueSort = function( results ) {
|
||||
var elem,
|
||||
i = 1;
|
||||
duplicates = [],
|
||||
i = 1,
|
||||
j = 0;
|
||||
|
||||
hasDuplicate = baseHasDuplicate;
|
||||
results.sort( sortOrder );
|
||||
|
@ -4667,9 +4665,12 @@ Sizzle.uniqueSort = function( results ) {
|
|||
if ( hasDuplicate ) {
|
||||
for ( ; (elem = results[i]); i++ ) {
|
||||
if ( elem === results[ i - 1 ] ) {
|
||||
results.splice( i--, 1 );
|
||||
j = duplicates.push( i );
|
||||
}
|
||||
}
|
||||
while ( j-- ) {
|
||||
results.splice( duplicates[ j ], 1 );
|
||||
}
|
||||
}
|
||||
|
||||
return results;
|
||||
|
@ -4680,8 +4681,9 @@ Sizzle.error = function( msg ) {
|
|||
};
|
||||
|
||||
function tokenize( selector, parseOnly ) {
|
||||
var matched, match, tokens, type, soFar, groups, preFilters,
|
||||
cached = tokenCache[ expando ][ selector ];
|
||||
var matched, match, tokens, type,
|
||||
soFar, groups, preFilters,
|
||||
cached = tokenCache[ expando ][ selector + " " ];
|
||||
|
||||
if ( cached ) {
|
||||
return parseOnly ? 0 : cached.slice( 0 );
|
||||
|
@ -4696,7 +4698,8 @@ function tokenize( selector, parseOnly ) {
|
|||
// Comma and first run
|
||||
if ( !matched || (match = rcomma.exec( soFar )) ) {
|
||||
if ( match ) {
|
||||
soFar = soFar.slice( match[0].length );
|
||||
// Don't consume trailing commas as valid
|
||||
soFar = soFar.slice( match[0].length ) || soFar;
|
||||
}
|
||||
groups.push( tokens = [] );
|
||||
}
|
||||
|
@ -4715,8 +4718,7 @@ function tokenize( selector, parseOnly ) {
|
|||
// Filters
|
||||
for ( type in Expr.filter ) {
|
||||
if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
|
||||
// The last two arguments here are (context, xml) for backCompat
|
||||
(match = preFilters[ type ]( match, document, true ))) ) {
|
||||
(match = preFilters[ type ]( match ))) ) {
|
||||
|
||||
tokens.push( matched = new Token( match.shift() ) );
|
||||
soFar = soFar.slice( matched.length );
|
||||
|
@ -4836,18 +4838,13 @@ function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postS
|
|||
postFinder = setMatcher( postFinder, postSelector );
|
||||
}
|
||||
return markFunction(function( seed, results, context, xml ) {
|
||||
// Positional selectors apply to seed elements, so it is invalid to follow them with relative ones
|
||||
if ( seed && postFinder ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var i, elem, postFilterIn,
|
||||
var temp, i, elem,
|
||||
preMap = [],
|
||||
postMap = [],
|
||||
preexisting = results.length,
|
||||
|
||||
// Get initial elements from seed or context
|
||||
elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [], seed ),
|
||||
elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
|
||||
|
||||
// Prefilter to get matcher input, preserving a map for seed-results synchronization
|
||||
matcherIn = preFilter && ( seed || !selector ) ?
|
||||
|
@ -4872,27 +4869,45 @@ function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postS
|
|||
|
||||
// Apply postFilter
|
||||
if ( postFilter ) {
|
||||
postFilterIn = condense( matcherOut, postMap );
|
||||
postFilter( postFilterIn, [], context, xml );
|
||||
temp = condense( matcherOut, postMap );
|
||||
postFilter( temp, [], context, xml );
|
||||
|
||||
// Un-match failing elements by moving them back to matcherIn
|
||||
i = postFilterIn.length;
|
||||
i = temp.length;
|
||||
while ( i-- ) {
|
||||
if ( (elem = postFilterIn[i]) ) {
|
||||
if ( (elem = temp[i]) ) {
|
||||
matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Keep seed and results synchronized
|
||||
if ( seed ) {
|
||||
// Ignore postFinder because it can't coexist with seed
|
||||
i = preFilter && matcherOut.length;
|
||||
while ( i-- ) {
|
||||
if ( (elem = matcherOut[i]) ) {
|
||||
seed[ preMap[i] ] = !(results[ preMap[i] ] = elem);
|
||||
if ( postFinder || preFilter ) {
|
||||
if ( postFinder ) {
|
||||
// Get the final matcherOut by condensing this intermediate into postFinder contexts
|
||||
temp = [];
|
||||
i = matcherOut.length;
|
||||
while ( i-- ) {
|
||||
if ( (elem = matcherOut[i]) ) {
|
||||
// Restore matcherIn since elem is not yet a final match
|
||||
temp.push( (matcherIn[i] = elem) );
|
||||
}
|
||||
}
|
||||
postFinder( null, (matcherOut = []), temp, xml );
|
||||
}
|
||||
|
||||
// Move matched elements from seed to results to keep them synchronized
|
||||
i = matcherOut.length;
|
||||
while ( i-- ) {
|
||||
if ( (elem = matcherOut[i]) &&
|
||||
(temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) {
|
||||
|
||||
seed[temp] = !(results[temp] = elem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add elements to results, through postFinder if defined
|
||||
} else {
|
||||
matcherOut = condense(
|
||||
matcherOut === results ?
|
||||
|
@ -4933,7 +4948,6 @@ function matcherFromTokens( tokens ) {
|
|||
if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
|
||||
matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ];
|
||||
} else {
|
||||
// The concatenated values are (context, xml) for backCompat
|
||||
matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
|
||||
|
||||
// Return special upon seeing a positional matcher
|
||||
|
@ -5062,7 +5076,7 @@ compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) {
|
|||
var i,
|
||||
setMatchers = [],
|
||||
elementMatchers = [],
|
||||
cached = compilerCache[ expando ][ selector ];
|
||||
cached = compilerCache[ expando ][ selector + " " ];
|
||||
|
||||
if ( !cached ) {
|
||||
// Generate a function of recursive functions that can be used to check each element
|
||||
|
@ -5085,11 +5099,11 @@ compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) {
|
|||
return cached;
|
||||
};
|
||||
|
||||
function multipleContexts( selector, contexts, results, seed ) {
|
||||
function multipleContexts( selector, contexts, results ) {
|
||||
var i = 0,
|
||||
len = contexts.length;
|
||||
for ( ; i < len; i++ ) {
|
||||
Sizzle( selector, contexts[i], results, seed );
|
||||
Sizzle( selector, contexts[i], results );
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
@ -5167,15 +5181,14 @@ if ( document.querySelectorAll ) {
|
|||
rescape = /'|\\/g,
|
||||
rattributeQuotes = /\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,
|
||||
|
||||
// qSa(:focus) reports false when true (Chrome 21),
|
||||
// qSa(:focus) reports false when true (Chrome 21), no need to also add to buggyMatches since matches checks buggyQSA
|
||||
// A support test would require too much code (would include document ready)
|
||||
rbuggyQSA = [":focus"],
|
||||
rbuggyQSA = [ ":focus" ],
|
||||
|
||||
// matchesSelector(:focus) reports false when true (Chrome 21),
|
||||
// matchesSelector(:active) reports false when true (IE9/Opera 11.5)
|
||||
// A support test would require too much code (would include document ready)
|
||||
// just skip matchesSelector for :active
|
||||
rbuggyMatches = [ ":active", ":focus" ],
|
||||
rbuggyMatches = [ ":active" ],
|
||||
matches = docElem.matchesSelector ||
|
||||
docElem.mozMatchesSelector ||
|
||||
docElem.webkitMatchesSelector ||
|
||||
|
@ -5229,7 +5242,7 @@ if ( document.querySelectorAll ) {
|
|||
// Only use querySelectorAll when not filtering,
|
||||
// when this is not xml,
|
||||
// and when no QSA bugs apply
|
||||
if ( !seed && !xml && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
|
||||
if ( !seed && !xml && !rbuggyQSA.test( selector ) ) {
|
||||
var groups, i,
|
||||
old = true,
|
||||
nid = expando,
|
||||
|
@ -5298,7 +5311,7 @@ if ( document.querySelectorAll ) {
|
|||
expr = expr.replace( rattributeQuotes, "='$1']" );
|
||||
|
||||
// rbuggyMatches always contains :active, so no need for an existence check
|
||||
if ( !isXML( elem ) && !rbuggyMatches.test( expr ) && (!rbuggyQSA || !rbuggyQSA.test( expr )) ) {
|
||||
if ( !isXML( elem ) && !rbuggyMatches.test( expr ) && !rbuggyQSA.test( expr ) ) {
|
||||
try {
|
||||
var ret = matches.call( elem, expr );
|
||||
|
||||
|
@ -6533,7 +6546,7 @@ var curCSS, iframe, iframeDoc,
|
|||
rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ),
|
||||
rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ),
|
||||
rrelNum = new RegExp( "^([-+])=(" + core_pnum + ")", "i" ),
|
||||
elemdisplay = {},
|
||||
elemdisplay = { BODY: "block" },
|
||||
|
||||
cssShow = { position: "absolute", visibility: "hidden", display: "block" },
|
||||
cssNormalTransform = {
|
||||
|
@ -6814,7 +6827,9 @@ if ( window.getComputedStyle ) {
|
|||
|
||||
if ( computed ) {
|
||||
|
||||
ret = computed[ name ];
|
||||
// getPropertyValue is only needed for .css('filter') in IE9, see #12537
|
||||
ret = computed.getPropertyValue( name ) || computed[ name ];
|
||||
|
||||
if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
|
||||
ret = jQuery.style( elem, name );
|
||||
}
|
||||
|
@ -7843,9 +7858,12 @@ jQuery.extend({
|
|||
|
||||
// A cross-domain request is in order when we have a protocol:host:port mismatch
|
||||
if ( s.crossDomain == null ) {
|
||||
parts = rurl.exec( s.url.toLowerCase() ) || false;
|
||||
s.crossDomain = parts && ( parts.join(":") + ( parts[ 3 ] ? "" : parts[ 1 ] === "http:" ? 80 : 443 ) ) !==
|
||||
( ajaxLocParts.join(":") + ( ajaxLocParts[ 3 ] ? "" : ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) );
|
||||
parts = rurl.exec( s.url.toLowerCase() );
|
||||
s.crossDomain = !!( parts &&
|
||||
( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||
|
||||
( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) !=
|
||||
( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) )
|
||||
);
|
||||
}
|
||||
|
||||
// Convert data if not already a string
|
||||
|
@ -8464,7 +8482,7 @@ if ( jQuery.support.ajax ) {
|
|||
// on any attempt to access responseText (#11426)
|
||||
try {
|
||||
responses.text = xhr.responseText;
|
||||
} catch( _ ) {
|
||||
} catch( e ) {
|
||||
}
|
||||
|
||||
// Firefox throws an exception when accessing
|
||||
|
@ -8617,7 +8635,9 @@ function Animation( elem, properties, options ) {
|
|||
tick = function() {
|
||||
var currentTime = fxNow || createFxNow(),
|
||||
remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
|
||||
percent = 1 - ( remaining / animation.duration || 0 ),
|
||||
// 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;
|
||||
|
||||
|
@ -8769,7 +8789,7 @@ jQuery.Animation = jQuery.extend( Animation, {
|
|||
});
|
||||
|
||||
function defaultPrefilter( elem, props, opts ) {
|
||||
var index, prop, value, length, dataShow, tween, hooks, oldfire,
|
||||
var index, prop, value, length, dataShow, toggle, tween, hooks, oldfire,
|
||||
anim = this,
|
||||
style = elem.style,
|
||||
orig = {},
|
||||
|
@ -8843,6 +8863,7 @@ function defaultPrefilter( elem, props, opts ) {
|
|||
value = props[ index ];
|
||||
if ( rfxtypes.exec( value ) ) {
|
||||
delete props[ index ];
|
||||
toggle = toggle || value === "toggle";
|
||||
if ( value === ( hidden ? "hide" : "show" ) ) {
|
||||
continue;
|
||||
}
|
||||
|
@ -8853,6 +8874,14 @@ function defaultPrefilter( elem, props, opts ) {
|
|||
length = handled.length;
|
||||
if ( length ) {
|
||||
dataShow = jQuery._data( elem, "fxshow" ) || jQuery._data( elem, "fxshow", {} );
|
||||
if ( "hidden" in dataShow ) {
|
||||
hidden = dataShow.hidden;
|
||||
}
|
||||
|
||||
// store state if its toggle - enables .stop().toggle() to "reverse"
|
||||
if ( toggle ) {
|
||||
dataShow.hidden = !hidden;
|
||||
}
|
||||
if ( hidden ) {
|
||||
jQuery( elem ).show();
|
||||
} else {
|
||||
|
@ -9149,6 +9178,8 @@ jQuery.fx.tick = function() {
|
|||
timers = jQuery.timers,
|
||||
i = 0;
|
||||
|
||||
fxNow = jQuery.now();
|
||||
|
||||
for ( ; i < timers.length; i++ ) {
|
||||
timer = timers[ i ];
|
||||
// Checks the timer has not already been removed
|
||||
|
@ -9160,6 +9191,7 @@ jQuery.fx.tick = function() {
|
|||
if ( !timers.length ) {
|
||||
jQuery.fx.stop();
|
||||
}
|
||||
fxNow = undefined;
|
||||
};
|
||||
|
||||
jQuery.fx.timer = function( timer ) {
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -10,7 +10,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/// <reference path="Scripts/jquery-1.6.2.js" />
|
||||
/// <reference path="Scripts/jquery-1.6.4.js" />
|
||||
(function ($, window) {
|
||||
"use strict";
|
||||
|
||||
|
@ -35,6 +35,7 @@
|
|||
onReceived: "onReceived",
|
||||
onError: "onError",
|
||||
onConnectionSlow: "onConnectionSlow",
|
||||
onReconnecting: "onReconnecting",
|
||||
onReconnect: "onReconnect",
|
||||
onStateChanged: "onStateChanged",
|
||||
onDisconnect: "onDisconnect"
|
||||
|
@ -74,6 +75,7 @@
|
|||
changeState = function (connection, expectedState, newState) {
|
||||
if (expectedState === connection.state) {
|
||||
connection.state = newState;
|
||||
|
||||
$(connection).triggerHandler(events.onStateChanged, [{ oldState: expectedState, newState: newState }]);
|
||||
return true;
|
||||
}
|
||||
|
@ -83,6 +85,26 @@
|
|||
|
||||
isDisconnecting = function (connection) {
|
||||
return connection.state === signalR.connectionState.disconnected;
|
||||
},
|
||||
|
||||
configureStopReconnectingTimeout = function (connection) {
|
||||
var stopReconnectingTimeout,
|
||||
onReconnectTimeout = function (connection) {
|
||||
connection.log("Couldn't reconnect within the configured timeout (" + connection.disconnectTimeout + "ms), disconnecting.");
|
||||
connection.stop(/* async */ false, /* notifyServer */ false);
|
||||
};
|
||||
|
||||
connection.reconnecting(function () {
|
||||
var connection = this;
|
||||
stopReconnectingTimeout = window.setTimeout(function () { onReconnectTimeout(connection); }, connection.disconnectTimeout);
|
||||
});
|
||||
|
||||
connection.stateChanged(function (data) {
|
||||
if (data.oldState === signalR.connectionState.reconnecting) {
|
||||
// Clear the pending reconnect timeout check
|
||||
window.clearTimeout(stopReconnectingTimeout);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
signalR = function (url, qs, logging) {
|
||||
|
@ -123,14 +145,42 @@
|
|||
|
||||
_pageWindow.load(function () { _pageLoaded = true; });
|
||||
|
||||
function validateTransport(requestedTransport, connection) {
|
||||
/// <summary>Validates the requested transport by cross checking it with the pre-defined signalR.transports</summary>
|
||||
/// <param name="requestedTransport" type="Object">The designated transports that the user has specified.</param>
|
||||
/// <param name="connection" type="signalR">The connection that will be using the requested transports. Used for logging purposes.</param>
|
||||
/// <returns type="Object" />
|
||||
if ($.isArray(requestedTransport)) {
|
||||
// Go through transport array and remove an "invalid" tranports
|
||||
for (var i = requestedTransport.length - 1; i >= 0; i--) {
|
||||
var transport = requestedTransport[i];
|
||||
if ($.type(requestedTransport) !== "object" && ($.type(transport) !== "string" || !signalR.transports[transport])) {
|
||||
connection.log("Invalid transport: " + transport + ", removing it from the transports list.");
|
||||
requestedTransport.splice(i, 1);
|
||||
}
|
||||
}
|
||||
|
||||
// Verify we still have transports left, if we dont then we have invalid transports
|
||||
if (requestedTransport.length === 0) {
|
||||
connection.log("No transports remain within the specified transport array.");
|
||||
requestedTransport = null;
|
||||
}
|
||||
} else if ($.type(requestedTransport) !== "object" && !signalR.transports[requestedTransport] && requestedTransport !== "auto") {
|
||||
connection.log("Invalid transport: " + requestedTransport.toString());
|
||||
requestedTransport = null;
|
||||
}
|
||||
|
||||
return requestedTransport;
|
||||
}
|
||||
|
||||
signalR.fn = signalR.prototype = {
|
||||
init: function (url, qs, logging) {
|
||||
this.url = url;
|
||||
this.qs = qs;
|
||||
this.keepAliveData = {};
|
||||
if (typeof (logging) === "boolean") {
|
||||
this.logging = logging;
|
||||
}
|
||||
configureStopReconnectingTimeout(this);
|
||||
},
|
||||
|
||||
ajaxDataType: "json",
|
||||
|
@ -139,8 +189,14 @@
|
|||
|
||||
state: signalR.connectionState.disconnected,
|
||||
|
||||
groups: {},
|
||||
|
||||
keepAliveData: {},
|
||||
|
||||
reconnectDelay: 2000,
|
||||
|
||||
disconnectTimeout: 40000, // This should be set by the server in response to the negotiate request (40s default)
|
||||
|
||||
keepAliveTimeoutCount: 2,
|
||||
|
||||
keepAliveWarnAt: 2 / 3, // Warn user of slow connection if we breach the X% mark of the keep alive timeout
|
||||
|
@ -169,6 +225,13 @@
|
|||
}
|
||||
}
|
||||
|
||||
config.transport = validateTransport(config.transport, connection);
|
||||
|
||||
// If the transport is invalid throw an error and abort start
|
||||
if (!config.transport) {
|
||||
throw new Error("SignalR: Invalid transport(s) specified, aborting start.");
|
||||
}
|
||||
|
||||
// Check to see if start is being called prior to page load
|
||||
// If waitForPageLoad is true we then want to re-direct function call to the window load event
|
||||
if (!_pageLoaded && config.waitForPageLoad === true) {
|
||||
|
@ -307,6 +370,11 @@
|
|||
connection.id = res.ConnectionId;
|
||||
connection.webSocketServerUrl = res.WebSocketServerUrl;
|
||||
|
||||
// Once the server has labeled the PersistentConnection as Disconnected, we should stop attempting to reconnect
|
||||
// after res.DisconnectTimeout seconds.
|
||||
connection.disconnectTimeout = res.DisconnectTimeout * 1000; // in ms
|
||||
|
||||
|
||||
// If we have a keep alive
|
||||
if (res.KeepAlive) {
|
||||
// Convert to milliseconds
|
||||
|
@ -328,7 +396,7 @@
|
|||
keepAliveData.activated = false;
|
||||
}
|
||||
|
||||
if (!res.ProtocolVersion || res.ProtocolVersion !== "1.0") {
|
||||
if (!res.ProtocolVersion || res.ProtocolVersion !== "1.1") {
|
||||
$(connection).triggerHandler(events.onError, "SignalR: Incompatible protocol version.");
|
||||
deferred.reject("SignalR: Incompatible protocol version.");
|
||||
return;
|
||||
|
@ -457,6 +525,17 @@
|
|||
return connection;
|
||||
},
|
||||
|
||||
reconnecting: function (callback) {
|
||||
/// <summary>Adds a callback that will be invoked when the underlying transport begins reconnecting</summary>
|
||||
/// <param name="callback" type="Function">A callback function to execute when the connection enters a reconnecting state</param>
|
||||
/// <returns type="signalR" />
|
||||
var connection = this;
|
||||
$(connection).bind(events.onReconnecting, function (e, data) {
|
||||
callback.call(connection);
|
||||
});
|
||||
return connection;
|
||||
},
|
||||
|
||||
reconnected: function (callback) {
|
||||
/// <summary>Adds a callback that will be invoked when the underlying transport reconnects</summary>
|
||||
/// <param name="callback" type="Function">A callback function to execute when the connection is restored</param>
|
||||
|
@ -543,7 +622,8 @@
|
|||
"use strict";
|
||||
|
||||
var signalR = $.signalR,
|
||||
events = $.signalR.events;
|
||||
events = $.signalR.events,
|
||||
changeState = $.signalR.changeState;
|
||||
|
||||
signalR.transports = {};
|
||||
|
||||
|
@ -610,7 +690,8 @@
|
|||
/// <summary>Gets the url for making a GET based connect request</summary>
|
||||
var baseUrl = transport === "webSockets" ? "" : connection.baseUrl,
|
||||
url = baseUrl + connection.appRelativeUrl,
|
||||
qs = "transport=" + transport + "&connectionId=" + window.escape(connection.id);
|
||||
qs = "transport=" + transport + "&connectionId=" + window.escape(connection.id),
|
||||
groups = this.getGroups(connection);
|
||||
|
||||
if (connection.data) {
|
||||
qs += "&connectionData=" + window.escape(connection.data);
|
||||
|
@ -623,10 +704,10 @@
|
|||
url = url + "/reconnect";
|
||||
}
|
||||
if (connection.messageId) {
|
||||
qs += "&messageId=" + connection.messageId;
|
||||
qs += "&messageId=" + window.escape(connection.messageId);
|
||||
}
|
||||
if (connection.groups) {
|
||||
qs += "&groups=" + window.escape(JSON.stringify(connection.groups));
|
||||
if (groups.length !== 0) {
|
||||
qs += "&groups=" + window.escape(JSON.stringify(groups));
|
||||
}
|
||||
}
|
||||
url += "?" + qs;
|
||||
|
@ -635,6 +716,54 @@
|
|||
return url;
|
||||
},
|
||||
|
||||
maximizePersistentResponse: function (minPersistentResponse) {
|
||||
return {
|
||||
MessageId: minPersistentResponse.C,
|
||||
Messages: minPersistentResponse.M,
|
||||
Disconnect: typeof (minPersistentResponse.D) !== "undefined" ? true : false,
|
||||
TimedOut: typeof (minPersistentResponse.T) !== "undefined" ? true : false,
|
||||
LongPollDelay: minPersistentResponse.L,
|
||||
ResetGroups: minPersistentResponse.R,
|
||||
AddedGroups: minPersistentResponse.G,
|
||||
RemovedGroups: minPersistentResponse.g
|
||||
};
|
||||
},
|
||||
|
||||
updateGroups: function (connection, resetGroups, addedGroups, removedGroups) {
|
||||
// Use the keys in connection.groups object as a set of groups.
|
||||
// Prefix all group names with # so we don't conflict with the object's prototype or __proto__.
|
||||
function addGroups(groups) {
|
||||
$.each(groups, function (_, group) {
|
||||
connection.groups['#' + group] = true;
|
||||
});
|
||||
}
|
||||
|
||||
if (resetGroups) {
|
||||
connection.groups = {};
|
||||
addGroups(resetGroups);
|
||||
} else {
|
||||
if (addedGroups) {
|
||||
addGroups(addedGroups);
|
||||
}
|
||||
if (removedGroups) {
|
||||
$.each(removedGroups, function (_, group) {
|
||||
delete connection.groups['# ' + group];
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
getGroups: function (connection) {
|
||||
var groups = [];
|
||||
if (connection.groups) {
|
||||
$.each(connection.groups, function (group, _) {
|
||||
// Add keys from connection.groups without the # prefix
|
||||
groups.push(group.substr(1));
|
||||
});
|
||||
}
|
||||
return groups;
|
||||
},
|
||||
|
||||
ajaxSend: function (connection, data) {
|
||||
var url = connection.url + "/send" + "?transport=" + connection.transport.name + "&connectionId=" + window.escape(connection.id);
|
||||
url = this.addQs(url, connection);
|
||||
|
@ -687,7 +816,8 @@
|
|||
connection.log("Fired ajax abort async = " + async);
|
||||
},
|
||||
|
||||
processMessages: function (connection, data) {
|
||||
processMessages: function (connection, minData) {
|
||||
var data;
|
||||
// Transport can be null if we've just closed the connection
|
||||
if (connection.transport) {
|
||||
var $connection = $(connection);
|
||||
|
@ -698,10 +828,12 @@
|
|||
this.updateKeepAlive(connection);
|
||||
}
|
||||
|
||||
if (!data) {
|
||||
if (!minData) {
|
||||
return;
|
||||
}
|
||||
|
||||
data = this.maximizePersistentResponse(minData);
|
||||
|
||||
if (data.Disconnect) {
|
||||
connection.log("Disconnect command received from server");
|
||||
|
||||
|
@ -710,6 +842,8 @@
|
|||
return;
|
||||
}
|
||||
|
||||
this.updateGroups(connection, data.ResetGroups, data.AddedGroups, data.RemovedGroups);
|
||||
|
||||
if (data.Messages) {
|
||||
$.each(data.Messages, function () {
|
||||
try {
|
||||
|
@ -725,10 +859,6 @@
|
|||
if (data.MessageId) {
|
||||
connection.messageId = data.MessageId;
|
||||
}
|
||||
|
||||
if (data.TransportData) {
|
||||
connection.groups = data.TransportData.Groups;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -781,6 +911,15 @@
|
|||
connection.keepAliveData.lastKeepAlive = new Date();
|
||||
},
|
||||
|
||||
ensureReconnectingState: function (connection) {
|
||||
if (changeState(connection,
|
||||
signalR.connectionState.connected,
|
||||
signalR.connectionState.reconnecting) === true) {
|
||||
$(connection).triggerHandler(events.onReconnecting);
|
||||
}
|
||||
return connection.state === signalR.connectionState.reconnecting;
|
||||
},
|
||||
|
||||
foreverFrame: {
|
||||
count: 0,
|
||||
connections: {}
|
||||
|
@ -854,13 +993,10 @@
|
|||
|
||||
if (onSuccess) {
|
||||
onSuccess();
|
||||
}
|
||||
else {
|
||||
if (changeState(connection,
|
||||
signalR.connectionState.reconnecting,
|
||||
signalR.connectionState.connected) === true) {
|
||||
$connection.triggerHandler(events.onReconnect);
|
||||
}
|
||||
} else if (changeState(connection,
|
||||
signalR.connectionState.reconnecting,
|
||||
signalR.connectionState.connected) === true) {
|
||||
$connection.triggerHandler(events.onReconnect);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -897,7 +1033,8 @@
|
|||
$connection = $(connection);
|
||||
|
||||
if (data) {
|
||||
if ($.isEmptyObject(data) || data.Messages) {
|
||||
// data.M is PersistentResponse.Messages
|
||||
if ($.isEmptyObject(data) || data.M) {
|
||||
transportLogic.processMessages(connection, data);
|
||||
} else {
|
||||
// For websockets we need to trigger onReceived
|
||||
|
@ -922,16 +1059,11 @@
|
|||
that.stop(connection);
|
||||
}
|
||||
|
||||
if (connection.state === signalR.connectionState.reconnecting ||
|
||||
changeState(connection,
|
||||
signalR.connectionState.connected,
|
||||
signalR.connectionState.reconnecting) === true) {
|
||||
|
||||
if (transportLogic.ensureReconnectingState(connection)) {
|
||||
connection.log("Websocket reconnecting");
|
||||
that.start(connection);
|
||||
}
|
||||
},
|
||||
connection.reconnectDelay);
|
||||
}, connection.reconnectDelay);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -1064,14 +1196,11 @@
|
|||
|
||||
if (onSuccess) {
|
||||
onSuccess();
|
||||
}
|
||||
|
||||
if (reconnecting) {
|
||||
if (changeState(connection,
|
||||
signalR.connectionState.reconnecting,
|
||||
signalR.connectionState.connected) === true) {
|
||||
$connection.triggerHandler(events.onReconnect);
|
||||
}
|
||||
} else if (changeState(connection,
|
||||
signalR.connectionState.reconnecting,
|
||||
signalR.connectionState.connected) === true) {
|
||||
// If there's no onSuccess handler we assume this is a reconnect
|
||||
$connection.triggerHandler(events.onReconnect);
|
||||
}
|
||||
}
|
||||
}, false);
|
||||
|
@ -1122,15 +1251,10 @@
|
|||
that.reconnectTimeout = window.setTimeout(function () {
|
||||
that.stop(connection);
|
||||
|
||||
if (connection.state === signalR.connectionState.reconnecting ||
|
||||
changeState(connection,
|
||||
signalR.connectionState.connected,
|
||||
signalR.connectionState.reconnecting) === true) {
|
||||
if (transportLogic.ensureReconnectingState(connection)) {
|
||||
connection.log("EventSource reconnecting");
|
||||
|
||||
that.start(connection);
|
||||
}
|
||||
|
||||
}, connection.reconnectDelay);
|
||||
},
|
||||
|
||||
|
@ -1181,13 +1305,12 @@
|
|||
var that = this,
|
||||
frameId = (transportLogic.foreverFrame.count += 1),
|
||||
url,
|
||||
connectTimeOut,
|
||||
frame = $("<iframe data-signalr-connection-id='" + connection.id + "' style='position:absolute;top:0;left:0;width:0;height:0;visibility:hidden;' src=''></iframe>");
|
||||
|
||||
if (window.EventSource) {
|
||||
// If the browser supports SSE, don't use Forever Frame
|
||||
if (onFailed) {
|
||||
connection.log("This brower supports SSE, skipping Forever Frame.");
|
||||
connection.log("This browser supports SSE, skipping Forever Frame.");
|
||||
onFailed();
|
||||
}
|
||||
return;
|
||||
|
@ -1222,8 +1345,7 @@
|
|||
|
||||
// After connecting, if after the specified timeout there's no response stop the connection
|
||||
// and raise on failed
|
||||
// REVIEW: Why is connectTimeOut set here and never used again?
|
||||
connectTimeOut = window.setTimeout(function () {
|
||||
window.setTimeout(function () {
|
||||
if (connection.onSuccess) {
|
||||
connection.log("Failed to connect using forever frame source, it timed out after " + that.timeOut + "ms.");
|
||||
that.stop(connection);
|
||||
|
@ -1238,21 +1360,12 @@
|
|||
reconnect: function (connection) {
|
||||
var that = this;
|
||||
window.setTimeout(function () {
|
||||
if (!connection.frame) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (connection.state === signalR.connectionState.reconnecting ||
|
||||
changeState(connection,
|
||||
signalR.connectionState.connected,
|
||||
signalR.connectionState.reconnecting) === true) {
|
||||
|
||||
if (connection.frame && transportLogic.ensureReconnectingState(connection)) {
|
||||
var frame = connection.frame,
|
||||
src = transportLogic.getUrl(connection, that.name, true) + "&frameId=" + connection.frameId;
|
||||
connection.log("Upating iframe src to '" + src + "'.");
|
||||
src = transportLogic.getUrl(connection, that.name, true) + "&frameId=" + connection.frameId;
|
||||
connection.log("Updating iframe src to '" + src + "'.");
|
||||
frame.src = src;
|
||||
}
|
||||
|
||||
}, connection.reconnectDelay);
|
||||
},
|
||||
|
||||
|
@ -1285,9 +1398,15 @@
|
|||
if (connection.frame.stop) {
|
||||
connection.frame.stop();
|
||||
} else {
|
||||
cw = connection.frame.contentWindow || connection.frame.contentDocument;
|
||||
if (cw.document && cw.document.execCommand) {
|
||||
cw.document.execCommand("Stop");
|
||||
try
|
||||
{
|
||||
cw = connection.frame.contentWindow || connection.frame.contentDocument;
|
||||
if (cw.document && cw.document.execCommand) {
|
||||
cw.document.execCommand("Stop");
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
connection.log("SignalR: Error occured when stopping foreverFrame transport. Message = " + e.message);
|
||||
}
|
||||
}
|
||||
$(connection.frame).remove();
|
||||
|
@ -1313,14 +1432,11 @@
|
|||
connection.onSuccess();
|
||||
connection.onSuccess = null;
|
||||
delete connection.onSuccess;
|
||||
}
|
||||
else {
|
||||
if (changeState(connection,
|
||||
signalR.connectionState.reconnecting,
|
||||
signalR.connectionState.connected) === true) {
|
||||
// If there's no onSuccess handler we assume this is a reconnect
|
||||
$(connection).triggerHandler(events.onReconnect);
|
||||
}
|
||||
} else if (changeState(connection,
|
||||
signalR.connectionState.reconnecting,
|
||||
signalR.connectionState.connected) === true) {
|
||||
// If there's no onSuccess handler we assume this is a reconnect
|
||||
$(connection).triggerHandler(events.onReconnect);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -1363,21 +1479,30 @@
|
|||
|
||||
window.setTimeout(function () {
|
||||
(function poll(instance, raiseReconnect) {
|
||||
|
||||
var messageId = instance.messageId,
|
||||
connect = (messageId === null),
|
||||
reconnecting = !connect,
|
||||
url = transportLogic.getUrl(instance, that.name, reconnecting, raiseReconnect),
|
||||
reconnectTimeOut = null,
|
||||
reconnectFired = false;
|
||||
reconnectFired = false,
|
||||
triggerReconnected = function () {
|
||||
// Fire the reconnect event if it hasn't been fired as yet
|
||||
if (reconnectFired === false) {
|
||||
connection.log("Raising the reconnect event");
|
||||
|
||||
if (reconnecting === true && raiseReconnect === true) {
|
||||
if (connection.state !== signalR.connectionState.reconnecting &&
|
||||
changeState(connection,
|
||||
signalR.connectionState.connected,
|
||||
signalR.connectionState.reconnecting) === false) {
|
||||
return;
|
||||
}
|
||||
if (changeState(connection,
|
||||
signalR.connectionState.reconnecting,
|
||||
signalR.connectionState.connected) === true) {
|
||||
|
||||
$(instance).triggerHandler(events.onReconnect);
|
||||
reconnectFired = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if (reconnecting === true && raiseReconnect === true &&
|
||||
!transportLogic.ensureReconnectingState(connection)) {
|
||||
return;
|
||||
}
|
||||
|
||||
connection.log("Attempting to connect to '" + url + "' using longPolling.");
|
||||
|
@ -1387,9 +1512,14 @@
|
|||
cache: false,
|
||||
type: "GET",
|
||||
dataType: connection.ajaxDataType,
|
||||
success: function (data) {
|
||||
success: function (minData) {
|
||||
var delay = 0,
|
||||
timedOutReceived = false;
|
||||
timedOutReceived = false,
|
||||
data;
|
||||
|
||||
if (minData) {
|
||||
data = transportLogic.maximizePersistentResponse(minData);
|
||||
}
|
||||
|
||||
if (initialConnectFired === false) {
|
||||
onSuccess();
|
||||
|
@ -1397,25 +1527,13 @@
|
|||
}
|
||||
|
||||
if (raiseReconnect === true) {
|
||||
// Fire the reconnect event if it hasn't been fired as yet
|
||||
if (reconnectFired === false) {
|
||||
connection.log("Raising the reconnect event");
|
||||
|
||||
if (changeState(connection,
|
||||
signalR.connectionState.reconnecting,
|
||||
signalR.connectionState.connected) === true) {
|
||||
|
||||
$(instance).triggerHandler(events.onReconnect);
|
||||
reconnectFired = true;
|
||||
}
|
||||
}
|
||||
triggerReconnected();
|
||||
}
|
||||
|
||||
transportLogic.processMessages(instance, data);
|
||||
transportLogic.processMessages(instance, minData);
|
||||
if (data &&
|
||||
data.TransportData &&
|
||||
$.type(data.TransportData.LongPollDelay) === "number") {
|
||||
delay = data.TransportData.LongPollDelay;
|
||||
$.type(data.LongPollDelay) === "number") {
|
||||
delay = data.LongPollDelay;
|
||||
}
|
||||
|
||||
if (data && data.TimedOut) {
|
||||
|
@ -1445,15 +1563,14 @@
|
|||
return;
|
||||
}
|
||||
|
||||
connection.log("An error occurred using longPolling. Status = " + textStatus + ". " + data.responseText);
|
||||
|
||||
if (reconnectTimeOut) {
|
||||
// If the request failed then we clear the timeout so that the
|
||||
// reconnect event doesn't get fired
|
||||
window.clearTimeout(reconnectTimeOut);
|
||||
if (connection.state !== signalR.connectionState.reconnecting) {
|
||||
connection.log("An error occurred using longPolling. Status = " + textStatus + ". " + data.responseText);
|
||||
$(instance).triggerHandler(events.onError, [data.responseText]);
|
||||
}
|
||||
|
||||
$(instance).triggerHandler(events.onError, [data.responseText]);
|
||||
// If the request failed then we clear the timeout so that the
|
||||
// reconnect event doesn't get fired
|
||||
window.clearTimeout(reconnectTimeOut);
|
||||
|
||||
window.setTimeout(function () {
|
||||
if (isDisconnecting(instance) === false) {
|
||||
|
@ -1464,18 +1581,7 @@
|
|||
});
|
||||
|
||||
if (raiseReconnect === true) {
|
||||
reconnectTimeOut = window.setTimeout(function () {
|
||||
if (reconnectFired === false) {
|
||||
if (changeState(connection,
|
||||
signalR.connectionState.reconnecting,
|
||||
signalR.connectionState.connected) === true) {
|
||||
|
||||
$(instance).triggerHandler(events.onReconnect);
|
||||
reconnectFired = true;
|
||||
}
|
||||
}
|
||||
},
|
||||
that.reconnectDelay);
|
||||
reconnectTimeOut = window.setTimeout(triggerReconnected, that.reconnectDelay);
|
||||
}
|
||||
|
||||
}(connection));
|
||||
|
@ -1658,11 +1764,13 @@
|
|||
var self = this,
|
||||
args = $.makeArray(arguments).slice(1),
|
||||
argValues = args.map(getArgValue),
|
||||
data = { hub: self.hubName, method: methodName, args: argValues, state: self.state, id: callbackId },
|
||||
data = { H: self.hubName, M: methodName, A: argValues, I: callbackId },
|
||||
d = $.Deferred(),
|
||||
callback = function (result) {
|
||||
callback = function (minResult) {
|
||||
var result = self._maximizeHubResponse(minResult);
|
||||
|
||||
// Update the hub state
|
||||
$.extend(this.state, result.State);
|
||||
$.extend(self.state, result.State);
|
||||
|
||||
if (result.Error) {
|
||||
// Server hub method threw an exception, log it & reject the deferred
|
||||
|
@ -1678,9 +1786,24 @@
|
|||
|
||||
callbacks[callbackId.toString()] = { scope: self, method: callback };
|
||||
callbackId += 1;
|
||||
|
||||
if (!$.isEmptyObject(self.state)) {
|
||||
data.S = self.state;
|
||||
}
|
||||
|
||||
self.connection.send(window.JSON.stringify(data));
|
||||
|
||||
return d.promise();
|
||||
},
|
||||
|
||||
_maximizeHubResponse: function (minHubResponse) {
|
||||
return {
|
||||
State: minHubResponse.S,
|
||||
Result: minHubResponse.R,
|
||||
Id: minHubResponse.I,
|
||||
Error: minHubResponse.E,
|
||||
StackTrace: minHubResponse.T
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1724,15 +1847,15 @@
|
|||
connection.proxies = {};
|
||||
|
||||
// Wire up the received handler
|
||||
connection.received(function (data) {
|
||||
var proxy, dataCallbackId, callback, hubName, eventName;
|
||||
if (!data) {
|
||||
connection.received(function (minData) {
|
||||
var data, proxy, dataCallbackId, callback, hubName, eventName;
|
||||
if (!minData) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof (data.Id) !== "undefined") {
|
||||
if (typeof (minData.I) !== "undefined") {
|
||||
// We received the return value from a server method invocation, look up callback by id and call it
|
||||
dataCallbackId = data.Id.toString();
|
||||
dataCallbackId = minData.I.toString();
|
||||
callback = callbacks[dataCallbackId];
|
||||
if (callback) {
|
||||
// Delete the callback from the proxy
|
||||
|
@ -1740,9 +1863,11 @@
|
|||
delete callbacks[dataCallbackId];
|
||||
|
||||
// Invoke the callback
|
||||
callback.method.call(callback.scope, data);
|
||||
callback.method.call(callback.scope, minData);
|
||||
}
|
||||
} else {
|
||||
data = this._maximizeClientHubInvocation(minData);
|
||||
|
||||
// We received a client invocation request, i.e. broadcast from server hub
|
||||
connection.log("Triggering client hub event '" + data.Method + "' on hub '" + data.Hub + "'.");
|
||||
|
||||
|
@ -1760,6 +1885,15 @@
|
|||
});
|
||||
};
|
||||
|
||||
hubConnection.fn._maximizeClientHubInvocation = function (minClientHubInvocation) {
|
||||
return {
|
||||
Hub: minClientHubInvocation.H,
|
||||
Method: minClientHubInvocation.M,
|
||||
Args: minClientHubInvocation.A,
|
||||
State: minClientHubInvocation.S
|
||||
};
|
||||
};
|
||||
|
||||
hubConnection.fn._registerSubscribedHubs = function () {
|
||||
/// <summary>
|
||||
/// Sets the starting event to loop through the known hubs and register any new hubs
|
||||
|
@ -1812,3 +1946,11 @@
|
|||
$.hubConnection = hubConnection;
|
||||
|
||||
}(window.jQuery, window));
|
||||
/* jquery.signalR.version.js */
|
||||
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.md in the project root for license information.
|
||||
|
||||
/*global window:false */
|
||||
/// <reference path="jquery.signalR.core.js" />
|
||||
(function ($) {
|
||||
$.signalR.version = "1.0.0.rc1";
|
||||
}(window.jQuery));
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -8,8 +8,8 @@
|
|||
<input type="button" id="send" value="send" />
|
||||
<ul id="message">
|
||||
</ul>
|
||||
<script src="Scripts/jquery-1.8.2.min.js"></script>
|
||||
<script src="Scripts/jquery.signalR-1.0.0-alpha2.min.js"></script>
|
||||
<script src="Scripts/jquery-1.8.3.min.js"></script>
|
||||
<script src="Scripts/jquery.signalR-1.0.0-rc1.min.js"></script>
|
||||
<script src="http://localhost:44914/signalR/hubs"></script>
|
||||
<script>
|
||||
$(function () {
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
<input type="button" id="send" value="send" />
|
||||
<ul id="message">
|
||||
</ul>
|
||||
<script src="Scripts/jquery-1.8.2.min.js"></script>
|
||||
<script src="Scripts/jquery.signalR-1.0.0-alpha2.min.js"></script>
|
||||
<script src="Scripts/jquery-1.8.3.min.js"></script>
|
||||
<script src="Scripts/jquery.signalR-1.0.0-rc1.min.js"></script>
|
||||
<script>
|
||||
$(function () {
|
||||
// Open a connection to the remote server
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="jQuery" version="1.8.2" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.SignalR.JS" version="1.0.0-alpha2" targetFramework="net45" />
|
||||
<package id="jQuery" version="1.8.3" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.SignalR.JS" version="1.0.0-rc1" targetFramework="net45" />
|
||||
</packages>
|
|
@ -1,18 +0,0 @@
|
|||
using System.Web;
|
||||
using System.Web.Routing;
|
||||
using Microsoft.AspNet.SignalR;
|
||||
using Microsoft.AspNet.SignalR.Hosting.AspNet;
|
||||
|
||||
[assembly: PreApplicationStartMethod(typeof(BasicChat.Mvc.RegisterHubs), "Start")]
|
||||
|
||||
namespace BasicChat.Mvc
|
||||
{
|
||||
public static class RegisterHubs
|
||||
{
|
||||
public static void Start()
|
||||
{
|
||||
// Register the default hubs route: ~/signalr/hubs
|
||||
RouteTable.Routes.MapHubs();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -41,20 +41,27 @@
|
|||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.AspNet.SignalR.Core">
|
||||
<HintPath>..\packages\Microsoft.AspNet.SignalR.Core.1.0.0-alpha2\lib\net40\Microsoft.AspNet.SignalR.Core.dll</HintPath>
|
||||
<Reference Include="Microsoft.AspNet.SignalR.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Microsoft.AspNet.SignalR.Core.1.0.0-rc1\lib\net40\Microsoft.AspNet.SignalR.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.AspNet.SignalR.Hosting.AspNet">
|
||||
<HintPath>..\packages\Microsoft.AspNet.SignalR.Hosting.AspNet.1.0.0-alpha2\lib\net45\Microsoft.AspNet.SignalR.Hosting.AspNet.dll</HintPath>
|
||||
<Reference Include="Microsoft.AspNet.SignalR.Owin">
|
||||
<HintPath>..\packages\Microsoft.AspNet.SignalR.Owin.1.0.0-rc1\lib\net45\Microsoft.AspNet.SignalR.Owin.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.AspNet.SignalR.Hosting.Common">
|
||||
<HintPath>..\packages\Microsoft.AspNet.SignalR.Hosting.Common.1.0.0-alpha2\lib\net40\Microsoft.AspNet.SignalR.Hosting.Common.dll</HintPath>
|
||||
<Reference Include="Microsoft.AspNet.SignalR.SystemWeb">
|
||||
<HintPath>..\packages\Microsoft.AspNet.SignalR.SystemWeb.1.0.0-rc1\lib\net45\Microsoft.AspNet.SignalR.SystemWeb.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="Microsoft.Owin.Host.SystemWeb">
|
||||
<HintPath>..\packages\Microsoft.Owin.Host.SystemWeb.1.0.0-rc1\lib\net45\Microsoft.Owin.Host.SystemWeb.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Newtonsoft.Json.4.5.11\lib\net40\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Owin">
|
||||
<HintPath>..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Data.Entity" />
|
||||
|
@ -195,7 +202,6 @@
|
|||
<Compile Include="App_Start\AuthConfig.cs" />
|
||||
<Compile Include="App_Start\BundleConfig.cs" />
|
||||
<Compile Include="App_Start\FilterConfig.cs" />
|
||||
<Compile Include="App_Start\RegisterHubs.cs" />
|
||||
<Compile Include="App_Start\RouteConfig.cs" />
|
||||
<Compile Include="App_Start\WebApiConfig.cs" />
|
||||
<Compile Include="Controllers\AccountController.cs" />
|
||||
|
@ -265,14 +271,14 @@
|
|||
<Content Include="Content\themes\base\minified\jquery.ui.theme.min.css" />
|
||||
<Content Include="favicon.ico" />
|
||||
<Content Include="Global.asax" />
|
||||
<None Include="Scripts\jquery-1.7.1.intellisense.js" />
|
||||
<Content Include="Scripts\jquery-1.7.1.js" />
|
||||
<Content Include="Scripts\jquery-1.7.1.min.js" />
|
||||
<None Include="Scripts\jquery.validate-vsdoc.js" />
|
||||
<None Include="Scripts\jquery-1.8.3.intellisense.js" />
|
||||
<Content Include="Scripts\jquery-1.8.3.js" />
|
||||
<Content Include="Scripts\jquery-1.8.3.min.js" />
|
||||
<Content Include="Scripts\jquery-ui-1.8.20.js" />
|
||||
<Content Include="Scripts\jquery-ui-1.8.20.min.js" />
|
||||
<Content Include="Scripts\jquery.signalR-1.0.0-alpha2.js" />
|
||||
<Content Include="Scripts\jquery.signalR-1.0.0-alpha2.min.js" />
|
||||
<Content Include="Scripts\jquery.signalR-1.0.0-rc1.js" />
|
||||
<Content Include="Scripts\jquery.signalR-1.0.0-rc1.min.js" />
|
||||
<Content Include="Scripts\jquery.unobtrusive-ajax.js" />
|
||||
<Content Include="Scripts\jquery.unobtrusive-ajax.min.js" />
|
||||
<Content Include="Scripts\jquery.validate.js" />
|
||||
|
|
|
@ -6,6 +6,7 @@ using System.Web.Http;
|
|||
using System.Web.Mvc;
|
||||
using System.Web.Optimization;
|
||||
using System.Web.Routing;
|
||||
using Microsoft.AspNet.SignalR;
|
||||
|
||||
namespace BasicChat.Mvc
|
||||
{
|
||||
|
@ -18,6 +19,8 @@ namespace BasicChat.Mvc
|
|||
{
|
||||
AreaRegistration.RegisterAllAreas();
|
||||
|
||||
RouteTable.Routes.MapHubs();
|
||||
|
||||
WebApiConfig.Register(GlobalConfiguration.Configuration);
|
||||
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
|
||||
RouteConfig.RegisterRoutes(RouteTable.Routes);
|
||||
|
|
Двоичные данные
BasicChat.Mvc/Scripts/_references.js
Двоичные данные
BasicChat.Mvc/Scripts/_references.js
Двоичный файл не отображается.
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -1,5 +1,5 @@
|
|||
/*!
|
||||
* jQuery JavaScript Library v1.8.2
|
||||
* jQuery JavaScript Library v1.8.3
|
||||
* http://jquery.com/
|
||||
*
|
||||
* Includes Sizzle.js
|
||||
|
@ -9,7 +9,7 @@
|
|||
* Released under the MIT license
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* Date: Thu Sep 20 2012 21:13:05 GMT-0400 (Eastern Daylight Time)
|
||||
* Date: Tue Nov 13 2012 08:20:33 GMT-0500 (Eastern Standard Time)
|
||||
*/
|
||||
(function( window, undefined ) {
|
||||
var
|
||||
|
@ -186,7 +186,7 @@ jQuery.fn = jQuery.prototype = {
|
|||
selector: "",
|
||||
|
||||
// The current version of jQuery being used
|
||||
jquery: "1.8.2",
|
||||
jquery: "1.8.3",
|
||||
|
||||
// The default length of a jQuery object is 0
|
||||
length: 0,
|
||||
|
@ -999,8 +999,10 @@ jQuery.Callbacks = function( options ) {
|
|||
(function add( args ) {
|
||||
jQuery.each( args, function( _, arg ) {
|
||||
var type = jQuery.type( arg );
|
||||
if ( type === "function" && ( !options.unique || !self.has( arg ) ) ) {
|
||||
list.push( arg );
|
||||
if ( type === "function" ) {
|
||||
if ( !options.unique || !self.has( arg ) ) {
|
||||
list.push( arg );
|
||||
}
|
||||
} else if ( arg && arg.length && type !== "string" ) {
|
||||
// Inspect recursively
|
||||
add( arg );
|
||||
|
@ -1253,24 +1255,23 @@ jQuery.support = (function() {
|
|||
clickFn,
|
||||
div = document.createElement("div");
|
||||
|
||||
// Preliminary tests
|
||||
// Setup
|
||||
div.setAttribute( "className", "t" );
|
||||
div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
|
||||
|
||||
// Support tests won't run in some limited or non-browser environments
|
||||
all = div.getElementsByTagName("*");
|
||||
a = div.getElementsByTagName("a")[ 0 ];
|
||||
a.style.cssText = "top:1px;float:left;opacity:.5";
|
||||
|
||||
// Can't get basic test support
|
||||
if ( !all || !all.length ) {
|
||||
if ( !all || !a || !all.length ) {
|
||||
return {};
|
||||
}
|
||||
|
||||
// First batch of supports tests
|
||||
// First batch of tests
|
||||
select = document.createElement("select");
|
||||
opt = select.appendChild( document.createElement("option") );
|
||||
input = div.getElementsByTagName("input")[ 0 ];
|
||||
|
||||
a.style.cssText = "top:1px;float:left;opacity:.5";
|
||||
support = {
|
||||
// IE strips leading whitespace when .innerHTML is used
|
||||
leadingWhitespace: ( div.firstChild.nodeType === 3 ),
|
||||
|
@ -1312,7 +1313,7 @@ jQuery.support = (function() {
|
|||
// Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
|
||||
getSetAttribute: div.className !== "t",
|
||||
|
||||
// Tests for enctype support on a form(#6743)
|
||||
// Tests for enctype support on a form (#6743)
|
||||
enctype: !!document.createElement("form").enctype,
|
||||
|
||||
// Makes sure cloning an html5 element does not cause problems
|
||||
|
@ -2217,26 +2218,25 @@ jQuery.extend({
|
|||
},
|
||||
select: {
|
||||
get: function( elem ) {
|
||||
var value, i, max, option,
|
||||
index = elem.selectedIndex,
|
||||
values = [],
|
||||
var value, option,
|
||||
options = elem.options,
|
||||
one = elem.type === "select-one";
|
||||
|
||||
// Nothing was selected
|
||||
if ( index < 0 ) {
|
||||
return null;
|
||||
}
|
||||
index = elem.selectedIndex,
|
||||
one = elem.type === "select-one" || index < 0,
|
||||
values = one ? null : [],
|
||||
max = one ? index + 1 : options.length,
|
||||
i = index < 0 ?
|
||||
max :
|
||||
one ? index : 0;
|
||||
|
||||
// Loop through all the selected options
|
||||
i = one ? index : 0;
|
||||
max = one ? index + 1 : options.length;
|
||||
for ( ; i < max; i++ ) {
|
||||
option = options[ i ];
|
||||
|
||||
// Don't return options that are disabled or in a disabled optgroup
|
||||
if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) &&
|
||||
(!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) {
|
||||
// oldIE doesn't update selected after form reset (#2551)
|
||||
if ( ( option.selected || i === index ) &&
|
||||
// Don't return options that are disabled or in a disabled optgroup
|
||||
( jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) &&
|
||||
( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
|
||||
|
||||
// Get the specific value for the option
|
||||
value = jQuery( option ).val();
|
||||
|
@ -2251,11 +2251,6 @@ jQuery.extend({
|
|||
}
|
||||
}
|
||||
|
||||
// Fixes Bug #2551 -- select.val() broken in IE after form.reset()
|
||||
if ( one && !values.length && options.length ) {
|
||||
return jQuery( options[ index ] ).val();
|
||||
}
|
||||
|
||||
return values;
|
||||
},
|
||||
|
||||
|
@ -3233,7 +3228,7 @@ jQuery.removeEvent = document.removeEventListener ?
|
|||
|
||||
if ( elem.detachEvent ) {
|
||||
|
||||
// #8545, #7054, preventing memory leaks for custom events in IE6-8 –
|
||||
// #8545, #7054, preventing memory leaks for custom events in IE6-8
|
||||
// detachEvent needed property on element, by name of that event, to properly expose it to GC
|
||||
if ( typeof elem[ name ] === "undefined" ) {
|
||||
elem[ name ] = null;
|
||||
|
@ -3725,7 +3720,8 @@ var cachedruns,
|
|||
delete cache[ keys.shift() ];
|
||||
}
|
||||
|
||||
return (cache[ key ] = value);
|
||||
// Retrieve with (key + " ") to avoid collision with native Object.prototype properties (see Issue #157)
|
||||
return (cache[ key + " " ] = value);
|
||||
}, cache );
|
||||
},
|
||||
|
||||
|
@ -4259,13 +4255,13 @@ Expr = Sizzle.selectors = {
|
|||
},
|
||||
|
||||
"CLASS": function( className ) {
|
||||
var pattern = classCache[ expando ][ className ];
|
||||
if ( !pattern ) {
|
||||
pattern = classCache( className, new RegExp("(^|" + whitespace + ")" + className + "(" + whitespace + "|$)") );
|
||||
}
|
||||
return function( elem ) {
|
||||
return pattern.test( elem.className || (typeof elem.getAttribute !== strundefined && elem.getAttribute("class")) || "" );
|
||||
};
|
||||
var pattern = classCache[ expando ][ className + " " ];
|
||||
|
||||
return pattern ||
|
||||
(pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
|
||||
classCache( className, function( elem ) {
|
||||
return pattern.test( elem.className || (typeof elem.getAttribute !== strundefined && elem.getAttribute("class")) || "" );
|
||||
});
|
||||
},
|
||||
|
||||
"ATTR": function( name, operator, check ) {
|
||||
|
@ -4511,7 +4507,7 @@ Expr = Sizzle.selectors = {
|
|||
|
||||
"focus": function( elem ) {
|
||||
var doc = elem.ownerDocument;
|
||||
return elem === doc.activeElement && (!doc.hasFocus || doc.hasFocus()) && !!(elem.type || elem.href);
|
||||
return elem === doc.activeElement && (!doc.hasFocus || doc.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
|
||||
},
|
||||
|
||||
"active": function( elem ) {
|
||||
|
@ -4519,11 +4515,11 @@ Expr = Sizzle.selectors = {
|
|||
},
|
||||
|
||||
// Positional types
|
||||
"first": createPositionalPseudo(function( matchIndexes, length, argument ) {
|
||||
"first": createPositionalPseudo(function() {
|
||||
return [ 0 ];
|
||||
}),
|
||||
|
||||
"last": createPositionalPseudo(function( matchIndexes, length, argument ) {
|
||||
"last": createPositionalPseudo(function( matchIndexes, length ) {
|
||||
return [ length - 1 ];
|
||||
}),
|
||||
|
||||
|
@ -4531,14 +4527,14 @@ Expr = Sizzle.selectors = {
|
|||
return [ argument < 0 ? argument + length : argument ];
|
||||
}),
|
||||
|
||||
"even": createPositionalPseudo(function( matchIndexes, length, argument ) {
|
||||
"even": createPositionalPseudo(function( matchIndexes, length ) {
|
||||
for ( var i = 0; i < length; i += 2 ) {
|
||||
matchIndexes.push( i );
|
||||
}
|
||||
return matchIndexes;
|
||||
}),
|
||||
|
||||
"odd": createPositionalPseudo(function( matchIndexes, length, argument ) {
|
||||
"odd": createPositionalPseudo(function( matchIndexes, length ) {
|
||||
for ( var i = 1; i < length; i += 2 ) {
|
||||
matchIndexes.push( i );
|
||||
}
|
||||
|
@ -4659,7 +4655,9 @@ baseHasDuplicate = !hasDuplicate;
|
|||
// Document sorting and removing duplicates
|
||||
Sizzle.uniqueSort = function( results ) {
|
||||
var elem,
|
||||
i = 1;
|
||||
duplicates = [],
|
||||
i = 1,
|
||||
j = 0;
|
||||
|
||||
hasDuplicate = baseHasDuplicate;
|
||||
results.sort( sortOrder );
|
||||
|
@ -4667,9 +4665,12 @@ Sizzle.uniqueSort = function( results ) {
|
|||
if ( hasDuplicate ) {
|
||||
for ( ; (elem = results[i]); i++ ) {
|
||||
if ( elem === results[ i - 1 ] ) {
|
||||
results.splice( i--, 1 );
|
||||
j = duplicates.push( i );
|
||||
}
|
||||
}
|
||||
while ( j-- ) {
|
||||
results.splice( duplicates[ j ], 1 );
|
||||
}
|
||||
}
|
||||
|
||||
return results;
|
||||
|
@ -4680,8 +4681,9 @@ Sizzle.error = function( msg ) {
|
|||
};
|
||||
|
||||
function tokenize( selector, parseOnly ) {
|
||||
var matched, match, tokens, type, soFar, groups, preFilters,
|
||||
cached = tokenCache[ expando ][ selector ];
|
||||
var matched, match, tokens, type,
|
||||
soFar, groups, preFilters,
|
||||
cached = tokenCache[ expando ][ selector + " " ];
|
||||
|
||||
if ( cached ) {
|
||||
return parseOnly ? 0 : cached.slice( 0 );
|
||||
|
@ -4696,7 +4698,8 @@ function tokenize( selector, parseOnly ) {
|
|||
// Comma and first run
|
||||
if ( !matched || (match = rcomma.exec( soFar )) ) {
|
||||
if ( match ) {
|
||||
soFar = soFar.slice( match[0].length );
|
||||
// Don't consume trailing commas as valid
|
||||
soFar = soFar.slice( match[0].length ) || soFar;
|
||||
}
|
||||
groups.push( tokens = [] );
|
||||
}
|
||||
|
@ -4715,8 +4718,7 @@ function tokenize( selector, parseOnly ) {
|
|||
// Filters
|
||||
for ( type in Expr.filter ) {
|
||||
if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
|
||||
// The last two arguments here are (context, xml) for backCompat
|
||||
(match = preFilters[ type ]( match, document, true ))) ) {
|
||||
(match = preFilters[ type ]( match ))) ) {
|
||||
|
||||
tokens.push( matched = new Token( match.shift() ) );
|
||||
soFar = soFar.slice( matched.length );
|
||||
|
@ -4836,18 +4838,13 @@ function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postS
|
|||
postFinder = setMatcher( postFinder, postSelector );
|
||||
}
|
||||
return markFunction(function( seed, results, context, xml ) {
|
||||
// Positional selectors apply to seed elements, so it is invalid to follow them with relative ones
|
||||
if ( seed && postFinder ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var i, elem, postFilterIn,
|
||||
var temp, i, elem,
|
||||
preMap = [],
|
||||
postMap = [],
|
||||
preexisting = results.length,
|
||||
|
||||
// Get initial elements from seed or context
|
||||
elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [], seed ),
|
||||
elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
|
||||
|
||||
// Prefilter to get matcher input, preserving a map for seed-results synchronization
|
||||
matcherIn = preFilter && ( seed || !selector ) ?
|
||||
|
@ -4872,27 +4869,45 @@ function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postS
|
|||
|
||||
// Apply postFilter
|
||||
if ( postFilter ) {
|
||||
postFilterIn = condense( matcherOut, postMap );
|
||||
postFilter( postFilterIn, [], context, xml );
|
||||
temp = condense( matcherOut, postMap );
|
||||
postFilter( temp, [], context, xml );
|
||||
|
||||
// Un-match failing elements by moving them back to matcherIn
|
||||
i = postFilterIn.length;
|
||||
i = temp.length;
|
||||
while ( i-- ) {
|
||||
if ( (elem = postFilterIn[i]) ) {
|
||||
if ( (elem = temp[i]) ) {
|
||||
matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Keep seed and results synchronized
|
||||
if ( seed ) {
|
||||
// Ignore postFinder because it can't coexist with seed
|
||||
i = preFilter && matcherOut.length;
|
||||
while ( i-- ) {
|
||||
if ( (elem = matcherOut[i]) ) {
|
||||
seed[ preMap[i] ] = !(results[ preMap[i] ] = elem);
|
||||
if ( postFinder || preFilter ) {
|
||||
if ( postFinder ) {
|
||||
// Get the final matcherOut by condensing this intermediate into postFinder contexts
|
||||
temp = [];
|
||||
i = matcherOut.length;
|
||||
while ( i-- ) {
|
||||
if ( (elem = matcherOut[i]) ) {
|
||||
// Restore matcherIn since elem is not yet a final match
|
||||
temp.push( (matcherIn[i] = elem) );
|
||||
}
|
||||
}
|
||||
postFinder( null, (matcherOut = []), temp, xml );
|
||||
}
|
||||
|
||||
// Move matched elements from seed to results to keep them synchronized
|
||||
i = matcherOut.length;
|
||||
while ( i-- ) {
|
||||
if ( (elem = matcherOut[i]) &&
|
||||
(temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) {
|
||||
|
||||
seed[temp] = !(results[temp] = elem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add elements to results, through postFinder if defined
|
||||
} else {
|
||||
matcherOut = condense(
|
||||
matcherOut === results ?
|
||||
|
@ -4933,7 +4948,6 @@ function matcherFromTokens( tokens ) {
|
|||
if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
|
||||
matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ];
|
||||
} else {
|
||||
// The concatenated values are (context, xml) for backCompat
|
||||
matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
|
||||
|
||||
// Return special upon seeing a positional matcher
|
||||
|
@ -5062,7 +5076,7 @@ compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) {
|
|||
var i,
|
||||
setMatchers = [],
|
||||
elementMatchers = [],
|
||||
cached = compilerCache[ expando ][ selector ];
|
||||
cached = compilerCache[ expando ][ selector + " " ];
|
||||
|
||||
if ( !cached ) {
|
||||
// Generate a function of recursive functions that can be used to check each element
|
||||
|
@ -5085,11 +5099,11 @@ compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) {
|
|||
return cached;
|
||||
};
|
||||
|
||||
function multipleContexts( selector, contexts, results, seed ) {
|
||||
function multipleContexts( selector, contexts, results ) {
|
||||
var i = 0,
|
||||
len = contexts.length;
|
||||
for ( ; i < len; i++ ) {
|
||||
Sizzle( selector, contexts[i], results, seed );
|
||||
Sizzle( selector, contexts[i], results );
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
@ -5167,15 +5181,14 @@ if ( document.querySelectorAll ) {
|
|||
rescape = /'|\\/g,
|
||||
rattributeQuotes = /\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,
|
||||
|
||||
// qSa(:focus) reports false when true (Chrome 21),
|
||||
// qSa(:focus) reports false when true (Chrome 21), no need to also add to buggyMatches since matches checks buggyQSA
|
||||
// A support test would require too much code (would include document ready)
|
||||
rbuggyQSA = [":focus"],
|
||||
rbuggyQSA = [ ":focus" ],
|
||||
|
||||
// matchesSelector(:focus) reports false when true (Chrome 21),
|
||||
// matchesSelector(:active) reports false when true (IE9/Opera 11.5)
|
||||
// A support test would require too much code (would include document ready)
|
||||
// just skip matchesSelector for :active
|
||||
rbuggyMatches = [ ":active", ":focus" ],
|
||||
rbuggyMatches = [ ":active" ],
|
||||
matches = docElem.matchesSelector ||
|
||||
docElem.mozMatchesSelector ||
|
||||
docElem.webkitMatchesSelector ||
|
||||
|
@ -5229,7 +5242,7 @@ if ( document.querySelectorAll ) {
|
|||
// Only use querySelectorAll when not filtering,
|
||||
// when this is not xml,
|
||||
// and when no QSA bugs apply
|
||||
if ( !seed && !xml && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
|
||||
if ( !seed && !xml && !rbuggyQSA.test( selector ) ) {
|
||||
var groups, i,
|
||||
old = true,
|
||||
nid = expando,
|
||||
|
@ -5298,7 +5311,7 @@ if ( document.querySelectorAll ) {
|
|||
expr = expr.replace( rattributeQuotes, "='$1']" );
|
||||
|
||||
// rbuggyMatches always contains :active, so no need for an existence check
|
||||
if ( !isXML( elem ) && !rbuggyMatches.test( expr ) && (!rbuggyQSA || !rbuggyQSA.test( expr )) ) {
|
||||
if ( !isXML( elem ) && !rbuggyMatches.test( expr ) && !rbuggyQSA.test( expr ) ) {
|
||||
try {
|
||||
var ret = matches.call( elem, expr );
|
||||
|
||||
|
@ -6533,7 +6546,7 @@ var curCSS, iframe, iframeDoc,
|
|||
rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ),
|
||||
rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ),
|
||||
rrelNum = new RegExp( "^([-+])=(" + core_pnum + ")", "i" ),
|
||||
elemdisplay = {},
|
||||
elemdisplay = { BODY: "block" },
|
||||
|
||||
cssShow = { position: "absolute", visibility: "hidden", display: "block" },
|
||||
cssNormalTransform = {
|
||||
|
@ -6814,7 +6827,9 @@ if ( window.getComputedStyle ) {
|
|||
|
||||
if ( computed ) {
|
||||
|
||||
ret = computed[ name ];
|
||||
// getPropertyValue is only needed for .css('filter') in IE9, see #12537
|
||||
ret = computed.getPropertyValue( name ) || computed[ name ];
|
||||
|
||||
if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
|
||||
ret = jQuery.style( elem, name );
|
||||
}
|
||||
|
@ -7843,9 +7858,12 @@ jQuery.extend({
|
|||
|
||||
// A cross-domain request is in order when we have a protocol:host:port mismatch
|
||||
if ( s.crossDomain == null ) {
|
||||
parts = rurl.exec( s.url.toLowerCase() ) || false;
|
||||
s.crossDomain = parts && ( parts.join(":") + ( parts[ 3 ] ? "" : parts[ 1 ] === "http:" ? 80 : 443 ) ) !==
|
||||
( ajaxLocParts.join(":") + ( ajaxLocParts[ 3 ] ? "" : ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) );
|
||||
parts = rurl.exec( s.url.toLowerCase() );
|
||||
s.crossDomain = !!( parts &&
|
||||
( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||
|
||||
( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) !=
|
||||
( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) )
|
||||
);
|
||||
}
|
||||
|
||||
// Convert data if not already a string
|
||||
|
@ -8464,7 +8482,7 @@ if ( jQuery.support.ajax ) {
|
|||
// on any attempt to access responseText (#11426)
|
||||
try {
|
||||
responses.text = xhr.responseText;
|
||||
} catch( _ ) {
|
||||
} catch( e ) {
|
||||
}
|
||||
|
||||
// Firefox throws an exception when accessing
|
||||
|
@ -8617,7 +8635,9 @@ function Animation( elem, properties, options ) {
|
|||
tick = function() {
|
||||
var currentTime = fxNow || createFxNow(),
|
||||
remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
|
||||
percent = 1 - ( remaining / animation.duration || 0 ),
|
||||
// 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;
|
||||
|
||||
|
@ -8769,7 +8789,7 @@ jQuery.Animation = jQuery.extend( Animation, {
|
|||
});
|
||||
|
||||
function defaultPrefilter( elem, props, opts ) {
|
||||
var index, prop, value, length, dataShow, tween, hooks, oldfire,
|
||||
var index, prop, value, length, dataShow, toggle, tween, hooks, oldfire,
|
||||
anim = this,
|
||||
style = elem.style,
|
||||
orig = {},
|
||||
|
@ -8843,6 +8863,7 @@ function defaultPrefilter( elem, props, opts ) {
|
|||
value = props[ index ];
|
||||
if ( rfxtypes.exec( value ) ) {
|
||||
delete props[ index ];
|
||||
toggle = toggle || value === "toggle";
|
||||
if ( value === ( hidden ? "hide" : "show" ) ) {
|
||||
continue;
|
||||
}
|
||||
|
@ -8853,6 +8874,14 @@ function defaultPrefilter( elem, props, opts ) {
|
|||
length = handled.length;
|
||||
if ( length ) {
|
||||
dataShow = jQuery._data( elem, "fxshow" ) || jQuery._data( elem, "fxshow", {} );
|
||||
if ( "hidden" in dataShow ) {
|
||||
hidden = dataShow.hidden;
|
||||
}
|
||||
|
||||
// store state if its toggle - enables .stop().toggle() to "reverse"
|
||||
if ( toggle ) {
|
||||
dataShow.hidden = !hidden;
|
||||
}
|
||||
if ( hidden ) {
|
||||
jQuery( elem ).show();
|
||||
} else {
|
||||
|
@ -9149,6 +9178,8 @@ jQuery.fx.tick = function() {
|
|||
timers = jQuery.timers,
|
||||
i = 0;
|
||||
|
||||
fxNow = jQuery.now();
|
||||
|
||||
for ( ; i < timers.length; i++ ) {
|
||||
timer = timers[ i ];
|
||||
// Checks the timer has not already been removed
|
||||
|
@ -9160,6 +9191,7 @@ jQuery.fx.tick = function() {
|
|||
if ( !timers.length ) {
|
||||
jQuery.fx.stop();
|
||||
}
|
||||
fxNow = undefined;
|
||||
};
|
||||
|
||||
jQuery.fx.timer = function( timer ) {
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -10,7 +10,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/// <reference path="Scripts/jquery-1.6.2.js" />
|
||||
/// <reference path="Scripts/jquery-1.6.4.js" />
|
||||
(function ($, window) {
|
||||
"use strict";
|
||||
|
||||
|
@ -35,6 +35,7 @@
|
|||
onReceived: "onReceived",
|
||||
onError: "onError",
|
||||
onConnectionSlow: "onConnectionSlow",
|
||||
onReconnecting: "onReconnecting",
|
||||
onReconnect: "onReconnect",
|
||||
onStateChanged: "onStateChanged",
|
||||
onDisconnect: "onDisconnect"
|
||||
|
@ -74,6 +75,7 @@
|
|||
changeState = function (connection, expectedState, newState) {
|
||||
if (expectedState === connection.state) {
|
||||
connection.state = newState;
|
||||
|
||||
$(connection).triggerHandler(events.onStateChanged, [{ oldState: expectedState, newState: newState }]);
|
||||
return true;
|
||||
}
|
||||
|
@ -83,6 +85,26 @@
|
|||
|
||||
isDisconnecting = function (connection) {
|
||||
return connection.state === signalR.connectionState.disconnected;
|
||||
},
|
||||
|
||||
configureStopReconnectingTimeout = function (connection) {
|
||||
var stopReconnectingTimeout,
|
||||
onReconnectTimeout = function (connection) {
|
||||
connection.log("Couldn't reconnect within the configured timeout (" + connection.disconnectTimeout + "ms), disconnecting.");
|
||||
connection.stop(/* async */ false, /* notifyServer */ false);
|
||||
};
|
||||
|
||||
connection.reconnecting(function () {
|
||||
var connection = this;
|
||||
stopReconnectingTimeout = window.setTimeout(function () { onReconnectTimeout(connection); }, connection.disconnectTimeout);
|
||||
});
|
||||
|
||||
connection.stateChanged(function (data) {
|
||||
if (data.oldState === signalR.connectionState.reconnecting) {
|
||||
// Clear the pending reconnect timeout check
|
||||
window.clearTimeout(stopReconnectingTimeout);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
signalR = function (url, qs, logging) {
|
||||
|
@ -123,14 +145,42 @@
|
|||
|
||||
_pageWindow.load(function () { _pageLoaded = true; });
|
||||
|
||||
function validateTransport(requestedTransport, connection) {
|
||||
/// <summary>Validates the requested transport by cross checking it with the pre-defined signalR.transports</summary>
|
||||
/// <param name="requestedTransport" type="Object">The designated transports that the user has specified.</param>
|
||||
/// <param name="connection" type="signalR">The connection that will be using the requested transports. Used for logging purposes.</param>
|
||||
/// <returns type="Object" />
|
||||
if ($.isArray(requestedTransport)) {
|
||||
// Go through transport array and remove an "invalid" tranports
|
||||
for (var i = requestedTransport.length - 1; i >= 0; i--) {
|
||||
var transport = requestedTransport[i];
|
||||
if ($.type(requestedTransport) !== "object" && ($.type(transport) !== "string" || !signalR.transports[transport])) {
|
||||
connection.log("Invalid transport: " + transport + ", removing it from the transports list.");
|
||||
requestedTransport.splice(i, 1);
|
||||
}
|
||||
}
|
||||
|
||||
// Verify we still have transports left, if we dont then we have invalid transports
|
||||
if (requestedTransport.length === 0) {
|
||||
connection.log("No transports remain within the specified transport array.");
|
||||
requestedTransport = null;
|
||||
}
|
||||
} else if ($.type(requestedTransport) !== "object" && !signalR.transports[requestedTransport] && requestedTransport !== "auto") {
|
||||
connection.log("Invalid transport: " + requestedTransport.toString());
|
||||
requestedTransport = null;
|
||||
}
|
||||
|
||||
return requestedTransport;
|
||||
}
|
||||
|
||||
signalR.fn = signalR.prototype = {
|
||||
init: function (url, qs, logging) {
|
||||
this.url = url;
|
||||
this.qs = qs;
|
||||
this.keepAliveData = {};
|
||||
if (typeof (logging) === "boolean") {
|
||||
this.logging = logging;
|
||||
}
|
||||
configureStopReconnectingTimeout(this);
|
||||
},
|
||||
|
||||
ajaxDataType: "json",
|
||||
|
@ -139,8 +189,14 @@
|
|||
|
||||
state: signalR.connectionState.disconnected,
|
||||
|
||||
groups: {},
|
||||
|
||||
keepAliveData: {},
|
||||
|
||||
reconnectDelay: 2000,
|
||||
|
||||
disconnectTimeout: 40000, // This should be set by the server in response to the negotiate request (40s default)
|
||||
|
||||
keepAliveTimeoutCount: 2,
|
||||
|
||||
keepAliveWarnAt: 2 / 3, // Warn user of slow connection if we breach the X% mark of the keep alive timeout
|
||||
|
@ -169,6 +225,13 @@
|
|||
}
|
||||
}
|
||||
|
||||
config.transport = validateTransport(config.transport, connection);
|
||||
|
||||
// If the transport is invalid throw an error and abort start
|
||||
if (!config.transport) {
|
||||
throw new Error("SignalR: Invalid transport(s) specified, aborting start.");
|
||||
}
|
||||
|
||||
// Check to see if start is being called prior to page load
|
||||
// If waitForPageLoad is true we then want to re-direct function call to the window load event
|
||||
if (!_pageLoaded && config.waitForPageLoad === true) {
|
||||
|
@ -307,6 +370,11 @@
|
|||
connection.id = res.ConnectionId;
|
||||
connection.webSocketServerUrl = res.WebSocketServerUrl;
|
||||
|
||||
// Once the server has labeled the PersistentConnection as Disconnected, we should stop attempting to reconnect
|
||||
// after res.DisconnectTimeout seconds.
|
||||
connection.disconnectTimeout = res.DisconnectTimeout * 1000; // in ms
|
||||
|
||||
|
||||
// If we have a keep alive
|
||||
if (res.KeepAlive) {
|
||||
// Convert to milliseconds
|
||||
|
@ -328,7 +396,7 @@
|
|||
keepAliveData.activated = false;
|
||||
}
|
||||
|
||||
if (!res.ProtocolVersion || res.ProtocolVersion !== "1.0") {
|
||||
if (!res.ProtocolVersion || res.ProtocolVersion !== "1.1") {
|
||||
$(connection).triggerHandler(events.onError, "SignalR: Incompatible protocol version.");
|
||||
deferred.reject("SignalR: Incompatible protocol version.");
|
||||
return;
|
||||
|
@ -457,6 +525,17 @@
|
|||
return connection;
|
||||
},
|
||||
|
||||
reconnecting: function (callback) {
|
||||
/// <summary>Adds a callback that will be invoked when the underlying transport begins reconnecting</summary>
|
||||
/// <param name="callback" type="Function">A callback function to execute when the connection enters a reconnecting state</param>
|
||||
/// <returns type="signalR" />
|
||||
var connection = this;
|
||||
$(connection).bind(events.onReconnecting, function (e, data) {
|
||||
callback.call(connection);
|
||||
});
|
||||
return connection;
|
||||
},
|
||||
|
||||
reconnected: function (callback) {
|
||||
/// <summary>Adds a callback that will be invoked when the underlying transport reconnects</summary>
|
||||
/// <param name="callback" type="Function">A callback function to execute when the connection is restored</param>
|
||||
|
@ -543,7 +622,8 @@
|
|||
"use strict";
|
||||
|
||||
var signalR = $.signalR,
|
||||
events = $.signalR.events;
|
||||
events = $.signalR.events,
|
||||
changeState = $.signalR.changeState;
|
||||
|
||||
signalR.transports = {};
|
||||
|
||||
|
@ -610,7 +690,8 @@
|
|||
/// <summary>Gets the url for making a GET based connect request</summary>
|
||||
var baseUrl = transport === "webSockets" ? "" : connection.baseUrl,
|
||||
url = baseUrl + connection.appRelativeUrl,
|
||||
qs = "transport=" + transport + "&connectionId=" + window.escape(connection.id);
|
||||
qs = "transport=" + transport + "&connectionId=" + window.escape(connection.id),
|
||||
groups = this.getGroups(connection);
|
||||
|
||||
if (connection.data) {
|
||||
qs += "&connectionData=" + window.escape(connection.data);
|
||||
|
@ -623,10 +704,10 @@
|
|||
url = url + "/reconnect";
|
||||
}
|
||||
if (connection.messageId) {
|
||||
qs += "&messageId=" + connection.messageId;
|
||||
qs += "&messageId=" + window.escape(connection.messageId);
|
||||
}
|
||||
if (connection.groups) {
|
||||
qs += "&groups=" + window.escape(JSON.stringify(connection.groups));
|
||||
if (groups.length !== 0) {
|
||||
qs += "&groups=" + window.escape(JSON.stringify(groups));
|
||||
}
|
||||
}
|
||||
url += "?" + qs;
|
||||
|
@ -635,6 +716,54 @@
|
|||
return url;
|
||||
},
|
||||
|
||||
maximizePersistentResponse: function (minPersistentResponse) {
|
||||
return {
|
||||
MessageId: minPersistentResponse.C,
|
||||
Messages: minPersistentResponse.M,
|
||||
Disconnect: typeof (minPersistentResponse.D) !== "undefined" ? true : false,
|
||||
TimedOut: typeof (minPersistentResponse.T) !== "undefined" ? true : false,
|
||||
LongPollDelay: minPersistentResponse.L,
|
||||
ResetGroups: minPersistentResponse.R,
|
||||
AddedGroups: minPersistentResponse.G,
|
||||
RemovedGroups: minPersistentResponse.g
|
||||
};
|
||||
},
|
||||
|
||||
updateGroups: function (connection, resetGroups, addedGroups, removedGroups) {
|
||||
// Use the keys in connection.groups object as a set of groups.
|
||||
// Prefix all group names with # so we don't conflict with the object's prototype or __proto__.
|
||||
function addGroups(groups) {
|
||||
$.each(groups, function (_, group) {
|
||||
connection.groups['#' + group] = true;
|
||||
});
|
||||
}
|
||||
|
||||
if (resetGroups) {
|
||||
connection.groups = {};
|
||||
addGroups(resetGroups);
|
||||
} else {
|
||||
if (addedGroups) {
|
||||
addGroups(addedGroups);
|
||||
}
|
||||
if (removedGroups) {
|
||||
$.each(removedGroups, function (_, group) {
|
||||
delete connection.groups['# ' + group];
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
getGroups: function (connection) {
|
||||
var groups = [];
|
||||
if (connection.groups) {
|
||||
$.each(connection.groups, function (group, _) {
|
||||
// Add keys from connection.groups without the # prefix
|
||||
groups.push(group.substr(1));
|
||||
});
|
||||
}
|
||||
return groups;
|
||||
},
|
||||
|
||||
ajaxSend: function (connection, data) {
|
||||
var url = connection.url + "/send" + "?transport=" + connection.transport.name + "&connectionId=" + window.escape(connection.id);
|
||||
url = this.addQs(url, connection);
|
||||
|
@ -687,7 +816,8 @@
|
|||
connection.log("Fired ajax abort async = " + async);
|
||||
},
|
||||
|
||||
processMessages: function (connection, data) {
|
||||
processMessages: function (connection, minData) {
|
||||
var data;
|
||||
// Transport can be null if we've just closed the connection
|
||||
if (connection.transport) {
|
||||
var $connection = $(connection);
|
||||
|
@ -698,10 +828,12 @@
|
|||
this.updateKeepAlive(connection);
|
||||
}
|
||||
|
||||
if (!data) {
|
||||
if (!minData) {
|
||||
return;
|
||||
}
|
||||
|
||||
data = this.maximizePersistentResponse(minData);
|
||||
|
||||
if (data.Disconnect) {
|
||||
connection.log("Disconnect command received from server");
|
||||
|
||||
|
@ -710,6 +842,8 @@
|
|||
return;
|
||||
}
|
||||
|
||||
this.updateGroups(connection, data.ResetGroups, data.AddedGroups, data.RemovedGroups);
|
||||
|
||||
if (data.Messages) {
|
||||
$.each(data.Messages, function () {
|
||||
try {
|
||||
|
@ -725,10 +859,6 @@
|
|||
if (data.MessageId) {
|
||||
connection.messageId = data.MessageId;
|
||||
}
|
||||
|
||||
if (data.TransportData) {
|
||||
connection.groups = data.TransportData.Groups;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -781,6 +911,15 @@
|
|||
connection.keepAliveData.lastKeepAlive = new Date();
|
||||
},
|
||||
|
||||
ensureReconnectingState: function (connection) {
|
||||
if (changeState(connection,
|
||||
signalR.connectionState.connected,
|
||||
signalR.connectionState.reconnecting) === true) {
|
||||
$(connection).triggerHandler(events.onReconnecting);
|
||||
}
|
||||
return connection.state === signalR.connectionState.reconnecting;
|
||||
},
|
||||
|
||||
foreverFrame: {
|
||||
count: 0,
|
||||
connections: {}
|
||||
|
@ -854,13 +993,10 @@
|
|||
|
||||
if (onSuccess) {
|
||||
onSuccess();
|
||||
}
|
||||
else {
|
||||
if (changeState(connection,
|
||||
signalR.connectionState.reconnecting,
|
||||
signalR.connectionState.connected) === true) {
|
||||
$connection.triggerHandler(events.onReconnect);
|
||||
}
|
||||
} else if (changeState(connection,
|
||||
signalR.connectionState.reconnecting,
|
||||
signalR.connectionState.connected) === true) {
|
||||
$connection.triggerHandler(events.onReconnect);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -897,7 +1033,8 @@
|
|||
$connection = $(connection);
|
||||
|
||||
if (data) {
|
||||
if ($.isEmptyObject(data) || data.Messages) {
|
||||
// data.M is PersistentResponse.Messages
|
||||
if ($.isEmptyObject(data) || data.M) {
|
||||
transportLogic.processMessages(connection, data);
|
||||
} else {
|
||||
// For websockets we need to trigger onReceived
|
||||
|
@ -922,16 +1059,11 @@
|
|||
that.stop(connection);
|
||||
}
|
||||
|
||||
if (connection.state === signalR.connectionState.reconnecting ||
|
||||
changeState(connection,
|
||||
signalR.connectionState.connected,
|
||||
signalR.connectionState.reconnecting) === true) {
|
||||
|
||||
if (transportLogic.ensureReconnectingState(connection)) {
|
||||
connection.log("Websocket reconnecting");
|
||||
that.start(connection);
|
||||
}
|
||||
},
|
||||
connection.reconnectDelay);
|
||||
}, connection.reconnectDelay);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -1064,14 +1196,11 @@
|
|||
|
||||
if (onSuccess) {
|
||||
onSuccess();
|
||||
}
|
||||
|
||||
if (reconnecting) {
|
||||
if (changeState(connection,
|
||||
signalR.connectionState.reconnecting,
|
||||
signalR.connectionState.connected) === true) {
|
||||
$connection.triggerHandler(events.onReconnect);
|
||||
}
|
||||
} else if (changeState(connection,
|
||||
signalR.connectionState.reconnecting,
|
||||
signalR.connectionState.connected) === true) {
|
||||
// If there's no onSuccess handler we assume this is a reconnect
|
||||
$connection.triggerHandler(events.onReconnect);
|
||||
}
|
||||
}
|
||||
}, false);
|
||||
|
@ -1122,15 +1251,10 @@
|
|||
that.reconnectTimeout = window.setTimeout(function () {
|
||||
that.stop(connection);
|
||||
|
||||
if (connection.state === signalR.connectionState.reconnecting ||
|
||||
changeState(connection,
|
||||
signalR.connectionState.connected,
|
||||
signalR.connectionState.reconnecting) === true) {
|
||||
if (transportLogic.ensureReconnectingState(connection)) {
|
||||
connection.log("EventSource reconnecting");
|
||||
|
||||
that.start(connection);
|
||||
}
|
||||
|
||||
}, connection.reconnectDelay);
|
||||
},
|
||||
|
||||
|
@ -1181,13 +1305,12 @@
|
|||
var that = this,
|
||||
frameId = (transportLogic.foreverFrame.count += 1),
|
||||
url,
|
||||
connectTimeOut,
|
||||
frame = $("<iframe data-signalr-connection-id='" + connection.id + "' style='position:absolute;top:0;left:0;width:0;height:0;visibility:hidden;' src=''></iframe>");
|
||||
|
||||
if (window.EventSource) {
|
||||
// If the browser supports SSE, don't use Forever Frame
|
||||
if (onFailed) {
|
||||
connection.log("This brower supports SSE, skipping Forever Frame.");
|
||||
connection.log("This browser supports SSE, skipping Forever Frame.");
|
||||
onFailed();
|
||||
}
|
||||
return;
|
||||
|
@ -1222,8 +1345,7 @@
|
|||
|
||||
// After connecting, if after the specified timeout there's no response stop the connection
|
||||
// and raise on failed
|
||||
// REVIEW: Why is connectTimeOut set here and never used again?
|
||||
connectTimeOut = window.setTimeout(function () {
|
||||
window.setTimeout(function () {
|
||||
if (connection.onSuccess) {
|
||||
connection.log("Failed to connect using forever frame source, it timed out after " + that.timeOut + "ms.");
|
||||
that.stop(connection);
|
||||
|
@ -1238,21 +1360,12 @@
|
|||
reconnect: function (connection) {
|
||||
var that = this;
|
||||
window.setTimeout(function () {
|
||||
if (!connection.frame) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (connection.state === signalR.connectionState.reconnecting ||
|
||||
changeState(connection,
|
||||
signalR.connectionState.connected,
|
||||
signalR.connectionState.reconnecting) === true) {
|
||||
|
||||
if (connection.frame && transportLogic.ensureReconnectingState(connection)) {
|
||||
var frame = connection.frame,
|
||||
src = transportLogic.getUrl(connection, that.name, true) + "&frameId=" + connection.frameId;
|
||||
connection.log("Upating iframe src to '" + src + "'.");
|
||||
src = transportLogic.getUrl(connection, that.name, true) + "&frameId=" + connection.frameId;
|
||||
connection.log("Updating iframe src to '" + src + "'.");
|
||||
frame.src = src;
|
||||
}
|
||||
|
||||
}, connection.reconnectDelay);
|
||||
},
|
||||
|
||||
|
@ -1285,9 +1398,15 @@
|
|||
if (connection.frame.stop) {
|
||||
connection.frame.stop();
|
||||
} else {
|
||||
cw = connection.frame.contentWindow || connection.frame.contentDocument;
|
||||
if (cw.document && cw.document.execCommand) {
|
||||
cw.document.execCommand("Stop");
|
||||
try
|
||||
{
|
||||
cw = connection.frame.contentWindow || connection.frame.contentDocument;
|
||||
if (cw.document && cw.document.execCommand) {
|
||||
cw.document.execCommand("Stop");
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
connection.log("SignalR: Error occured when stopping foreverFrame transport. Message = " + e.message);
|
||||
}
|
||||
}
|
||||
$(connection.frame).remove();
|
||||
|
@ -1313,14 +1432,11 @@
|
|||
connection.onSuccess();
|
||||
connection.onSuccess = null;
|
||||
delete connection.onSuccess;
|
||||
}
|
||||
else {
|
||||
if (changeState(connection,
|
||||
signalR.connectionState.reconnecting,
|
||||
signalR.connectionState.connected) === true) {
|
||||
// If there's no onSuccess handler we assume this is a reconnect
|
||||
$(connection).triggerHandler(events.onReconnect);
|
||||
}
|
||||
} else if (changeState(connection,
|
||||
signalR.connectionState.reconnecting,
|
||||
signalR.connectionState.connected) === true) {
|
||||
// If there's no onSuccess handler we assume this is a reconnect
|
||||
$(connection).triggerHandler(events.onReconnect);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -1363,21 +1479,30 @@
|
|||
|
||||
window.setTimeout(function () {
|
||||
(function poll(instance, raiseReconnect) {
|
||||
|
||||
var messageId = instance.messageId,
|
||||
connect = (messageId === null),
|
||||
reconnecting = !connect,
|
||||
url = transportLogic.getUrl(instance, that.name, reconnecting, raiseReconnect),
|
||||
reconnectTimeOut = null,
|
||||
reconnectFired = false;
|
||||
reconnectFired = false,
|
||||
triggerReconnected = function () {
|
||||
// Fire the reconnect event if it hasn't been fired as yet
|
||||
if (reconnectFired === false) {
|
||||
connection.log("Raising the reconnect event");
|
||||
|
||||
if (reconnecting === true && raiseReconnect === true) {
|
||||
if (connection.state !== signalR.connectionState.reconnecting &&
|
||||
changeState(connection,
|
||||
signalR.connectionState.connected,
|
||||
signalR.connectionState.reconnecting) === false) {
|
||||
return;
|
||||
}
|
||||
if (changeState(connection,
|
||||
signalR.connectionState.reconnecting,
|
||||
signalR.connectionState.connected) === true) {
|
||||
|
||||
$(instance).triggerHandler(events.onReconnect);
|
||||
reconnectFired = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if (reconnecting === true && raiseReconnect === true &&
|
||||
!transportLogic.ensureReconnectingState(connection)) {
|
||||
return;
|
||||
}
|
||||
|
||||
connection.log("Attempting to connect to '" + url + "' using longPolling.");
|
||||
|
@ -1387,9 +1512,14 @@
|
|||
cache: false,
|
||||
type: "GET",
|
||||
dataType: connection.ajaxDataType,
|
||||
success: function (data) {
|
||||
success: function (minData) {
|
||||
var delay = 0,
|
||||
timedOutReceived = false;
|
||||
timedOutReceived = false,
|
||||
data;
|
||||
|
||||
if (minData) {
|
||||
data = transportLogic.maximizePersistentResponse(minData);
|
||||
}
|
||||
|
||||
if (initialConnectFired === false) {
|
||||
onSuccess();
|
||||
|
@ -1397,25 +1527,13 @@
|
|||
}
|
||||
|
||||
if (raiseReconnect === true) {
|
||||
// Fire the reconnect event if it hasn't been fired as yet
|
||||
if (reconnectFired === false) {
|
||||
connection.log("Raising the reconnect event");
|
||||
|
||||
if (changeState(connection,
|
||||
signalR.connectionState.reconnecting,
|
||||
signalR.connectionState.connected) === true) {
|
||||
|
||||
$(instance).triggerHandler(events.onReconnect);
|
||||
reconnectFired = true;
|
||||
}
|
||||
}
|
||||
triggerReconnected();
|
||||
}
|
||||
|
||||
transportLogic.processMessages(instance, data);
|
||||
transportLogic.processMessages(instance, minData);
|
||||
if (data &&
|
||||
data.TransportData &&
|
||||
$.type(data.TransportData.LongPollDelay) === "number") {
|
||||
delay = data.TransportData.LongPollDelay;
|
||||
$.type(data.LongPollDelay) === "number") {
|
||||
delay = data.LongPollDelay;
|
||||
}
|
||||
|
||||
if (data && data.TimedOut) {
|
||||
|
@ -1445,15 +1563,14 @@
|
|||
return;
|
||||
}
|
||||
|
||||
connection.log("An error occurred using longPolling. Status = " + textStatus + ". " + data.responseText);
|
||||
|
||||
if (reconnectTimeOut) {
|
||||
// If the request failed then we clear the timeout so that the
|
||||
// reconnect event doesn't get fired
|
||||
window.clearTimeout(reconnectTimeOut);
|
||||
if (connection.state !== signalR.connectionState.reconnecting) {
|
||||
connection.log("An error occurred using longPolling. Status = " + textStatus + ". " + data.responseText);
|
||||
$(instance).triggerHandler(events.onError, [data.responseText]);
|
||||
}
|
||||
|
||||
$(instance).triggerHandler(events.onError, [data.responseText]);
|
||||
// If the request failed then we clear the timeout so that the
|
||||
// reconnect event doesn't get fired
|
||||
window.clearTimeout(reconnectTimeOut);
|
||||
|
||||
window.setTimeout(function () {
|
||||
if (isDisconnecting(instance) === false) {
|
||||
|
@ -1464,18 +1581,7 @@
|
|||
});
|
||||
|
||||
if (raiseReconnect === true) {
|
||||
reconnectTimeOut = window.setTimeout(function () {
|
||||
if (reconnectFired === false) {
|
||||
if (changeState(connection,
|
||||
signalR.connectionState.reconnecting,
|
||||
signalR.connectionState.connected) === true) {
|
||||
|
||||
$(instance).triggerHandler(events.onReconnect);
|
||||
reconnectFired = true;
|
||||
}
|
||||
}
|
||||
},
|
||||
that.reconnectDelay);
|
||||
reconnectTimeOut = window.setTimeout(triggerReconnected, that.reconnectDelay);
|
||||
}
|
||||
|
||||
}(connection));
|
||||
|
@ -1658,11 +1764,13 @@
|
|||
var self = this,
|
||||
args = $.makeArray(arguments).slice(1),
|
||||
argValues = args.map(getArgValue),
|
||||
data = { hub: self.hubName, method: methodName, args: argValues, state: self.state, id: callbackId },
|
||||
data = { H: self.hubName, M: methodName, A: argValues, I: callbackId },
|
||||
d = $.Deferred(),
|
||||
callback = function (result) {
|
||||
callback = function (minResult) {
|
||||
var result = self._maximizeHubResponse(minResult);
|
||||
|
||||
// Update the hub state
|
||||
$.extend(this.state, result.State);
|
||||
$.extend(self.state, result.State);
|
||||
|
||||
if (result.Error) {
|
||||
// Server hub method threw an exception, log it & reject the deferred
|
||||
|
@ -1678,9 +1786,24 @@
|
|||
|
||||
callbacks[callbackId.toString()] = { scope: self, method: callback };
|
||||
callbackId += 1;
|
||||
|
||||
if (!$.isEmptyObject(self.state)) {
|
||||
data.S = self.state;
|
||||
}
|
||||
|
||||
self.connection.send(window.JSON.stringify(data));
|
||||
|
||||
return d.promise();
|
||||
},
|
||||
|
||||
_maximizeHubResponse: function (minHubResponse) {
|
||||
return {
|
||||
State: minHubResponse.S,
|
||||
Result: minHubResponse.R,
|
||||
Id: minHubResponse.I,
|
||||
Error: minHubResponse.E,
|
||||
StackTrace: minHubResponse.T
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1724,15 +1847,15 @@
|
|||
connection.proxies = {};
|
||||
|
||||
// Wire up the received handler
|
||||
connection.received(function (data) {
|
||||
var proxy, dataCallbackId, callback, hubName, eventName;
|
||||
if (!data) {
|
||||
connection.received(function (minData) {
|
||||
var data, proxy, dataCallbackId, callback, hubName, eventName;
|
||||
if (!minData) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof (data.Id) !== "undefined") {
|
||||
if (typeof (minData.I) !== "undefined") {
|
||||
// We received the return value from a server method invocation, look up callback by id and call it
|
||||
dataCallbackId = data.Id.toString();
|
||||
dataCallbackId = minData.I.toString();
|
||||
callback = callbacks[dataCallbackId];
|
||||
if (callback) {
|
||||
// Delete the callback from the proxy
|
||||
|
@ -1740,9 +1863,11 @@
|
|||
delete callbacks[dataCallbackId];
|
||||
|
||||
// Invoke the callback
|
||||
callback.method.call(callback.scope, data);
|
||||
callback.method.call(callback.scope, minData);
|
||||
}
|
||||
} else {
|
||||
data = this._maximizeClientHubInvocation(minData);
|
||||
|
||||
// We received a client invocation request, i.e. broadcast from server hub
|
||||
connection.log("Triggering client hub event '" + data.Method + "' on hub '" + data.Hub + "'.");
|
||||
|
||||
|
@ -1760,6 +1885,15 @@
|
|||
});
|
||||
};
|
||||
|
||||
hubConnection.fn._maximizeClientHubInvocation = function (minClientHubInvocation) {
|
||||
return {
|
||||
Hub: minClientHubInvocation.H,
|
||||
Method: minClientHubInvocation.M,
|
||||
Args: minClientHubInvocation.A,
|
||||
State: minClientHubInvocation.S
|
||||
};
|
||||
};
|
||||
|
||||
hubConnection.fn._registerSubscribedHubs = function () {
|
||||
/// <summary>
|
||||
/// Sets the starting event to loop through the known hubs and register any new hubs
|
||||
|
@ -1812,3 +1946,11 @@
|
|||
$.hubConnection = hubConnection;
|
||||
|
||||
}(window.jQuery, window));
|
||||
/* jquery.signalR.version.js */
|
||||
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.md in the project root for license information.
|
||||
|
||||
/*global window:false */
|
||||
/// <reference path="jquery.signalR.core.js" />
|
||||
(function ($) {
|
||||
$.signalR.version = "1.0.0.rc1";
|
||||
}(window.jQuery));
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -19,7 +19,7 @@
|
|||
</section>
|
||||
}
|
||||
@section scripts {
|
||||
<script src="~/Scripts/jquery.signalR-1.0.0-alpha2.min.js"></script>
|
||||
<script src="~/Scripts/jquery.signalR-1.0.0-rc1.min.js"></script>
|
||||
<script src="~/signalR/hubs"></script>
|
||||
<script>
|
||||
$(function () {
|
||||
|
|
|
@ -61,6 +61,10 @@
|
|||
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
|
||||
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Owin.Host.SystemWeb" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-1.0.0.0" newVersion="1.0.0.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<entityFramework>
|
||||
|
|
|
@ -7,18 +7,18 @@
|
|||
<package id="DotNetOpenAuth.OpenId.Core" version="4.0.3.12153" targetFramework="net45" />
|
||||
<package id="DotNetOpenAuth.OpenId.RelyingParty" version="4.0.3.12153" targetFramework="net45" />
|
||||
<package id="EntityFramework" version="5.0.0" targetFramework="net45" />
|
||||
<package id="jQuery" version="1.7.1.1" targetFramework="net45" />
|
||||
<package id="jQuery" version="1.8.3" targetFramework="net45" />
|
||||
<package id="jQuery.UI.Combined" version="1.8.20.1" targetFramework="net45" />
|
||||
<package id="jQuery.Validation" version="1.9.0.1" targetFramework="net45" />
|
||||
<package id="knockoutjs" version="2.1.0" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.Mvc" version="4.0.20710.0" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.Mvc.FixedDisplayModes" version="1.0.0" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.Razor" version="2.0.20715.0" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.SignalR" version="1.0.0-alpha2" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.SignalR.Core" version="1.0.0-alpha2" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.SignalR.Hosting.AspNet" version="1.0.0-alpha2" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.SignalR.Hosting.Common" version="1.0.0-alpha2" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.SignalR.JS" version="1.0.0-alpha2" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.SignalR" version="1.0.0-rc1" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.SignalR.Core" version="1.0.0-rc1" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.SignalR.JS" version="1.0.0-rc1" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.SignalR.Owin" version="1.0.0-rc1" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.SignalR.SystemWeb" version="1.0.0-rc1" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.Web.Optimization" version="1.0.0" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.WebApi" version="4.0.20710.0" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.WebApi.Client" version="4.0.20710.0" targetFramework="net45" />
|
||||
|
@ -35,9 +35,11 @@
|
|||
<package id="Microsoft.jQuery.Unobtrusive.Ajax" version="2.0.20710.0" targetFramework="net45" />
|
||||
<package id="Microsoft.jQuery.Unobtrusive.Validation" version="2.0.20710.0" targetFramework="net45" />
|
||||
<package id="Microsoft.Net.Http" version="2.0.20710.0" targetFramework="net45" />
|
||||
<package id="Microsoft.Owin.Host.SystemWeb" version="1.0.0-rc1" targetFramework="net45" />
|
||||
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net45" />
|
||||
<package id="Modernizr" version="2.5.3" targetFramework="net45" />
|
||||
<package id="Newtonsoft.Json" version="4.5.11" targetFramework="net45" />
|
||||
<package id="Owin" version="1.0" targetFramework="net45" />
|
||||
<package id="System.Spatial" version="5.1.0-rc2" targetFramework="net45" />
|
||||
<package id="WebGrease" version="1.1.0" targetFramework="net45" />
|
||||
</packages>
|
|
@ -1,7 +1,6 @@
|
|||
using System.Web;
|
||||
using System.Web.Routing;
|
||||
using Microsoft.AspNet.SignalR;
|
||||
using Microsoft.AspNet.SignalR.Hosting.AspNet;
|
||||
|
||||
[assembly: PreApplicationStartMethod(typeof(Samples.RegisterHubs), "Start")]
|
||||
|
||||
|
|
|
@ -40,19 +40,30 @@
|
|||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.AspNet.SignalR.Core">
|
||||
<HintPath>..\packages\Microsoft.AspNet.SignalR.Core.1.0.0-alpha2\lib\net40\Microsoft.AspNet.SignalR.Core.dll</HintPath>
|
||||
<Reference Include="Microsoft.AspNet.SignalR.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Microsoft.AspNet.SignalR.Core.1.0.0-rc1\lib\net40\Microsoft.AspNet.SignalR.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.AspNet.SignalR.Hosting.AspNet">
|
||||
<HintPath>..\packages\Microsoft.AspNet.SignalR.Hosting.AspNet.1.0.0-alpha2\lib\net45\Microsoft.AspNet.SignalR.Hosting.AspNet.dll</HintPath>
|
||||
<Reference Include="Microsoft.AspNet.SignalR.Owin">
|
||||
<HintPath>..\packages\Microsoft.AspNet.SignalR.Owin.1.0.0-rc1\lib\net45\Microsoft.AspNet.SignalR.Owin.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.AspNet.SignalR.Hosting.Common">
|
||||
<HintPath>..\packages\Microsoft.AspNet.SignalR.Hosting.Common.1.0.0-alpha2\lib\net40\Microsoft.AspNet.SignalR.Hosting.Common.dll</HintPath>
|
||||
<Reference Include="Microsoft.AspNet.SignalR.SystemWeb">
|
||||
<HintPath>..\packages\Microsoft.AspNet.SignalR.SystemWeb.1.0.0-rc1\lib\net45\Microsoft.AspNet.SignalR.SystemWeb.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="Microsoft.Owin.Host.SystemWeb">
|
||||
<HintPath>..\packages\Microsoft.Owin.Host.SystemWeb.1.0.0-rc1\lib\net45\Microsoft.Owin.Host.SystemWeb.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<Private>True</Private>
|
||||
<HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json">
|
||||
<HintPath>..\packages\Newtonsoft.Json.4.5.11\lib\net40\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Owin">
|
||||
<HintPath>..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.DynamicData" />
|
||||
<Reference Include="System.Web.Entity" />
|
||||
<Reference Include="System.Web.ApplicationServices" />
|
||||
|
@ -73,11 +84,11 @@
|
|||
<ItemGroup>
|
||||
<Content Include="chat-tracking.html" />
|
||||
<Content Include="index.html" />
|
||||
<None Include="Scripts\jquery-1.8.2.intellisense.js" />
|
||||
<Content Include="Scripts\jquery-1.8.2.js" />
|
||||
<Content Include="Scripts\jquery-1.8.2.min.js" />
|
||||
<Content Include="Scripts\jquery.signalR-1.0.0-alpha2.js" />
|
||||
<Content Include="Scripts\jquery.signalR-1.0.0-alpha2.min.js" />
|
||||
<None Include="Scripts\jquery-1.8.3.intellisense.js" />
|
||||
<Content Include="Scripts\jquery-1.8.3.js" />
|
||||
<Content Include="Scripts\jquery-1.8.3.min.js" />
|
||||
<Content Include="Scripts\jquery.signalR-1.0.0-rc1.js" />
|
||||
<Content Include="Scripts\jquery.signalR-1.0.0-rc1.min.js" />
|
||||
<Content Include="Web.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -1,31 +1,3 @@
|
|||
/*!
|
||||
* Documentation Content
|
||||
* Copyright (c) 2009 Packt Publishing, http://packtpub.com/
|
||||
* Copyright (c) 2012 jQuery Foundation, http://jquery.org/
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals. For exact contribution history, see the revision history
|
||||
* and logs, available at http://github.com/jquery/api.jquery.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
intellisense.annotate(jQuery, {
|
||||
'ajax': function() {
|
||||
/// <signature>
|
||||
|
@ -101,7 +73,6 @@ intellisense.annotate(jQuery, {
|
|||
/// <summary>Execute the next function on the queue for the matched element.</summary>
|
||||
/// <param name="element" type="Element">A DOM element from which to remove and execute a queued function.</param>
|
||||
/// <param name="queueName" type="String">A string containing the name of the queue. Defaults to fx, the standard effects queue.</param>
|
||||
/// <returns type="jQuery" />
|
||||
/// </signature>
|
||||
},
|
||||
'each': function() {
|
||||
|
@ -462,6 +433,7 @@ intellisense.annotate(_object, {
|
|||
|
||||
return _object;
|
||||
};
|
||||
intellisense.redirectDefinition(jQuery.Callbacks, _1228819969);
|
||||
|
||||
var _731531622 = jQuery.Deferred;
|
||||
jQuery.Deferred = function(func) {
|
||||
|
@ -596,6 +568,7 @@ intellisense.annotate(_object, {
|
|||
|
||||
return _object;
|
||||
};
|
||||
intellisense.redirectDefinition(jQuery.Callbacks, _731531622);
|
||||
|
||||
intellisense.annotate(jQuery.Event.prototype, {
|
||||
'currentTarget': function() {
|
||||
|
@ -783,7 +756,7 @@ intellisense.annotate(jQuery.fn, {
|
|||
/// <signature>
|
||||
/// <summary>Perform a custom animation of a set of CSS properties.</summary>
|
||||
/// <param name="properties" type="Object">A map of CSS properties that the animation will move toward.</param>
|
||||
/// <param name="options" type="Object">A map of additional options to pass to the method. Supported keys: duration: A string or number determining how long the animation will run.easing: A string indicating which easing function to use for the transition.complete: A function to call once the animation is complete.step: A function to be called after each step of the animation.queue: A Boolean indicating whether to place the animation in the effects queue. If false, the animation will begin immediately. As of jQuery 1.7, the queue option can also accept a string, in which case the animation is added to the queue represented by that string.specialEasing: A map of one or more of the CSS properties defined by the properties argument and their corresponding easing functions (added 1.4).</param>
|
||||
/// <param name="options" type="Object">A map of additional options to pass to the method. Supported keys: duration: A string or number determining how long the animation will run.easing: A string indicating which easing function to use for the transition.complete: A function to call once the animation is complete.step: A function to be called after each step of the animation.queue: A Boolean indicating whether to place the animation in the effects queue. If false, the animation will begin immediately. As of jQuery 1.7, the queue option can also accept a string, in which case the animation is added to the queue represented by that string.specialEasing: A map of one or more of the CSS properties defined by the properties argument and their corresponding easing functions (added 1.4).</param>
|
||||
/// <returns type="jQuery" />
|
||||
/// </signature>
|
||||
},
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -10,7 +10,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/// <reference path="Scripts/jquery-1.6.2.js" />
|
||||
/// <reference path="Scripts/jquery-1.6.4.js" />
|
||||
(function ($, window) {
|
||||
"use strict";
|
||||
|
||||
|
@ -35,6 +35,7 @@
|
|||
onReceived: "onReceived",
|
||||
onError: "onError",
|
||||
onConnectionSlow: "onConnectionSlow",
|
||||
onReconnecting: "onReconnecting",
|
||||
onReconnect: "onReconnect",
|
||||
onStateChanged: "onStateChanged",
|
||||
onDisconnect: "onDisconnect"
|
||||
|
@ -74,6 +75,7 @@
|
|||
changeState = function (connection, expectedState, newState) {
|
||||
if (expectedState === connection.state) {
|
||||
connection.state = newState;
|
||||
|
||||
$(connection).triggerHandler(events.onStateChanged, [{ oldState: expectedState, newState: newState }]);
|
||||
return true;
|
||||
}
|
||||
|
@ -83,6 +85,26 @@
|
|||
|
||||
isDisconnecting = function (connection) {
|
||||
return connection.state === signalR.connectionState.disconnected;
|
||||
},
|
||||
|
||||
configureStopReconnectingTimeout = function (connection) {
|
||||
var stopReconnectingTimeout,
|
||||
onReconnectTimeout = function (connection) {
|
||||
connection.log("Couldn't reconnect within the configured timeout (" + connection.disconnectTimeout + "ms), disconnecting.");
|
||||
connection.stop(/* async */ false, /* notifyServer */ false);
|
||||
};
|
||||
|
||||
connection.reconnecting(function () {
|
||||
var connection = this;
|
||||
stopReconnectingTimeout = window.setTimeout(function () { onReconnectTimeout(connection); }, connection.disconnectTimeout);
|
||||
});
|
||||
|
||||
connection.stateChanged(function (data) {
|
||||
if (data.oldState === signalR.connectionState.reconnecting) {
|
||||
// Clear the pending reconnect timeout check
|
||||
window.clearTimeout(stopReconnectingTimeout);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
signalR = function (url, qs, logging) {
|
||||
|
@ -123,14 +145,42 @@
|
|||
|
||||
_pageWindow.load(function () { _pageLoaded = true; });
|
||||
|
||||
function validateTransport(requestedTransport, connection) {
|
||||
/// <summary>Validates the requested transport by cross checking it with the pre-defined signalR.transports</summary>
|
||||
/// <param name="requestedTransport" type="Object">The designated transports that the user has specified.</param>
|
||||
/// <param name="connection" type="signalR">The connection that will be using the requested transports. Used for logging purposes.</param>
|
||||
/// <returns type="Object" />
|
||||
if ($.isArray(requestedTransport)) {
|
||||
// Go through transport array and remove an "invalid" tranports
|
||||
for (var i = requestedTransport.length - 1; i >= 0; i--) {
|
||||
var transport = requestedTransport[i];
|
||||
if ($.type(requestedTransport) !== "object" && ($.type(transport) !== "string" || !signalR.transports[transport])) {
|
||||
connection.log("Invalid transport: " + transport + ", removing it from the transports list.");
|
||||
requestedTransport.splice(i, 1);
|
||||
}
|
||||
}
|
||||
|
||||
// Verify we still have transports left, if we dont then we have invalid transports
|
||||
if (requestedTransport.length === 0) {
|
||||
connection.log("No transports remain within the specified transport array.");
|
||||
requestedTransport = null;
|
||||
}
|
||||
} else if ($.type(requestedTransport) !== "object" && !signalR.transports[requestedTransport] && requestedTransport !== "auto") {
|
||||
connection.log("Invalid transport: " + requestedTransport.toString());
|
||||
requestedTransport = null;
|
||||
}
|
||||
|
||||
return requestedTransport;
|
||||
}
|
||||
|
||||
signalR.fn = signalR.prototype = {
|
||||
init: function (url, qs, logging) {
|
||||
this.url = url;
|
||||
this.qs = qs;
|
||||
this.keepAliveData = {};
|
||||
if (typeof (logging) === "boolean") {
|
||||
this.logging = logging;
|
||||
}
|
||||
configureStopReconnectingTimeout(this);
|
||||
},
|
||||
|
||||
ajaxDataType: "json",
|
||||
|
@ -139,8 +189,14 @@
|
|||
|
||||
state: signalR.connectionState.disconnected,
|
||||
|
||||
groups: {},
|
||||
|
||||
keepAliveData: {},
|
||||
|
||||
reconnectDelay: 2000,
|
||||
|
||||
disconnectTimeout: 40000, // This should be set by the server in response to the negotiate request (40s default)
|
||||
|
||||
keepAliveTimeoutCount: 2,
|
||||
|
||||
keepAliveWarnAt: 2 / 3, // Warn user of slow connection if we breach the X% mark of the keep alive timeout
|
||||
|
@ -169,6 +225,13 @@
|
|||
}
|
||||
}
|
||||
|
||||
config.transport = validateTransport(config.transport, connection);
|
||||
|
||||
// If the transport is invalid throw an error and abort start
|
||||
if (!config.transport) {
|
||||
throw new Error("SignalR: Invalid transport(s) specified, aborting start.");
|
||||
}
|
||||
|
||||
// Check to see if start is being called prior to page load
|
||||
// If waitForPageLoad is true we then want to re-direct function call to the window load event
|
||||
if (!_pageLoaded && config.waitForPageLoad === true) {
|
||||
|
@ -307,6 +370,11 @@
|
|||
connection.id = res.ConnectionId;
|
||||
connection.webSocketServerUrl = res.WebSocketServerUrl;
|
||||
|
||||
// Once the server has labeled the PersistentConnection as Disconnected, we should stop attempting to reconnect
|
||||
// after res.DisconnectTimeout seconds.
|
||||
connection.disconnectTimeout = res.DisconnectTimeout * 1000; // in ms
|
||||
|
||||
|
||||
// If we have a keep alive
|
||||
if (res.KeepAlive) {
|
||||
// Convert to milliseconds
|
||||
|
@ -328,7 +396,7 @@
|
|||
keepAliveData.activated = false;
|
||||
}
|
||||
|
||||
if (!res.ProtocolVersion || res.ProtocolVersion !== "1.0") {
|
||||
if (!res.ProtocolVersion || res.ProtocolVersion !== "1.1") {
|
||||
$(connection).triggerHandler(events.onError, "SignalR: Incompatible protocol version.");
|
||||
deferred.reject("SignalR: Incompatible protocol version.");
|
||||
return;
|
||||
|
@ -457,6 +525,17 @@
|
|||
return connection;
|
||||
},
|
||||
|
||||
reconnecting: function (callback) {
|
||||
/// <summary>Adds a callback that will be invoked when the underlying transport begins reconnecting</summary>
|
||||
/// <param name="callback" type="Function">A callback function to execute when the connection enters a reconnecting state</param>
|
||||
/// <returns type="signalR" />
|
||||
var connection = this;
|
||||
$(connection).bind(events.onReconnecting, function (e, data) {
|
||||
callback.call(connection);
|
||||
});
|
||||
return connection;
|
||||
},
|
||||
|
||||
reconnected: function (callback) {
|
||||
/// <summary>Adds a callback that will be invoked when the underlying transport reconnects</summary>
|
||||
/// <param name="callback" type="Function">A callback function to execute when the connection is restored</param>
|
||||
|
@ -543,7 +622,8 @@
|
|||
"use strict";
|
||||
|
||||
var signalR = $.signalR,
|
||||
events = $.signalR.events;
|
||||
events = $.signalR.events,
|
||||
changeState = $.signalR.changeState;
|
||||
|
||||
signalR.transports = {};
|
||||
|
||||
|
@ -610,7 +690,8 @@
|
|||
/// <summary>Gets the url for making a GET based connect request</summary>
|
||||
var baseUrl = transport === "webSockets" ? "" : connection.baseUrl,
|
||||
url = baseUrl + connection.appRelativeUrl,
|
||||
qs = "transport=" + transport + "&connectionId=" + window.escape(connection.id);
|
||||
qs = "transport=" + transport + "&connectionId=" + window.escape(connection.id),
|
||||
groups = this.getGroups(connection);
|
||||
|
||||
if (connection.data) {
|
||||
qs += "&connectionData=" + window.escape(connection.data);
|
||||
|
@ -623,10 +704,10 @@
|
|||
url = url + "/reconnect";
|
||||
}
|
||||
if (connection.messageId) {
|
||||
qs += "&messageId=" + connection.messageId;
|
||||
qs += "&messageId=" + window.escape(connection.messageId);
|
||||
}
|
||||
if (connection.groups) {
|
||||
qs += "&groups=" + window.escape(JSON.stringify(connection.groups));
|
||||
if (groups.length !== 0) {
|
||||
qs += "&groups=" + window.escape(JSON.stringify(groups));
|
||||
}
|
||||
}
|
||||
url += "?" + qs;
|
||||
|
@ -635,6 +716,54 @@
|
|||
return url;
|
||||
},
|
||||
|
||||
maximizePersistentResponse: function (minPersistentResponse) {
|
||||
return {
|
||||
MessageId: minPersistentResponse.C,
|
||||
Messages: minPersistentResponse.M,
|
||||
Disconnect: typeof (minPersistentResponse.D) !== "undefined" ? true : false,
|
||||
TimedOut: typeof (minPersistentResponse.T) !== "undefined" ? true : false,
|
||||
LongPollDelay: minPersistentResponse.L,
|
||||
ResetGroups: minPersistentResponse.R,
|
||||
AddedGroups: minPersistentResponse.G,
|
||||
RemovedGroups: minPersistentResponse.g
|
||||
};
|
||||
},
|
||||
|
||||
updateGroups: function (connection, resetGroups, addedGroups, removedGroups) {
|
||||
// Use the keys in connection.groups object as a set of groups.
|
||||
// Prefix all group names with # so we don't conflict with the object's prototype or __proto__.
|
||||
function addGroups(groups) {
|
||||
$.each(groups, function (_, group) {
|
||||
connection.groups['#' + group] = true;
|
||||
});
|
||||
}
|
||||
|
||||
if (resetGroups) {
|
||||
connection.groups = {};
|
||||
addGroups(resetGroups);
|
||||
} else {
|
||||
if (addedGroups) {
|
||||
addGroups(addedGroups);
|
||||
}
|
||||
if (removedGroups) {
|
||||
$.each(removedGroups, function (_, group) {
|
||||
delete connection.groups['# ' + group];
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
getGroups: function (connection) {
|
||||
var groups = [];
|
||||
if (connection.groups) {
|
||||
$.each(connection.groups, function (group, _) {
|
||||
// Add keys from connection.groups without the # prefix
|
||||
groups.push(group.substr(1));
|
||||
});
|
||||
}
|
||||
return groups;
|
||||
},
|
||||
|
||||
ajaxSend: function (connection, data) {
|
||||
var url = connection.url + "/send" + "?transport=" + connection.transport.name + "&connectionId=" + window.escape(connection.id);
|
||||
url = this.addQs(url, connection);
|
||||
|
@ -687,7 +816,8 @@
|
|||
connection.log("Fired ajax abort async = " + async);
|
||||
},
|
||||
|
||||
processMessages: function (connection, data) {
|
||||
processMessages: function (connection, minData) {
|
||||
var data;
|
||||
// Transport can be null if we've just closed the connection
|
||||
if (connection.transport) {
|
||||
var $connection = $(connection);
|
||||
|
@ -698,10 +828,12 @@
|
|||
this.updateKeepAlive(connection);
|
||||
}
|
||||
|
||||
if (!data) {
|
||||
if (!minData) {
|
||||
return;
|
||||
}
|
||||
|
||||
data = this.maximizePersistentResponse(minData);
|
||||
|
||||
if (data.Disconnect) {
|
||||
connection.log("Disconnect command received from server");
|
||||
|
||||
|
@ -710,6 +842,8 @@
|
|||
return;
|
||||
}
|
||||
|
||||
this.updateGroups(connection, data.ResetGroups, data.AddedGroups, data.RemovedGroups);
|
||||
|
||||
if (data.Messages) {
|
||||
$.each(data.Messages, function () {
|
||||
try {
|
||||
|
@ -725,10 +859,6 @@
|
|||
if (data.MessageId) {
|
||||
connection.messageId = data.MessageId;
|
||||
}
|
||||
|
||||
if (data.TransportData) {
|
||||
connection.groups = data.TransportData.Groups;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -781,6 +911,15 @@
|
|||
connection.keepAliveData.lastKeepAlive = new Date();
|
||||
},
|
||||
|
||||
ensureReconnectingState: function (connection) {
|
||||
if (changeState(connection,
|
||||
signalR.connectionState.connected,
|
||||
signalR.connectionState.reconnecting) === true) {
|
||||
$(connection).triggerHandler(events.onReconnecting);
|
||||
}
|
||||
return connection.state === signalR.connectionState.reconnecting;
|
||||
},
|
||||
|
||||
foreverFrame: {
|
||||
count: 0,
|
||||
connections: {}
|
||||
|
@ -854,13 +993,10 @@
|
|||
|
||||
if (onSuccess) {
|
||||
onSuccess();
|
||||
}
|
||||
else {
|
||||
if (changeState(connection,
|
||||
signalR.connectionState.reconnecting,
|
||||
signalR.connectionState.connected) === true) {
|
||||
$connection.triggerHandler(events.onReconnect);
|
||||
}
|
||||
} else if (changeState(connection,
|
||||
signalR.connectionState.reconnecting,
|
||||
signalR.connectionState.connected) === true) {
|
||||
$connection.triggerHandler(events.onReconnect);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -897,7 +1033,8 @@
|
|||
$connection = $(connection);
|
||||
|
||||
if (data) {
|
||||
if ($.isEmptyObject(data) || data.Messages) {
|
||||
// data.M is PersistentResponse.Messages
|
||||
if ($.isEmptyObject(data) || data.M) {
|
||||
transportLogic.processMessages(connection, data);
|
||||
} else {
|
||||
// For websockets we need to trigger onReceived
|
||||
|
@ -922,16 +1059,11 @@
|
|||
that.stop(connection);
|
||||
}
|
||||
|
||||
if (connection.state === signalR.connectionState.reconnecting ||
|
||||
changeState(connection,
|
||||
signalR.connectionState.connected,
|
||||
signalR.connectionState.reconnecting) === true) {
|
||||
|
||||
if (transportLogic.ensureReconnectingState(connection)) {
|
||||
connection.log("Websocket reconnecting");
|
||||
that.start(connection);
|
||||
}
|
||||
},
|
||||
connection.reconnectDelay);
|
||||
}, connection.reconnectDelay);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -1064,14 +1196,11 @@
|
|||
|
||||
if (onSuccess) {
|
||||
onSuccess();
|
||||
}
|
||||
|
||||
if (reconnecting) {
|
||||
if (changeState(connection,
|
||||
signalR.connectionState.reconnecting,
|
||||
signalR.connectionState.connected) === true) {
|
||||
$connection.triggerHandler(events.onReconnect);
|
||||
}
|
||||
} else if (changeState(connection,
|
||||
signalR.connectionState.reconnecting,
|
||||
signalR.connectionState.connected) === true) {
|
||||
// If there's no onSuccess handler we assume this is a reconnect
|
||||
$connection.triggerHandler(events.onReconnect);
|
||||
}
|
||||
}
|
||||
}, false);
|
||||
|
@ -1122,15 +1251,10 @@
|
|||
that.reconnectTimeout = window.setTimeout(function () {
|
||||
that.stop(connection);
|
||||
|
||||
if (connection.state === signalR.connectionState.reconnecting ||
|
||||
changeState(connection,
|
||||
signalR.connectionState.connected,
|
||||
signalR.connectionState.reconnecting) === true) {
|
||||
if (transportLogic.ensureReconnectingState(connection)) {
|
||||
connection.log("EventSource reconnecting");
|
||||
|
||||
that.start(connection);
|
||||
}
|
||||
|
||||
}, connection.reconnectDelay);
|
||||
},
|
||||
|
||||
|
@ -1181,13 +1305,12 @@
|
|||
var that = this,
|
||||
frameId = (transportLogic.foreverFrame.count += 1),
|
||||
url,
|
||||
connectTimeOut,
|
||||
frame = $("<iframe data-signalr-connection-id='" + connection.id + "' style='position:absolute;top:0;left:0;width:0;height:0;visibility:hidden;' src=''></iframe>");
|
||||
|
||||
if (window.EventSource) {
|
||||
// If the browser supports SSE, don't use Forever Frame
|
||||
if (onFailed) {
|
||||
connection.log("This brower supports SSE, skipping Forever Frame.");
|
||||
connection.log("This browser supports SSE, skipping Forever Frame.");
|
||||
onFailed();
|
||||
}
|
||||
return;
|
||||
|
@ -1222,8 +1345,7 @@
|
|||
|
||||
// After connecting, if after the specified timeout there's no response stop the connection
|
||||
// and raise on failed
|
||||
// REVIEW: Why is connectTimeOut set here and never used again?
|
||||
connectTimeOut = window.setTimeout(function () {
|
||||
window.setTimeout(function () {
|
||||
if (connection.onSuccess) {
|
||||
connection.log("Failed to connect using forever frame source, it timed out after " + that.timeOut + "ms.");
|
||||
that.stop(connection);
|
||||
|
@ -1238,21 +1360,12 @@
|
|||
reconnect: function (connection) {
|
||||
var that = this;
|
||||
window.setTimeout(function () {
|
||||
if (!connection.frame) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (connection.state === signalR.connectionState.reconnecting ||
|
||||
changeState(connection,
|
||||
signalR.connectionState.connected,
|
||||
signalR.connectionState.reconnecting) === true) {
|
||||
|
||||
if (connection.frame && transportLogic.ensureReconnectingState(connection)) {
|
||||
var frame = connection.frame,
|
||||
src = transportLogic.getUrl(connection, that.name, true) + "&frameId=" + connection.frameId;
|
||||
connection.log("Upating iframe src to '" + src + "'.");
|
||||
src = transportLogic.getUrl(connection, that.name, true) + "&frameId=" + connection.frameId;
|
||||
connection.log("Updating iframe src to '" + src + "'.");
|
||||
frame.src = src;
|
||||
}
|
||||
|
||||
}, connection.reconnectDelay);
|
||||
},
|
||||
|
||||
|
@ -1285,9 +1398,15 @@
|
|||
if (connection.frame.stop) {
|
||||
connection.frame.stop();
|
||||
} else {
|
||||
cw = connection.frame.contentWindow || connection.frame.contentDocument;
|
||||
if (cw.document && cw.document.execCommand) {
|
||||
cw.document.execCommand("Stop");
|
||||
try
|
||||
{
|
||||
cw = connection.frame.contentWindow || connection.frame.contentDocument;
|
||||
if (cw.document && cw.document.execCommand) {
|
||||
cw.document.execCommand("Stop");
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
connection.log("SignalR: Error occured when stopping foreverFrame transport. Message = " + e.message);
|
||||
}
|
||||
}
|
||||
$(connection.frame).remove();
|
||||
|
@ -1313,14 +1432,11 @@
|
|||
connection.onSuccess();
|
||||
connection.onSuccess = null;
|
||||
delete connection.onSuccess;
|
||||
}
|
||||
else {
|
||||
if (changeState(connection,
|
||||
signalR.connectionState.reconnecting,
|
||||
signalR.connectionState.connected) === true) {
|
||||
// If there's no onSuccess handler we assume this is a reconnect
|
||||
$(connection).triggerHandler(events.onReconnect);
|
||||
}
|
||||
} else if (changeState(connection,
|
||||
signalR.connectionState.reconnecting,
|
||||
signalR.connectionState.connected) === true) {
|
||||
// If there's no onSuccess handler we assume this is a reconnect
|
||||
$(connection).triggerHandler(events.onReconnect);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -1363,21 +1479,30 @@
|
|||
|
||||
window.setTimeout(function () {
|
||||
(function poll(instance, raiseReconnect) {
|
||||
|
||||
var messageId = instance.messageId,
|
||||
connect = (messageId === null),
|
||||
reconnecting = !connect,
|
||||
url = transportLogic.getUrl(instance, that.name, reconnecting, raiseReconnect),
|
||||
reconnectTimeOut = null,
|
||||
reconnectFired = false;
|
||||
reconnectFired = false,
|
||||
triggerReconnected = function () {
|
||||
// Fire the reconnect event if it hasn't been fired as yet
|
||||
if (reconnectFired === false) {
|
||||
connection.log("Raising the reconnect event");
|
||||
|
||||
if (reconnecting === true && raiseReconnect === true) {
|
||||
if (connection.state !== signalR.connectionState.reconnecting &&
|
||||
changeState(connection,
|
||||
signalR.connectionState.connected,
|
||||
signalR.connectionState.reconnecting) === false) {
|
||||
return;
|
||||
}
|
||||
if (changeState(connection,
|
||||
signalR.connectionState.reconnecting,
|
||||
signalR.connectionState.connected) === true) {
|
||||
|
||||
$(instance).triggerHandler(events.onReconnect);
|
||||
reconnectFired = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if (reconnecting === true && raiseReconnect === true &&
|
||||
!transportLogic.ensureReconnectingState(connection)) {
|
||||
return;
|
||||
}
|
||||
|
||||
connection.log("Attempting to connect to '" + url + "' using longPolling.");
|
||||
|
@ -1387,9 +1512,14 @@
|
|||
cache: false,
|
||||
type: "GET",
|
||||
dataType: connection.ajaxDataType,
|
||||
success: function (data) {
|
||||
success: function (minData) {
|
||||
var delay = 0,
|
||||
timedOutReceived = false;
|
||||
timedOutReceived = false,
|
||||
data;
|
||||
|
||||
if (minData) {
|
||||
data = transportLogic.maximizePersistentResponse(minData);
|
||||
}
|
||||
|
||||
if (initialConnectFired === false) {
|
||||
onSuccess();
|
||||
|
@ -1397,25 +1527,13 @@
|
|||
}
|
||||
|
||||
if (raiseReconnect === true) {
|
||||
// Fire the reconnect event if it hasn't been fired as yet
|
||||
if (reconnectFired === false) {
|
||||
connection.log("Raising the reconnect event");
|
||||
|
||||
if (changeState(connection,
|
||||
signalR.connectionState.reconnecting,
|
||||
signalR.connectionState.connected) === true) {
|
||||
|
||||
$(instance).triggerHandler(events.onReconnect);
|
||||
reconnectFired = true;
|
||||
}
|
||||
}
|
||||
triggerReconnected();
|
||||
}
|
||||
|
||||
transportLogic.processMessages(instance, data);
|
||||
transportLogic.processMessages(instance, minData);
|
||||
if (data &&
|
||||
data.TransportData &&
|
||||
$.type(data.TransportData.LongPollDelay) === "number") {
|
||||
delay = data.TransportData.LongPollDelay;
|
||||
$.type(data.LongPollDelay) === "number") {
|
||||
delay = data.LongPollDelay;
|
||||
}
|
||||
|
||||
if (data && data.TimedOut) {
|
||||
|
@ -1445,15 +1563,14 @@
|
|||
return;
|
||||
}
|
||||
|
||||
connection.log("An error occurred using longPolling. Status = " + textStatus + ". " + data.responseText);
|
||||
|
||||
if (reconnectTimeOut) {
|
||||
// If the request failed then we clear the timeout so that the
|
||||
// reconnect event doesn't get fired
|
||||
window.clearTimeout(reconnectTimeOut);
|
||||
if (connection.state !== signalR.connectionState.reconnecting) {
|
||||
connection.log("An error occurred using longPolling. Status = " + textStatus + ". " + data.responseText);
|
||||
$(instance).triggerHandler(events.onError, [data.responseText]);
|
||||
}
|
||||
|
||||
$(instance).triggerHandler(events.onError, [data.responseText]);
|
||||
// If the request failed then we clear the timeout so that the
|
||||
// reconnect event doesn't get fired
|
||||
window.clearTimeout(reconnectTimeOut);
|
||||
|
||||
window.setTimeout(function () {
|
||||
if (isDisconnecting(instance) === false) {
|
||||
|
@ -1464,18 +1581,7 @@
|
|||
});
|
||||
|
||||
if (raiseReconnect === true) {
|
||||
reconnectTimeOut = window.setTimeout(function () {
|
||||
if (reconnectFired === false) {
|
||||
if (changeState(connection,
|
||||
signalR.connectionState.reconnecting,
|
||||
signalR.connectionState.connected) === true) {
|
||||
|
||||
$(instance).triggerHandler(events.onReconnect);
|
||||
reconnectFired = true;
|
||||
}
|
||||
}
|
||||
},
|
||||
that.reconnectDelay);
|
||||
reconnectTimeOut = window.setTimeout(triggerReconnected, that.reconnectDelay);
|
||||
}
|
||||
|
||||
}(connection));
|
||||
|
@ -1658,11 +1764,13 @@
|
|||
var self = this,
|
||||
args = $.makeArray(arguments).slice(1),
|
||||
argValues = args.map(getArgValue),
|
||||
data = { hub: self.hubName, method: methodName, args: argValues, state: self.state, id: callbackId },
|
||||
data = { H: self.hubName, M: methodName, A: argValues, I: callbackId },
|
||||
d = $.Deferred(),
|
||||
callback = function (result) {
|
||||
callback = function (minResult) {
|
||||
var result = self._maximizeHubResponse(minResult);
|
||||
|
||||
// Update the hub state
|
||||
$.extend(this.state, result.State);
|
||||
$.extend(self.state, result.State);
|
||||
|
||||
if (result.Error) {
|
||||
// Server hub method threw an exception, log it & reject the deferred
|
||||
|
@ -1678,9 +1786,24 @@
|
|||
|
||||
callbacks[callbackId.toString()] = { scope: self, method: callback };
|
||||
callbackId += 1;
|
||||
|
||||
if (!$.isEmptyObject(self.state)) {
|
||||
data.S = self.state;
|
||||
}
|
||||
|
||||
self.connection.send(window.JSON.stringify(data));
|
||||
|
||||
return d.promise();
|
||||
},
|
||||
|
||||
_maximizeHubResponse: function (minHubResponse) {
|
||||
return {
|
||||
State: minHubResponse.S,
|
||||
Result: minHubResponse.R,
|
||||
Id: minHubResponse.I,
|
||||
Error: minHubResponse.E,
|
||||
StackTrace: minHubResponse.T
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1724,15 +1847,15 @@
|
|||
connection.proxies = {};
|
||||
|
||||
// Wire up the received handler
|
||||
connection.received(function (data) {
|
||||
var proxy, dataCallbackId, callback, hubName, eventName;
|
||||
if (!data) {
|
||||
connection.received(function (minData) {
|
||||
var data, proxy, dataCallbackId, callback, hubName, eventName;
|
||||
if (!minData) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof (data.Id) !== "undefined") {
|
||||
if (typeof (minData.I) !== "undefined") {
|
||||
// We received the return value from a server method invocation, look up callback by id and call it
|
||||
dataCallbackId = data.Id.toString();
|
||||
dataCallbackId = minData.I.toString();
|
||||
callback = callbacks[dataCallbackId];
|
||||
if (callback) {
|
||||
// Delete the callback from the proxy
|
||||
|
@ -1740,9 +1863,11 @@
|
|||
delete callbacks[dataCallbackId];
|
||||
|
||||
// Invoke the callback
|
||||
callback.method.call(callback.scope, data);
|
||||
callback.method.call(callback.scope, minData);
|
||||
}
|
||||
} else {
|
||||
data = this._maximizeClientHubInvocation(minData);
|
||||
|
||||
// We received a client invocation request, i.e. broadcast from server hub
|
||||
connection.log("Triggering client hub event '" + data.Method + "' on hub '" + data.Hub + "'.");
|
||||
|
||||
|
@ -1760,6 +1885,15 @@
|
|||
});
|
||||
};
|
||||
|
||||
hubConnection.fn._maximizeClientHubInvocation = function (minClientHubInvocation) {
|
||||
return {
|
||||
Hub: minClientHubInvocation.H,
|
||||
Method: minClientHubInvocation.M,
|
||||
Args: minClientHubInvocation.A,
|
||||
State: minClientHubInvocation.S
|
||||
};
|
||||
};
|
||||
|
||||
hubConnection.fn._registerSubscribedHubs = function () {
|
||||
/// <summary>
|
||||
/// Sets the starting event to loop through the known hubs and register any new hubs
|
||||
|
@ -1812,3 +1946,11 @@
|
|||
$.hubConnection = hubConnection;
|
||||
|
||||
}(window.jQuery, window));
|
||||
/* jquery.signalR.version.js */
|
||||
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.md in the project root for license information.
|
||||
|
||||
/*global window:false */
|
||||
/// <reference path="jquery.signalR.core.js" />
|
||||
(function ($) {
|
||||
$.signalR.version = "1.0.0.rc1";
|
||||
}(window.jQuery));
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -1,14 +1,19 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
For more information on how to configure your ASP.NET application, please visit
|
||||
http://go.microsoft.com/fwlink/?LinkId=169433
|
||||
-->
|
||||
|
||||
<configuration>
|
||||
<system.web>
|
||||
<compilation debug="true" targetFramework="4.5" />
|
||||
<httpRuntime targetFramework="4.5" />
|
||||
</system.web>
|
||||
|
||||
</configuration>
|
||||
<system.web>
|
||||
<compilation debug="true" targetFramework="4.5" />
|
||||
<httpRuntime targetFramework="4.5" />
|
||||
</system.web>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Owin.Host.SystemWeb" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-1.0.0.0" newVersion="1.0.0.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
|
@ -8,8 +8,8 @@
|
|||
<input type="button" id="send" value="send" />
|
||||
<ul id="message">
|
||||
</ul>
|
||||
<script src="Scripts/jquery-1.8.2.min.js"></script>
|
||||
<script src="Scripts/jquery.signalR-1.0.0-alpha2.min.js"></script>
|
||||
<script src="Scripts/jquery-1.8.3.min.js"></script>
|
||||
<script src="Scripts/jquery.signalR-1.0.0-rc1.min.js"></script>
|
||||
<script src="signalR/hubs"></script>
|
||||
<script>
|
||||
$(function () {
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
<input type="button" id="send" value="send" />
|
||||
<ul id="message">
|
||||
</ul>
|
||||
<script src="Scripts/jquery-1.8.2.min.js"></script>
|
||||
<script src="Scripts/jquery.signalR-1.0.0-alpha2.min.js"></script>
|
||||
<script src="Scripts/jquery-1.8.3.min.js"></script>
|
||||
<script src="Scripts/jquery.signalR-1.0.0-rc1.min.js"></script>
|
||||
<script src="signalR/hubs"></script>
|
||||
<script>
|
||||
$(function () {
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="jQuery" version="1.8.2" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.SignalR" version="1.0.0-alpha2" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.SignalR.Core" version="1.0.0-alpha2" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.SignalR.Hosting.AspNet" version="1.0.0-alpha2" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.SignalR.Hosting.Common" version="1.0.0-alpha2" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.SignalR.JS" version="1.0.0-alpha2" targetFramework="net45" />
|
||||
<package id="jQuery" version="1.8.3" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.SignalR" version="1.0.0-rc1" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.SignalR.Core" version="1.0.0-rc1" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.SignalR.JS" version="1.0.0-rc1" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.SignalR.Owin" version="1.0.0-rc1" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.SignalR.SystemWeb" version="1.0.0-rc1" targetFramework="net45" />
|
||||
<package id="Microsoft.Owin.Host.SystemWeb" version="1.0.0-rc1" targetFramework="net45" />
|
||||
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net45" />
|
||||
<package id="Newtonsoft.Json" version="4.5.11" targetFramework="net45" />
|
||||
<package id="Owin" version="1.0" targetFramework="net45" />
|
||||
</packages>
|
|
@ -34,8 +34,9 @@
|
|||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.AspNet.SignalR.Client">
|
||||
<HintPath>..\packages\Microsoft.AspNet.SignalR.Client.1.0.0-alpha2\lib\net40\Microsoft.AspNet.SignalR.Client.dll</HintPath>
|
||||
<Reference Include="Microsoft.AspNet.SignalR.Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Microsoft.AspNet.SignalR.Client.1.0.0-rc1\lib\net40\Microsoft.AspNet.SignalR.Client.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json">
|
||||
<HintPath>..\packages\Newtonsoft.Json.4.5.11\lib\net40\Newtonsoft.Json.dll</HintPath>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.AspNet.SignalR.Client" version="1.0.0-alpha2" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.SignalR.Client" version="1.0.0-rc1" targetFramework="net45" />
|
||||
<package id="Newtonsoft.Json" version="4.5.11" targetFramework="net45" />
|
||||
</packages>
|
Загрузка…
Ссылка в новой задаче