Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

New button causes existing to stop working

Featured Replies

I started to get into plugin development and for my first one I wanted to create a simple one with only one button on the docker page.

 

Adding the button works like a charm, but afterwards the button "Container Size" stops working.

 

This is my whole plugin code at the moment:

$('<input/>', {
    type: 'button',
    onclick: 'openShowRunCommandDialog()',
    value: 'Show Run Command',
    style: 'display:none'
}).insertAfter('div.content > input:last');

function openShowRunCommandDialog() {
    alert("Works!");
}

The exception thrown in the console:

70306971_Screenshot2023-06-04at04_22_21.thumb.png.6d1ec7d6114866bc0f99b963126fd743.png

 

The plugin in question: docker.ui-runcmd.

 

Since the insert does exactly what it supposed to do, I am a little bit lost. I guess I am missing something, but I followed other plugins and can't find it :( 

 

Any help is appreciated, thank you :) 

That cannot be all if it is working.  I assume that what you have posted is the contents of a .page file?  - If so it is missing all the HTML elements.   The function being called is a Javascript function and your code shows no HTML elements that put it inside a <script> tag.

  • Author

Thanks for the reply :) Sorry, I should have mentioned it, that is the content of a js files which I load in a page file. The matching page file looks like the following

 

Menu="Docker"
---
<script src="/plugins/docker.ui-runcmd/include/docker.ui-runcmd.js" />

 

I wanted to split page file and actual code so syntax highlighting in vscode works like expected. For completion, my plg file looks like the following

 

<?xml version="1.0" standalone="yes"?>
<!DOCTYPE PLUGIN [
    <!ENTITY name "docker.ui-runcmd">
    <!ENTITY author "Bastians-Bits">
    <!ENTITY version "2023.06.03j">
    <!ENTITY github "Bastians-Bits/unraid.docker">
    <!ENTITY plugdir "/usr/local/emhttp/plugins/&name;">
    <!ENTITY pluginURL "https://raw.githubusercontent.com/&github;/main/&name;/&name;.plg">
    <!ENTITY md5 "40f329a921c9965eed0f027adc693c4b">
]>

<PLUGIN name="&name;"
    author="&author;"
    version="&version;"
    pluginURL="&pluginURL;"
    icon="docker"
    support="https://github.com/Bastians-Bits/unraid.docker"
    min="6.11.5">

    <CHANGES>
###0000.00.02
- Test 1 Block

###0000.00.01
- Test 2 Blocks

###0000.00.00
- Initial Release
    </CHANGES>

    <!-- Installation -->

    <!-- Remove the old version -->
    <FILE Run="/bin/bash">
        <INLINE>
            rm -f $(ls /boot/config/plugins/&name;/&name;*.txz 2&gt;/dev/null | grep -v '&version;')
        </INLINE>
    </FILE>

    <!-- Download the new file -->
    <FILE Name="/boot/config/plugins/&name;/&name;-&version;.txz" Run="upgradepkg --install-new">
        <URL>https://raw.github.com/&github;/main/archive/&name;/&name;-&version;.txz</URL>
        <MD5>&md5;</MD5>
    </FILE>

    <!-- Post installation -->
    <FILE Run="/bin/bash">
        <INLINE>
            echo ""
            echo "----------------------------------------------------"
            echo " &name; has been installed."
            echo " Version: &version;"
            echo "----------------------------------------------------"
            echo ""
        </INLINE>
    </FILE>

    <!-- De-installation -->

    <!-- Remove the plugin and all files -->
    <FILE Run="/bin/bash" Method="remove">
        <INLINE>
            removepkg &name;-&version;
            rm -rf &plugdir;
            rm -rf /boot/config/plugins/&name;
        </INLINE>
    </FILE>
</PLUGIN>

 

  • Author

In my defence, I am not a front-end developer and worked with HTML the last time 10 years ago. <script /> is not valid syntax, has to be <script></script>.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.