[hg] galaxy 2618: Remove unused js
details: http://www.bx.psu.edu/hg/galaxy/rev/07a02ebbdf1a changeset: 2618:07a02ebbdf1a user: Kanwei Li <kanwei@gmail.com> date: Mon Aug 24 15:46:03 2009 -0400 description: Remove unused js 1 file(s) affected in this change: static/scripts/json_cookie.js diffs (66 lines): diff -r 168a6ef6a99a -r 07a02ebbdf1a static/scripts/json_cookie.js --- a/static/scripts/json_cookie.js Sun Aug 23 17:13:04 2009 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ -/* - JSONCookie: Uses JSON to allow the settings of multiple preferences in one cookie. - Kanwei Li, 2009 - - cookie = new JSONCookie("cookie_name"); // Pass in the name of the cookie - - // Gets the value of a preference, returns optional second argument if pref not found - cookie.get("pref", "val_if_not_found"); - - cookie.set("pref", "val"); // Sets a value for the preference and saves cookie - cookie.unset("pref"); // Unsets the preference and saves cookie - cookie.clear() // Deletes the cookie - -*/ - -function JSONCookie(name) { - this.cookie_name = name; - -} - -JSONCookie.prototype = { - json_data : function() { - cookie = $.cookie(this.cookie_name); - return cookie ? JSON.parse(cookie) : null; - }, - - save : function(data) { - $.cookie(this.cookie_name, JSON.stringify(data)); - }, - - get : function(attr, else_val) { - data = this.json_data(); - if (data && data[attr]) { return data[attr]; - } else if (else_val) { return else_val; - } else { return null; - } - }, - - set : function(attr, val) { - data = this.json_data(); - if (data) { - data[attr] = val; - } else { - data = { attr : val } - } - this.save(data); - }, - - unset : function(attr) { - data = this.json_data(); - if (data) { - delete data[attr]; - } - this.save(data); - }, - - clear : function() { - this.save(null); - } - -}; \ No newline at end of file
participants (1)
-
Nate Coraor