# HG changeset patch # User RĂ©mi Cardona # Date 1396015173 -3600 # Node ID c170ec8a4525296a11a2e20ae91c9279699de715 # Parent a78efec4cf04f4037723f74b60a0cadfa609b303 [web/data] Remove broken jquery-json plugin (closes #3590335) Conversion of Date() objects is somehow broken (don't know why beyond that it's due to jquery-json's monkeypatched Date.toJSON() method). Use the now-standard JSON.stringify() instead. http://caniuse.com/#feat=json says it's supported by all browsers, and even IE going back to version 8. diff -r a78efec4cf04 -r c170ec8a4525 doc/tools/pyjsrest.py --- a/doc/tools/pyjsrest.py Mon Jan 27 14:02:21 2014 +0100 +++ b/doc/tools/pyjsrest.py Fri Mar 28 14:59:33 2014 +0100 @@ -142,7 +142,6 @@ FILES_TO_IGNORE = set([ 'jquery.js', 'jquery.treeview.js', - 'jquery.json.js', 'jquery.tablesorter.js', 'jquery.timePicker.js', 'jquery.flot.js', diff -r a78efec4cf04 -r c170ec8a4525 web/data/cubicweb.ajax.js --- a/web/data/cubicweb.ajax.js Mon Jan 27 14:02:21 2014 +0100 +++ b/web/data/cubicweb.ajax.js Fri Mar 28 14:59:33 2014 +0100 @@ -312,7 +312,7 @@ $.extend(form, { 'fname': fname, 'pageid': pageid, - 'arg': $.map(cw.utils.sliceList(arguments, 2), jQuery.toJSON) + 'arg': $.map(cw.utils.sliceList(arguments, 2), JSON.stringify) }); return form; } @@ -745,7 +745,7 @@ var props = { fname: fname, pageid: pageid, - arg: $.map(cw.utils.sliceList(arguments, 1), jQuery.toJSON) + arg: $.map(cw.utils.sliceList(arguments, 1), JSON.stringify) }; var result = jQuery.ajax({ url: AJAX_BASE_URL, @@ -765,7 +765,7 @@ var props = { fname: fname, pageid: pageid, - arg: $.map(cw.utils.sliceList(arguments, 1), jQuery.toJSON) + arg: $.map(cw.utils.sliceList(arguments, 1), JSON.stringify) }; // XXX we should inline the content of loadRemote here var deferred = loadRemote(AJAX_BASE_URL, props, 'POST'); diff -r a78efec4cf04 -r c170ec8a4525 web/data/cubicweb.edition.js --- a/web/data/cubicweb.edition.js Mon Jan 27 14:02:21 2014 +0100 +++ b/web/data/cubicweb.edition.js Fri Mar 28 14:59:33 2014 +0100 @@ -26,7 +26,7 @@ var args = { fname: 'prop_widget', pageid: pageid, - arg: $.map([key, varname, tabindex], jQuery.toJSON) + arg: $.map([key, varname, tabindex], JSON.stringify) }; cw.jqNode('div:value:' + varname).loadxhtml(AJAX_BASE_URL, args, 'post'); } diff -r a78efec4cf04 -r c170ec8a4525 web/data/cubicweb.js --- a/web/data/cubicweb.js Mon Jan 27 14:02:21 2014 +0100 +++ b/web/data/cubicweb.js Fri Mar 28 14:59:33 2014 +0100 @@ -384,7 +384,7 @@ */ strFuncCall: function(fname /* ...*/) { return (fname + '(' + - $.map(cw.utils.sliceList(arguments, 1), jQuery.toJSON).join(',') + $.map(cw.utils.sliceList(arguments, 1), JSON.stringify).join(',') + ')' ); } diff -r a78efec4cf04 -r c170ec8a4525 web/data/jquery.json.js --- a/web/data/jquery.json.js Mon Jan 27 14:02:21 2014 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -(function($){function toIntegersAtLease(n) -{return n<10?'0'+n:n;} -Date.prototype.toJSON=function(date) -{return date.getUTCFullYear()+'-'+ -toIntegersAtLease(date.getUTCMonth()+1)+'-'+ -toIntegersAtLease(date.getUTCDate());};var escapeable=/["\\\x00-\x1f\x7f-\x9f]/g;var meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'} -$.quoteString=function(string) -{if(escapeable.test(string)) -{return'"'+string.replace(escapeable,function(a) -{var c=meta[a];if(typeof c==='string'){return c;} -c=a.charCodeAt();return'\\u00'+Math.floor(c/16).toString(16)+(c%16).toString(16);})+'"'} -return'"'+string+'"';} -$.toJSON=function(o) -{var type=typeof(o);if(type=="undefined") -return"undefined";else if(type=="number"||type=="boolean") -return o+"";else if(o===null) -return"null";if(type=="string") -{return $.quoteString(o);} -if(type=="object"&&typeof o.toJSON=="function") -return o.toJSON();if(type!="function"&&typeof(o.length)=="number") -{var ret=[];for(var i=0;i