Guns McWar Posted November 26, 2020 Share Posted November 26, 2020 Thank you everyone for reading. To the plugin gurus like @Squid, @dlandon, @bonienl, and more, this is probably the easiest Unraid dev question you've ever been asked. TL;DR: How do I inject a simple line of JavaScript into the entire WebGUI? I'm making a simple plugin to change the href of the WebGUI Unraid logo. I'd prefer it link to my server IP rather than the Unraid website. Also, I'd like to learn Unraid development and fill some holes in the plugin documentation for aspiring plugin developers. My plugin page in settings currently reads and writes to a configuration file stored on the boot flash drive. I'd like to take values from the configuration file and include those values in some JavaScript across the whole WebGUI. My plugin structure is: /boot/config/plugins/[plugin name] .cfg file: stores user values usr/local/emhttp/plugins/[plugin name] .page file: retrieves values from config and HTTP posts them to save-settings.php save-settings.php: gets the HTTP post data and writes those values to the config file Any help would be greatly appreciated! I've tried to do this all independently based on existing resources, but I figured it's time to ask. Thank you! Quote Link to comment
Squid Posted November 26, 2020 Share Posted November 26, 2020 If you have a "settings" .page file, then you need to create another .page that'll inject the code Menu='Buttons' Link='nav-user' --- <? . . . ?> <script> . . . </script> 1 Quote Link to comment
Squid Posted November 26, 2020 Share Posted November 26, 2020 Oh, and forgot to mention. Ensure that any and all variables, elements etc are 100% unique and not a generic naming so as to not interfere with any thing else now or in the future, or with any random plugin installed 1 Quote Link to comment
Guns McWar Posted November 26, 2020 Author Share Posted November 26, 2020 Thank you so much! Great point about the variable names -- mine are very generic. Thank you for all that you do for the community, @Squid. If I can ask one last question, does anyone know how get a plugin to appear under Tools > Web GUI? I believe I've tried Menu="WebGUI" on my settings .page, but I didn't see it there. However, it could've been any number of other issues in my early code. Quote Link to comment
Squid Posted November 26, 2020 Share Posted November 26, 2020 6 minutes ago, Guns McWar said: Menu="WebGUI" That's how you want it. Quote Link to comment
Guns McWar Posted November 26, 2020 Author Share Posted November 26, 2020 Wow, thanks again! Quote Link to comment
Guns McWar Posted November 27, 2020 Author Share Posted November 27, 2020 21 hours ago, Squid said: That's how you want it. Just following up in case someone else has this question: Menu="WebGui" works, but Menu="WebGUI" does not. 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.