X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;f=www%2Fiphone%2Fiphone.js;h=93008b187b9cd20bc9afd85c42535f85ab8a8660;hb=39e16afca77ea4bfaee853ff5b689be8fd82de45;hp=8a71600ef8b89a585fc1c68b4dc2e40ceb66590e;hpb=a14c3ce9ee3f8b46f28fb3eaf99e4cb71d3fad18;p=pazpar2-moved-to-github.git diff --git a/www/iphone/iphone.js b/www/iphone/iphone.js index 8a71600..93008b1 100644 --- a/www/iphone/iphone.js +++ b/www/iphone/iphone.js @@ -1,6 +1,5 @@ var count = 0; var termlist = {}; -var JSON = JSON || {}; var inApp = false; var callback = {}; @@ -8,17 +7,9 @@ var callback = {}; callback.init = function() { if (!inApp) { callback.type = 'browser'; - document.getElementById("heading").style.display=""; - } else + } else { callback.type = 'iphone'; - - var searchdiv = document.getElementById("searchdiv"); - if (this.type != 'iphone') { - searchdiv.style.display = ''; - document.search.onsubmit = onFormSubmit; } - else - searchdiv.style.display = 'none'; }; String.prototype.replaceAll = function(stringToFind,stringToReplace) { @@ -43,33 +34,12 @@ callback.send = function() var message = "myapp:" + args.join(":"); if (this.type == 'iphone') document.location = message; - else - document.getElementById("log").innerHTML = message; + else { + // Debug communication with Web View + // document.getElementById("log").innerHTML = message; + } } -// implement JSON.stringify serialization -JSON.stringify = JSON.stringify || function(obj) { - var t = typeof (obj); - if (t != "object" || obj === null) { - // simple data type - if (t == "string") - obj = '"' + obj + '"'; - 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 ? "]" : "}"); - } -}; function search(message) { document.search.query.value = message;