Jump to content

New button causes existing to stop working

Recommended Posts

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() {

The exception thrown in the console:



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 :) 

Link to comment

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.

Link to comment

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


<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"?>
    <!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;"

- Test 1 Block

- Test 2 Blocks

- Initial Release

    <!-- Installation -->

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

    <!-- Download the new file -->
    <FILE Name="/boot/config/plugins/&name;/&name;-&version;.txz" Run="upgradepkg --install-new">

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

    <!-- De-installation -->

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


Link to comment

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.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...