gEAR plugin support
November 14, 2025 · View on GitHub
You can create your own plugs to add or even modify gEAR functionality. These can operate on one or many pages across the site.
Plugin architecture
File structure and naming conventions
Each plugin is made up of a single directory within the www/plugins directory. For any gEAR page your plugin will operate on, it is expected there will be three files with the same basename. For this document we'll consider a plugin called extrabuttons which adds features to the index.html and analyze_dataset.html pages. The plugin directory should have this structure:
extrabuttons/
├── analyze_dataset.css
├── analyze_dataset.html
├── analyze_dataset.js
├── index.css
├── index.html
└── index.js
Each of these files needs to exist for each page your plugin operates, even if they're empty.
It's worth looking at any of the existing plugins to get a sense of how things work.
The HTML file
It is expected that each of your plugin HTML files is an HTML snippet rather than a complete document. The best practice is to make it a single div element with an ID you can reference as needed.
When a page is loaded the contents of that HTML file are added to a (hidden) div at the end of the page and is accessible to your plugin JS file using the ID convention:
plugin_name + "_html_c"
So if I'm on the index page and my plugin is called extrabuttons I can add code to my index.js which can access the HTML elements via a selector like "#extrabuttons_html_c". You can then move the content to whatever place in the DOM it belongs.
You should also take care to give unique, descriptive IDs and class attributes to your elements so they don't conflict with others. Prefixing these with your plugin name is a best practice.
The CSS file
Vanilla CSS file here just gets imported, no special considerations.
The Javascript file
Add the Javascript here needed for your plugin. No need to wrap in a document ready function, as plugins are loaded after this is already true.
Other files
There are no restrictions to your adding other files (such as JSON data files) within your plugin directory as long as you handle their import/processing within your own plugin's javascript.
Site preferences configuration
Each gEAR portal has a site preferences JSON file at www/site_domain_prefs.json. In this file you'll need to create entries to inform gEAR about your plugin and on which pages it operates. For our example, we'd add this:
"enabled_plugins": {"extrabuttons": ["index.html", "analyze_dataset.html"]}
Submitting your plugin
If you have written a plugin you'd like to share with the community please submit a pull request.# gEAR plugin support You can create your own plugs to add or even modify gEAR functionality. These can operate on one or many pages across the site.