User Tools

Site Tools


plugins

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
plugins [2021/10/01 11:23] witsecplugins [2024/09/01 14:30] (current) – external edit 127.0.0.1
Line 7: Line 7:
 Plugins are loaded through the ''params.json'' file. Depending on what your extension needs (and when), you can load one or more plugins. The most common way to tell Mobirise what plugins exist is to place them all in the same directory. In the example below, all plugins are in the same `plugins` directory: Plugins are loaded through the ''params.json'' file. Depending on what your extension needs (and when), you can load one or more plugins. The most common way to tell Mobirise what plugins exist is to place them all in the same directory. In the example below, all plugins are in the same `plugins` directory:
  
-<code json>"plugins": [+<code javascript> 
 +"plugins": [
   "plugins"   "plugins"
-],</code>+] 
 +</code>
  
 These few lines tell Mobirise that plugins can be found in the ''plugins'' folder. These few lines tell Mobirise that plugins can be found in the ''plugins'' folder.
Line 19: Line 21:
 Each directory that contains one or more plugins should have a ''plugin.json'' file to actually load them into Mobirise. Here's a little example: Each directory that contains one or more plugins should have a ''plugin.json'' file to actually load them into Mobirise. Here's a little example:
  
-<code json>+<code javascript>
 [ [
   {   {
Line 41: Line 43:
 === files === === files ===
 This is a list of one or more files you want to load or publish. Mobirise is smart enough to automatically place JavaScript files in the HTML. If you want to load images or other file types, Mobirise will simply publish them, without putting them in any HTML. This is a list of one or more files you want to load or publish. Mobirise is smart enough to automatically place JavaScript files in the HTML. If you want to load images or other file types, Mobirise will simply publish them, without putting them in any HTML.
 +
 +Files don't **have** to be in their own folder, but especially if you have multiple files for a plugin, it's easier to manage them by placing them in their own folder.
  
  
Line 60: Line 64:
 There's another way to get your plugin to load. For example when you want your script to be loaded at all times, without having to depend on any block to refer to it. You do this by adding a ''condition'' key to the ''plugin.json'' file. Here's an example: There's another way to get your plugin to load. For example when you want your script to be loaded at all times, without having to depend on any block to refer to it. You do this by adding a ''condition'' key to the ''plugin.json'' file. Here's an example:
  
-<code json>+<code javascript>
 [ [
   {   {
Line 74: Line 78:
  
 If the condition is met, the plugin will be loaded. In this case you've set it to ''true'', so the plugin will always be loaded and you'll always find the ''myscript.js'' file referenced inside the HTML. If the condition is met, the plugin will be loaded. In this case you've set it to ''true'', so the plugin will always be loaded and you'll always find the ''myscript.js'' file referenced inside the HTML.
 +
 +It's also possible to have the plugin rely on a theme or parameter setting. For example, if your plugin should only be loaded if the "Animate on Scroll" is enabled, you could do something like this:
 +
 +<code javascript>
 +[
 +  {
 +    "name": "plugin-name",
 +    "condition": ["_theme.isAnimatedOnScroll"],
 +    "priority": 3000,
 +    "files": [
 +      "plugin-name-or-directory/myscript.js"
 +    ]
 +  }
 +]
 +</code>
plugins.1633080209.txt.gz · Last modified: 2024/09/01 14:30 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki