Skip to content

A Glance addon scripts that adds more feature to an already amazing piece of dashboard.

License

Notifications You must be signed in to change notification settings

ralphocdol/glance-addon-scripts

Repository files navigation

Note

Rename Notice

Yes, this repository was renamed from glance-micro-scripts to glance-addon-scripts.

This repository started with only a few scripts like HTML Script Loader and Swipe Left and Right hence why it's previously named glance-micro-scripts. Then I started adding Modal, Glimpse and Responsive Table which quickly made the previous name irrelevant.

Note

Rewrite Notice

With how the scripts got larger hence the need to rename this repository, I have rewritten the method of loading the scripts. Previously with the $include, everything is loaded to the DOM and not cached by default.

If you still need the $include method:

⚠️ Disclaimer

This repository provides an unofficial add-on script for Glance.
It is not affiliated with, endorsed by, or connected to it or its maintainers.

Warning

This repository is provided "as is" without any warranties or guarantees. Use it at your own risk. I, the author is not responsible for any damage, loss of data, or any issues arising from the use or misuse of this code.

Check the Widget Repository that uses these scripts.

Addon Scripts

Script Short Description Tested Version
HTML Script Loader Adds the ability to load <script> inside custom-api v0.8.4 | dev@784bf53
Swipe Left and Right Swipe left/right on Mobile v0.8.4 | dev@784bf53
Modal A modal popup v0.8.4 | dev@784bf53
Tab Notification Show notification count on group tabs v0.8.4 | dev@784bf53
Glimpse A search widget that searches other widgets v0.8.4 | dev@784bf53
Responsive Table A table widget v0.8.4 | dev@784bf53
Lazy Unloader Unloads image when not in view v0.8.4 | dev@784bf53
Custom Menu Menu grid for Addon Script v0.8.4 | dev@784bf53
Toast Message Custom notification message display v0.8.4 | dev@784bf53
Custom Settings Custom settings manager for Addon Script v0.8.4 | dev@784bf53
Theming Theme editor/manager for Glance v0.8.4 | dev@784bf53
Mobile Vertical Navigation Replaces horizontal navigation v0.8.4 | dev@784bf53
Custom Dialog A basic dialog box v0.8.4 | dev@784bf53
Navigation Shortcuts Navigation shortcut using Ctrl+Shift+# v0.8.4 | dev@784bf53

Limitations

Scripts that provide GUI itself like Modal can only be used with widgets that allows custom html like custom-api, html, extension and the like.

Loading Script

We will use the Glance's served assets path at /assets/.

in the document config:

document:
  head: | #gohtml
    <script async src="/assets/path-to-addon-script/global-functions/CREATE_ELEMENT.js?v=1"></script>
    
    <link rel="preload" href="/assets/path-to-addon-script/toast-message/style.css?v=1" as="style" onload="this.onload=null;this.rel='stylesheet'">
    <script defer src="/assets/path-to-addon-script/toast-message/script.js?v=1"></script>

still want to use $include?

If for some reason you really want to use the $include method, I will not be supporting it but you should be able to:

  head: | #gohtml
    <script>
      $include: /app/assets/path-to-addon-script/global-functions/CREATE_ELEMENT.js
    </script>
    <script>
      $include: /app/assets/path-to-addon-script/toast-message/style.css
    </script>

you can retain the css in import url or copy the one above

Know issue

Loading the scripts this way will have a Cache Busting Issue. You, the user, will have to do things manually.

Here are several method to do so:

  • By Force loading your browser while Glance is open, there are plenty of tutorial out there on how to do it but typically its just Ctrl+Shift+R
  • By updating all the instance of ?v=1 to ?v=2 and so on each addon-script update.
  • If you want to disable caching entirely and don't care about bandwidth or any other issue that may come with it (careful, this is for those who knows what they are doing). You can do so by disabling the caching in the Glance's /assets/. If you are using Nginx to proxy Glance, you can add this location block
  location /assets/ {
    add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
    add_header Pragma 'no-cache';
    add_header Expires 0;
  }

About

A Glance addon scripts that adds more feature to an already amazing piece of dashboard.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published