diff --git a/ui (gen4)/data.js b/ui (gen4)/data.js index 9d77206b..3abda14f 100755 --- a/ui (gen4)/data.js +++ b/ui (gen4)/data.js @@ -308,20 +308,28 @@ var DataPrototype = { // // If no arguments are given then a unique gid will be generated. // + // XXX revise... newGid: function(str, nohash){ - var p = location.hostname + '-' + // prevent same gids from ever being created... + // NOTE: this is here in case we are generating new gids fast + // enough that Date.now() produces identical results for 2+ + // consecutive calls... + var t = module.__gid_ticker = (module.__gid_ticker || 0) + 1 + + var p = typeof(location) != 'undefined' ? location.hostname : '' + // if we are on node.js add process pid if(typeof(process) != 'undefined'){ - p += process.pid + '-' + p += process.pid } // return string as-is... if(nohash){ - return str || p+Date.now() + return str || p+'-'+t+'-'+Date.now() } // make a hash... - var gid = hash(str || (p+Date.now())) + var gid = hash(str || (p+'-'+t+'-'+Date.now())) // for explicit string return the hash as-is... if(str != null){ @@ -331,7 +339,7 @@ var DataPrototype = { // check that the gid is unique... while(this.ribbon_order.indexOf(gid) >= 0 || this.order.indexOf(gid) >= 0){ - gid = hash(p+Date.now()) + gid = hash(p+'-'+t+'-'+Date.now()) } return gid diff --git a/ui (gen4)/formats.js b/ui (gen4)/formats.js index 1d425e0e..decf58ee 100755 --- a/ui (gen4)/formats.js +++ b/ui (gen4)/formats.js @@ -44,7 +44,7 @@ function(data, cmp){ res.data.current = data.position // ribbons and images... - $.each(data.ribbons, function(i, input_images){ + data.ribbons.forEach(function(input_images, i){ var ribbon = [] ribbons.push(ribbon) for(var id in input_images){ diff --git a/ui (gen4)/viewer.js b/ui (gen4)/viewer.js index 133becfc..dede795f 100755 --- a/ui (gen4)/viewer.js +++ b/ui (gen4)/viewer.js @@ -2906,9 +2906,13 @@ var FileSystemLoaderActions = actions.Actions({ loadPath: ['File/', function(path){ var that = this - // XXX does not appear to load correctly... + + // XXX this will not work for explicit path (path to a dir + // that contains the index) file.loadIndex(path) .done(function(res){ + // XXX if res is empty load raw... + // XXX res may contain multiple indexes, need to // combine them... var k = Object.keys(res)[0]