~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to www/media/common/json2.js

  • Committer: chadnickbok
  • Date: 2009-01-19 22:56:46 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:1170
This commit fixes issue #10 and part of issue #9

There are now two options for moving files with their
svn history intact; svn move and svn copy. These
use the svn commands to move the files, allowing students
to move and rename files without their histories being
lost.

This commit also shows the svn status of a dir, if it is
the 'head' of an svn repository.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* json2.js
 
2
 * Public Domain
 
3
 * No warranty expressed or implied. Use at your own risk.
 
4
 * See http://www.JSON.org/js.html
 
5
*/
 
6
if(!this.JSON){JSON=function(){function f(n){return n<10?'0'+n:n;}
 
7
Date.prototype.toJSON=function(){return this.getUTCFullYear()+'-'+
 
8
f(this.getUTCMonth()+1)+'-'+
 
9
f(this.getUTCDate())+'T'+
 
10
f(this.getUTCHours())+':'+
 
11
f(this.getUTCMinutes())+':'+
 
12
f(this.getUTCSeconds())+'Z';};var m={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'};function stringify(value,whitelist){var a,i,k,l,r=/["\\\x00-\x1f\x7f-\x9f]/g,v;switch(typeof value){case'string':return r.test(value)?'"'+value.replace(r,function(a){var c=m[a];if(c){return c;}
 
13
c=a.charCodeAt();return'\\u00'+Math.floor(c/16).toString(16)+
 
14
(c%16).toString(16);})+'"':'"'+value+'"';case'number':return isFinite(value)?String(value):'null';case'boolean':case'null':return String(value);case'object':if(!value){return'null';}
 
15
if(typeof value.toJSON==='function'){return stringify(value.toJSON());}
 
16
a=[];if(typeof value.length==='number'&&!(value.propertyIsEnumerable('length'))){l=value.length;for(i=0;i<l;i+=1){a.push(stringify(value[i],whitelist)||'null');}
 
17
return'['+a.join(',')+']';}
 
18
if(whitelist){l=whitelist.length;for(i=0;i<l;i+=1){k=whitelist[i];if(typeof k==='string'){v=stringify(value[k],whitelist);if(v){a.push(stringify(k)+':'+v);}}}}else{for(k in value){if(typeof k==='string'){v=stringify(value[k],whitelist);if(v){a.push(stringify(k)+':'+v);}}}}
 
19
return'{'+a.join(',')+'}';}}
 
20
return{stringify:stringify,parse:function(text,filter){var j;function walk(k,v){var i,n;if(v&&typeof v==='object'){for(i in v){if(Object.prototype.hasOwnProperty.apply(v,[i])){n=walk(i,v[i]);if(n!==undefined){v[i]=n;}}}}
 
21
return filter(k,v);}
 
22
if(/^[\],:{}\s]*$/.test(text.replace(/\\./g,'@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(:?[eE][+\-]?\d+)?/g,']').replace(/(?:^|:|,)(?:\s*\[)+/g,''))){j=eval('('+text+')');return typeof filter==='function'?walk('',j):j;}
 
23
throw new SyntaxError('parseJSON');}};}();}