X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;f=www%2Fiphone%2Fexample_client.js;h=9761e831996dcb6ebcedc53d1438c9d6941e5e9a;hb=09e752194178c47e62eb2cc45bdf58728a87ea54;hp=336739bfe4baa433a3e3292ace996e95304db59a;hpb=465f2f7e0d0c21cde0a4f70600c5693b5e20b0ef;p=pazpar2-moved-to-github.git diff --git a/www/iphone/example_client.js b/www/iphone/example_client.js index 336739b..9761e83 100644 --- a/www/iphone/example_client.js +++ b/www/iphone/example_client.js @@ -12,9 +12,10 @@ var querys = {'su': '', 'au': '', 'xt': ''}; if (document.location.hash == '#useproxy' || document.location.search.match("useproxy=true")) { usesessions = false; pazpar2path = '/service-proxy/'; - showResponseType = 'xml'; + showResponseType = 'json'; } + my_paz = new pz2( { "onshow": my_onshow, "showtime": 500, //each timer (show, stat, term, bytarget) can be specified this way "pazpar2path": pazpar2path, @@ -80,25 +81,25 @@ function login() { } function logout() { - auth.logOut(loggedOut, loggingOutFailed, false); + auth.logOut(loggedOut, loggingOutFailed, true); } function logInOrOut() { var loginElement = document.getElementById("login"); if (loginElement.innerHTML == 'Login') - login(); + login(); else - logout(); + logout(); } function loggedIn() { var login = document.getElementById("login"); - login.innerHTML = 'Logout'; - // login.onclick = 'logout();'; - domReady(); + login.innerHTML = 'Logout(' + auth.displayName + ')'; + document.getElementById("log").innerHTML = login.innerHTML; } function auth_check() { - auth.check(loggedIn, login, false); + auth.check(loggedIn, login, true); + domReady(); } // @@ -246,27 +247,6 @@ function my_onterm(data) { showhide(); } -function serialize(array) { - var t = typeof (obj); - if (t != "object" || obj === null) { - // simple data type - return String(obj); - } else { - // recurse array or object - var n, v, json = [], arr = (obj && obj.constructor == Array); - for (n in obj) { - v = obj[n]; - t = typeof (v); - if (t == "string") - v = '"' + v + '"'; - else if (t == "object" && v !== null) - v = JSON.stringify(v); - json.push((arr ? "" : '"' + n + '":') + String(v)); - } - return (arr ? "" : "") + String(json) + (arr ? "]" : "}"); - } -} - var termlist = {}; function my_onterm_iphone(data) { my_onterm(data); @@ -287,7 +267,6 @@ function my_onterm_iphone(data) { authors = authors + "au" + "|" + data.author[i].name + "|" + data.author[i].freq + "\n"; } termlist["authors"] = authors; - //document.getElementById("log").innerHTML = targets + "\n" + subjects + "\n" + authors; callback.send("termlist", "refresh"); } @@ -364,6 +343,7 @@ function applicationMode(newmode) searchdiv.style.display = 'none'; } else { + document.getElementById("nav").style.display=""; searchdiv.style.display = ''; document.search.onsubmit = onFormSubmit; } @@ -640,7 +620,8 @@ function renderDetails_iphone(data, marker) { //return renderDetails(data,marker); - + if (!data) + return ""; var details = '
' /* details = '