Jump to content

load JS when using emby-linkbutton?


mickle026

Recommended Posts

mickle026

I have several pages in my plugin that I do not want in the main area, but as sub pages.

I would like them to load through links like this does

1077907885_Screenshot2022-03-26at00-01-36Emby.png.202349dbdfb225ebefe2d298620eb7b9.png

<a is="emby-linkbutton" class="button-link emby-button emby-button-backdropfilter" href="dashboard/releasenotes.html?version=4.7.0.32">4.7.0.32</a>

 

I can load the pages like this

<a is="emby-linkbutton" class="button-link emby-button emby-button-backdropfilter" href="configurationpage?name=MyPageName" style="margin: 0 .7em;">MyPageName</a>

However, when adding the pages and the JS within

new PluginPageInfo
{ 
	Name = "MyPageName.js",
    EmbeddedResourcePath = GetType().Namespace + ".Configuration.MyPageName.js"
}

as an embeded resource the JS doesn't load.

<div id="MyPageName" data-role="page" class="page type-interior pluginConfigurationPage page-windowScroll"
     data-require="emby-button,emby-select,emby-checkbox,emby-linkbutton,emby-input" data-controller="__plugin/MyPageName.js">

I even tried it in the same page as my html in script tags, it still doesn't load.

I also tried preloading it

<link rel="preload" href="configurationpage?name=MyPageName.js" as="script">

Is there a way to do this without using TabManager or having the content in the TabManager pages?

 

Am I missing something?  Everything works fine in the tabManager pages, just not in its own page via a linkbutton.

 

Thanks

Link to comment
Share on other sites

mickle026

please ignore this, found the silent error that was killing the JS, its nothing to do with the embylink

simply a single typo in just one of the ApiClient functions where i had probably just caught the keyboard or something

 ApiClient.getJSON(ApiClient.getUrl('Typo in here so wasn't a string literal as such!')).then(response =>

I cannot believe this took hours to find, also that it did not even throw an error in the browser console and prevented any JS from working at all!

It was a completely silent error.

 

  • Thanks 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...