window.mkws = {
$: $, // Our own local copy of the jQuery object
authenticated: false,
+ authenticating: false,
active: false,
log_level: 1, // Will be overridden from mkws.config, but
// initial value allows jQuery popup to use logging.
* for the site.
*/
function authenticateSession(auth_url, auth_domain, pp2_url) {
+ mkws.authenticating = true;
log("service proxy authentication on URL: " + auth_url);
if (!auth_domain) {
}, auth_domain);
request.get(null, function(data) {
+ mkws.authenticating = false;
if (!$.isXMLDoc(data)) {
alert("Service Proxy authentication response is not a valid XML document");
return;
}
*/
- if (mkws.config.use_service_proxy) {
- if (!mkws.authenticated) {
- authenticateSession(mkws.config.service_proxy_auth,
- mkws.config.service_proxy_auth_domain,
- mkws.config.pazpar2_url);
- }
- } else {
- // raw pp2
+ if (mkws.config.use_service_proxy && !mkws.authenticated && !mkws.authenticating) {
+ authenticateSession(mkws.config.service_proxy_auth,
+ mkws.config.service_proxy_auth_domain,
+ mkws.config.pazpar2_url);
+ } else if (!mkws.authenticating) {
+ // raw pp2 or we have a session already open
runAutoSearches();
}
};
$(document).ready(function() {
- mkws.init();
+ if (!window.mkws_noready && !mkws.authenticating && !mkws.active) {
+ mkws.init();
+ }
});
})(mkws.$);