htmlSvg.append("<html>\n");
if (jsonData != null)
{
- htmlSvg.append("<button onclick=\"javascipt:openJalviewUsingCurrentUrl();\">Launch in Jalview</button>");
- htmlSvg.append("<input type=\"hidden\" name=\"seqData\" id=\"seqData\" value='"
- + jsonData + "'>");
+ htmlSvg.append("<button onclick=\"javascipt:openJalviewUsingCurrentUrl();\">Launch in Jalview</button> ");
+ htmlSvg.append("<input type=\"submit\" value=\"View raw BioJSON Data\" onclick=\"jQuery.facebox({ div:'#seqData' }); return false;\" />");
+ htmlSvg.append("<div style=\"display: none;\" name=\"seqData\" id=\"seqData\" >"
+ + jsonData + "</div>");
+ htmlSvg.append("<br/> ");
}
htmlSvg.append("\n<style type=\"text/css\"> "
+ "div.parent{ width:100%;<!-- overflow: auto; -->}\n"
+ "div.titlex{ width:11%; float: left; }\n"
+ "div.align{ width:89%; float: right; }\n"
+ + "div.main-container{ border: 2px solid blue; border: 2px solid blue; width: 99%; min-height: 99%; }\n"
+ ".sub-category-container {overflow-y: scroll; overflow-x: hidden; width: 100%; height: 100%;}\n"
- + "object {pointer-events: none;}"
- + "</style>");
- htmlSvg.append("<div>");
- htmlSvg.append(
-"<div class=\"titlex\">");
- htmlSvg.append(
-"<div class=\"sub-category-container\"> ")
- .append(titleSvg)
- .append("</div>")
- .append("</div>\n\n<!-- ========================================================================================== -->\n\n");
- htmlSvg.append(
-"<div class=\"align\" >");
+ + "object {pointer-events: none;}");
+ if (jsonData != null)
+ {
+ // facebox style sheet for displaying raw BioJSON data
+ htmlSvg.append("#facebox { position: absolute; top: 0; left: 0; z-index: 100; text-align: left; }\n"
+ + "#facebox .popup{ position:relative; border:3px solid rgba(0,0,0,0); -webkit-border-radius:5px;"
+ + "-moz-border-radius:5px; border-radius:5px; -webkit-box-shadow:0 0 18px rgba(0,0,0,0.4); -moz-box-shadow:0 0 18px rgba(0,0,0,0.4);"
+ + "box-shadow:0 0 18px rgba(0,0,0,0.4); }\n"
+ + "#facebox .content { display:table; width: 98%; padding: 10px; background: #fff; -webkit-border-radius:4px; -moz-border-radius:4px;"
+ + " border-radius:4px; }\n"
+ + "#facebox .content > p:first-child{ margin-top:0; }\n"
+ + "#facebox .content > p:last-child{ margin-bottom:0; }\n"
+ + "#facebox .close{ position:absolute; top:5px; right:5px; padding:2px; background:#fff; }\n"
+ + "#facebox .close img{ opacity:0.3; }\n"
+ + "#facebox .close:hover img{ opacity:1.0; }\n"
+ + "#facebox .loading { text-align: center; }\n"
+ + "#facebox .image { text-align: center;}\n"
+ + "#facebox img { border: 0; margin: 0; }\n"
+ + "#facebox_overlay { position: fixed; top: 0px; left: 0px; height:100%; width:100%; }\n"
+ + ".facebox_hide { z-index:-100; }\n"
+ + ".facebox_overlayBG { background-color: #000; z-index: 99; }");
+ }
+
+ htmlSvg.append("</style>");
+ htmlSvg.append("<div class=\"main-container\" \n>");
+ htmlSvg.append("<div class=\"titlex\">\n");
+ htmlSvg.append("<div class=\"sub-category-container\"> \n");
+ htmlSvg.append(titleSvg);
+ htmlSvg.append("</div>");
+ htmlSvg.append("</div>\n\n<!-- ========================================================================================== -->\n\n");
+ htmlSvg.append("<div class=\"align\" >");
htmlSvg.append(
"<div class=\"sub-category-container\"> <div style=\"overflow-x: scroll;\">")
.append(alignmentSvg)
htmlSvg.append("</div>");
htmlSvg.append("<script language=\"JavaScript\" type=\"text/javascript\" src=\"http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js\"></script>\n"
- + "<script language=\"JavaScript\" type=\"text/javascript\" src=\"//ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js\"></script>\n"
+ + "<script language=\"JavaScript\" type=\"text/javascript\" src=\"http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js\"></script>\n"
+ "<script>\n"
+ "var subCatContainer = $(\".sub-category-container\");\n"
+ "subCatContainer.scroll(\nfunction() {\n"
htmlSvg.append("<script language=\"JavaScript\">\n");
htmlSvg.append("function openJalviewUsingCurrentUrl(){\n");
- htmlSvg.append(" var json = JSON.parse(document.getElementById(\"seqData\").value);\n");
+ htmlSvg.append(" var json = JSON.parse(document.getElementById(\"seqData\").innerHTML);\n");
htmlSvg.append(" var jalviewVersion = json['appSettings'].version;\n");
htmlSvg.append(" var url = json['appSettings'].webStartUrl;\n");
htmlSvg.append(" var myForm = document.createElement(\"form\");\n\n");
htmlSvg.append(" myForm.submit() ;\n");
htmlSvg.append(" document.body.removeChild(myForm);\n");
htmlSvg.append("}\n");
+
+ // jquery facebox for displaying raw BioJSON data");
+ if (jsonData != null)
+ {
+ htmlSvg.append("/* Facebox (for jQuery)\n");
+ htmlSvg.append("* version: 1.3\n");
+ htmlSvg.append(" * @requires jQuery v1.2 or later\n");
+ htmlSvg.append(" * @homepage https://github.com/defunkt/facebox\n");
+ htmlSvg.append(" * Licensed under the MIT:\n");
+ htmlSvg.append(" * http://www.opensource.org/licenses/mit-license.php\n");
+ htmlSvg.append(" * Copyright Forever Chris Wanstrath, Kyle Neath\n");
+ htmlSvg.append(" * Usage:\n");
+ htmlSvg.append(" * jQuery(document).ready(function() {\n");
+ htmlSvg.append(" * jQuery('a[rel*=facebox]').facebox()\n");
+ htmlSvg.append(" * })\n");
+ htmlSvg.append(" * <a href=\"#terms\" rel=\"facebox\">Terms</a>\n");
+ htmlSvg.append(" * Loads the #terms div in the box\n");
+ htmlSvg.append(" * <a href=\"terms.html\" rel=\"facebox\">Terms</a>\n");
+ htmlSvg.append(" * Loads the terms.html page in the box\n");
+ htmlSvg.append(" * <a href=\"terms.png\" rel=\"facebox\">Terms</a>\n");
+ htmlSvg.append(" * Loads the terms.png image in the box\n");
+ htmlSvg.append(" * You can also use it programmatically:\n");
+ htmlSvg.append(" * jQuery.facebox('some html')\n");
+ htmlSvg.append(" * jQuery.facebox('some html', 'my-groovy-style')\n");
+ htmlSvg.append(" * The above will open a facebox with \"some html\" as the content.\n");
+ htmlSvg.append(" * jQuery.facebox(function($) {\n");
+ htmlSvg.append(" * $.get('blah.html', function(data) { $.facebox(data) })\n");
+ htmlSvg.append(" * })\n");
+ htmlSvg.append(" * The above will show a loading screen before the passed function is called,\n");
+ htmlSvg.append(" * allowing for a better ajaxy experience.\n");
+ htmlSvg.append(" * The facebox function can also display an ajax page, an image, or the contents of a div:\n");
+ htmlSvg.append(" * jQuery.facebox({ ajax: 'remote.html' })\n");
+ htmlSvg.append(" * jQuery.facebox({ ajax: 'remote.html' }, 'my-groovy-style')\n");
+ htmlSvg.append(" * jQuery.facebox({ image: 'stairs.jpg' })\n");
+ htmlSvg.append(" * jQuery.facebox({ image: 'stairs.jpg' }, 'my-groovy-style')\n");
+ htmlSvg.append(" * jQuery.facebox({ div: '#box' })\n");
+ htmlSvg.append(" * jQuery.facebox({ div: '#box' }, 'my-groovy-style')\n");
+ htmlSvg.append(" * Want to close the facebox? Trigger the 'close.facebox' document event:\n");
+ htmlSvg.append(" * jQuery(document).trigger('close.facebox')\n");
+ htmlSvg.append(" * Facebox also has a bunch of other hooks:\n");
+ htmlSvg.append(" * loading.facebox\n");
+ htmlSvg.append(" * beforeReveal.facebox\n");
+ htmlSvg.append(" * reveal.facebox (aliased as 'afterReveal.facebox')\n");
+ htmlSvg.append(" * init.facebox\n");
+ htmlSvg.append(" * afterClose.facebox\n");
+ htmlSvg.append(" * Simply bind a function to any of these hooks:\n");
+ htmlSvg.append(" * $(document).bind('reveal.facebox', function() { ...stuff to do after the facebox and contents are revealed... })\n");
+ htmlSvg.append(" *\n");
+ htmlSvg.append(" */\n");
+ htmlSvg.append("(function($) {\n");
+ htmlSvg.append(" $.facebox = function(data, klass) {\n");
+ htmlSvg.append(" $.facebox.loading()\n");
+ htmlSvg.append(" if (data.ajax) fillFaceboxFromAjax(data.ajax, klass)\n");
+ htmlSvg.append(" else if (data.image) fillFaceboxFromImage(data.image, klass)\n");
+ htmlSvg.append(" else if (data.div) fillFaceboxFromHref(data.div, klass)\n");
+ htmlSvg.append(" else if ($.isFunction(data)) data.call($)\n");
+ htmlSvg.append(" else $.facebox.reveal(data, klass)\n");
+ htmlSvg.append(" }\n");
+
+ htmlSvg.append(" $.extend($.facebox, {\n");
+ htmlSvg.append(" settings: {\n");
+ htmlSvg.append(" opacity : 0.2,\n");
+ htmlSvg.append(" overlay : true,\n");
+ htmlSvg.append(" loadingImage : 'https://raw.githubusercontent.com/jalview/biojson/gh-pages/images/loading.gif',\n");
+ htmlSvg.append(" closeImage : 'https://raw.githubusercontent.com/jalview/biojson/gh-pages/images/cancel.png',\n");
+ htmlSvg.append(" imageTypes : [ 'png', 'jpg', 'jpeg', 'gif' ],\n");
+ htmlSvg.append(" faceboxHtml : '<div id=\"facebox\" style=\"display:none; width: 95%; height: 85%; overflow: auto;\"> ");
+ htmlSvg.append(" <div class=\"popup\"> ");
+ htmlSvg.append(" <div class=\"content\"> ");
+ htmlSvg.append(" </div> ");
+ htmlSvg.append(" <a href=\"#\" class=\"close\"></a> ");
+ htmlSvg.append(" </div> ");
+ htmlSvg.append(" </div>'\n");
+ htmlSvg.append(" }, \n");
+ htmlSvg.append(" loading: function() {\n");
+ htmlSvg.append(" init()\n");
+ htmlSvg.append(" if ($('#facebox .loading').length == 1) return true\n");
+ htmlSvg.append(" showOverlay() \n");
+ htmlSvg.append(" $('#facebox .content').empty().\n");
+ htmlSvg.append(" append('<div class=\"loading\"><img src=\"'+$.facebox.settings.loadingImage+'\"/></div>')\n");
+ htmlSvg.append(" $('#facebox').show().css({\n");
+ htmlSvg.append(" top: getPageScroll()[1] + (getPageHeight() / 10),\n");
+ htmlSvg.append(" left: $(window).width() / 2 - ($('#facebox .popup').outerWidth() / 2)\n");
+ htmlSvg.append(" }) \n");
+ htmlSvg.append(" $(document).bind('keydown.facebox', function(e) {\n");
+ htmlSvg.append(" if (e.keyCode == 27) $.facebox.close()\n");
+ htmlSvg.append(" return true\n");
+ htmlSvg.append(" })\n");
+ htmlSvg.append(" $(document).trigger('loading.facebox')\n");
+ htmlSvg.append(" },\n");
+ htmlSvg.append(" reveal: function(data, klass) {\n");
+ htmlSvg.append(" $(document).trigger('beforeReveal.facebox')\n");
+ htmlSvg.append(" if (klass) $('#facebox .content').addClass(klass)\n");
+ htmlSvg.append(" $('#facebox .content').empty().append('<pre><code>'+JSON.stringify(JSON.parse(data),null,4)+'</pre></code>')\n");
+ htmlSvg.append(" $('#facebox .popup').children().fadeIn('normal')\n");
+ htmlSvg.append(" $('#facebox').css('left', $(window).width() / 2 - ($('#facebox .popup').outerWidth() / 2))\n");
+ htmlSvg.append(" $(document).trigger('reveal.facebox').trigger('afterReveal.facebox')\n");
+ htmlSvg.append(" }, \n");
+ htmlSvg.append(" close: function() {\n");
+ htmlSvg.append(" $(document).trigger('close.facebox')\n");
+ htmlSvg.append(" return false\n");
+ htmlSvg.append(" }\n");
+ htmlSvg.append(" })\n");
+ htmlSvg.append(" $.fn.facebox = function(settings) {\n");
+ htmlSvg.append(" if ($(this).length == 0) return \n");
+ htmlSvg.append(" init(settings) \n");
+ htmlSvg.append(" function clickHandler() {\n");
+ htmlSvg.append(" $.facebox.loading(true) \n");
+ htmlSvg.append(" // support for rel=\"facebox.inline_popup\" syntax, to add a class\n");
+ htmlSvg.append(" // also supports deprecated \"facebox[.inline_popup]\" syntax\n");
+ htmlSvg.append(" var klass = this.rel.match(/facebox\\[?\\.(\\w+)\\]?/)\n");
+ htmlSvg.append(" if (klass) klass = klass[1]\n");
+ htmlSvg.append(" fillFaceboxFromHref(this.href, klass)\n");
+ htmlSvg.append(" return false\n");
+ htmlSvg.append(" } \n");
+ htmlSvg.append(" return this.bind('click.facebox', clickHandler)\n");
+ htmlSvg.append(" }\n");
+ htmlSvg.append(" // called one time to setup facebox on this page\n");
+ htmlSvg.append(" function init(settings) {\n");
+ htmlSvg.append(" if ($.facebox.settings.inited) return true\n");
+ htmlSvg.append(" else $.facebox.settings.inited = true\n");
+ htmlSvg.append(" $(document).trigger('init.facebox')\n");
+ htmlSvg.append(" makeCompatible()\n");
+ htmlSvg.append(" var imageTypes = $.facebox.settings.imageTypes.join('|')\n");
+ htmlSvg.append(" $.facebox.settings.imageTypesRegexp = new RegExp('\\\\.(' + imageTypes + ')(\\\\?.*)?$', 'i')\n");
+
+ htmlSvg.append(" if (settings) $.extend($.facebox.settings, settings)\n");
+ htmlSvg.append(" $('body').append($.facebox.settings.faceboxHtml)\n");
+
+ htmlSvg.append(" var preload = [ new Image(), new Image() ]\n");
+ htmlSvg.append(" preload[0].src = $.facebox.settings.closeImage\n");
+ htmlSvg.append(" preload[1].src = $.facebox.settings.loadingImage\n");
+
+ htmlSvg.append(" $('#facebox').find('.b:first, .bl').each(function() {\n");
+ htmlSvg.append(" preload.push(new Image())\n");
+ htmlSvg.append(" preload.slice(-1).src = $(this).css('background-image').replace(/url\\((.+)\\)/, '$1')\n");
+ htmlSvg.append(" })\n");
+
+ htmlSvg.append(" $('#facebox .close')\n");
+ htmlSvg.append(" .click($.facebox.close)\n");
+ htmlSvg.append(" .append('<img src=\"'\n");
+ htmlSvg.append(" + $.facebox.settings.closeImage\n");
+ htmlSvg.append(" + '\" class=\"close_image\" title=\"close\">')\n");
+ htmlSvg.append(" }\n");
+
+ htmlSvg.append(" // getPageScroll() by quirksmode.com\n");
+ htmlSvg.append(" function getPageScroll() {\n");
+ htmlSvg.append(" var xScroll, yScroll;\n");
+ htmlSvg.append(" if (self.pageYOffset) {\n");
+ htmlSvg.append(" yScroll = self.pageYOffset;\n");
+ htmlSvg.append(" xScroll = self.pageXOffset;\n");
+ htmlSvg.append(" } else if (document.documentElement && document.documentElement.scrollTop) { // Explorer 6 Strict\n");
+ htmlSvg.append(" yScroll = document.documentElement.scrollTop;\n");
+ htmlSvg.append(" xScroll = document.documentElement.scrollLeft;\n");
+ htmlSvg.append(" } else if (document.body) {// all other Explorers\n");
+ htmlSvg.append(" yScroll = document.body.scrollTop;\n");
+ htmlSvg.append(" xScroll = document.body.scrollLeft;\n");
+ htmlSvg.append(" }\n");
+ htmlSvg.append(" return new Array(xScroll,yScroll)\n");
+ htmlSvg.append(" }\n");
+
+ // Adapted from getPageSize() by quirksmode.com");
+ htmlSvg.append(" function getPageHeight() {\n");
+ htmlSvg.append(" var windowHeight\n");
+ htmlSvg.append(" if (self.innerHeight) { // all except Explorer\n");
+ htmlSvg.append(" windowHeight = self.innerHeight;\n");
+ htmlSvg.append(" } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode\n");
+ htmlSvg.append(" windowHeight = document.documentElement.clientHeight;\n");
+ htmlSvg.append(" } else if (document.body) { // other Explorers\n");
+ htmlSvg.append(" windowHeight = document.body.clientHeight;\n");
+ htmlSvg.append(" }\n");
+ htmlSvg.append(" return windowHeight\n");
+ htmlSvg.append(" }\n");
+
+ htmlSvg.append(" // Backwards compatibility\n");
+ htmlSvg.append(" function makeCompatible() {\n");
+ htmlSvg.append(" var $s = $.facebox.settings \n");
+ htmlSvg.append(" $s.loadingImage = $s.loading_image || $s.loadingImage\n");
+ htmlSvg.append(" $s.closeImage = $s.close_image || $s.closeImage\n");
+ htmlSvg.append(" $s.imageTypes = $s.image_types || $s.imageTypes\n");
+ htmlSvg.append(" $s.faceboxHtml = $s.facebox_html || $s.faceboxHtml\n");
+ htmlSvg.append(" }\n");
+
+ htmlSvg.append(" // Figures out what you want to display and displays it\n");
+ htmlSvg.append(" // formats are:\n");
+ htmlSvg.append(" // div: #id\n");
+ htmlSvg.append(" // image: blah.extension\n");
+ htmlSvg.append(" // ajax: anything else\n");
+ htmlSvg.append(" function fillFaceboxFromHref(href, klass) {\n");
+ htmlSvg.append(" // div\n");
+ htmlSvg.append(" if (href.match(/#/)) {\n");
+ htmlSvg.append(" var url = window.location.href.split('#')[0]\n");
+ htmlSvg.append(" var target = href.replace(url,'')\n");
+ htmlSvg.append(" if (target == '#') return\n");
+ htmlSvg.append(" $.facebox.reveal($(target).html(), klass)\n");
+
+ htmlSvg.append(" // image\n");
+ htmlSvg.append(" } else if (href.match($.facebox.settings.imageTypesRegexp)) {\n");
+ htmlSvg.append(" fillFaceboxFromImage(href, klass)\n");
+ htmlSvg.append(" // ajax\n");
+ htmlSvg.append(" } else {\n");
+ htmlSvg.append(" fillFaceboxFromAjax(href, klass)\n");
+ htmlSvg.append(" }\n");
+ htmlSvg.append(" }\n");
+
+ htmlSvg.append(" function fillFaceboxFromImage(href, klass) {\n");
+ htmlSvg.append(" var image = new Image()\n");
+ htmlSvg.append(" image.onload = function() {\n");
+ htmlSvg.append(" $.facebox.reveal('<div class=\"image\"><img src=\"' + image.src + '\" /></div>', klass)\n");
+ htmlSvg.append(" }\n");
+ htmlSvg.append(" image.src = href\n");
+ htmlSvg.append(" }\n");
+
+ htmlSvg.append(" function fillFaceboxFromAjax(href, klass) {\n");
+ htmlSvg.append(" $.facebox.jqxhr = $.get(href, function(data) { $.facebox.reveal(data, klass) })\n");
+ htmlSvg.append(" }\n");
+
+ htmlSvg.append(" function skipOverlay() {\n");
+ htmlSvg.append(" return $.facebox.settings.overlay == false || $.facebox.settings.opacity === null\n");
+ htmlSvg.append(" }\n");
+
+ htmlSvg.append(" function showOverlay() {\n");
+ htmlSvg.append(" if (skipOverlay()) return\n");
+
+ htmlSvg.append(" if ($('#facebox_overlay').length == 0)\n");
+ htmlSvg.append(" $(\"body\").append('<div id=\"facebox_overlay\" class=\"facebox_hide\"></div>')\n");
+
+ htmlSvg.append(" $('#facebox_overlay').hide().addClass(\"facebox_overlayBG\")\n");
+ htmlSvg.append(" .css('opacity', $.facebox.settings.opacity)\n");
+ htmlSvg.append(" .click(function() { $(document).trigger('close.facebox') })\n");
+ htmlSvg.append(" .fadeIn(200)\n");
+ htmlSvg.append(" return false\n");
+ htmlSvg.append(" }\n");
+
+ htmlSvg.append(" function hideOverlay() {\n");
+ htmlSvg.append(" if (skipOverlay()) return \n");
+ htmlSvg.append(" $('#facebox_overlay').fadeOut(200, function(){\n");
+ htmlSvg.append(" $(\"#facebox_overlay\").removeClass(\"facebox_overlayBG\")\n");
+ htmlSvg.append(" $(\"#facebox_overlay\").addClass(\"facebox_hide\")\n");
+ htmlSvg.append(" $(\"#facebox_overlay\").remove()\n");
+ htmlSvg.append(" }) \n");
+ htmlSvg.append(" return false\n");
+ htmlSvg.append(" }\n");
+
+ htmlSvg.append(" $(document).bind('close.facebox', function() {\n");
+ htmlSvg.append(" if ($.facebox.jqxhr) {\n");
+ htmlSvg.append(" $.facebox.jqxhr.abort()\n");
+ htmlSvg.append(" $.facebox.jqxhr = null\n");
+ htmlSvg.append(" }\n");
+ htmlSvg.append(" $(document).unbind('keydown.facebox')\n");
+ htmlSvg.append(" $('#facebox').fadeOut(function() {\n");
+ htmlSvg.append(" $('#facebox .content').removeClass().addClass('content')\n");
+ htmlSvg.append(" $('#facebox .loading').remove()\n");
+ htmlSvg.append(" $(document).trigger('afterClose.facebox')\n");
+ htmlSvg.append(" })\n");
+ htmlSvg.append(" hideOverlay()\n");
+ htmlSvg.append(" })\n");
+
+ htmlSvg.append("})(jQuery);\n");
+
+ }
+
htmlSvg.append("</script>\n");
htmlSvg.append("</hmtl>");
return htmlSvg.toString();