MediaWiki/Tags for In-page Models

From Jmol
Jump to navigation Jump to search

Tags in the Jmol Extension for MediaWiki that will include models while the page loads

These tags will embed in the page a JSmol panel displaying a structure, at the same time the page is displayed.

Note that the page will take longer to load and to be responsive, particularly if more than one JSmol is embedded. For a quick loading page where models are only loaded later, on user action, see MediaWiki/Tags for Pop-up Models, [[MediaWiki/Tags for Pop-in Models|Tags for Pop-in Models}} and Simple Tags.

The tags are sub-tags of the <jmol> tag and in turn include several sub-tags, described below.

The wikicode is displayed to the right of each example.


jmolApplet tag

uploadedFileContents subtag

A model stored in a file in this wiki

Chair conformation of cyclohexane

<jmol>
  <jmolApplet>
    <name>A</name> 
    <title>A model stored in a file in this wiki</title> 
    <caption>Chair conformation of cyclohexane</caption> 
    <color>greenTint</color> 
    <size>260</size> 
    <uploadedFileContents> Chair.cml </uploadedFileContents>
    <controls>spin popup</controls> 
    <frame> true </frame>
  </jmolApplet>
</jmol>

urlContents subtag

A file retrieved from the web

Murine adipocyte lipid binding protein at pH 4.5 (1AB0.pdb)

<jmol>
  <jmolApplet>
    <name>B</name> 
    <title>A file retrieved from the web</title> 
    <caption>Murine adipocyte lipid binding protein at pH 4.5 (1AB0.pdb)</caption> 
    <color>blueTint</color> 
    <size>300</size> 
    <urlContents> https://files.rcsb.org/download/1ab0.pdb.gz </urlContents>
    <pspeed>2</pspeed> 
    <controls>spin popup</controls> 
    <frame> true </frame>
  </jmolApplet>
</jmol>

wikiPageContents subtag

This is 2-propanol

Data read from the page Models/2-propanol

<jmol>
  <jmolApplet>
    <name>D</name> 
    <title>This is 2-propanol </title> 
    <color>yellowtint</color> 
    <size>260</size> 
    <caption>Data read from the page [[Models/2-propanol]]</caption> 
    <wikiPageContents> Models/2-propanol </wikiPageContents>
    <frame> true </frame>
  </jmolApplet>
</jmol>

script subtag

This box has a message, but might hold a 3D model
<jmol>
  <jmolApplet>
    <name>E</name> 
    <title>This box has a message, but might hold a 3D model</title> 
    <color>blueTint</color> 
    <size>150</size> 
    <script> echo Hi there! </script>
    <frame> true </frame>
  </jmolApplet>
</jmol>

inlineContents subtag

And also demonstrating controls.

This is 1-propanol

<jmol>
  <jmolApplet>
    <name>C</name> 
    <color>lightGray</color> 
    <size>240</size> 
    <caption>This is 1-propanol</caption> 
    <frame> true </frame>
    <inlineContents> 
C3H8O 1-propanol
APtclcactv02181912073D 0   0.00000     0.00000
 
 12 11  0  0  0  0  0  0  0  0999 V2000
    0.5267   -0.4947   -0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
   -0.5950    0.5458   -0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
   -1.9499   -0.1649    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
    1.7922    0.1691    0.0000 O   0  0  0  0  0  0  0  0  0  0  0  0
    0.4436   -1.1185    0.8900 H   0  0  0  0  0  0  0  0  0  0  0  0
    0.4436   -1.1185   -0.8900 H   0  0  0  0  0  0  0  0  0  0  0  0
   -0.5119    1.1696    0.8900 H   0  0  0  0  0  0  0  0  0  0  0  0
   -0.5119    1.1696   -0.8900 H   0  0  0  0  0  0  0  0  0  0  0  0
   -2.0330   -0.7887   -0.8900 H   0  0  0  0  0  0  0  0  0  0  0  0
   -2.0330   -0.7887    0.8900 H   0  0  0  0  0  0  0  0  0  0  0  0
   -2.7490    0.5764    0.0000 H   0  0  0  0  0  0  0  0  0  0  0  0
    2.5508   -0.4305   -0.0000 H   0  0  0  0  0  0  0  0  0  0  0  0
  1  2  1  0  0  0  0
  2  3  1  0  0  0  0
  1  4  1  0  0  0  0
  1  5  1  0  0  0  0
  1  6  1  0  0  0  0
  2  7  1  0  0  0  0
  2  8  1  0  0  0  0
  3  9  1  0  0  0  0
  3 10  1  0  0  0  0
  3 11  1  0  0  0  0
  4 12  1  0  0  0  0
M  END
    </inlineContents>
  </jmolApplet>

  <jmolButton>
    <script> spacefill on </script>
    <text> spacefill </text>
    <target> C </target>
  </jmolButton>

  <jmolLink>
    <script> spacefill 23% </script>
    <text> ball and stick </text>
    <target> C </target>
  </jmolLink>

  <jmolCheckbox>
    <scriptWhenChecked> spin on </scriptWhenChecked>
    <scriptWhenUnchecked> spin off </scriptWhenUnchecked>
    <checked> false </checked> 
    <text> spin </text>
    <target> C </target>
  </jmolCheckbox>

  <jmolMenu>
    <target> C </target>
    <item>
      <text> color CPK </text>
      <checked> true </checked>
      <script> color cpk </script>
    </item>
    <item>
      <text> blue </text>
      <script> color dodgerBlue </script>
    </item>
    <item>
      <text> green </text>
      <script> color green </script>
    </item>
  </jmolMenu>

  <jmolRadioGroup>
    <target> C </target>
    <vertical>false</vertical>
    <item>
      <text> color CPK </text>
      <checked> true </checked>
      <script> color cpk </script>
    </item>
    <item>
      <text> blue </text>
      <script> color dodgerBlue </script>
    </item>
    <item>
      <text> green </text>
      <script> color green </script>
    </item>
  </jmolRadioGroup>

</jmol>


<< Back to the index page of the Extension.

Contributors

AngelHerraez