details: http://www.bx.psu.edu/hg/galaxy/rev/0517fd342fc8 changeset: 2601:0517fd342fc8 user: Kanwei Li <kanwei@gmail.com> date: Thu Aug 20 12:41:37 2009 -0400 description: Use JSON2.js for all JSON operations, and remove unused javascript files 7 file(s) affected in this change: static/scripts/cookie_set.js static/scripts/jquery.cookie.js static/scripts/jquery.json.js static/scripts/packed/cookie_set.js static/scripts/packed/jquery.cookie.js static/scripts/packed/jquery.json.js templates/workflow/editor.mako diffs (270 lines): diff -r 97170896bb91 -r 0517fd342fc8 static/scripts/cookie_set.js --- a/static/scripts/cookie_set.js Thu Aug 20 11:04:45 2009 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -function CookieSet( cookie_name ) { - this.cookie_name = cookie_name; - this.store = store = {}; - jQuery.each( ( jQuery.cookie( cookie_name) || "" ).split( "|" ), function( k, v ) { - store[ v ] = true; - }); -}; -CookieSet.prototype.add = function( value ) { - this.store[value] = true; - return this; -}; -CookieSet.prototype.remove = function( value ) { - delete this.store[value]; - return this; -}; -CookieSet.prototype.removeAll = function( value ) { - this.store = {}; - return this; -}; -CookieSet.prototype.contains = function( value ) { - return ( value in this.store ); -}; -CookieSet.prototype.save = function() { - t = []; - for ( key in this.store ) { - if ( key != "" ) { t.push( key ) } - } - jQuery.cookie( this.cookie_name, t.join( "|" ) ); - return this; -}; \ No newline at end of file diff -r 97170896bb91 -r 0517fd342fc8 static/scripts/jquery.cookie.js --- a/static/scripts/jquery.cookie.js Thu Aug 20 11:04:45 2009 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,92 +0,0 @@ -/** - * Cookie plugin - * - * Copyright (c) 2006 Klaus Hartl (stilbuero.de) - * Dual licensed under the MIT and GPL licenses: - * http://www.opensource.org/licenses/mit-license.php - * http://www.gnu.org/licenses/gpl.html - * - */ - -/** - * Create a cookie with the given name and value and other optional parameters. - * - * @example $.cookie('the_cookie', 'the_value'); - * @desc Set the value of a cookie. - * @example $.cookie('the_cookie', 'the_value', {expires: 7, path: '/', domain: 'jquery.com', secure: true}); - * @desc Create a cookie with all available options. - * @example $.cookie('the_cookie', 'the_value'); - * @desc Create a session cookie. - * @example $.cookie('the_cookie', null); - * @desc Delete a cookie by passing null as value. - * - * @param String name The name of the cookie. - * @param String value The value of the cookie. - * @param Object options An object literal containing key/value pairs to provide optional cookie attributes. - * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object. - * If a negative value is specified (e.g. a date in the past), the cookie will be deleted. - * If set to null or omitted, the cookie will be a session cookie and will not be retained - * when the the browser exits. - * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie). - * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie). - * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will - * require a secure protocol (like HTTPS). - * @type undefined - * - * @name $.cookie - * @cat Plugins/Cookie - * @author Klaus Hartl/klaus.hartl@stilbuero.de - */ - -/** - * Get the value of a cookie with the given name. - * - * @example $.cookie('the_cookie'); - * @desc Get the value of a cookie. - * - * @param String name The name of the cookie. - * @return The value of the cookie. - * @type String - * - * @name $.cookie - * @cat Plugins/Cookie - * @author Klaus Hartl/klaus.hartl@stilbuero.de - */ -jQuery.cookie = function(name, value, options) { - if (typeof value != 'undefined') { // name and value given, set cookie - options = options || {}; - if (value === null) { - value = ''; - options.expires = -1; - } - var expires = ''; - if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) { - var date; - if (typeof options.expires == 'number') { - date = new Date(); - date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000)); - } else { - date = options.expires; - } - expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE - } - var path = options.path ? '; path=' + options.path : ''; - var domain = options.domain ? '; domain=' + options.domain : ''; - var secure = options.secure ? '; secure' : ''; - document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join(''); - } else { // only name given, get cookie - var cookieValue = null; - if (document.cookie && document.cookie != '') { - var cookies = document.cookie.split(';'); - for (var i = 0; i < cookies.length; i++) { - var cookie = jQuery.trim(cookies[i]); - // Does this cookie string begin with the name we want? - if (cookie.substring(0, name.length + 1) == (name + '=')) { - cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); - break; - } - } - } - return cookieValue; - } -}; \ No newline at end of file diff -r 97170896bb91 -r 0517fd342fc8 static/scripts/jquery.json.js --- a/static/scripts/jquery.json.js Thu Aug 20 11:04:45 2009 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,96 +0,0 @@ -(function ($) { - var m = { - '\b': '\\b', - '\t': '\\t', - '\n': '\\n', - '\f': '\\f', - '\r': '\\r', - '"' : '\\"', - '\\': '\\\\' - }, - s = { - 'array': function (x) { - var a = ['['], b, f, i, l = x.length, v; - for (i = 0; i < l; i += 1) { - v = x[i]; - f = s[typeof v]; - if (f) { - v = f(v); - if (typeof v == 'string') { - if (b) { - a[a.length] = ','; - } - a[a.length] = v; - b = true; - } - } - } - a[a.length] = ']'; - return a.join(''); - }, - 'boolean': function (x) { - return String(x); - }, - 'null': function (x) { - return "null"; - }, - 'number': function (x) { - return isFinite(x) ? String(x) : 'null'; - }, - 'object': function (x) { - if (x) { - if (x instanceof Array) { - return s.array(x); - } - var a = ['{'], b, f, i, v; - for (i in x) { - v = x[i]; - f = s[typeof v]; - if (f) { - v = f(v); - if (typeof v == 'string') { - if (b) { - a[a.length] = ','; - } - a.push(s.string(i), ':', v); - b = true; - } - } - } - a[a.length] = '}'; - return a.join(''); - } - return 'null'; - }, - 'string': function (x) { - if (/["\\\x00-\x1f]/.test(x)) { - x = x.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 '"' + x + '"'; - } - }; - - $.toJSON = function(v) { - var f = isNaN(v) ? s[typeof v] : s['number']; - if (f) return f(v); - }; - - $.parseJSON = function(v, safe) { - if (safe === undefined) safe = $.parseJSON.safe; - if (safe && !/^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/.test(v)) - return undefined; - return eval('('+v+')'); - }; - - $.parseJSON.safe = false; - -})(jQuery); diff -r 97170896bb91 -r 0517fd342fc8 static/scripts/packed/cookie_set.js --- a/static/scripts/packed/cookie_set.js Thu Aug 20 11:04:45 2009 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -function CookieSet(a){this.cookie_name=a;this.store=store={};jQuery.each((jQuery.cookie(a)||"").split("|"),function(c,b){store[b]=true})}CookieSet.prototype.add=function(a){this.store[a]=true;return this};CookieSet.prototype.remove=function(a){delete this.store[a];return this};CookieSet.prototype.removeAll=function(a){this.store={};return this};CookieSet.prototype.contains=function(a){return(a in this.store)};CookieSet.prototype.save=function(){t=[];for(key in this.store){if(key!=""){t.push(key)}}jQuery.cookie(this.cookie_name,t.join("|"));return this}; \ No newline at end of file diff -r 97170896bb91 -r 0517fd342fc8 static/scripts/packed/jquery.cookie.js --- a/static/scripts/packed/jquery.cookie.js Thu Aug 20 11:04:45 2009 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -jQuery.cookie=function(b,j,m){if(typeof j!="undefined"){m=m||{};if(j===null){j="";m.expires=-1}var e="";if(m.expires&&(typeof m.expires=="number"||m.expires.toUTCString)){var f;if(typeof m.expires=="number"){f=new Date();f.setTime(f.getTime()+(m.expires*24*60*60*1000))}else{f=m.expires}e="; expires="+f.toUTCString()}var l=m.path?"; path="+m.path:"";var g=m.domain?"; domain="+m.domain:"";var a=m.secure?"; secure":"";document.cookie=[b,"=",encodeURIComponent(j),e,l,g,a].join("")}else{var d=null;if(document.cookie&&document.cookie!=""){var k=document.cookie.split(";");for(var h=0;h<k.length;h++){var c=jQuery.trim(k[h]);if(c.substring(0,b.length+1)==(b+"=")){d=decodeURIComponent(c.substring(b.length+1));break}}}return d}}; \ No newline at end of file diff -r 97170896bb91 -r 0517fd342fc8 static/scripts/packed/jquery.json.js --- a/static/scripts/packed/jquery.json.js Thu Aug 20 11:04:45 2009 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -(function($){var m={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},s={array:function(x){var a=["["],b,f,i,l=x.length,v;for(i=0;i<l;i+=1){v=x[i];f=s[typeof v];if(f){v=f(v);if(typeof v=="string"){if(b){a[a.length]=","}a[a.length]=v;b=true}}}a[a.length]="]";return a.join("")},"boolean":function(x){return String(x)},"null":function(x){return"null"},number:function(x){return isFinite(x)?String(x):"null"},object:function(x){if(x){if(x instanceof Array){return s.array(x)}var a=["{"],b,f,i,v;for(i in x){v=x[i];f=s[typeof v];if(f){v=f(v);if(typeof v=="string"){if(b){a[a.length]=","}a.push(s.string(i),":",v);b=true}}}a[a.length]="}";return a.join("")}return"null"},string:function(x){if(/["\\\x00-\x1f]/.test(x)){x=x.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'"'+x+'"'}};$.toJSON=function(v){var f=isNaN(v)?s[typeof v]:s.number;if(f){return f(v) }};$.parseJSON=function(v,safe){if(safe===undefined){safe=$.parseJSON.safe}if(safe&&!/^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/.test(v)){return undefined}return eval("("+v+")")};$.parseJSON.safe=false})(jQuery); \ No newline at end of file diff -r 97170896bb91 -r 0517fd342fc8 templates/workflow/editor.mako --- a/templates/workflow/editor.mako Thu Aug 20 11:04:45 2009 -0400 +++ b/templates/workflow/editor.mako Thu Aug 20 12:41:37 2009 -0400 @@ -30,7 +30,6 @@ <script type='text/javascript' src="${h.url_for('/static/scripts/jquery.event.drop.js')}"> </script> <script type='text/javascript' src="${h.url_for('/static/scripts/jquery.event.hover.js')}"> </script> <script type='text/javascript' src="${h.url_for('/static/scripts/jquery.form.js')}"> </script> - <script type='text/javascript' src="${h.url_for('/static/scripts/jquery.json.js')}"> </script> <script type='text/javascript' src="${h.url_for('/static/scripts/jquery.jstore-all.js')}"> </script> <script type='text/javascript' src="${h.url_for('/static/scripts/galaxy.base.js')}"> </script> @@ -350,7 +349,7 @@ type: "POST", data: { id: "${trans.security.encode_id( workflow_id )}", - workflow_data: function() { return $.toJSON( workflow.to_simple() ) }, + workflow_data: function() { return JSON.stringify( workflow.to_simple() ) }, "_": "true" }, dataType: 'json',