diff --git a/JMolViewer/jmol.htm b/JMolViewer/jmol.htm index 660bd93255..6eb58c6ad2 100644 --- a/JMolViewer/jmol.htm +++ b/JMolViewer/jmol.htm @@ -13,7 +13,6 @@ // control bar? var controls = str.split(',')[2].split('controls=')[1]; - // spin var spin = str.split(',')[1].split('spin=')[1]; if (spin == "true") { @@ -26,7 +25,7 @@ // background colour var bgColour = str.split(',')[3].split('bgColour=')[1]; - if (bgColour == "undefined" || bgColour == "" || bgColour == "White") { + if (bgColour != "Black" && bgColour != "Blue") { bgColour = "White"; } setUpInfo += " background " + bgColour + ";"; @@ -85,7 +84,7 @@ // bespoke script stuff var initScript = str.split(',')[8].split('initScript=')[1]; - if (initScript != "undefined" && initScript != "") { + if (initScript != "undefined" && initScript != "" && initScript != "null") { setUpInfo += initScript; } var scriptOpt = str.split(',')[9].split('scriptOpt=')[1]; @@ -304,7 +303,7 @@ - +
diff --git a/modules/xerte/parent_templates/Nottingham/models_html5/bullets.html b/modules/xerte/parent_templates/Nottingham/models_html5/bullets.html index 05a44cff5d..c722bf939a 100644 --- a/modules/xerte/parent_templates/Nottingham/models_html5/bullets.html +++ b/modules/xerte/parent_templates/Nottingham/models_html5/bullets.html @@ -72,7 +72,10 @@ endTag = ""; } for (var i=0; i + + // pageChanged & sizeChanged functions are needed in every model file + // other functions for model should also be in here to avoid conflicts + var jmol = new function() { + // function called every time the page is viewed after it has initially loaded + this.pageChanged = function() { + + } + + // function called every time the size of the LO is changed + this.sizeChanged = function() { + var $pageContents = $("#pageContents"); + var $textHolder = $("#textHolder"); + if ($pageContents.data("modelSize") == "Large") { + var $iFrame = $("#iFrameHolder iframe"); + $iFrame + .height((jmol.calcHeight() * 0.8) - 20) + .width(jmol.calcWidth()); + $textHolder.height(jmol.calcHeight() * 0.2); + document.getElementById("iFrame0").contentWindow.resize($iFrame.width(), $iFrame.height()); + } else if ($pageContents.data("numXYZ") == 2) { + $textHolder.height(jmol.calcHeight() * 0.2); + } + } + + this.calcHeight = function() { + var frameHeight; + if (x_browserInfo.mobile == false) { + frameHeight = $x_pageHolder.height() - parseInt($x_pageDiv.css("padding-top")) * 3; + } else { + frameHeight = $x_mobileScroll.height() - $x_headerBlock.height() - $x_footerBlock.height() - (parseInt($x_pageDiv.css("padding-top")) * 2) - 3; + } + return frameHeight; + } + + this.calcWidth = function() { + return $x_pageHolder.width() - (parseInt($x_pageDiv.css("padding-right")) * 2) - 13; + } + } + + var $iFrameHolder = $("#iFrameHolder"); + var $pageContents = $("#pageContents"); + var $textHolder = $("#textHolder"); + $textHolder.html(x_addLineBreaks(x_currentPageXML.getAttribute("text"))); + + var numXYZ = 1; + var controls = x_currentPageXML.getAttribute("controls"); + var scriptOpt = x_currentPageXML.getAttribute("scriptOpt"); + var size = x_currentPageXML.getAttribute("size"); + var dimensions = []; + + if (size == undefined) { + size = "Medium"; + } + if (x_currentPageXML.getAttribute("xyz2") != undefined) { // if there's a 2nd jmol file it defaults to medium size + size = "Medium"; + numXYZ = 2; + } + + $pageContents.data({ + "modelSize" :size, + "numXYZ" :numXYZ + }); + + if (size == "Small") { + controls = false; // no space for control bar when model is small + scriptOpt = false; + $iFrameHolder.addClass("x_floatRight"); + dimensions = [250,250]; + } else if (size == "Medium") { + dimensions = [350,350]; + if (x_currentPageXML.getAttribute("xyz2") == undefined) { + $iFrameHolder.addClass("x_floatRight"); + } else { + $iFrameHolder + .appendTo($pageContents) + .addClass("centerAlign"); + $textHolder.height(jmol.calcHeight() * 0.2); + } + } else { + $iFrameHolder + .appendTo($pageContents) + .addClass("centerAlign"); + $textHolder.height(jmol.calcHeight() * 0.2); + dimensions = [jmol.calcWidth(),(jmol.calcHeight() * 0.8) - 20]; + } + + for (i=0; i'; + $iFrameHolder.append(iFrameTag); + } + + // call this function in every model once everything's loaded + x_pageLoaded(); + + + + + +
+ +
+ +
+ +
\ No newline at end of file