{
  "version": "https://jsonfeed.org/version/1.1",
  "title": "chem-bla-ics",
  "description": "Chemblaics (pronounced chem-bla-ics) is the science that uses open science and computers to solve problems in chemistry, biochemistry and related fields.",
  "home_page_url": "https://chem-bla-ics.linkedchemistry.info/",
  "feed_url": "https://chem-bla-ics.linkedchemistry.info/2007/01/02/chemistry-in-html-javascript-from.json",
  "icon": "https://chem-bla-ics.linkedchemistry.info/assets/images/chem-bla-ics_logo.png",
  "language": "en",
  "authors": [
    {
      "name": "Egon Willighagen",
      "url": "https://orcid.org/0000-0001-7542-0286",
      "_orcid": "0000-0001-7542-0286"
    }
  ],
  "items": [

    {
      "id": "https://doi.org/10.59350/dmfek-pdt97",
      "url": "https://chem-bla-ics.linkedchemistry.info/2007/01/02/chemistry-in-html-javascript-from.html",
      "title": "Chemistry in HTML: JavaScript from the server",
      "content_html": "<p>Recently I blogged about <a href=\"https://chem-bla-ics.linkedchemistry.info/2006/12/17/smiles-cas-and-inchi-in-blogs.html\">a Greasemonkey script <i class=\"fa-solid fa-recycle fa-xs\"></i></a>\nto take advantage of <a href=\"https://chem-bla-ics.linkedchemistry.info/2006/12/10/including-smiles-cml-and-inchi-in.html\">semantic markup of chemistry in blogs <i class=\"fa-solid fa-recycle fa-xs\"></i></a>\n(and HTML in general), and later made <a href=\"https://chem-bla-ics.linkedchemistry.info/2006/12/19/chemistry-in-html-greasemonkey-again.html\">some plans how this can be\nextended <i class=\"fa-solid fa-recycle fa-xs\"></i></a>.\nOne of the ideas was to make this userscript available from the server, instead\nof having people need to install <a href=\"http://greasemonkey.mozdev.org/\">Greasemonkey</a>\nand the script separately. So, here it is.</p>\n\n<h2 id=\"sechemticjs\">sechemtic.js</h2>\n\n<p>Consider this (X)HTML:</p>\n\n<div class=\"language-html highlighter-rouge\"><div class=\"highlight\"><pre class=\"highlight\"><code><span class=\"nt\">&lt;html</span> <span class=\"na\">xmlns=</span><span class=\"s\">\"http://www.w3.org/1999/xhtml\"</span>\n      <span class=\"na\">xmlns:chem=</span><span class=\"s\">\"http://www.blueobelisk.org/chemistryblogs/\"</span><span class=\"nt\">&gt;</span>\n\n<span class=\"nt\">&lt;head&gt;</span>\n <span class=\"nt\">&lt;title&gt;</span>m1<span class=\"nt\">&lt;/title&gt;</span>\n <span class=\"nt\">&lt;script </span><span class=\"na\">type=</span><span class=\"s\">\"text/javascript\"</span> <span class=\"na\">src=</span><span class=\"s\">\"sechemtic.js\"</span> <span class=\"nt\">/&gt;</span>\n<span class=\"o\">&lt;</span><span class=\"sr\">/head</span><span class=\"err\">&gt;\n</span>\n<span class=\"o\">&lt;</span><span class=\"nx\">body</span> <span class=\"nx\">onload</span><span class=\"o\">=</span><span class=\"dl\">\"</span><span class=\"s2\">addGoogleAndPubChemLinks(1,1)</span><span class=\"dl\">\"</span><span class=\"o\">&gt;</span>\n  <span class=\"o\">&lt;</span><span class=\"nx\">h1</span><span class=\"o\">&gt;</span><span class=\"nx\">The</span> <span class=\"nx\">Output</span><span class=\"o\">&lt;</span><span class=\"sr\">/h1</span><span class=\"err\">&gt;\n</span>  <span class=\"o\">&lt;</span><span class=\"nx\">p</span><span class=\"o\">&gt;</span><span class=\"nx\">This</span> <span class=\"nx\">article</span> <span class=\"nx\">is</span> <span class=\"nx\">about</span> <span class=\"o\">&lt;</span><span class=\"nx\">span</span> <span class=\"kd\">class</span><span class=\"o\">=</span><span class=\"dl\">\"</span><span class=\"s2\">chem:compound</span><span class=\"dl\">\"</span><span class=\"o\">&gt;</span><span class=\"nx\">m1</span><span class=\"o\">&lt;</span><span class=\"sr\">/span&gt;</span><span class=\"err\"> \n</span>  <span class=\"p\">(</span><span class=\"nx\">SMILES</span><span class=\"p\">:</span><span class=\"o\">&lt;</span><span class=\"nx\">span</span> <span class=\"kd\">class</span><span class=\"o\">=</span><span class=\"dl\">\"</span><span class=\"s2\">chem:smiles</span><span class=\"dl\">\"</span><span class=\"o\">&gt;</span><span class=\"nx\">CCCOC</span><span class=\"o\">&lt;</span><span class=\"sr\">/span&gt;</span><span class=\"se\">)</span><span class=\"sr\">.&lt;/</span><span class=\"nx\">p</span><span class=\"o\">&gt;</span>\n\n<span class=\"o\">&lt;</span><span class=\"sr\">/body</span><span class=\"err\">&gt;\n</span>\n<span class=\"o\">&lt;</span><span class=\"sr\">/html</span><span class=\"err\">&gt;\n</span></code></pre></div></div>\n\n<p><img src=\"/assets/images/sechemticJSOutput.png\" alt=\"\" /></p>\n\n<p>I think the above example shows the simple setup of the Sechemtic Web script (please\nforgive me my habit to use bad linguistic mashups ;). Just load the script in the\nHTML <code class=\"language-plaintext highlighter-rouge\">&lt;head&gt;</code>, and add in the <code class=\"language-plaintext highlighter-rouge\">onload=\"addGoogleAndPubChemLinks(1,1)\"</code> attribute to\nthe <code class=\"language-plaintext highlighter-rouge\">&lt;body&gt;</code> element. With blogs these bits would be part of the template, and,\ntherefore, need to be installed once. From then on, just use the <a href=\"https://chem-bla-ics.linkedchemistry.info/2006/12/10/including-smiles-cml-and-inchi-in.html\">semantic markup as\nexplained earlier <i class=\"fa-solid fa-recycle fa-xs\"></i></a>.\nBoth the microformat and the RDFa method are supported. In\ncase of the latter, I recommend to define the chem namespace in the template of\nwebpages too, instead of in the <code class=\"language-plaintext highlighter-rouge\">&lt;span&gt;</code> elements.</p>\n\n<p>Currently, the Sechemtic Web script only has one functionality: to add links to\n<a href=\"http://pubchem.ncbi.nlm.nih.gov/\">PubChem</a> and <a href=\"http://www.google.com/\">Google</a>,\nwith the <code class=\"language-plaintext highlighter-rouge\">addGoogleAndPubChemLinks(int, int)</code> method. The\nfirst parameter determines (0 or 1) if links to Google should be made, and the\nsecond parameter does the same for links to PubChem.</p>\n\n<h2 id=\"download\">Download</h2>\n\n<p>For now, the script can be downloaded <a href=\"http://wiki.cubic.uni-koeln.de/cb/sechemtic.js\">here</a>.\nIt is licensed with the GPL version 2.0.</p>\n\n<h2 id=\"microformats\">Microformats</h2>\n\n<p>Here’s the same example using <a href=\"http://microformats.org/\">microformats</a>\ninstead of RDFa:</p>\n\n<div class=\"language-html highlighter-rouge\"><div class=\"highlight\"><pre class=\"highlight\"><code><span class=\"nt\">&lt;html&gt;</span>\n\n<span class=\"nt\">&lt;head&gt;</span>\n <span class=\"nt\">&lt;title&gt;</span>m1<span class=\"nt\">&lt;/title&gt;</span>\n <span class=\"nt\">&lt;script </span><span class=\"na\">type=</span><span class=\"s\">\"text/javascript\"</span> <span class=\"na\">src=</span><span class=\"s\">\"sechemtic.js\"</span> <span class=\"nt\">/&gt;</span>\n<span class=\"o\">&lt;</span><span class=\"sr\">/head</span><span class=\"err\">&gt;\n</span>\n<span class=\"o\">&lt;</span><span class=\"nx\">body</span> <span class=\"nx\">onload</span><span class=\"o\">=</span><span class=\"dl\">\"</span><span class=\"s2\">addGoogleAndPubChemLinks(1,1)</span><span class=\"dl\">\"</span><span class=\"o\">&gt;</span>\n  <span class=\"o\">&lt;</span><span class=\"nx\">h1</span><span class=\"o\">&gt;</span><span class=\"nx\">The</span> <span class=\"nx\">Output</span><span class=\"o\">&lt;</span><span class=\"sr\">/h1</span><span class=\"err\">&gt;\n</span>  <span class=\"o\">&lt;</span><span class=\"nx\">p</span><span class=\"o\">&gt;</span><span class=\"nx\">This</span> <span class=\"nx\">article</span> <span class=\"nx\">is</span> <span class=\"nx\">about</span> <span class=\"o\">&lt;</span><span class=\"nx\">span</span> <span class=\"kd\">class</span><span class=\"o\">=</span><span class=\"dl\">\"</span><span class=\"s2\">compound</span><span class=\"dl\">\"</span><span class=\"o\">&gt;</span><span class=\"nx\">m1</span><span class=\"o\">&lt;</span><span class=\"sr\">/span&gt;</span><span class=\"err\"> \n</span>  <span class=\"p\">(</span><span class=\"nx\">SMILES</span><span class=\"p\">:</span><span class=\"o\">&lt;</span><span class=\"nx\">span</span> <span class=\"kd\">class</span><span class=\"o\">=</span><span class=\"dl\">\"</span><span class=\"s2\">smiles</span><span class=\"dl\">\"</span><span class=\"o\">&gt;</span><span class=\"nx\">CCCOC</span><span class=\"o\">&lt;</span><span class=\"sr\">/span&gt;</span><span class=\"se\">)</span><span class=\"sr\">.&lt;/</span><span class=\"nx\">p</span><span class=\"o\">&gt;</span>\n\n<span class=\"o\">&lt;</span><span class=\"sr\">/body</span><span class=\"err\">&gt;\n</span>\n<span class=\"o\">&lt;</span><span class=\"sr\">/html</span><span class=\"err\">&gt;\n</span></code></pre></div></div>",
      "summary": "Recently I blogged about a Greasemonkey script to take advantage of semantic markup of chemistry in blogs (and HTML in general), and later made some plans how this can be extended . One of the ideas was to make this userscript available from the server, instead of having people need to install Greasemonkey and the script separately. So, here it is.",
      "image": "https://chem-bla-ics.linkedchemistry.info/assets/images/sechemticJSOutput.png",
      "date_published": "2007-01-02T00:00:00+00:00",
      "date_modified": "2025-04-27T00:00:00+00:00",
      "tags": ["html","javascript","userscript","rdfa"],
      
      
      
      
      
      
        "authors": [ { "name": "Egon Willighagen", "url": "https://orcid.org/0000-0001-7542-0286" } ]
      
    }

  ]
}
