Changeset 485

Show
Ignore:
Timestamp:
07/02/07 15:35:07 (2 years ago)
Author:
laurentj
Message:

update install directory in jxxulapp and jxauth modules; new json.js file, and improvement in jxulform xbl binding; fixed also a bug when using json function of PHP

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/build/manifests/jelix-lib.mn

    r480 r485  
    218218  jelixuser.dao.xml 
    219219cd lib/jelix-modules/jauth/install/var/config 
    220   auth.plugin.ini.php 
    221   authsw.plugin.ini.php 
     220  auth.coord.ini.php 
     221  authsw.coord.ini.php 
    222222cd lib/jelix-modules/jauth/locales/en_US 
    223223  auth.ISO-8859-1.properties 
     
    349349  simple.urls.php 
    350350 
    351 cd lib/jelix-www 
    352   json.js 
    353351cd lib/jelix-www/design 
    354352  jelix.css 
     
    357355  tooltip.js 
    358356  jforms.js 
     357  json.js 
    359358cd lib/jelix-www/xul 
    360359  jxulform.css 
  • trunk/build/manifests/jelix-lib.mn

    r480 r485  
    218218  jelixuser.dao.xml 
    219219cd lib/jelix-modules/jauth/install/var/config 
    220   auth.plugin.ini.php 
    221   authsw.plugin.ini.php 
     220  auth.coord.ini.php 
     221  authsw.coord.ini.php 
    222222cd lib/jelix-modules/jauth/locales/en_US 
    223223  auth.ISO-8859-1.properties 
     
    349349  simple.urls.php 
    350350 
    351 cd lib/jelix-www 
    352   json.js 
    353351cd lib/jelix-www/design 
    354352  jelix.css 
     
    357355  tooltip.js 
    358356  jforms.js 
     357  json.js 
    359358cd lib/jelix-www/xul 
    360359  jxulform.css 
  • trunk/build/manifests/jelix-modules.mn

    r469 r485  
    66  main.tpl 
    77  login.tpl 
    8 cd jxxulapp/install/var/config 
    9   auth.plugin.ini.php 
    10   auth.plugin.jsonrpc.ini.php 
    11   config.classic.ini.php 
    12   auth.plugin.rdf.ini.php 
    13   auth.plugin.xul.ini.php 
    14   config.jsonrpc.ini.php 
    15   config.rdf.ini.php 
    16   configxul.classic.ini.php 
     8cd jxxulapp/install/var/config/index 
     9  auth.coord.ini.php 
     10  config.ini.php 
     11cd jxxulapp/install/var/config/rdf 
     12  auth.coord.ini.php 
     13  config.ini.php 
     14cd jxxulapp/install/var/config/jsonrpc 
     15  auth.coord.ini.php 
     16  config.ini.php 
     17cd jxxulapp/install/var/config/xul 
     18  auth.coord.ini.php 
     19  config.ini.php 
    1720cd jxxulapp/install/www 
    1821  jsonrpc.php 
    1922  rdf.php 
    20   xmlrpc.php 
    2123  xul.php 
    2224  index.php 
  • trunk/build/manifests/jelix-modules.mn

    r469 r485  
    66  main.tpl 
    77  login.tpl 
    8 cd jxxulapp/install/var/config 
    9   auth.plugin.ini.php 
    10   auth.plugin.jsonrpc.ini.php 
    11   config.classic.ini.php 
    12   auth.plugin.rdf.ini.php 
    13   auth.plugin.xul.ini.php 
    14   config.jsonrpc.ini.php 
    15   config.rdf.ini.php 
    16   configxul.classic.ini.php 
     8cd jxxulapp/install/var/config/index 
     9  auth.coord.ini.php 
     10  config.ini.php 
     11cd jxxulapp/install/var/config/rdf 
     12  auth.coord.ini.php 
     13  config.ini.php 
     14cd jxxulapp/install/var/config/jsonrpc 
     15  auth.coord.ini.php 
     16  config.ini.php 
     17cd jxxulapp/install/var/config/xul 
     18  auth.coord.ini.php 
     19  config.ini.php 
    1720cd jxxulapp/install/www 
    1821  jsonrpc.php 
    1922  rdf.php 
    20   xmlrpc.php 
    2123  xul.php 
    2224  index.php 
  • trunk/demoxul/var/config/defaultconfig.ini.php.dist

    r451 r485  
    1515pluginsPath = lib:jelix-plugins/,app:plugins/ 
    1616modulesPath = lib:jelix-modules/,app:modules/ 
    17 tplpluginsPath = lib:jelix/tpl/plugins/ 
    1817 
    1918dbProfils = dbprofils.ini.php 
  • trunk/demoxul/var/config/defaultconfig.ini.php.dist

    r451 r485  
    1515pluginsPath = lib:jelix-plugins/,app:plugins/ 
    1616modulesPath = lib:jelix-modules/,app:modules/ 
    17 tplpluginsPath = lib:jelix/tpl/plugins/ 
    1817 
    1918dbProfils = dbprofils.ini.php 
  • trunk/lib/jelix-modules/jxxulapp/install/var/config/index/config.ini.php

    r479 r485  
    55defaultAction = "default_index" 
    66defaultLocale = "fr_FR" 
    7 defaultCharset = "ISO-8859-1
     7defaultCharset = "UTF-8
    88 
    99checkTrustedModules = off 
     
    2222 
    2323[plugins] 
    24 auth = auth.plugin.ini.php 
     24auth = "index/auth.coord.ini.php" 
    2525 
    2626[responses] 
  • trunk/lib/jelix-modules/jxxulapp/install/var/config/index/config.ini.php

    r479 r485  
    55defaultAction = "default_index" 
    66defaultLocale = "fr_FR" 
    7 defaultCharset = "ISO-8859-1
     7defaultCharset = "UTF-8
    88 
    99checkTrustedModules = off 
     
    2222 
    2323[plugins] 
    24 auth = auth.plugin.ini.php 
     24auth = "index/auth.coord.ini.php" 
    2525 
    2626[responses] 
  • trunk/lib/jelix-modules/jxxulapp/install/var/config/jsonrpc/config.ini.php

    r479 r485  
    55defaultAction = "default_index" 
    66defaultLocale = "fr_FR" 
    7 defaultCharset = "ISO-8859-1
     7defaultCharset = "UTF-8
    88 
    99checkTrustedModules = off 
     
    2121 
    2222[plugins] 
    23 auth = auth.plugin.jsonrpc.ini.php 
     23auth = "jsonrpc/auth.coord.ini.php" 
    2424 
    2525[responses] 
  • trunk/lib/jelix-modules/jxxulapp/install/var/config/jsonrpc/config.ini.php

    r479 r485  
    55defaultAction = "default_index" 
    66defaultLocale = "fr_FR" 
    7 defaultCharset = "ISO-8859-1
     7defaultCharset = "UTF-8
    88 
    99checkTrustedModules = off 
     
    2121 
    2222[plugins] 
    23 auth = auth.plugin.jsonrpc.ini.php 
     23auth = "jsonrpc/auth.coord.ini.php" 
    2424 
    2525[responses] 
  • trunk/lib/jelix-modules/jxxulapp/install/var/config/rdf/config.ini.php

    r479 r485  
    55defaultAction = "default_index" 
    66defaultLocale = "fr_FR" 
    7 defaultCharset = "ISO-8859-1
     7defaultCharset = "UTF-8
    88 
    99checkTrustedModules = off 
     
    2121 
    2222[plugins] 
    23 auth = auth.plugin.rdf.ini.php 
     23auth = "rdf/auth.coord.ini.php" 
    2424 
    2525[responses] 
  • trunk/lib/jelix-modules/jxxulapp/install/var/config/rdf/config.ini.php

    r479 r485  
    55defaultAction = "default_index" 
    66defaultLocale = "fr_FR" 
    7 defaultCharset = "ISO-8859-1
     7defaultCharset = "UTF-8
    88 
    99checkTrustedModules = off 
     
    2121 
    2222[plugins] 
    23 auth = auth.plugin.rdf.ini.php 
     23auth = "rdf/auth.coord.ini.php" 
    2424 
    2525[responses] 
  • trunk/lib/jelix-modules/jxxulapp/install/var/config/xul/config.ini.php

    r479 r485  
    55defaultAction = "default_index" 
    66defaultLocale = "fr_FR" 
    7 defaultCharset = "ISO-8859-1
     7defaultCharset = "UTF-8
    88 
    99checkTrustedModules = off 
     
    2121 
    2222[plugins] 
    23 auth = auth.plugin.xul.ini.php 
     23auth = "xul/auth.coord.ini.php" 
    2424 
    2525[responses] 
  • trunk/lib/jelix-modules/jxxulapp/install/var/config/xul/config.ini.php

    r479 r485  
    55defaultAction = "default_index" 
    66defaultLocale = "fr_FR" 
    7 defaultCharset = "ISO-8859-1
     7defaultCharset = "UTF-8
    88 
    99checkTrustedModules = off 
     
    2121 
    2222[plugins] 
    23 auth = auth.plugin.xul.ini.php 
     23auth = "xul/auth.coord.ini.php" 
    2424 
    2525[responses] 
  • trunk/lib/jelix-modules/jxxulapp/templates/login.tpl

    r386 r485  
    22{meta_xul css 'jelix/xul/jxulform.css'} 
    33{meta_xul ns array('jx'=>'jxbl')} 
     4{meta_xul js 'jelix/js/json.js'} 
    45 
    56<script type="application/x-javascript"><![CDATA[ 
     
    2425 
    2526<jx:submission id="loginform" action="{jurl '@jsonrpc'}" method="POST" 
    26         format="json-rpc" 
     27        format="json-rpc" rpcmethod="jxauth~login_in" 
    2728        onsubmit="" 
    28         rpcmethod="jxauth~login_in" 
     29        oninvalidate="alert('Saisissez un login et mot de passe')" 
     30 
    2931        onresult="onLoginResult(this)" 
    30         onhttperror="alert('erreur http :' + event.errorCode)" 
    31         oninvalidate="alert('Saisissez un login et mot de passe')" 
    32         onrpcerror="alert(this.jsonResponse.error.toSource())" 
    33         onerror="alert(this.httpreq.responseText);" 
     32        onrpcerror="alert('RPC error\ncode='+this.jsonResponse.error.code + '\nmessage='+this.jsonResponse.error.string)" 
     33        onhttperror="alert('HTTP Error\nstatus=' + this.httpreq.status + '\nresponse='+ this.httpreq.responseText)" 
     34        onerror="alert('internal error, code ='+event.errorCode+'\nresponse='+ this.httpreq.responseText)" 
    3435        /> 
    3536 
  • trunk/lib/jelix-modules/jxxulapp/templates/login.tpl

    r386 r485  
    22{meta_xul css 'jelix/xul/jxulform.css'} 
    33{meta_xul ns array('jx'=>'jxbl')} 
     4{meta_xul js 'jelix/js/json.js'} 
    45 
    56<script type="application/x-javascript"><![CDATA[ 
     
    2425 
    2526<jx:submission id="loginform" action="{jurl '@jsonrpc'}" method="POST" 
    26         format="json-rpc" 
     27        format="json-rpc" rpcmethod="jxauth~login_in" 
    2728        onsubmit="" 
    28         rpcmethod="jxauth~login_in" 
     29        oninvalidate="alert('Saisissez un login et mot de passe')" 
     30 
    2931        onresult="onLoginResult(this)" 
    30         onhttperror="alert('erreur http :' + event.errorCode)" 
    31         oninvalidate="alert('Saisissez un login et mot de passe')" 
    32         onrpcerror="alert(this.jsonResponse.error.toSource())" 
    33         onerror="alert(this.httpreq.responseText);" 
     32        onrpcerror="alert('RPC error\ncode='+this.jsonResponse.error.code + '\nmessage='+this.jsonResponse.error.string)" 
     33        onhttperror="alert('HTTP Error\nstatus=' + this.httpreq.status + '\nresponse='+ this.httpreq.responseText)" 
     34        onerror="alert('internal error, code ='+event.errorCode+'\nresponse='+ this.httpreq.responseText)" 
    3435        /> 
    3536 
  • trunk/lib/jelix-www/js/json.js

    r144 r485  
    11/* 
    2 Copyright (c) 2005 JSON.org 
     2    json.js 
     3    2007-06-19 
    34 
    4 Permission is hereby granted, free of charge, to any person obtaining a copy 
    5 of this software and associated documentation files (the "Software"), to deal 
    6 in the Software without restriction, including without limitation the rights 
    7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 
    8 copies of the Software, and to permit persons to whom the Software is 
    9 furnished to do so, subject to the following conditions: 
     5    Public Domain 
    106 
    11 The Software shall be used for Good, not Evil. 
     7    This file adds these methods to JavaScript: 
    128 
    13 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
    14 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
    15 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
    16 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
    17 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
    18 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
    19 SOFTWARE. 
     9        array.toJSONString() 
     10        boolean.toJSONString() 
     11        date.toJSONString() 
     12        number.toJSONString() 
     13        object.toJSONString() 
     14        string.toJSONString() 
     15            These methods produce a JSON text from a JavaScript value. 
     16            It must not contain any cyclical references. Illegal values 
     17            will be excluded. 
     18 
     19            The default conversion for dates is to an ISO string. You can 
     20            add a toJSONString method to any date object to get a different 
     21            representation. 
     22 
     23        string.parseJSON(filter) 
     24            This method parses a JSON text to produce an object or 
     25            array. It can throw a SyntaxError exception. 
     26 
     27            The optional filter parameter is a function which can filter and 
     28            transform the results. It receives each of the keys and values, and 
     29            its return value is used instead of the original value. If it 
     30            returns what it received, then structure is not modified. If it 
     31            returns undefined then the member is deleted. 
     32 
     33            Example: 
     34 
     35            // Parse the text. If a key contains the string 'date' then 
     36            // convert the value to a date. 
     37 
     38            myData = text.parseJSON(function (key, value) { 
     39                return key.indexOf('date') >= 0 ? new Date(value) : value; 
     40            }); 
     41 
     42    It is expected that these methods will formally become part of the 
     43    JavaScript Programming Language in the Fourth Edition of the 
     44    ECMAScript standard in 2008. 
     45 
     46    This file will break programs with improper for..in loops. See 
     47    http://yuiblog.com/blog/2006/09/26/for-in-intrigue/ 
     48 
     49    This is a reference implementation. You are free to copy, modify, or 
     50    redistribute. 
     51 
     52    Use your own copy. It is extremely unwise to load untrusted third party 
     53    code into your pages. 
    2054*/ 
    2155 
    22 var JSON = { 
    23     org: 'http://www.JSON.org', 
    24     copyright: '(c)2005 JSON.org', 
    25     license: 'http://www.crockford.com/JSON/license.html', 
    26     stringify: function stringify(arg) { 
    27         var c, i, l, s = '', v; 
     56/*jslint evil: true */ 
    2857 
    29         switch (typeof arg) { 
    30         case 'object': 
    31             if (arg) { 
    32                 if (arg.constructor == Array) { 
    33                     for (i = 0; i < arg.length; ++i) { 
    34                         v = this.stringify(arg[i]); 
    35                         if (s) { 
    36                             s += ','; 
    37                         } 
    38                         s += v; 
    39                     } 
    40                     return '[' + s + ']'; 
    41                 } else if (typeof arg.toString != 'undefined') { 
    42                     for (i in arg) { 
    43                         v = arg[i]; 
    44                         if (typeof v != 'undefined' && typeof v != 'function') { 
    45                             v = this.stringify(v); 
    46                             if (s) { 
    47                                 s += ','; 
    48                             } 
    49                             s += this.stringify(i) + ':' + v; 
    50                         } 
    51                     } 
    52                     return '{' + s + '}'; 
    53                 } 
    54             } 
    55             return 'null'; 
    56         case 'number': 
    57             return isFinite(arg) ? String(arg) : 'null'; 
    58         case 'string': 
    59             l = arg.length; 
    60             s = '"'; 
    61             for (i = 0; i < l; i += 1) { 
    62                 c = arg.charAt(i); 
    63                 if (c >= ' ') { 
    64                     if (c == '\\' || c == '"') { 
    65                         s += '\\'; 
    66                     } 
    67                     s += c; 
    68                 } else { 
    69                     switch (c) { 
    70                         case '\b': 
    71                             s += '\\b'; 
    72                             break; 
    73                         case '\f': 
    74                             s += '\\f'; 
    75                             break; 
    76                         case '\n': 
    77                             s += '\\n'; 
    78                             break; 
    79                         case '\r': 
    80                             s += '\\r'; 
    81                             break; 
    82                         case '\t': 
    83                             s += '\\t'; 
    84                             break; 
    85                         default: 
    86                             c = c.charCodeAt(); 
    87                             s += '\\u00' + Math.floor(c / 16).toString(16) + 
    88                                 (c % 16).toString(16); 
    89                     } 
    90                 } 
    91             } 
    92             return s + '"'; 
    93         case 'boolean': 
    94             return String(arg); 
    95         default: 
    96             return 'null'; 
    97         } 
    98     }, 
    99     parse: function (text) { 
    100         var at = 0; 
    101         var ch = ' '; 
    102  
    103         function error(m) { 
    104             throw { 
    105                 name: 'JSONError', 
    106                 message: m, 
    107                 at: at - 1, 
    108                 text: text 
    109             }; 
    110         } 
    111  
    112         function next() { 
    113             ch = text.charAt(at); 
    114             at += 1; 
    115             return ch; 
    116         } 
    117  
    118         function white() { 
    119             while (ch) { 
    120                 if (ch <= ' ') { 
    121                     next(); 
    122                 } else if (ch == '/') { 
    123                     switch (next()) { 
    124                         case '/': 
    125                             while (next() && ch != '\n' && ch != '\r') {} 
    126                             break; 
    127                         case '*': 
    128                             next(); 
    129                             for (;;) { 
    130                                 if (ch) { 
    131                                     if (ch == '*') { 
    132                                         if (next() == '/') { 
    133                                             next(); 
    134                                             break; 
    135                                         } 
    136                                     } else { 
    137                                         next(); 
    138                                     } 
    139                                 } else { 
    140                                     error("Unterminated comment"); 
    141                                 } 
    142                             } 
    143                             break; 
    144                         default: 
    145                             error("Syntax error"); 
     58if (!Object.prototype.toJSONString) { 
     59    Array.prototype.toJSONString = function () { 
     60        var a = [], i, l = this.length, v; 
     61        for (i = 0; i < l; i += 1) { 
     62            v = this[i]; 
     63            switch (typeof v) { 
     64            case 'object': 
     65                if (v) { 
     66                    if (typeof v.toJSONString === 'function') { 
     67                        a.push(v.toJSONString()); 
    14668                    } 
    14769                } else { 
     70                    a.push('null'); 
     71                } 
     72                break; 
     73 
     74            case 'string': 
     75            case 'number': 
     76            case 'boolean': 
     77                a.push(v.toJSONString()); 
     78            } 
     79        } 
     80        return '[' + a.join(',') + ']'; 
     81    }; 
     82 
     83    Boolean.prototype.toJSONString = function () { 
     84        return String(this); 
     85    }; 
     86 
     87    Date.prototype.toJSONString = function () { 
     88        function f(n) { 
     89            return n < 10 ? '0' + n : n; 
     90        } 
     91        return '"' + this.getFullYear() + '-' + 
     92                f(this.getMonth() + 1) + '-' + 
     93                f(this.getDate()) + 'T' + 
     94                f(this.getHours()) + ':' + 
     95                f(this.getMinutes()) + ':' + 
     96                f(this.getSeconds()) + '"'; 
     97    }; 
     98    Number.prototype.toJSONString = function () { 
     99        return isFinite(this) ? String(this) : 'null'; 
     100    }; 
     101    Object.prototype.toJSONString = function () { 
     102        var a = [], k, v; 
     103        for (k in this) { 
     104            if (this.hasOwnProperty(k)) { 
     105                v = this[k]; 
     106                switch (typeof v) { 
     107                case 'object': 
     108                    if (v) { 
     109                        if (typeof v.toJSONString === 'function') { 
     110                            a.push(k.toJSONString() + ':' + v.toJSONString()); 
     111                        } 
     112                    } else { 
     113                        a.push(k.toJSONString() + ':null'); 
     114                    } 
    148115                    break; 
     116 
     117                case 'string': 
     118                case 'number': 
     119                case 'boolean': 
     120                    a.push(k.toJSONString() + ':' + v.toJSONString()); 
    149121                } 
    150122            } 
    151123        } 
     124        return '{' + a.join(',') + '}'; 
     125    }; 
    152126 
    153         function string() { 
    154             var i, s = '', t, u; 
     127    (function (s) { 
     128        var m = { 
     129            '\b': '\\b', 
     130            '\t': '\\t', 
     131            '\n': '\\n', 
     132            '\f': '\\f', 
     133            '\r': '\\r', 
     134            '"' : '\\"', 
     135            '\\': '\\\\' 
     136        }; 
     137        s.parseJSON = function (filter) { 
     138            var j; 
    155139 
    156             if (ch == '"') { 
    157 outer:          while (next()) { 
    158                     if (ch == '"') { 
    159                         next(); 
    160                         return s; 
    161                     } else if (ch == '\\') { 
    162                         switch (next()) { 
    163                         case 'b': 
    164                             s += '\b'; 
    165                             break; 
    166                         case 'f': 
    167                             s += '\f'; 
    168                             break; 
    169                         case 'n': 
    170                             s += '\n'; 
    171                             break; 
    172                         case 'r': 
    173                             s += '\r'; 
    174                             break; 
    175                         case 't': 
    176                             s += '\t'; 
    177                             break; 
    178                         case 'u': 
    179                             u = 0; 
    180                             for (i = 0; i < 4; i += 1) { 
    181                                 t = parseInt(next(), 16); 
    182                                 if (!isFinite(t)) { 
    183                                     break outer; 
    184                                 } 
    185                                 u = u * 16 + t; 
    186                             } 
    187                             s += String.fromCharCode(u); 
    188                             break; 
    189                         default: 
    190                             s += ch; 
     140            function walk(k, v) { 
     141                var i; 
     142                if (v && typeof v === 'object') { 
     143                    for (i in v) { 
     144                        if (v.hasOwnProperty(i)) { 
     145                            v[i] = walk(i, v[i]); 
    191146                        } 
    192                     } else { 
    193                         s += ch; 
    194147                    } 
    195148                } 
     149                return filter(k, v); 
    196150            } 
    197             error("Bad string"); 
    198         } 
    199  
    200         function array() { 
    201             var a = []; 
    202  
    203             if (ch == '[') { 
    204                 next(); 
    205                 white(); 
    206                 if (ch == ']') { 
    207                     next(); 
    208                     return a; 
     151            if (/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/.test(this. 
     152                    replace(/\\./g, '@'). 
     153                    replace(/"[^"\\\n\r]*"/g, ''))) { 
     154                j = eval('(' + this + ')'); 
     155                if (typeof filter === 'function') { 
     156                    j = walk('', j); 
    209157                } 
    210                 while (ch) { 
    211                     a.push(value()); 
    212                     white(); 
    213                     if (ch == ']') { 
    214                         next(); 
    215                         return a; 
    216                     } else if (ch != ',') { 
    217                         break; 
     158                return j; 
     159            } 
     160            throw new SyntaxError('parseJSON'); 
     161        }; 
     162        s.toJSONString = function () { 
     163            if (/["\\\x00-\x1f]/.test(this)) { 
     164                return '"' + this.replace(/([\x00-\x1f\\"])/g, function (a, b) { 
     165                    var c = m[b]; 
     166                    if (c) { 
     167                        return c; 
    218168                    } 
    219                     next(); 
    220                     white(); 
    221                 } 
     169                    c = b.charCodeAt(); 
     170                    return '\\u00' + 
     171                        Math.floor(c / 16).toString(16) + 
     172                        (c % 16).toString(16); 
     173                }) + '"'; 
    222174            } 
    223             error("Bad array"); 
    224         } 
    225  
    226         function object() { 
    227             var k, o = {}; 
    228  
    229             if (ch == '{') { 
    230                 next(); 
    231                 white(); 
    232                 if (ch == '}') { 
    233                     next(); 
    234                     return o; 
    235                 } 
    236                 while (ch) { 
    237                     k = string(); 
    238                     white(); 
    239                     if (ch != ':') { 
    240                         break; 
    241                     } 
    242                     next(); 
    243                     o[k] = value(); 
    244                     white(); 
    245                     if (ch == '}') { 
    246                         next(); 
    247                         return o; 
    248                     } else if (ch != ',') { 
    249                         break; 
    250                     } 
    251                     next(); 
    252                     white(); 
    253                 } 
    254             } 
    255             error("Bad object"); 
    256         } 
    257  
    258         function number() { 
    259             var n = '', v; 
    260  
    261             if (ch == '-') { 
    262                 n = '-'; 
    263                 next(); 
    264             } 
    265             while (ch >= '0' && ch <= '9') { 
    266                 n += ch; 
    267                 next(); 
    268             } 
    269             if (ch == '.') { 
    270                 n += '.'; 
    271                 while (next() && ch >= '0' && ch <= '9') { 
    272                     n += ch; 
    273                 } 
    274             } 
    275             v = +n; 
    276             if (!isFinite(v)) { 
    277                 error("Bad number"); 
    278             } else { 
    279                 return v; 
    280             } 
    281         } 
    282  
    283         function word() { 
    284             switch (ch) { 
    285                 case 't': 
    286                     if (next() == 'r' && next() == 'u' && next() == 'e') { 
    287                         next(); 
    288                         return true; 
    289                     } 
    290                     break; 
    291                 case 'f': 
    292                     if (next() == 'a' && next() == 'l' && next() == 's' && 
    293                             next() == 'e') { 
    294                         next(); 
    295                         return false; 
    296                     } 
    297                     break; 
    298                 case 'n': 
    299                     if (next() == 'u' && next() == 'l' && next() == 'l') { 
    300                         next(); 
    301             &n