Skip to content

Commit

Permalink
fix tracklist=0 URL control param, which fixes embedded mode and closes
Browse files Browse the repository at this point in the history
  • Loading branch information
rbuels committed Aug 28, 2012
1 parent 1bd31f2 commit 62e3644
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 6 deletions.
36 changes: 35 additions & 1 deletion src/JBrowse/Browser.js
Expand Up @@ -454,7 +454,41 @@ Browser.prototype.loadConfig = function () {
this.onConfigLoaded();
}));
};
Browser.prototype.onConfigLoaded = function() {};

/**
* Hook run after the configuration is all loaded.
*/
Browser.prototype.onConfigLoaded = function() {
// coerce some config keys to boolean
dojo.forEach( ['show_tracklist','show_nav','show_overview'], function(v) {
this.config[v] = this._coerceBoolean( this.config[v] );
},this);
};

/**
* Coerce a value of unknown type to a boolean, treating string 'true'
* and 'false' as the values they indicate, and string numbers as
* numbers.
* @private
*/
Browser.prototype._coerceBoolean = function(val) {
if( typeof val == 'string' ) {
val = val.toLowerCase();
if( val == 'true' ) {
return true;
}
else if( val == 'false' )
return false;
else
return parseInt(val);
}
else if( typeof val == 'boolean' ) {
return val;
}
else {
return true;
}
};

/**
* Add a function to be executed once JBrowse is initialized
Expand Down
14 changes: 9 additions & 5 deletions src/JBrowse/View/TrackList/Null.js
@@ -1,12 +1,16 @@
define(['dojo/_base/declare'],function(declare) {

return declare(null,

/**
* Null track selector. Does not actually do anything.
* @class JBrowse.View.TrackList.Null
* @lends JBrowse.View.TrackList.Null.prototype
*/

dojo.declare( 'JBrowse.View.TrackList.Null', null, {
{
setTracksActive: function() {},
setTracksInactive: function() {},
show: function() {},
hide: function() {},
toggle: function() {}
} );
});
});

0 comments on commit 62e3644

Please sign in to comment.