Bastian Posted June 4, 2023 Share Posted June 4, 2023 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: 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 Quote Link to comment
itimpi Posted June 4, 2023 Share Posted June 4, 2023 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. Quote Link to comment
Bastian Posted June 4, 2023 Author Share Posted June 4, 2023 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>/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> Quote Link to comment
Bastian Posted June 8, 2023 Author Share Posted June 8, 2023 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>. Quote Link to comment
Recommended Posts
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.