Results 1 to 9 of 9

Thread: Javascript problem

  1. #1
    linksor.com is offline Active Member
    Join Date
    Sep 2005
    Location
    Poland - Warsaw
    Posts
    341

    Default Javascript problem

    Hi,

    I know 5.4 is not supported but some users reported me that there is an error in Javascript (JSON).

    link: json.js:91

    Does anybody know what that means ?

    May I download new version JSON or copy it from new IU ?

    This error causing an issue that it is impossible to submit page into directory and browser must be closed and reopen ... sometimes user must wait a little time and refresh a form/page
    Last edited by linksor.com; 12-20-2009 at 05:36 AM.

  2. #2
    rman is offline Registered User
    Join Date
    Jun 2005
    Posts
    21

    Default same problem

    ... in our site
    Any news about jason.js ?

    thanks a lot

  3. #3
    linksor.com is offline Active Member
    Join Date
    Sep 2005
    Location
    Poland - Warsaw
    Posts
    341

    Default

    no news.

    it seems that where there are a lot of users online at one moment the json is not working correctly. On my other sites where I dont have many users online (up to 20-30) there is no such problem.

    Problem exitsts only on 5.4.x

  4. #4
    rman is offline Registered User
    Join Date
    Jun 2005
    Posts
    21

    Default

    please if you find a solution post it here!
    Thanks a lot

  5. #5
    dody is offline Administrator
    Join Date
    Aug 2001
    Location
    Indonesia
    Posts
    3,731

    Default

    The json.js script is originally from here: JSON
    www.nicecoder.com
    www.dodyrw.com

  6. #6
    linksor.com is offline Active Member
    Join Date
    Sep 2005
    Location
    Poland - Warsaw
    Posts
    341

    Default

    Quote Originally Posted by dody View Post
    The json.js script is originally from here: JSON

    which package ? JSON for PHP - could U be more specific please ?

  7. #7
    linksor.com is offline Active Member
    Join Date
    Sep 2005
    Location
    Poland - Warsaw
    Posts
    341

    Default

    never mind - I have found json.js and testing it currently - seems to be better (no such errors) but I must make a test on a bigger site.

    I will post some news after I make some tests

  8. #8
    dody is offline Administrator
    Join Date
    Aug 2001
    Location
    Indonesia
    Posts
    3,731

    Default

    That's great.
    www.nicecoder.com
    www.dodyrw.com

  9. #9
    linksor.com is offline Active Member
    Join Date
    Sep 2005
    Location
    Poland - Warsaw
    Posts
    341

    Default

    OK seems that this version of JSON.JS working. Just copy the code and paste it into JSON.JS file. With the Old one please make a backup.

    Code:
    /*
        json.js
        2006-11-09
        This file adds these methods to JavaScript:
            array.toJSONString()
            boolean.toJSONString()
            date.toJSONString()
            number.toJSONString()
            object.toJSONString()
            string.toJSONString()
                These method produces a JSON text from a JavaScript value.
                It must not contain any cyclical references. Illegal values
                will be excluded.
                The default conversion for dates is to an ISO string. You can
                add a toJSONString method to any date object to get a different
                representation.
            string.parseJSON()
                This method parses a JSON text to produce an object or
                array. It can throw a SyntaxError exception.
        It is expected that these methods will formally become part of the
        JavaScript Programming Language in the Fourth Edition of the
        ECMAScript standard in 2007.
    */
    Array.prototype.toJSONString = function () {
        var a = ['['], b, i, l = this.length, v;
        function p(s) {
            if (b) {
                a.push(',');
            }
            a.push(s);
            b = true;
        }
        for (i = 0; i < l; i += 1) {
            v = this[i];
            switch (typeof v) {
            case 'undefined':
            case 'function':
            case 'unknown':
                break;
            case 'object':
                if (v) {
                    if (typeof v.toJSONString === 'function') {
                        p(v.toJSONString());
                    }
                } else {
                    p("null");
                }
                break;
            default:
                p(v.toJSONString());
            }
        }
        a.push(']');
        return a.join('');
    };
    Boolean.prototype.toJSONString = function () {
        return String(this);
    };
    Date.prototype.toJSONString = function () {
        function f(n) {
            return n < 10 ? '0' + n : n;
        }
        return '"' + this.getFullYear() + '-' +
                f(this.getMonth() + 1) + '-' +
                f(this.getDate()) + 'T' +
                f(this.getHours()) + ':' +
                f(this.getMinutes()) + ':' +
                f(this.getSeconds()) + '"';
    };
    Number.prototype.toJSONString = function () {
        return isFinite(this) ? String(this) : "null";
    };
    Object.prototype.toJSONString = function () {
        var a = ['{'], b, i, v;
        function p(s) {
            if (b) {
                a.push(',');
            }
            a.push(i.toJSONString(), ':', s);
            b = true;
        }
        for (i in this) {
            if (this.hasOwnProperty(i)) {
                v = this[i];
                switch (typeof v) {
                case 'undefined':
                case 'function':
                case 'unknown':
                    break;
                case 'object':
                    if (v) {
                        if (typeof v.toJSONString === 'function') {
                            p(v.toJSONString());
                        }
                    } else {
                        p("null");
                    }
                    break;
                default:
                    p(v.toJSONString());
                }
            }
        }
        a.push('}');
        return a.join('');
    };
    (function (s) {
        var m = {
            '\b': '\\b',
            '\t': '\\t',
            '\n': '\\n',
            '\f': '\\f',
            '\r': '\\r',
            '"' : '\\"',
            '\\': '\\\\'
        };
        s.parseJSON = function () {
            try {
                if (/^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/.
                        test(this)) {
                    return eval('(' + this + ')');
                }
            } catch (e) {
            }
            throw new SyntaxError("parseJSON");
        };
        s.toJSONString = function () {
            if (/["\\\x00-\x1f]/.test(this)) {
                return '"' + this.replace(/([\x00-\x1f\\"])/g, function(a, b) {
                    var c = m[b];
                    if (c) {
                        return c;
                    }
                    c = b.charCodeAt();
                    return '\\u00' +
                        Math.floor(c / 16).toString(16) +
                        (c % 16).toString(16);
                }) + '"';
            }
            return '"' + this + '"';
        };
    })(String.prototype);

Similar Threads

  1. <SCRIPT language=javascript> change
    By FSGDAG in forum iDesk - Customer Service Helpdesk
    Replies: 2
    Last Post: 08-13-2009, 12:43 AM
  2. Minimum description with counter (javascript)
    By linksor.com in forum Blocks and Modification
    Replies: 4
    Last Post: 02-10-2009, 09:15 AM
  3. use sneaky redirects with javascript mouseovers
    By bugsdirectory in forum Website development, hosting and promotion
    Replies: 0
    Last Post: 02-13-2006, 04:54 PM
  4. Install.php problem - Admin problem
    By highfly in forum Indexu Lite
    Replies: 0
    Last Post: 01-12-2006, 06:31 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •