Skip to content

Instantly share code, notes, and snippets.

@hexylena
Created December 31, 2015 16:45
Show Gist options
  • Save hexylena/9cf020138d787eb47891 to your computer and use it in GitHub Desktop.
Save hexylena/9cf020138d787eb47891 to your computer and use it in GitHub Desktop.
JBrowse analytics patch
--- a/src/dojo/dojo.js 2015-12-30 17:07:30.735832912 -0600
+++ b/src/dojo/dojo.js 2015-12-31 09:27:19.348605487 -0600
@@ -77,7 +77,7 @@
"https";if("undefined"!=typeof this.config.clientReport&&"undefined"!=typeof this.config.clientReport.protocol)b=this.config.clientReport.protocol;a=b+"://jbrowse.org/analytics/clientReport?"+dojo.objectToQuery(a);dojo.create("img",{style:{display:"none"},src:a},document.body)},getStore:function(a,b){if(!b)throw"invalid arguments";var c=this._storeCache||{};this._storeCache=c;if(c=c[a])c.refCount++,b(c.store);else{var f=this.config.stores[a];f?(c=f.type)?require([c],dojo.hitch(this,function(c){var d=
{};dojo.mixin(d,f);dojo.mixin(d,{config:f,browser:this,refSeq:this.refSeq});c=new c(d);this._storeCache[a]={refCount:1,store:c};b(c);b=void 0})):(console.warn("store "+a+" has no type defined"),b(null)):(console.warn("store '"+a+"' not found"),b(null))}},uniqCounter:0,addStoreConfig:function(a,b){a=a||"addStore"+this.uniqCounter++;if(!this.config.stores)this.config.stores={};if(!this._storeCache)this._storeCache={};if(this.config.stores[a]||this._storeCache[a])throw"store "+a+" already exists!";this.config.stores[a]=
b;return a},clearStores:function(){this._storeCache={}},releaseStore:function(a){var b=this._storeCache[a];b&&!--b.refCount&&delete this._storeCache[a]},_calculateClientStats:function(){var a=screen||window.screen,b=new Date,c={ver:this.version||"dev","refSeqs-count":this.refSeqOrder.length,"refSeqs-avgLen":!this.refSeqOrder.length?null:S.reduce(dojo.map(this.refSeqOrder,function(a){a=this.allRefs[a];return!a?0:a.end-a.start},this),"+"),"tracks-count":this.config.tracks.length,plugins:S.keys(this.plugins).sort().join(","),
-"scn-h":a?a.height:null,"scn-w":a?a.width:null,"win-h":document.body.offsetHeight,"win-w":document.body.offsetWidth,"el-h":this.container.offsetHeight,"el-w":this.container.offsetWidth,t:b.getTime()/1E3,electron:G.isElectron(),tzoffset:b.getTimezoneOffset(),loadTime:(b.getTime()-this.startTime)/1E3};dojo.forEach(this.config.tracks,function(a){a="track-types-"+a.type||"null";c[a]=(c[a]||0)+1});return c},publish:function(){return k.publish.apply(k,arguments)},subscribe:function(){this._uniqueSubscriptionId=
+"scn-h":a?a.height:null,"scn-w":a?a.width:null,"win-h":document.body.offsetHeight,"win-w":document.body.offsetWidth,"el-h":this.container.offsetHeight,"el-w":this.container.offsetWidth,"galaxy":true,t:b.getTime()/1E3,electron:G.isElectron(),tzoffset:b.getTimezoneOffset(),loadTime:(b.getTime()-this.startTime)/1E3};dojo.forEach(this.config.tracks,function(a){a="track-types-"+a.type||"null";c[a]=(c[a]||0)+1});return c},publish:function(){return k.publish.apply(k,arguments)},subscribe:function(){this._uniqueSubscriptionId=
this._uniqueSubscriptionId||0;this._subscription=this._subscription||{};var a=++this._uniqueSubscriptionId,b=k.subscribe.apply(k,arguments),c=this;this._subscription[a]=b;return function(a){return{remove:function(){delete c._subscription[a];b.remove()}}}(a)},onResize:function(){if(this.navbox)this.view.locationTrapHeight=dojo.marginBox(this.navbox).h},getRecentlyUsedTracks:function(){return dojo.fromJson(this.cookie("recentTracks")||"[]")},addRecentlyUsedTracks:function(a){a=G.uniq(dojo.map(a,function(a){return{label:a,
time:Math.round(new Date/1E3)}},this).concat(dojo.fromJson(this.cookie("recentTracks"))||[]),function(a){return a.label}).slice(0,this.config.maxRecentTracks||10);this.cookie("recentTracks",a,{expires:365});return a},_milestoneFunction:function(a,b){var c=Array.prototype.slice.call(arguments,2),f=this._getDeferred(a);c.unshift(f);try{b.apply(this,c)}catch(d){console.error(d,d.stack),f.reject(d)}return f},_getDeferred:function(a){if(!this._deferred)this._deferred={};var b;if(!(b=this._deferred[a])){b=
this._deferred;var c=new f;c.then(null,h.hitch(this,"fatalError"));b=b[a]=c}return b},afterMilestone:function(a,b,c){return this._getDeferred(a).then(function(){try{b.call(c||this)}catch(a){console.error(""+a,a.stack,a)}})},passMilestone:function(a,b){return this._getDeferred(a).resolve(b)},reachedMilestone:function(a){return this._getDeferred(a).isResolved()},loadConfig:function(){return this._milestoneFunction("loadConfig",function(a){(new M({bootConfig:this.config,defaults:this._configDefaults(),
@@ -1739,4 +1739,4 @@
function(a){var d=a.target;if(3==d.nodeType)d=d.parentNode;for(;!j.matches(d,e,b);)if(d==b||!c||!(d=d.parentNode))return;return f.call(d,a)})}},countCurrentTouches:function(e,d){var c,b,f;for(c=0,b=0;f=e.touches[c];++c)d.contains(f.target)&&++b;return b},tap:function(e,d){return i(e,"touchstart",function(c){h(e,d,c)})}};g.dbltap=function(e,d){var c,b;return i(e,"touchstart",function(f){c?h(e,function(a){if(c){var e=a.changedTouches[0];Math.abs(e.screenX-c.screenX)<g.tapRadius&&Math.abs(e.screenY-
c.screenY)<g.tapRadius&&(b&&clearTimeout(b),c=b=null,d.call(this,a))}},f,!0):h(e,function(a){c=a.changedTouches[0];b=setTimeout(function(){c=b=null},g.dbltapTime)},f)})};return g})},"dgrid/util/has-css3":function(){define("dgrid/util/has-css3",["dojo/has","xstyle/css!../css/has-transforms3d.css"],function(i){var j=["ms","O","Moz","Webkit"];i.add("css-transitions",function(h,g,e){h=e.style;if(void 0!==h.transitionProperty)return!0;for(g=j.length;g--;)if(void 0!==h[j[g]+"TransitionProperty"])return j[g];
return!1});i.add("transitionend",function(){var h=i("css-transitions");return!h?!1:!0===h?"transitionend":{ms:"MSTransitionEnd",O:"oTransitionEnd",Moz:"transitionend",Webkit:"webkitTransitionEnd"}[h]});i.add("css-transforms",function(h,g,e){h=e.style;if(void 0!==h.transformProperty)return!0;for(g=j.length;g--;)if(void 0!==h[j[g]+"Transform"])return j[g];return!1});i.add("css-transforms3d",function(h,g,e){e.className="has-csstransforms3d";document.body.appendChild(e);h=e.offsetLeft;if(9===h)return!0;
-if(9<h)return(e=j[h-10])||!1;document.body.removeChild(e);e.className="";return!1});return i})},"*now":function(i){i(['dojo/i18n!*preload*dojo/nls/dojo*["ar","ca","cs","da","de","el","en-gb","en-us","es-es","fi-fi","fr-fr","he-il","hu","it-it","ja-jp","ko-kr","nl-nl","nb","pl","pt-br","pt-pt","ru","sk","sl","sv","th","tr","zh-tw","zh-cn","ROOT"]'])}}});(function(){var i=this.require;i({cache:{}});!i.async&&i(["dojo"]);i.boot&&i.apply(null,i.boot)})();
\ No newline at end of file
+if(9<h)return(e=j[h-10])||!1;document.body.removeChild(e);e.className="";return!1});return i})},"*now":function(i){i(['dojo/i18n!*preload*dojo/nls/dojo*["ar","ca","cs","da","de","el","en-gb","en-us","es-es","fi-fi","fr-fr","he-il","hu","it-it","ja-jp","ko-kr","nl-nl","nb","pl","pt-br","pt-pt","ru","sk","sl","sv","th","tr","zh-tw","zh-cn","ROOT"]'])}}});(function(){var i=this.require;i({cache:{}});!i.async&&i(["dojo"]);i.boot&&i.apply(null,i.boot)})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment