Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

General clean-up, especially around docs, in preparation for v1.0 #386

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified app/chemiscope-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
67 changes: 46 additions & 21 deletions app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,24 @@
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta
name="description"
content="Interactive data visualization for materials and molecular databases. Correlate atomic structures and their properties, either online or with a portable app."
content="Interactive data visualization for materials and molecular databases. Correlate atomic structures and their properties, either online, in a jupyter notebook, or with a portable app."
/>

<title>Chemiscope</title>

<script type="text/javascript">
// defines available examples (filename:label)
var examples = {
'Arginine-Dipeptide': 'Arginine Dipeptide',
'AlphaMu': 'Dielectric Response',
'CSD-1000R': 'Chemical Shieldings',
'ROY-GCH': 'Generalized Convex Hull',
'Qm7b': 'Qm7b',
'Azaphenacenes': 'Azaphenacenes',
'Zeolites': 'Zeolites'
};
</script>

<!-- analytics -->
<script defer data-domain="chemiscope.org" src="https://plausible.io/js/plausible.js"></script>

Expand Down Expand Up @@ -70,24 +83,8 @@
>
<i class="fa fa-images"></i> Examples
</a>
<div class="dropdown-menu" aria-labelledby="examples">
<span class="dropdown-item clickable" onclick="CHEMISCOPE_APP.loadExample('Arginine-Dipeptide');">
Arginine-Dipeptide
</span>
<span class="dropdown-item clickable" onclick="CHEMISCOPE_APP.loadExample('AlphaMu');">
Dielectric Response
</span>
<span class="dropdown-item clickable" onclick="CHEMISCOPE_APP.loadExample('CSD-1000R');">
Chemical Shieldings
</span>
<span class="dropdown-item clickable" onclick="CHEMISCOPE_APP.loadExample('ROY-GCH');">
Generalized Convex Hull
</span>
<span class="dropdown-item clickable" onclick="CHEMISCOPE_APP.loadExample('Qm7b');"> Qm7b </span>
<span class="dropdown-item clickable" onclick="CHEMISCOPE_APP.loadExample('Azaphenacenes');">
Azaphenacenes
</span>
<span class="dropdown-item clickable" onclick="CHEMISCOPE_APP.loadExample('Zeolites');"> Zeolites </span>
<div class="dropdown-menu" aria-labelledby="examples" id="examples-dropdown">
<!-- Menu items will be populated here based on the example dictionary defined above -->
</div>
</li>

Expand Down Expand Up @@ -315,7 +312,31 @@ <h5 style="margin-top: 1em">Visualization state</h5>
</div>
</div>
</body>
<script type="text/javascript">
// Populate the example menu
var dropdownMenu = document.getElementById('examples-dropdown');

// Loop through the examples object and create menu items
Object.keys(examples).forEach(function(file) {
var label = examples[file];

// Create a new span element for each menu item
var span = document.createElement('span');
span.className = 'dropdown-item clickable';

// Set the onclick handler
span.onclick = function() {
CHEMISCOPE_APP.loadExample(file);
};

// Set the display text
span.textContent = label;

// Append the span to the dropdown menu
dropdownMenu.appendChild(span);
});

</script>
<script type="text/javascript">
/**
* Create an URL that can be used to load data from the `external` URL
Expand Down Expand Up @@ -377,8 +398,12 @@ <h5 style="margin-top: 1em">Visualization state</h5>

await app.fetchAndLoad(externalDataUrl(external), config);
} else {
// default to Arginine-Dipeptide
await app.loadExample('Arginine-Dipeptide');
// loads a random example
var exampleKeys = Object.keys(examples);
var randomIndex = Math.floor(Math.random() * exampleKeys.length);
var randomExampleKey = exampleKeys[randomIndex];

await app.loadExample(randomExampleKey);
Comment on lines +401 to +406
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm worried this might make loading the website slower, since some of the examples add a fairly large download. Zeolites.json.gz is 1.8MiB, and CSD-1000R.json.gz is 3.5 MiB

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, but chemiscope.min.js is 3MB already so even in the worst case it will make loading 2x slower....
Maybe we can test a bit and see if it's a problem, and in case I think the "right thing" would be to reduce a bit the size of the demo datasets.

}
} else {
const data = standalone.innerText;
Expand Down
Binary file modified docs/_static/chemiscope-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading