mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
2 lines
2.8 KiB
JavaScript
2 lines
2.8 KiB
JavaScript
define(["galaxy.masthead","mvc/ui/ui-frames"],function(a,b){var c=Backbone.View.extend({el_main:"body",active:!1,button_active:null,button_load:null,initialize:function(){var c=this;this.frames=new b.View({visible:!1}),this.button_active=new a.GalaxyMastheadIcon({icon:"fa-th",tooltip:"Enable/Disable Scratchbook",onclick:function(){c._activate()},onbeforeunload:function(){return c.frames.length()>0?"You opened "+c.frames.length()+" frame(s) which will be lost.":void 0}}),Galaxy.masthead.append(this.button_active),this.button_load=new a.GalaxyMastheadIcon({icon:"fa-eye",tooltip:"Show/Hide Scratchbook",onclick:function(){c.frames.visible?c.frames.hide():c.frames.show()},with_number:!0}),Galaxy.masthead.append(this.button_load),this.setElement(this.frames.$el),$(this.el_main).append(this.$el),this.frames.setOnChange(function(){c._refresh()}),this._refresh()},add_dataset:function(a){var b=this;require(["mvc/data"],function(c){var d=new c.Dataset({id:a});$.when(d.fetch()).then(function(){var a={title:d.get("name")},e=_.find(["tabular","interval"],function(a){return-1!==d.get("data_type").indexOf(a)});if(e){var f=new c.TabularDataset(d.toJSON());_.extend(a,{type:"other",content:function(a){c.createTabularDatasetChunkedView({model:f,parent_elt:a,embedded:!0,height:"100%"})}})}else _.extend(a,{type:"url",content:galaxy_config.root+"datasets/"+d.id+"/display/?preview=True"});b.add(a)})})},add_trackster_viz:function(a){var b=this;require(["viz/visualization","viz/trackster"],function(c,d){var e=new c.Visualization({id:a});$.when(e.fetch()).then(function(){var a=new d.TracksterUI(galaxy_config.root),c={title:e.get("name"),type:"other",content:function(b){var c={container:b,name:e.get("title"),id:e.id,dbkey:e.get("dbkey"),stand_alone:!1},d=e.get("latest_revision"),f=d.config.view.drawables;_.each(f,function(a){a.dataset={hda_ldda:a.hda_ldda,id:a.dataset_id}}),view=a.create_visualization(c,d.config.viewport,d.config.view.drawables,d.config.bookmarks,!1)}};b.add(c)})})},add:function(a){if("_blank"==a.target)return void window.open(a.content);if("_top"==a.target||"_parent"==a.target||"_self"==a.target)return void(window.location=a.content);if(this.active)this.frames.add(a);else{var b=$(window.parent.document).find("#galaxy_main");if("galaxy_main"==a.target||"center"==a.target)if(0===b.length){var c=a.content;c+=-1==c.indexOf("?")?"?":"&",c+="use_panels=True",window.location=c}else b.attr("src",a.content);else window.location=a.content}},_activate:function(){this.active?(this.active=!1,this.button_active.untoggle(),this.frames.hide()):(this.active=!0,this.button_active.toggle())},_refresh:function(){this.button_load.number(this.frames.length()),0===this.frames.length()?this.button_load.hide():this.button_load.show(),this.frames.visible?this.button_load.toggle():this.button_load.untoggle()}});return{GalaxyFrame:c}});
|
|
//# sourceMappingURL=../maps/galaxy.frame.js.map
|