-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/sulcgroup/oxdna-viewer
- Loading branch information
Showing
21 changed files
with
739 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// let's define a storage structure for the plugin API | ||
// it will sit in local storage and load the code for the individual plugins named as key | ||
// and the code as value packed away in a JSON object hidden at the key "plugins" in local storage | ||
// this is the object that will be stored in local storage | ||
// it will contain the code for the individual plugins | ||
// the key will be the name of the plugin, the value will be the code | ||
let plugins = {}; | ||
// this function will load the plugins from local storage | ||
// it will be called at the beginning of the program | ||
function loadPlugins() { | ||
let pluginsString = localStorage.getItem("plugins"); | ||
if (pluginsString) { | ||
plugins = JSON.parse(pluginsString); | ||
} | ||
// if there are no plugins in local storage, we will create an empty object | ||
else { | ||
plugins = {}; //"test": plugin_code}; | ||
} | ||
//iterate over all the plugins and load them | ||
for (let plugin in plugins) { | ||
eval(plugins[plugin]); | ||
} | ||
} | ||
// this function will save the plugins to local storage (it will be called any time we add a new plugin) | ||
function savePlugins() { | ||
localStorage.setItem("plugins", JSON.stringify(plugins)); | ||
} | ||
function addPlugin(name, plugin_code) { | ||
plugins[name] = plugin_code; | ||
eval(plugin_code); | ||
savePlugins(); | ||
} | ||
loadPlugins(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.