Skip to content

Commit

Permalink
make track metadata source urls just be relative to the base
Browse files Browse the repository at this point in the history
(i.e. index.html), add support for a "class" param that specifies what
backend class to try to use, and make the dojo.require not be called
if the class is already loaded, and not throw if it doesn't succeed.
  • Loading branch information
rbuels committed May 9, 2012
1 parent d0b7982 commit ae05d90
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions js/Browser.js
Expand Up @@ -474,14 +474,18 @@ Browser.prototype.createTrackList = function() {
trackConfigs: this.config.tracks,
browser: this,
metadataStores: dojo.map( this.config.trackMetaSources || [], function( sourceDef ) {
var url = Util.resolveUrl( this.config.sourceUrl, sourceDef.url || 'trackMeta.csv' );
var url = sourceDef.url || 'trackMeta.csv';
var type = sourceDef.type || (
/\.csv$/i.test(url) ? 'csv' :
/\.js(on)?$/i.test(url) ? 'json' :
'csv'
);
var storeClass = { csv: 'dojox.data.CsvStore', json: 'dojox.data.JsonRestStore' }[type];
dojo.require(storeClass);
var storeClass = sourceDef['class']
|| { csv: 'dojox.data.CsvStore', json: 'dojox.data.JsonRestStore' }[type];

try { eval(storeClass) || dojo.require(storeClass); }
catch (x) { console.error('Could not load trackMetaSource class '+storeClass+': ' + x); }

return new (eval(storeClass))({ url: url });
},this)
}),
Expand Down

0 comments on commit ae05d90

Please sign in to comment.