Comparing versions 8 and 9.

JsonCallbackInfotron

This is another is_proxy wrapper which doesn't use input terminals, but traps acess to the wrapped/embedded achor element.

Demos that use it

  • 43.html
  • flickr_and_webshot.html
  • evdb.html
  • rss_feeds.html
  • rss_feeds_timeline.html
  • yahoosearch.html
  • map.html
  • multi_map.html


BLUEPRINT(
"~011A83EC1CBFAD4a3188344C9BA816DE73",
[
 [null, null, -1] // magic 
],
[
 "response_out"
],
function (Class) {

  Class.prototype._onInit = function(props) 
  {
    var a = this.dom_node.getElementsByTagName("A")[0];
    
//#ifdef __DEBUG__
    if (!a || a.rel != "rpc" || !a.href || !a.getAttribute("impl")) {
      
      throw "This is a proxy infotron: an anchor tag of the format \
< obj.length; ++i) {
        v = this._toJson(obj[i]);
        if (s) {
          s += ',';
        }
            s += v;
      }
      return '[' + s + ']';
    } else if (obj.constructor == Date) {
      return obj.valueOf();
    } else if (typeof obj.toString != 'undefined') {
      for (i in obj) {
        v = obj[i];
        if (typeof v != 'undefined' && typeof v != 'function') {
          v = this._toJson(v);
          if (s) {
        s += ',';
          }
          s += this._toJson(i) + ':' + v;
        }
      }
      return '{' + s + '}';
    }
      }
      return 'null';
    case 'number':
      return isFinite(obj) ? (new String(obj)) : 'null';
    case 'string':
      l = obj.length;
      s = '"';

      for (i = 0; i < l; i += 1) {
    c = obj.charAt(i);
    if (c >= ' ') {
      if (c == '\\' || c == '"') {
        s += '\\';
      }
      s += c;
    } else {
      switch (c) {
      case '\b':
        s += '\\b';
        break;
      case '\f':
        s += '\\f';
        break;
      case '\n':
        s += '\\n';
        break;
      case '\r':
        s += '\\r';
        break;
      case '\t':
        s += '\\t';
        break;
      default:
        c = c.charCodeAt();
        s += '\\u00' + Math.floor(c / 16).toString(16) +
          (c % 16).toString(16);
      }
    }
      }
      return s + '"';
    case 'boolean':
      return (new String(obj));
    default:
      return 'null';
    }
  }

 }, "JSON Callback Service Proxy");