mirror of https://github.com/apache/archiva.git
sammyjs 0.7.4
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1448851 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a73c35bcf2
commit
8ad0fb9872
|
@ -33,7 +33,7 @@
|
|||
|
||||
<script type="text/javascript" src="js/jquery-1.9.1.min.js"></script>
|
||||
<script type="text/javascript" src="js/jquery-ui-1.9.2.custom.min.js"></script>
|
||||
<script type="text/javascript" src="js/sammy.0.7.2.js"></script>
|
||||
<script type="text/javascript" src="js/sammy.0.7.4.js"></script>
|
||||
<script type="text/javascript" data-main="js/archiva/archiva.js" src="js/require.2.1.4.js"></script>
|
||||
|
||||
<title>Apache Archiva</title>
|
||||
|
|
|
@ -78,7 +78,7 @@ $.ajax({
|
|||
"tmpl": "tmpl.min",
|
||||
"purl": "purl-2.2.1",
|
||||
"prettify": "prettify",
|
||||
"sammy": "sammy.0.7.2",
|
||||
"sammy": "sammy.0.7.4",
|
||||
"select2": "select2.min-3.2",
|
||||
"jqueryFileTree": "jqueryFileTree-1.0.1",
|
||||
"redback": "redback/redback",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// name: sammy
|
||||
// version: 0.7.2
|
||||
// version: 0.7.4
|
||||
|
||||
// Sammy.js / http://sammyjs.org
|
||||
|
||||
|
@ -31,9 +31,9 @@
|
|||
return String(s).replace(/&(?!\w+;)/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');
|
||||
},
|
||||
_routeWrapper = function(verb) {
|
||||
return function() {
|
||||
return this.route.apply(this, [verb].concat(Array.prototype.slice.call(arguments)));
|
||||
};
|
||||
return function() {
|
||||
return this.route.apply(this, [verb].concat(Array.prototype.slice.call(arguments)));
|
||||
};
|
||||
},
|
||||
_template_cache = {},
|
||||
_has_history = !!(window.history && history.pushState),
|
||||
|
@ -87,7 +87,7 @@
|
|||
}
|
||||
};
|
||||
|
||||
Sammy.VERSION = '0.7.2';
|
||||
Sammy.VERSION = '0.7.4';
|
||||
|
||||
// Add to the global logger pool. Takes a function that accepts an
|
||||
// unknown number of arguments and should print them or send them somewhere
|
||||
|
@ -219,11 +219,11 @@
|
|||
// Return whether the event targets this window.
|
||||
Sammy.targetIsThisWindow = function targetIsThisWindow(event) {
|
||||
var targetWindow = $(event.target).attr('target');
|
||||
if ( !targetWindow || targetWindow === window.name || targetWindow === '_self' ) { return true; }
|
||||
if ( targetWindow === '_blank' ) { return false; }
|
||||
if ( targetWindow == null || targetWindow === window.name || targetWindow === '_self' ) { return true; }
|
||||
if ( targetWindow === 'top' && window === window.top ) { return true; }
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// The DefaultLocationProxy is the default location proxy for all Sammy applications.
|
||||
|
@ -591,11 +591,11 @@ $.extend(Sammy.DefaultLocationProxy.prototype , {
|
|||
path = new RegExp(path.replace(PATH_NAME_MATCHER, PATH_REPLACER) + "$");
|
||||
}
|
||||
// lookup callbacks
|
||||
$.each(callback,function(i,cb){
|
||||
if (typeof(cb) === 'string') {
|
||||
callback[i] = app[cb];
|
||||
}
|
||||
});
|
||||
$.each(callback,function(i,cb){
|
||||
if (typeof(cb) === 'string') {
|
||||
callback[i] = app[cb];
|
||||
}
|
||||
});
|
||||
|
||||
add_route = function(with_verb) {
|
||||
var r = {verb: with_verb, path: path, callback: callback, param_names: param_names};
|
||||
|
@ -818,54 +818,54 @@ $.extend(Sammy.DefaultLocationProxy.prototype , {
|
|||
},
|
||||
|
||||
// Adds a onComplete function to the application. onComplete functions are executed
|
||||
// at the end of a chain of route callbacks, if they call next(). Unlike after,
|
||||
// which is called as soon as the route is complete, onComplete is like a final next()
|
||||
// for all routes, and is thus run asynchronously
|
||||
// at the end of a chain of route callbacks, if they call next(). Unlike after,
|
||||
// which is called as soon as the route is complete, onComplete is like a final next()
|
||||
// for all routes, and is thus run asynchronously
|
||||
//
|
||||
// ### Example
|
||||
//
|
||||
// app.get('/chain',function(context,next){
|
||||
// console.log('chain1');
|
||||
// next();
|
||||
// },function(context,next){
|
||||
// console.log('chain2');
|
||||
// next();
|
||||
// });
|
||||
// console.log('chain1');
|
||||
// next();
|
||||
// },function(context,next){
|
||||
// console.log('chain2');
|
||||
// next();
|
||||
// });
|
||||
// app.get('/link',function(context,next){
|
||||
// console.log('link1');
|
||||
// next();
|
||||
// },function(context,next){
|
||||
// console.log('link2');
|
||||
// next();
|
||||
// });
|
||||
// app.onComplete(function(){
|
||||
// console.log("Running finally")
|
||||
// });
|
||||
//
|
||||
// If you go to '/chain', you will get the following messages:
|
||||
// chain1
|
||||
// chain2
|
||||
// Running onComplete
|
||||
//
|
||||
//
|
||||
// If you go to /link, you will get the following messages:
|
||||
// link1
|
||||
// link2
|
||||
// Running onComplete
|
||||
//
|
||||
// It really comes to play when doing asynchronous:
|
||||
// console.log('link1');
|
||||
// next();
|
||||
// },function(context,next){
|
||||
// console.log('link2');
|
||||
// next();
|
||||
// });
|
||||
// app.onComplete(function(){
|
||||
// console.log("Running finally")
|
||||
// });
|
||||
//
|
||||
// If you go to '/chain', you will get the following messages:
|
||||
// chain1
|
||||
// chain2
|
||||
// Running onComplete
|
||||
//
|
||||
//
|
||||
// If you go to /link, you will get the following messages:
|
||||
// link1
|
||||
// link2
|
||||
// Running onComplete
|
||||
//
|
||||
// It really comes to play when doing asynchronous:
|
||||
// app.get('/chain',function(context,next){
|
||||
// $.get('/my/url',function(){
|
||||
// console.log('chain1');
|
||||
// next();
|
||||
// })
|
||||
// },function(context,next){
|
||||
// console.log('chain2');
|
||||
// next();
|
||||
// });
|
||||
// $.get('/my/url',function(){
|
||||
// console.log('chain1');
|
||||
// next();
|
||||
// })
|
||||
// },function(context,next){
|
||||
// console.log('chain2');
|
||||
// next();
|
||||
// });
|
||||
//
|
||||
onComplete: function(callback) {
|
||||
this._onComplete = callback;
|
||||
this._onComplete = callback;
|
||||
return this;
|
||||
},
|
||||
|
||||
|
@ -1015,7 +1015,7 @@ $.extend(Sammy.DefaultLocationProxy.prototype , {
|
|||
destroy: function() {
|
||||
this.unload();
|
||||
delete Sammy.apps[this.element_selector];
|
||||
return this;
|
||||
return this;
|
||||
},
|
||||
|
||||
// Will bind a single callback function to every event that is already
|
||||
|
@ -1128,10 +1128,10 @@ $.extend(Sammy.DefaultLocationProxy.prototype , {
|
|||
arounds = this.arounds.slice(0);
|
||||
befores = this.befores.slice(0);
|
||||
// set the callback args to the context + contents of the splat
|
||||
callback_args = [context];
|
||||
if (params.splat) {
|
||||
callback_args = callback_args.concat(params.splat);
|
||||
}
|
||||
callback_args = [context];
|
||||
if (params.splat) {
|
||||
callback_args = callback_args.concat(params.splat);
|
||||
}
|
||||
// wrap the route up with the before filters
|
||||
wrapped_route = function() {
|
||||
var returned, i, nextRoute;
|
||||
|
@ -1145,23 +1145,23 @@ $.extend(Sammy.DefaultLocationProxy.prototype , {
|
|||
}
|
||||
app.last_route = route;
|
||||
context.trigger('event-context-before', {context: context});
|
||||
// run multiple callbacks
|
||||
if (typeof(route.callback) === "function") {
|
||||
route.callback = [route.callback];
|
||||
}
|
||||
if (route.callback && route.callback.length) {
|
||||
i = -1;
|
||||
nextRoute = function() {
|
||||
i++;
|
||||
if (route.callback[i]) {
|
||||
returned = route.callback[i].apply(context,callback_args);
|
||||
} else if (app._onComplete && typeof(app._onComplete === "function")) {
|
||||
app._onComplete(context);
|
||||
}
|
||||
};
|
||||
callback_args.push(nextRoute);
|
||||
nextRoute();
|
||||
}
|
||||
// run multiple callbacks
|
||||
if (typeof(route.callback) === "function") {
|
||||
route.callback = [route.callback];
|
||||
}
|
||||
if (route.callback && route.callback.length) {
|
||||
i = -1;
|
||||
nextRoute = function() {
|
||||
i++;
|
||||
if (route.callback[i]) {
|
||||
returned = route.callback[i].apply(context,callback_args);
|
||||
} else if (app._onComplete && typeof(app._onComplete === "function")) {
|
||||
app._onComplete(context);
|
||||
}
|
||||
};
|
||||
callback_args.push(nextRoute);
|
||||
nextRoute();
|
||||
}
|
||||
context.trigger('event-context-after', {context: context});
|
||||
return returned;
|
||||
};
|
||||
|
@ -1382,7 +1382,7 @@ $.extend(Sammy.DefaultLocationProxy.prototype , {
|
|||
$form = $(form);
|
||||
path = $form.attr('action') || '';
|
||||
verb = this._getFormVerb($form);
|
||||
|
||||
|
||||
if (this.debug) {
|
||||
this.log('_checkFormSubmission', $form, path, verb);
|
||||
}
|
||||
|
@ -1816,10 +1816,10 @@ $.extend(Sammy.DefaultLocationProxy.prototype , {
|
|||
if (callback) {
|
||||
$.each(data, function(i, value) {
|
||||
var idata = {}, engine = this.next_engine || location;
|
||||
if (name) {
|
||||
idata[name] = value;
|
||||
} else {
|
||||
idata = value;
|
||||
if (name) {
|
||||
idata[name] = value;
|
||||
} else {
|
||||
idata = value;
|
||||
}
|
||||
callback(value, rctx.event_context.interpolate(content, idata, engine));
|
||||
});
|
||||
|
@ -1827,7 +1827,7 @@ $.extend(Sammy.DefaultLocationProxy.prototype , {
|
|||
return this.collect(data, function(i, value) {
|
||||
var idata = {}, engine = this.next_engine || location;
|
||||
if (name) {
|
||||
idata[name] = value;
|
||||
idata[name] = value;
|
||||
} else {
|
||||
idata = value;
|
||||
}
|
||||
|
@ -2117,4 +2117,4 @@ $.extend(Sammy.DefaultLocationProxy.prototype , {
|
|||
|
||||
return Sammy;
|
||||
});
|
||||
})(jQuery, window);
|
||||
})(jQuery, window);
|
Loading…
Reference in New Issue