Files
galaxy/static/scripts/cookie_set.js
T
James Taylor 3ba107decc All javascript used in the web interface is now based on jQuery. All pages now work well with javascript disabled. Javascript enhancements (expand/collapse regions, confirmations, ajax delete, rollovers) are then added "unobtrusively".
Also, the consolidation makes the total file size substantially smaller. In addition, there is a "scripts/packed" directory that contains highly compressed versions of the javascript files. This should be used for production deployment. The initial load size is reduced by ~80%, before considering gzip and caching.
2007-06-28 23:52:40 +00:00

30 lines
798 B
JavaScript

function CookieSet( cookie_name ) {
this.cookie_name = cookie_name;
this.store = store = {};
q.each( ( q.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 ) }
}
q.cookie( this.cookie_name, t.join( "|" ) );
return this;
};