12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- //https://cdn.rawgit.com/calipho-sib/feature-viewer/v1.0.0/examples/index.html
- (function ($) {
- Drupal.behaviors.tripal_analysis_blast = {
- attach: function (context, settings) {
- /**
- * JS to add the feature viewer.
- */
- tripal_chado_sequence_features_feature_viewers(settings.children_draw_info);
- // Remove the jquery.ui override of our link theme:
- $(".ui-widget-content").removeClass('ui-widget-content')
- }
- };
- /**
- * Initializes the feature viewers on the page.
- */
- function tripal_chado_sequence_features_feature_viewers(features) {
- var residues = features.residues
- children = features.children
- Object.keys(children).forEach(function (key, index) {
- //Each child gets its own feature viewer
- var options = {
- showAxis: true,
- showSequence: true,
- brushActive: true,
- toolbar: true,
- bubbleHelp: true,
- zoomMax: 3
- }
- var fv = new FeatureViewer(residues, '#tripal_sequence_features_featureloc_viewer_' + index, options);
- subFeatures = children[key]
- Object.keys(subFeatures).forEach(function (sfKey, sfIndex) {
- subFeature = subFeatures[sfKey]
- fv.addFeature(subFeature)
- })
- })
- }
- // Trigger a window resize event to notify charting modules that
- // the container dimensions has changed
- $(document).on('collapsed', function (e) {
- setTimeout(function () {
- if (typeof Event !== 'undefined') {
- window.dispatchEvent(new Event('resize'));
- }
- else {
- // Support IE
- var event = window.document.createEvent('UIEvents');
- event.initUIEvent('resize', true, false, window, 0);
- window.dispatchEvent(event);
- }
- }, 1000)
- });
- })(jQuery);
|